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 WorkFlowRouteRulesBlanketAppAftBase extends MainTmplMthdSTNavBase{
027
028 /**
029 * ITUtil.PORTAL + "?channelTitle=Routing%20Rules&channelUrl=" + WebDriverUtils.getBaseUrlString() +
030 * "/kr/lookup.do?businessObjectClassName=org.kuali.rice.kew.rule.RuleBaseValues&docFormKey=88888888&returnLocation=" +
031 * ITUtil.PORTAL_URL + ITUtil.HIDE_RETURN_LINK+ "&showMaintenanceLinks=true";
032 */
033 public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Routing%20Rules&channelUrl=" + WebDriverUtils
034 .getBaseUrlString() +
035 "/kr/lookup.do?businessObjectClassName=org.kuali.rice.kew.rule.RuleBaseValues&docFormKey=88888888&returnLocation=" +
036 AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK+ "&showMaintenanceLinks=true";
037
038 @Override
039 protected String getBookmarkUrl() {
040 return BOOKMARK_URL;
041 }
042
043 /**
044 * {@inheritDoc}
045 * Routing Rules
046 * @return
047 */
048 @Override
049 protected String getLinkLocator() {
050 return "Routing Rules";
051 }
052
053 protected void testWorkFlowRouteRulesBlanketApp() throws Exception {
054 String random = AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomCharsNot9Digits();
055 waitForPageToLoad();
056 Thread.sleep(3000);
057 assertEquals("Kuali Portal Index", getTitle());
058 selectFrameIframePortlet();
059
060 // click on the create new button
061 waitAndClickCreateNew();
062
063 // lookup on the Document Type Name
064 waitAndClickByName("methodToCall.performLookup.(!!org.kuali.rice.kew.doctype.bo.DocumentType!!).(((name:documentTypeName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor");
065
066 // type in the name field the text RoutingRuleDocument
067 waitAndTypeByName("name", "RoutingRuleDocument");
068
069 // click the search button
070 waitAndClickSearch();
071
072 // click the return value link
073 waitAndClickReturnValue();
074
075 // lookup on the Rule Template Name
076 waitAndClickByName("methodToCall.performLookup.(!!org.kuali.rice.kew.rule.bo.RuleTemplateBo!!).(((name:ruleTemplateName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor");
077
078 // type in the name field the text RuleRoutingTemplate
079 waitAndTypeByName("name", "RuleRoutingTemplate");
080
081 // click the search button
082 waitAndClickSearch();
083
084 // click the return value link
085 waitAndClickReturnValue("testWorkFlowRouteRulesBlanketApp");
086
087 // click the create new button
088 waitAndClickByName("methodToCall.createRule");
089 waitForPageToLoad();
090 String docId = waitForDocId();
091 assertTrue(isElementPresentByName(CANCEL_NAME));
092
093 // type in the Document Overview Description the text Test Routing Rule
094 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Test Routing Rule " + random);
095
096 // click the Force Action checkbox
097 waitAndClickByXpath("//input[@id='document.newMaintainableObject.forceAction']");
098
099 // type in the Description text area the text Test Routing Rule1
100 waitAndTypeByXpath("//textarea[@id='document.newMaintainableObject.description']", "Test Routing Rule1 "
101 + random);
102
103 // type in the Document type name field the text DocumentTypeDocument
104 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.fieldValues(1321~docTypeFullName)']",
105 "DocumentTypeDocument");
106
107 // lookup on Person
108 waitAndClickByName("methodToCall.performLookup.(!!org.kuali.rice.kim.impl.identity.PersonImpl!!).(((principalName:document.newMaintainableObject.add.personResponsibilities.principalName,))).((`document.newMaintainableObject.add.personResponsibilities.principalName:principalName,`)).((<>)).(([])).((**)).((^^)).((&&)).((/personImpl/)).((~~)).(::::;"
109 + getBaseUrlString() + "/kr/lookup.do;::::).anchor15");
110
111 // click the search button
112 waitAndClickSearch();
113
114 // click the return value
115 waitAndClickReturnValue();
116
117 // select from the Action Request ACKNOWLEDGE
118 selectByXpath("//select[@id='document.newMaintainableObject.add.personResponsibilities.actionRequestedCd']",
119 "ACKNOWLEDGE");
120
121 // type in the Priority field the text 1
122 waitAndTypeByXpath("//input[@id='document.newMaintainableObject.add.personResponsibilities.priority']", "1");
123
124 // click the add button
125 waitAndClickByName("methodToCall.addLine.personResponsibilities.(!!org.kuali.rice.kew.rule.PersonRuleResponsibility!!).(:::;15;:::).anchor15");
126 waitForPageToLoad();
127
128 // click Blanket Approve
129 waitAndClickByName(BLANKET_APPROVE_NAME);
130
131 // doc search for the docId
132 waitForPageToLoad();
133 driver.switchTo().defaultContent(); //selectWindow("null");
134 waitAndClickDocSearch();
135 waitForPageToLoad();
136 assertEquals("Kuali Portal Index", getTitle());
137 selectFrameIframePortlet();
138 waitAndTypeByName("documentId", docId);
139 waitAndClickSearch();
140
141 // Expect the doc status to be FINAL
142 waitForElementPresent(By.linkText(docId));
143 if (isElementPresent(By.linkText(docId))) {
144 if (!DOC_STATUS_FINAL.equalsIgnoreCase(getTextByXpath(DOC_STATUS_XPATH_2))) {
145 jiraAwareFail("WorkFlowRouteRulesBlanketApp expected:<[FINAL]> but was " + getTextByXpath(DOC_STATUS_XPATH_2));
146 }
147 } else {
148 assertEquals(docId, getTextByXpath(DOC_ID_XPATH_2));
149 assertEquals(DOC_STATUS_FINAL, getTextByXpath(DOC_STATUS_XPATH_2));
150 }
151 }
152
153 public void testWorkFlowRouteRulesBlanketAppBookmark(JiraAwareFailable failable) throws Exception {
154 testWorkFlowRouteRulesBlanketApp();
155 passed();
156 }
157 public void testWorkFlowRouteRulesBlanketAppNav(JiraAwareFailable failable) throws Exception {
158 testWorkFlowRouteRulesBlanketApp();
159 passed();
160 }
161 }