1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.admin;
17
18 import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
19 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20 import org.kuali.rice.testtools.selenium.WebDriverUtils;
21 import org.apache.commons.lang.RandomStringUtils;
22 import org.junit.Test;
23
24
25
26
27
28
29 public class DetailedDocSearchAft extends WebDriverLegacyITBase {
30
31
32
33
34
35 public static String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Document%20Search&channelUrl=" + WebDriverUtils
36 .getBaseUrlString() + "/kew/DocumentSearch.do?docFormKey=88888888&returnLocation=" + AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK;
37
38 private String groupId = null;
39
40 @Override
41 protected String getBookmarkUrl() {
42 return BOOKMARK_URL;
43 }
44
45 @Override
46 protected void navigate() throws Exception {
47 waitAndClickByXpath("//img[@alt='doc search']");
48 }
49
50 @Test
51 public void testAdvancedDocSearchNav() throws Exception {
52 advancedDocSearchAll();
53 }
54
55 @Test
56 public void testAdvancedDocSearchBookmark() throws Exception {
57 advancedDocSearchAll();
58 }
59
60 private void advancedDocSearchAll() throws Exception{
61 createGroupDocument();
62 selectTopFrame();
63 waitAndClickByXpath("//a[@title='Document Search']");
64 acceptAlertIfPresent();
65 selectFrameIframePortlet();
66 waitAndClickByName("toggleAdvancedSearch");
67 acceptAlertIfPresent();
68 searchByDocumentType();
69 searchByInitiator();
70 searchByApprover();
71 searchByViewer();
72 searchByGroupViewer();
73 searchByDocumentId();
74 searchByApplicationDocumentId();
75 searchByDocumentStatus();
76 searchByDateCreatedFrom();
77 searchByDateCreatedTo();
78 searchByDateApprovedFrom();
79 searchByDateApprovedTo();
80 searchByDateLastModifiedFrom();
81 searchByDateLastModifiedTo();
82 searchByDateLastFinalizedFrom();
83 searchByDateLastFinalizedTo();
84 searchByTitle();
85 }
86
87 private void createGroupDocument() throws Exception{
88 waitAndClickAdministration();
89 selectFrameIframePortlet();
90 waitAndClickByLinkText("Group");
91 selectFrameIframePortlet();
92 waitAndClickByXpath("//a[@title='Create a new record']");
93 selectFrameIframePortlet();
94 String randomCode = RandomStringUtils.randomAlphabetic(9).toUpperCase();
95 waitAndSelectByName("document.groupNamespace","KR-BUS - Service Bus");
96 waitAndTypeByName("document.documentHeader.documentDescription","Group");
97 waitAndTypeByName("document.groupName","Group 1"+randomCode);
98 groupId=waitForElementPresentByXpath("//div[@id='tab-Overview-div']/div[@class='tab-container']/table/tbody/tr/td").getText();
99 waitAndClickByXpath("//input[@name='methodToCall.route']");
100 }
101
102 private void searchByDocumentType() throws Exception {
103 selectFrameIframePortlet();
104 waitAndTypeByName("documentTypeName","ParameterMaintenanceDocument");
105 waitAndTypeByName("rangeLowerBoundKeyPrefix_dateCreated","03/24/2000");
106 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
107 waitForTextPresent("Parameter Maintenance Document");
108 waitAndClickByName("methodToCall.clearValues");
109 }
110
111 private void searchByInitiator() throws Exception {
112 selectFrameIframePortlet();
113 waitAndTypeByName("initiatorPrincipalName","admin");
114 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
115 waitForTextPresent("items retrieved");
116 waitForElementPresentByXpath("//a[contains(text(),'admin, admin')]");
117 waitAndClickByName("methodToCall.clearValues");
118 }
119
120 private void searchByApprover() throws Exception {
121 selectFrameIframePortlet();
122 waitAndTypeByName("approverPrincipalName","admin");
123 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
124
125
126
127 }
128
129 private void searchByViewer() throws Exception {
130 waitAndTypeByName("viewerPrincipalName","admin");
131 clearTextByName("approverPrincipalName");
132 waitAndTypeByName("rangeLowerBoundKeyPrefix_dateCreated","03/24/2000");
133 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
134 waitForTextPresent("items retrieved");
135 waitForElementPresentByXpath("//a[contains(text(),'admin, admin')]");
136 waitAndClickByName("methodToCall.clearValues");
137 }
138
139 private void searchByGroupViewer() throws Exception {
140 waitAndClickByXpath("//input[@type='image' and @alt='Search Group Viewer Id']");
141 selectFrameIframePortlet();
142 waitAndTypeByName("id",groupId);
143 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
144 waitAndClickLinkContainingText("return value");
145 selectFrameIframePortlet();
146 waitAndTypeByName("rangeLowerBoundKeyPrefix_dateCreated","03/24/2000");
147 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
148 waitForTextPresent("Component Maintenance Document");
149 waitForElementPresentByXpath("//a[contains(text(),'admin, admin')]");
150 waitAndClickByName("methodToCall.clearValues");
151 }
152
153 private void searchByDocumentId() throws Exception {
154 waitAndTypeByName("documentId","2700");
155 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
156 waitForElementPresentByXpath("//a[contains(text(),'2700')]");
157 waitAndClickByName("methodToCall.clearValues");
158 }
159
160 private void searchByApplicationDocumentId() throws Exception {
161 waitAndTypeByName("applicationDocumentId","7777777");
162 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
163 waitForElementPresentByXpath("//a[contains(text(),'3221')]");
164 waitAndClickByName("methodToCall.clearValues");
165 }
166
167 private void searchByDocumentStatus() throws Exception {
168 selectByName("statusCode","Successful Statuses");
169 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
170 waitForTextPresent("FINAL");
171 waitAndClickByName("methodToCall.clearValues");
172 }
173
174 private void searchByDateCreatedFrom() throws Exception {
175 waitAndTypeByName("rangeLowerBoundKeyPrefix_dateCreated","04/17/2005");
176 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
177 waitForTextPresent("items retrieved");
178 waitAndClickByName("methodToCall.clearValues");
179 }
180
181 private void searchByDateCreatedTo() throws Exception {
182 waitAndTypeByName("dateCreated","04/17/2014");
183 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
184 waitForTextPresent("items retrieved");
185 waitAndClickByName("methodToCall.clearValues");
186 }
187
188 private void searchByDateApprovedFrom() throws Exception {
189 waitAndTypeByName("rangeLowerBoundKeyPrefix_dateApproved","04/17/2005");
190 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
191 waitForTextPresent("items retrieved");
192 waitAndClickByName("methodToCall.clearValues");
193 }
194
195 private void searchByDateApprovedTo() throws Exception {
196 waitAndTypeByName("dateApproved","04/17/2014");
197 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
198 waitForTextPresent("items retrieved");
199 waitAndClickByName("methodToCall.clearValues");
200 }
201
202 private void searchByDateLastModifiedFrom() throws Exception {
203 waitAndTypeByName("rangeLowerBoundKeyPrefix_dateLastModified","04/17/2005");
204 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
205 waitForTextPresent("items retrieved");
206 waitAndClickByName("methodToCall.clearValues");
207 }
208
209 private void searchByDateLastModifiedTo() throws Exception {
210 waitAndTypeByName("dateLastModified","04/17/2014");
211 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
212 waitForTextPresent("items retrieved");
213 waitAndClickByName("methodToCall.clearValues");
214 }
215
216 private void searchByDateLastFinalizedFrom() throws Exception {
217 waitAndTypeByName("rangeLowerBoundKeyPrefix_dateFinalized","04/17/2005");
218 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
219 waitForTextPresent("items retrieved");
220 waitAndClickByName("methodToCall.clearValues");
221 }
222
223 private void searchByDateLastFinalizedTo() throws Exception {
224 waitAndTypeByName("dateFinalized","04/17/2014");
225 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
226 waitForTextPresent("items retrieved");
227 waitAndClickByName("methodToCall.clearValues");
228 }
229
230 private void searchByTitle() throws Exception {
231 waitAndTypeByName("title","Travel Doc 2 - dfads");
232 waitAndTypeByName("rangeLowerBoundKeyPrefix_dateCreated","03/24/2000");
233 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
234 waitForTextPresent("Travel Doc 2 - dfads");
235 waitAndClickByName("methodToCall.clearValues");
236 }
237 }