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