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.WebDriverUtils;
20 import org.openqa.selenium.By;
21 import org.openqa.selenium.WebElement;
22
23
24
25
26 public abstract class ConfigComponentActionListAftBase extends ConfigComponentAftBase {
27
28
29
30
31
32
33 public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL+"?channelTitle=Component&channelUrl="+ WebDriverUtils
34 .getBaseUrlString()+"/kr/lookup.do?methodToCall=start&businessObjectClassName=org.kuali.rice.coreservice.impl.component.ComponentBo&docFormKey=88888888&returnLocation="+
35 AutomatedFunctionalTestUtils.PORTAL_URL+ AutomatedFunctionalTestUtils.HIDE_RETURN_LINK;
36
37 @Override
38 protected String getBookmarkUrl() {
39 return BOOKMARK_URL;
40 }
41
42 private void assertActionListRequestGroup(String userInGroup, String group, String namespace, String actionCode, String beforeState, String afterState) throws InterruptedException {
43 namespaceCode = namespace;
44 String docId = testCreateActionRequestGroup(group, namespace, actionCode);
45 impersonateUser(userInGroup);
46 assertActionList(docId, actionCode, beforeState);
47 assertOutbox(docId, afterState);
48 selectTopFrame();
49 }
50
51 private void assertActionListRequestPerson(String user, String actionType, String beforeState, String afterState) throws Exception {
52 String[][] adhocRequests = new String [][]{{user, actionType}};
53 assertActionListRequestPerson(adhocRequests, beforeState, afterState);
54 }
55
56 private void assertActionListRequestPerson(String[][] adhocRequests, String beforeState, String afterState) throws Exception {
57 String docId = testCreateActionRequestPerson(adhocRequests);
58 impersonateUser(adhocRequests[0][0]);
59 assertActionList(docId, adhocRequests[0][1], beforeState);
60 assertOutbox(docId, afterState);
61 selectTopFrame();
62 }
63
64 protected String testCreateActionRequestGroup(String user, String namespace, String actionType) throws InterruptedException{
65 String docId = testCreateNew();
66 addAdHocRecipientsGroup(new String[]{user, actionType, namespace});
67 submitAndClose();
68 return docId;
69 }
70
71
72
73
74
75
76
77
78
79
80 protected String testCreateActionRequestPerson(String[][] userActions) throws InterruptedException {
81 String docId = testCreateNew();
82 if (!userActions[0][0].isEmpty()){
83 addAdHocRecipientsPerson(userActions);
84 }
85 submitAndClose();
86 return docId;
87 }
88
89 public void testActionListAcknowledgeGroup() throws Exception {
90 assertActionListRequestGroup("fran", "RecipeMasters", "KR-WKFLW", "K", "PROCESSED", "FINAL");
91 passed();
92 }
93
94
95
96
97
98
99 public void testActionListAcknowledgePerson() throws Exception {
100 assertActionListRequestPerson("erin", "K", "PROCESSED", "FINAL");
101 passed();
102 }
103
104
105
106
107
108
109
110 public void testActionListAcknowledgePerson_WithPendingApprove() throws Exception {
111 String[][] adhocRequests = new String [][]{{"fred","A"},{"fran","K"}};
112 String docId = testCreateActionRequestPerson(adhocRequests);
113 impersonateUser("fran");
114 assertActionList(docId, "K", "ENROUTE");
115 assertOutbox(docId, "ENROUTE");
116 selectTopFrame();
117 passed();
118 }
119
120
121
122
123
124
125
126 public void testActionListAcknowledgePerson_WithPendingAcknowledge() throws Exception {
127 String[][] adhocRequests = new String [][]{{"fred","K"},{"fran","K"}};
128 String docId = testCreateActionRequestPerson(adhocRequests);
129 impersonateUser("fran");
130 assertActionList(docId, "K", "PROCESSED");
131 assertOutbox(docId, "PROCESSED");
132 selectTopFrame();
133 passed();
134 }
135
136
137
138
139
140
141 public void testActionListApprovePerson() throws Exception {
142 assertActionListRequestPerson("fred", "A", "ENROUTE", "FINAL");
143 passed();
144 }
145
146
147
148
149
150
151
152 public void testActionListApprovePerson_WithPendingApprove() throws Exception {
153 String[][] adhocRequests = new String [][]{{"fred","A"},{"fran","A"}};
154 assertActionListRequestPerson(adhocRequests, "ENROUTE", "ENROUTE");
155 passed();
156 }
157
158
159
160
161
162
163
164 public void testActionListApprovePerson_WithPendingAcknowledge() throws Exception {
165 String[][] adhocRequests = new String [][]{{"fran","A"},{"fred","K"}};
166 assertActionListRequestPerson(adhocRequests, "ENROUTE", "PROCESSED");
167 passed();
168 }
169
170 public void testActionListApproveGroup() throws Exception {
171 assertActionListRequestGroup("fred", "RecipeMasters", "KR-WKFLW", "A", "ENROUTE", "FINAL");
172 passed();
173 }
174
175 public void testActionListCompleteGroup() throws Exception {
176 assertActionListRequestGroup("dev1", "Kuali Developers", "KUALI", "C", "ENROUTE", "FINAL");
177 passed();
178 }
179
180
181
182
183
184
185 public void testActionListCompletePerson() throws Exception {
186 assertActionListRequestPerson("fran", "C", "ENROUTE", "FINAL");
187 passed();
188 }
189
190 public void testActionListCompletePerson_WithPendingAcknowledge() throws Exception {
191 String[][] adhocRequests = new String [][]{{"fran","C"},{"fred","K"}};
192 assertActionListRequestPerson(adhocRequests, "ENROUTE", "PROCESSED");
193 passed();
194 }
195
196 public void testActionListDisapproveGroup() throws Exception {
197 assertActionListRequestGroup("director", "ChickenRecipeMasters", "KR-WKFLW", "D", "ENROUTE", "DISAPPROVED");
198 passed();
199 }
200
201
202
203
204
205
206 public void testActionListDisapprovePerson() throws Exception {
207 assertActionListRequestPerson("fred", "D", "ENROUTE", "DISAPPROVED");
208 passed();
209 }
210
211 public void testActionListFyiGroup() throws Exception {
212 assertActionListRequestGroup("dev2", "Kuali Developers", "KUALI", "F", "FINAL", "FINAL");
213 passed();
214 }
215
216
217
218
219
220
221 public void testActionListFyiPerson() throws Exception {
222 assertActionListRequestPerson("eric", "F", "FINAL", "FINAL");
223 passed();
224 }
225
226
227
228 public void testActionListCancelPerson() throws Exception {
229 assertActionListRequestGroup("dev2", "Kuali Developers", "KUALI", "F", "FINAL", "FINAL");
230 passed();
231 }
232
233 public void testComponentRecallAndCancel_WithPendingPersonApprove() throws Exception {
234 String user = "erin";
235 String docId = testCreateNew();
236 addAdHocRecipientsPerson(new String[]{user, "A"});
237 submit();
238 recall(true);
239 impersonateUser(user);
240 assertNotInActionList(docId);
241 passed();
242 }
243
244 public void testComponentRecallToActionList_WithPendingPersonApprove() throws Exception {
245 String user = "erin";
246
247 String docId = testCreateNew();
248 addAdHocRecipientsPerson(new String[]{user, "A"});
249 submit();
250 waitForTextPresent("ENROUTE");
251 recall(false);
252
253 assertActionList(docId, "CR", "SAVED");
254
255 driver.navigate().to(WebDriverUtils.getBaseUrlString() + BOOKMARK_URL);
256 waitAndClickDocSearch();
257 selectFrameIframePortlet();
258 waitAndTypeByName("documentId",docId);
259 waitAndClickByXpath(SEARCH_XPATH);
260 waitForTextPresent("FINAL");
261 passed();
262 }
263
264 public void testComponentCancel_WithPendingPersonApprove()throws Exception {
265 String docId = testCreateNew();
266 addAdHocRecipientsPerson(new String[]{"fred", "A"});
267 waitAndClickByName("methodToCall.cancel");
268 assertDocSearchNoResults(docId);
269 }
270
271 public void testComponentSave_WithPendingPersonApprove() throws Exception {
272 String user = "erin";
273 String docId = testCreateNew();
274 addAdHocRecipientsPerson(new String[]{user, "A"});
275 saveAndReload();
276 waitForTextPresent("SAVED");
277 passed();
278 }
279
280 public void assertComponentSubmit_WithPersonRequest(String user, String action, String state) throws Exception {
281 String[][] userActions = new String [][]{{user, action}};
282 String docId = testCreateNew();
283 if (!userActions[0][0].isEmpty()){
284 addAdHocRecipientsPerson(userActions);
285 }
286 submit();
287 waitForTextPresent("ENROUTE");
288 waitAndClickByName("methodToCall.reload");
289 waitForTextPresent(state);
290 close();
291 }
292
293 public void testComponentSubmit() throws Exception {
294 assertComponentSubmit_WithPersonRequest("", "", "FINAL");
295 passed();
296 }
297
298 public void testComponentSubmit_WithPendingPersonApprove() throws Exception {
299 assertComponentSubmit_WithPersonRequest("erin", "A", "ENROUTE");
300 passed();
301 }
302
303 public void testComponentSubmit_WithPendingPersonAcknowledge() throws Exception {
304 assertComponentSubmit_WithPersonRequest("erin", "K", "PROCESSED");
305 passed();
306 }
307
308 public void testComponentSubmit_WithPendingPersonFyi() throws Exception {
309 assertComponentSubmit_WithPersonRequest("erin", "F", "FINAL");
310 passed();
311 }
312
313
314 }