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 String docId = peopleFlowCreateNew();
75
76 waitAndClickBlanketApprove();
77 waitAndClickConfirmationOk();
78 Thread.sleep(3000);
79 checkForIncidentReport();
80 jGrowl("Blanket Approve");
81 Thread.sleep(5000);
82
83
84
85
86 driver.switchTo().window(driver.getWindowHandles().toArray()[0].toString());
87 findElement(By.cssSelector("img[alt=\"doc search\"]")).click();
88 Thread.sleep(5000);
89 jGrowl("Document Search is " + docId + " present?");
90 selectFrameIframePortlet();
91 waitAndTypeByName("documentId", docId);
92 jGrowl("Click search");
93 findElement(By.cssSelector("td.infoline > input[name=\"methodToCall.search\"]")).click();
94 waitForTextPresent(DOC_STATUS_FINAL);
95 }
96
97 protected void testPeopleFlowCreateNew() throws Exception {
98 String docId = peopleFlowCreateNew();
99
100 waitAndClickSubmitByText();
101 waitAndClickConfirmationOk();
102 Thread.sleep(3000);
103 checkForDocError();
104 checkForIncidentReport();
105
106
107
108
109 driver.switchTo().window(driver.getWindowHandles().toArray()[0].toString());
110 findElement(By.cssSelector("img[alt=\"doc search\"]")).click();
111 Thread.sleep(5000);
112 jGrowl("Document Search is " + docId + " present?");
113 selectFrameIframePortlet();
114 waitAndTypeByName("documentId", docId);
115 jGrowl("Click search");
116 findElement(By.cssSelector("td.infoline > input[name=\"methodToCall.search\"]")).click();
117 waitForTextPresent(DOC_STATUS_FINAL);
118 }
119
120 private String peopleFlowCreateNew() throws InterruptedException {
121 selectFrameIframePortlet();
122
123 waitAndClickByLinkText("Create New");
124
125
126 waitForElementPresent("div[data-label='Document Number']");
127 String docId = getText("div[data-label='Document Number']");
128 assertTrue(docId != null);
129 jGrowlSticky("Doc Id is " + docId);
130
131 findElement(By.name("document.documentHeader.documentDescription")).clear();
132 waitAndTypeByName("document.documentHeader.documentDescription", "Description for Document");
133 waitAndSelectByName("document.newMaintainableObject.dataObject.namespaceCode", "KUALI - Kuali Systems");
134 findElement(By.name("document.newMaintainableObject.dataObject.name")).clear();
135 waitAndTypeByName("document.newMaintainableObject.dataObject.name", "Document Name" +
136 AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars());
137
138 jGrowl("Add Member kr");
139 findElement(By.name("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName")).clear();
140 waitAndTypeByName("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName", "kr");
141 waitAndClick(By.cssSelector("button[data-loadingmessage='Adding Line...']"));
142 Thread.sleep(3000);
143 checkForIncidentReport();
144
145 jGrowl("Add Member admin");
146 findElement(By.name("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName")).clear();
147 waitAndTypeByName("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName", "admin");
148 waitAndClick(By.cssSelector("button[data-loadingmessage='Adding Line...']"));
149 Thread.sleep(3000);
150 return docId;
151 }
152
153 private void testPeopleFlowDuplicateEntry() throws Exception {
154 selectFrameIframePortlet();
155 waitAndClickByLinkText("Create New");
156 clearTextByName("document.documentHeader.documentDescription");
157 waitAndTypeByName("document.documentHeader.documentDescription", "Description for Duplicate");
158 waitAndSelectByName("document.newMaintainableObject.dataObject.namespaceCode", "KUALI - Kuali Systems");
159 clearTextByName("document.newMaintainableObject.dataObject.name");
160 String tempValue=AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomChars();
161 waitAndTypeByName("document.newMaintainableObject.dataObject.name", "Document Name"+tempValue);
162 waitAndClickSubmitByText();
163 waitAndClickConfirmationOk();
164 waitForTextPresent("Document was successfully submitted.");
165 selectTopFrame();
166 waitAndClickByLinkText("Main Menu");
167 waitAndClickByLinkText("People Flow");
168 selectFrameIframePortlet();
169 waitAndClickByLinkText("Create New");
170 clearTextByName("document.documentHeader.documentDescription");
171 waitAndTypeByName("document.documentHeader.documentDescription", "Description for Duplicate");
172 waitAndSelectByName("document.newMaintainableObject.dataObject.namespaceCode", "KUALI - Kuali Systems");
173 clearTextByName("document.newMaintainableObject.dataObject.name");
174 waitAndTypeByName("document.newMaintainableObject.dataObject.name", "Document Name"+tempValue);
175 waitAndClickSubmitByText();
176 waitAndClickConfirmationOk();
177 waitForTextPresent("A PeopleFlow already exists with the name");
178 }
179 }