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.junit.Test;
22
23
24
25
26
27
28 public class DetailedDocSearchAft extends WebDriverLegacyITBase {
29
30
31
32
33
34 public static String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Document%20Search&channelUrl=" + WebDriverUtils
35 .getBaseUrlString() + "/kew/DocumentSearch.do?docFormKey=88888888&returnLocation=" + AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK;
36
37 @Override
38 protected String getBookmarkUrl() {
39 return BOOKMARK_URL;
40 }
41
42 @Override
43 protected void navigate() throws Exception {
44 waitAndClickByXpath("//img[@alt='doc search']");
45 }
46
47 @Test
48 public void testAdvancedDocSearchNav() throws Exception {
49 advancedDocSearchAll();
50 }
51
52 @Test
53 public void testAdvancedDocSearchBookmark() throws Exception {
54 advancedDocSearchAll();
55 }
56
57 private void advancedDocSearchAll() throws Exception{
58 selectFrameIframePortlet();
59 waitAndClickByName("toggleAdvancedSearch");
60 searchByDocumentType();
61 searchByInitiator();
62 searchByApprover();
63 searchByViewer();
64 searchByGroupViewer();
65 searchByDocumentId();
66 searchByApplicationDocumentId();
67 searchByDocumentStatus();
68 searchByDateCreatedFrom();
69 searchByDateCreatedTo();
70 searchByDateApprovedFrom();
71 searchByDateApprovedTo();
72 searchByDateLastModifiedFrom();
73 searchByDateLastModifiedTo();
74 searchByDateLastFinalizedFrom();
75 searchByDateLastFinalizedTo();
76 searchByTitle();
77 }
78
79 private void searchByDocumentType() throws Exception {
80 selectFrameIframePortlet();
81 waitAndTypeByName("documentTypeName","ParameterMaintenanceDocument");
82 waitAndTypeByName("rangeLowerBoundKeyPrefix_dateCreated","03/24/2000");
83 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
84 waitForTextPresent("Parameter Maintenance Document");
85 waitAndClickByName("methodToCall.clearValues");
86 }
87
88 private void searchByInitiator() throws Exception {
89 selectFrameIframePortlet();
90 waitAndTypeByName("initiatorPrincipalName","admin");
91 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
92 waitForTextPresent("items retrieved");
93 waitForElementPresentByXpath("//a[contains(text(),'admin, admin')]");
94 waitAndClickByName("methodToCall.clearValues");
95 }
96
97 private void searchByApprover() throws Exception {
98 selectFrameIframePortlet();
99 waitAndTypeByName("approverPrincipalName","admin");
100 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
101 waitForTextPresent("items retrieved");
102 waitForElementPresentByXpath("//a[contains(text(),'admin, admin')]");
103 waitAndClickByName("methodToCall.clearValues");
104 }
105
106 private void searchByViewer() throws Exception {
107 waitAndTypeByName("viewerPrincipalName","admin");
108 waitAndTypeByName("rangeLowerBoundKeyPrefix_dateCreated","03/24/2000");
109 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
110 waitForTextPresent("items retrieved");
111 waitForElementPresentByXpath("//a[contains(text(),'admin, admin')]");
112 waitAndClickByName("methodToCall.clearValues");
113 }
114
115 private void searchByGroupViewer() throws Exception {
116 waitAndClickByXpath("//input[@type='image' and @alt='Search Group Viewer Id']");
117 selectFrameIframePortlet();
118 waitAndTypeByName("id","2009");
119 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
120 waitAndClickLinkContainingText("return value");
121 selectFrameIframePortlet();
122 waitAndTypeByName("rangeLowerBoundKeyPrefix_dateCreated","03/24/2000");
123 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
124 waitForTextPresent("Component Maintenance Document");
125 waitForElementPresentByXpath("//a[contains(text(),'admin, admin')]");
126 waitAndClickByName("methodToCall.clearValues");
127 }
128
129 private void searchByDocumentId() throws Exception {
130 waitAndTypeByName("documentId","2700");
131 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
132 waitForElementPresentByXpath("//a[contains(text(),'2700')]");
133 waitAndClickByName("methodToCall.clearValues");
134 }
135
136 private void searchByApplicationDocumentId() throws Exception {
137 waitAndTypeByName("applicationDocumentId","7777777");
138 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
139 waitForElementPresentByXpath("//a[contains(text(),'3221')]");
140 waitAndClickByName("methodToCall.clearValues");
141 }
142
143 private void searchByDocumentStatus() throws Exception {
144 selectByName("statusCode","Successful Statuses");
145 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
146 waitForTextPresent("FINAL");
147 waitAndClickByName("methodToCall.clearValues");
148 }
149
150 private void searchByDateCreatedFrom() throws Exception {
151 waitAndTypeByName("rangeLowerBoundKeyPrefix_dateCreated","04/17/2005");
152 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
153 waitForTextPresent("items retrieved");
154 waitAndClickByName("methodToCall.clearValues");
155 }
156
157 private void searchByDateCreatedTo() throws Exception {
158 waitAndTypeByName("dateCreated","04/17/2014");
159 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
160 waitForTextPresent("items retrieved");
161 waitAndClickByName("methodToCall.clearValues");
162 }
163
164 private void searchByDateApprovedFrom() throws Exception {
165 waitAndTypeByName("rangeLowerBoundKeyPrefix_dateApproved","04/17/2005");
166 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
167 waitForTextPresent("items retrieved");
168 waitAndClickByName("methodToCall.clearValues");
169 }
170
171 private void searchByDateApprovedTo() throws Exception {
172 waitAndTypeByName("dateApproved","04/17/2014");
173 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
174 waitForTextPresent("items retrieved");
175 waitAndClickByName("methodToCall.clearValues");
176 }
177
178 private void searchByDateLastModifiedFrom() throws Exception {
179 waitAndTypeByName("rangeLowerBoundKeyPrefix_dateLastModified","04/17/2005");
180 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
181 waitForTextPresent("items retrieved");
182 waitAndClickByName("methodToCall.clearValues");
183 }
184
185 private void searchByDateLastModifiedTo() throws Exception {
186 waitAndTypeByName("dateLastModified","04/17/2014");
187 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
188 waitForTextPresent("items retrieved");
189 waitAndClickByName("methodToCall.clearValues");
190 }
191
192 private void searchByDateLastFinalizedFrom() throws Exception {
193 waitAndTypeByName("rangeLowerBoundKeyPrefix_dateFinalized","04/17/2005");
194 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
195 waitForTextPresent("items retrieved");
196 waitAndClickByName("methodToCall.clearValues");
197 }
198
199 private void searchByDateLastFinalizedTo() throws Exception {
200 waitAndTypeByName("dateFinalized","04/17/2014");
201 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
202 waitForTextPresent("items retrieved");
203 waitAndClickByName("methodToCall.clearValues");
204 }
205
206 private void searchByTitle() throws Exception {
207 waitAndTypeByName("title","Travel Doc 2 - dfads");
208 waitAndTypeByName("rangeLowerBoundKeyPrefix_dateCreated","03/24/2000");
209 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
210 waitForTextPresent("Travel Doc 2 - dfads");
211 waitAndClickByName("methodToCall.clearValues");
212 }
213 }