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