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