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