View Javadoc

1   /**
2    * Copyright 2005-2011 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.samplu.mainmenu.test;
17  
18  import edu.samplu.common.ITUtil;
19  import edu.samplu.common.WebDriverLegacyITBase;
20  
21  import org.junit.Test;
22  import org.openqa.selenium.By;
23  
24  import static org.junit.Assert.assertEquals;
25  import static org.junit.Assert.assertTrue;
26  
27  /**
28   * tests that user 'admin', on blanket approving a new Routing Rule maintenance document, results in a final document
29   * 
30   * @author Kuali Rice Team (rice.collab@kuali.org)
31   */
32  public class WorkFlowRouteRulesBlanketAppLegacyIT extends WebDriverLegacyITBase {
33      @Override
34      public String getTestUrl() {
35          return ITUtil.PORTAL;
36      }
37      @Test
38      public void testUntitled() throws Exception {    
39          assertEquals("Kuali Portal Index", getTitle());
40          // click on the main menu Routing Rules link
41          waitAndClickByLinkText("Routing Rules");
42          waitForPageToLoad();
43          Thread.sleep(3000);
44          assertEquals("Kuali Portal Index", getTitle());
45          selectFrame("iframeportlet");
46          // click on the create new button
47          waitAndClickByXpath("//img[@alt='create new']");
48          waitForPageToLoad();
49          // lookup on the Document Type Name
50          waitAndClickByName("methodToCall.performLookup.(!!org.kuali.rice.kew.doctype.bo.DocumentType!!).(((name:documentTypeName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor");
51          waitForPageToLoad();
52          // type in the name field the text RoutingRuleDocument
53          waitAndTypeByName("name", "RoutingRuleDocument");
54          // click the search button
55          waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
56          waitForPageToLoad();
57          // click the return value link
58          waitAndClickByLinkText("return value");
59          waitForPageToLoad();
60          // lookup on the Rule Template Name
61          waitAndClickByName("methodToCall.performLookup.(!!org.kuali.rice.kew.rule.bo.RuleTemplateBo!!).(((name:ruleTemplateName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor");
62          waitForPageToLoad();
63          // type in the name field the text RuleRoutingTemplate
64          waitAndTypeByName("name", "RuleRoutingTemplate");
65          // click the search button
66          waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
67          waitForPageToLoad();
68          // click the return value link
69          waitAndClickByLinkText("return value");
70          waitForPageToLoad();
71          // click the create new button
72          waitAndClickByName("methodToCall.createRule");
73          waitForPageToLoad();
74          Thread.sleep(3000);        
75          String docId = getTextByXpath("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
76          assertTrue(isElementPresentByName("methodToCall.cancel"));
77          // type in the Document Overview Description the text Test Routing Rule
78          waitAndTypeByXpath("//input[@id='document.documentHeader.documentDescription']", "Test Routing Rule");
79          // click the Force Action checkbox
80          waitAndClickByXpath("//input[@id='document.newMaintainableObject.forceAction']");
81          // type in the Description text area the text Test Routing Rule1
82          waitAndTypeByXpath("//textarea[@id='document.newMaintainableObject.description']", "Test Routing Rule1");
83          // type in the Document type name field the text DocumentTypeDocument
84          waitAndTypeByXpath("//input[@id='document.newMaintainableObject.fieldValues(1321~docTypeFullName)']", "DocumentTypeDocument");
85          // lookup on Person
86          waitAndClickByName("methodToCall.performLookup.(!!org.kuali.rice.kim.impl.identity.PersonImpl!!).(((principalName:document.newMaintainableObject.add.personResponsibilities.principalName,))).((`document.newMaintainableObject.add.personResponsibilities.principalName:principalName,`)).((<>)).(([])).((**)).((^^)).((&&)).((/personImpl/)).((~~)).(::::;" + getBaseUrlString() + "/kr/lookup.do;::::).anchor15");
87          waitForPageToLoad();
88          // click the search button
89          waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
90          waitForPageToLoad();
91          // click the return value
92          waitAndClickByLinkText("return value");
93          waitForPageToLoad();
94          // select from the Action Request ACKNOWLEDGE
95          selectByXpath("//select[@id='document.newMaintainableObject.add.personResponsibilities.actionRequestedCd']", "ACKNOWLEDGE");
96          // type in the Priority field the text 1
97          waitAndTypeByXpath("//input[@id='document.newMaintainableObject.add.personResponsibilities.priority']", "1");
98          // click the add button
99          waitAndClickByName("methodToCall.addLine.personResponsibilities.(!!org.kuali.rice.kew.rule.PersonRuleResponsibility!!).(:::;15;:::).anchor15");
100         waitForPageToLoad();
101         checkForIncidentReport("methodToCall.blanketApprove");
102         waitAndClickByName("methodToCall.blanketApprove");
103         waitForPageToLoad();
104         driver.switchTo().defaultContent();  //selectWindow("null");
105         Thread.sleep(2000);
106         waitAndClickByXpath("//img[@alt='doc search']");
107         waitForPageToLoad();
108         assertEquals("Kuali Portal Index", getTitle());
109         selectFrame("iframeportlet");
110         waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
111         waitForPageToLoad();
112        
113         //docId= "link=" + docId;
114         assertTrue(isElementPresent(By.linkText(docId)));
115         if(isElementPresent(By.linkText(docId))){
116             assertEquals("FINAL", getTextByXpath("//table[@id='row']/tbody/tr[1]/td[4]"));
117         }else{
118             assertEquals(docId, getTextByXpath("//table[@id='row']/tbody/tr[1]/td[1]"));
119             assertEquals("FINAL", getTextByXpath("//table[@id='row']/tbody/tr[1]/td[4]"));
120         }
121         
122     }
123 }
124