View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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   * @author Kuali Rice Team (rice.collab@kuali.org)
25   */
26  public class WorkFlowRouteRulesBlanketAppAftBase extends MainTmplMthdSTNavBase{
27  
28      /**
29       * ITUtil.PORTAL + "?channelTitle=Routing%20Rules&channelUrl=" + WebDriverUtils.getBaseUrlString() +
30       * "/kr/lookup.do?businessObjectClassName=org.kuali.rice.kew.rule.RuleBaseValues&docFormKey=88888888&returnLocation=" +
31       * ITUtil.PORTAL_URL + ITUtil.HIDE_RETURN_LINK+ "&showMaintenanceLinks=true";
32       */
33      public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Routing%20Rules&channelUrl=" + WebDriverUtils
34              .getBaseUrlString() +
35              "/kr/lookup.do?businessObjectClassName=org.kuali.rice.kew.rule.RuleBaseValues&docFormKey=88888888&returnLocation=" +
36              AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK+ "&showMaintenanceLinks=true";
37  
38      @Override
39      protected String getBookmarkUrl() {
40          return BOOKMARK_URL;
41      }
42  
43      /**
44       * {@inheritDoc}
45       * Routing Rules
46       * @return
47       */
48      @Override
49      protected String getLinkLocator() {
50          return "Routing Rules";
51      }
52  
53      protected void testWorkFlowRouteRulesBlanketApp() throws Exception {
54          String random = AutomatedFunctionalTestUtils.createUniqueDtsPlusTwoRandomCharsNot9Digits();
55          waitForPageToLoad();
56          Thread.sleep(3000);
57          assertEquals("Kuali Portal Index", getTitle());
58          selectFrameIframePortlet();
59  
60          // click on the create new button
61          waitAndClickCreateNew();
62  
63          // lookup on the Document Type Name
64          waitAndClickByName("methodToCall.performLookup.(!!org.kuali.rice.kew.doctype.bo.DocumentType!!).(((name:documentTypeName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor");
65  
66          // type in the name field the text RoutingRuleDocument
67          waitAndTypeByName("name", "RoutingRuleDocument");
68  
69          // click the search button
70          waitAndClickSearch();
71  
72          // click the return value link
73          waitAndClickReturnValue();
74  
75          // lookup on the Rule Template Name
76          waitAndClickByName("methodToCall.performLookup.(!!org.kuali.rice.kew.rule.bo.RuleTemplateBo!!).(((name:ruleTemplateName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor");
77  
78          // type in the name field the text RuleRoutingTemplate
79          waitAndTypeByName("name", "RuleRoutingTemplate");
80  
81          // click the search button
82          waitAndClickSearch();
83  
84          // click the return value link
85          waitAndClickReturnValue("testWorkFlowRouteRulesBlanketApp");
86  
87          // click the create new button
88          waitAndClickByName("methodToCall.createRule");
89          waitForPageToLoad();
90          String docId = waitForDocId();
91          assertTrue(isElementPresentByName(CANCEL_NAME));
92  
93          // type in the Document Overview Description the text Test Routing Rule
94          waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Test Routing Rule " + random);
95  
96          // click the Force Action checkbox
97          waitAndClickByXpath("//input[@id='document.newMaintainableObject.forceAction']");
98  
99          // 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 }