001 /**
002 * Copyright 2005-2014 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package edu.sampleu.main;
017
018 import org.kuali.rice.testtools.common.JiraAwareFailable;
019 import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
020 import org.kuali.rice.testtools.selenium.WebDriverUtils;
021 import org.openqa.selenium.By;
022
023 /**
024 * @author Kuali Rice Team (rice.collab@kuali.org)
025 */
026 public class PeopleFlowCreateNewAftBase extends MainTmplMthdSTNavBase{
027
028 /**
029 * ITUtil.PORTAL + "?channelTitle=People%20Flow&channelUrl="
030 * + WebDriverUtils.getBaseUrlString() + ITUtil.KRAD_LOOKUP_METHOD
031 * + "org.kuali.rice.kew.impl.peopleflow.PeopleFlowBo"
032 * + "&returnLocation=" + ITUtil.PORTAL_URL + ITUtil.SHOW_MAINTENANCE_LINKS;
033 */
034 public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=People%20Flow&channelUrl="
035 + WebDriverUtils.getBaseUrlString() + AutomatedFunctionalTestUtils.KRAD_LOOKUP_METHOD
036 + "org.kuali.rice.kew.impl.peopleflow.PeopleFlowBo"
037 + "&returnLocation=" + AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.SHOW_MAINTENANCE_LINKS;
038
039 @Override
040 protected String getBookmarkUrl() {
041 return BOOKMARK_URL;
042 }
043
044 /**
045 * {@inheritDoc}
046 * People Flow
047 * @return
048 */
049 @Override
050 protected String getLinkLocator() {
051 return "People Flow";
052 }
053
054 public void testPeopleFlowBlanketApproveBookmark(JiraAwareFailable failable) throws Exception {
055 testPeopleFlowBlanketApprove();
056 passed();
057 }
058 public void testPeopleFlowBlanketApproveNav(JiraAwareFailable failable) throws Exception {
059 testPeopleFlowBlanketApprove();
060 passed();
061 }
062
063 public void testPeopleFlowDuplicateEntryBookmark(JiraAwareFailable failable) throws Exception {
064 testPeopleFlowDuplicateEntry();
065 passed();
066 }
067
068 public void testPeopleFlowDuplicateEntryNav(JiraAwareFailable failable) throws Exception {
069 testPeopleFlowDuplicateEntry();
070 passed();
071 }
072
073 protected void testPeopleFlowBlanketApprove() throws Exception {
074 String docId = peopleFlowCreateNew();
075
076 waitAndClickButtonByText("blanket approve");
077 Thread.sleep(3000);
078 checkForIncidentReport();
079 jGrowl("Blanket Approve");
080 Thread.sleep(5000);
081
082 //Close the Doc
083 //findElement(By.id("uif-close")).click();
084 //Thread.sleep(3000);
085 driver.switchTo().window(driver.getWindowHandles().toArray()[0].toString());
086 findElement(By.cssSelector("img[alt=\"doc search\"]")).click();
087 Thread.sleep(5000);
088 jGrowl("Document Search is " + docId + " present?");
089 selectFrameIframePortlet();
090 waitAndTypeByName("documentId", docId);
091 jGrowl("Click search");
092 findElement(By.cssSelector("td.infoline > input[name=\"methodToCall.search\"]")).click();
093 waitForTextPresent(DOC_STATUS_FINAL);
094 }
095
096 protected void testPeopleFlowCreateNew() throws Exception {
097 String docId = peopleFlowCreateNew();
098
099 waitAndClickButtonByText("submit");
100 Thread.sleep(3000);
101 checkForDocError();
102 checkForIncidentReport();
103
104 //Close the Doc
105 //findElement(By.id("uif-close")).click();
106 //Thread.sleep(3000);
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 //Save docId
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 }