1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.main;
17
18 import org.kuali.rice.testtools.common.JiraAwareFailable;
19 import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
20 import org.kuali.rice.testtools.selenium.WebDriverUtils;
21 import org.openqa.selenium.By;
22
23
24
25
26 public class PeopleFlowCreateNewAftBase extends MainTmplMthdSTNavBase{
27
28
29
30
31
32
33
34 public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=People%20Flow&channelUrl="
35 + WebDriverUtils.getBaseUrlString() + AutomatedFunctionalTestUtils.KRAD_LOOKUP_METHOD
36 + "org.kuali.rice.kew.impl.peopleflow.PeopleFlowBo"
37 + "&returnLocation=" + AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.SHOW_MAINTENANCE_LINKS;
38
39 @Override
40 protected String getBookmarkUrl() {
41 return BOOKMARK_URL;
42 }
43
44
45
46
47
48
49 @Override
50 protected String getLinkLocator() {
51 return "People Flow";
52 }
53
54 public void testPeopleFlowBlanketApproveBookmark(JiraAwareFailable failable) throws Exception {
55 testPeopleFlowBlanketApprove();
56 passed();
57 }
58 public void testPeopleFlowBlanketApproveNav(JiraAwareFailable failable) throws Exception {
59 testPeopleFlowBlanketApprove();
60 passed();
61 }
62
63 public void testPeopleFlowDuplicateEntryBookmark(JiraAwareFailable failable) throws Exception {
64 testPeopleFlowDuplicateEntry();
65 passed();
66 }
67
68 public void testPeopleFlowDuplicateEntryNav(JiraAwareFailable failable) throws Exception {
69 testPeopleFlowDuplicateEntry();
70 passed();
71 }
72
73 protected void testPeopleFlowBlanketApprove() throws Exception {
74 PeopleFlowDocInfo docInfo = peopleFlowCreateNew();
75
76 jGrowl("Blanket Approve");
77 waitAndClickBlanketApprove();
78 waitAndClickConfirmBlanketApproveOk();
79 acceptAlertIfPresent();
80 waitForProgressLoading();
81 checkForIncidentReport();
82
83 driver.switchTo().window(driver.getWindowHandles().toArray()[0].toString());
84 findElement(By.cssSelector("img[alt=\"doc search\"]")).click();
85 Thread.sleep(5000);
86 jGrowl("Document Search is " + docInfo.getDocId() + " present?");
87 selectFrameIframePortlet();
88 waitAndTypeByName("documentId", docInfo.getDocId());
89 jGrowl("Click search");
90 findElement(By.cssSelector("td.infoline > input[name=\"methodToCall.search\"]")).click();
91 waitForTextPresent(DOC_STATUS_FINAL);
92 }
93
94 protected void testPeopleFlowCreateNew() throws Exception {
95 PeopleFlowDocInfo docInfo = peopleFlowCreateNew();
96
97 waitAndClickSubmitByText();
98 waitAndClickConfirmSubmitOk();
99 Thread.sleep(3000);
100 checkForDocError();
101 checkForIncidentReport();
102
103 driver.switchTo().window(driver.getWindowHandles().toArray()[0].toString());
104 findElement(By.cssSelector("img[alt=\"doc search\"]")).click();
105 Thread.sleep(5000);
106 jGrowl("Document Search is " + docInfo.getDocId() + " present?");
107 selectFrameIframePortlet();
108 waitAndTypeByName("documentId", docInfo.getDocId());
109 jGrowl("Click search");
110 findElement(By.cssSelector("td.infoline > input[name=\"methodToCall.search\"]")).click();
111 waitForTextPresent(DOC_STATUS_FINAL);
112
113
114 jGrowl("Find our PeopleFlow by lookup");
115 driver.switchTo().window(driver.getWindowHandles().toArray()[0].toString());
116 waitAndClick(By.linkText("Main Menu"));
117 Thread.sleep(3000);
118
119 waitAndClick(By.linkText("People Flow"));
120 waitForPageToLoad();
121 selectFrameIframePortlet();
122 waitAndTypeByName("lookupCriteria[name]", docInfo.getName());
123
124 jGrowl("Click search");
125 waitAndClickByXpath(SEARCH_XPATH_3);
126 waitForPageToLoad();
127 waitAndClickByLinkText("edit");
128 waitForPageToLoad();
129
130 jGrowl("verify the forceAction values for our two stops");
131 assertFalse(findElement(By.name("document.newMaintainableObject.dataObject.members[0].forceAction")).isSelected());
132 assertTrue(findElement(By.name("document.newMaintainableObject.dataObject.members[1].forceAction")).isSelected());
133 }
134
135 private PeopleFlowDocInfo peopleFlowCreateNew() throws InterruptedException {
136 selectFrameIframePortlet();
137
138 waitAndClickByLinkText("Create New");
139 String peopleFlowNamespace = "KUALI - Kuali Systems";
140 String peopleFlowName = "Document Name" +
141 AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars();
142
143
144 waitForElementPresent("div[data-label='Document Number']");
145 String docId = getText("div[data-label='Document Number']");
146 assertTrue(docId != null);
147 jGrowlSticky("Doc Id is " + docId);
148
149 findElement(By.name("document.documentHeader.documentDescription")).clear();
150 waitAndTypeByName("document.documentHeader.documentDescription", "Description for Document");
151 waitAndSelectByName("document.newMaintainableObject.dataObject.namespaceCode", peopleFlowNamespace);
152 findElement(By.name("document.newMaintainableObject.dataObject.name")).clear();
153 waitAndTypeByName("document.newMaintainableObject.dataObject.name", peopleFlowName);
154
155 jGrowl("Add Member kr");
156 findElement(By.name("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName")).clear();
157 waitAndTypeByName("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName", "kr");
158 findElement(By.name("newCollectionLines['document.newMaintainableObject.dataObject.members'].forceAction")).click();
159 waitAndClick(By.cssSelector("button[data-loadingmessage='Adding Line...']"));
160 Thread.sleep(3000);
161 checkForIncidentReport();
162
163 jGrowl("Add Member admin");
164 findElement(By.name("newCollectionLines['document.newMaintainableObject.dataObject.members'].priority")).clear();
165 waitAndTypeByName("newCollectionLines['document.newMaintainableObject.dataObject.members'].priority", "2");
166 findElement(By.name("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName")).clear();
167 waitAndTypeByName("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName", "admin");
168 waitAndClick(By.cssSelector("button[data-loadingmessage='Adding Line...']"));
169 Thread.sleep(3000);
170
171 return new PeopleFlowDocInfo(docId, peopleFlowNamespace, peopleFlowName);
172 }
173
174 private void testPeopleFlowDuplicateEntry() throws Exception {
175 selectFrameIframePortlet();
176 waitAndClickByLinkText("Create New");
177 clearTextByName("document.documentHeader.documentDescription");
178 waitAndTypeByName("document.documentHeader.documentDescription", "Description for Duplicate");
179 waitAndSelectByName("document.newMaintainableObject.dataObject.namespaceCode", "KUALI - Kuali Systems");
180 clearTextByName("document.newMaintainableObject.dataObject.name");
181 String tempValue=AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars();
182 waitAndTypeByName("document.newMaintainableObject.dataObject.name", "Document Name"+tempValue);
183 waitAndClickSubmitByText();
184 waitAndClickConfirmSubmitOk();
185 waitForTextPresent("Document was successfully submitted.");
186 selectTopFrame();
187 waitAndClickByLinkText("Main Menu");
188 waitAndClickByLinkText("People Flow");
189 selectFrameIframePortlet();
190 waitAndClickByLinkText("Create New");
191 clearTextByName("document.documentHeader.documentDescription");
192 waitAndTypeByName("document.documentHeader.documentDescription", "Description for Duplicate");
193 waitAndSelectByName("document.newMaintainableObject.dataObject.namespaceCode", "KUALI - Kuali Systems");
194 clearTextByName("document.newMaintainableObject.dataObject.name");
195 waitAndTypeByName("document.newMaintainableObject.dataObject.name", "Document Name"+tempValue);
196 waitAndClickSubmitByText();
197 waitAndClickConfirmSubmitOk();
198 waitForTextPresent("A PeopleFlow already exists with the name");
199 }
200
201
202
203
204 public static class PeopleFlowDocInfo {
205 private final String docId;
206 private final String namespace;
207 private final String name;
208
209
210
211
212 public PeopleFlowDocInfo(String docId, String namespace, String name) {
213 this.docId = docId;
214 this.namespace = namespace;
215 this.name = name;
216 }
217
218
219
220
221 public String getDocId() {
222 return docId;
223 }
224
225
226
227
228 public String getNamespace() {
229 return namespace;
230 }
231
232
233
234
235 public String getName() {
236 return name;
237 }
238 }
239 }