001 /** 002 * Copyright 2005-2011 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.samplu.mainmenu.test; 017 018 import edu.samplu.common.ITUtil; 019 import edu.samplu.common.UpgradedSeleniumITBase; 020 import org.junit.Test; 021 022 import static org.junit.Assert.assertEquals; 023 import static org.junit.Assert.assertTrue; 024 025 /** 026 * tests that user 'admin', on blanket approving a new Routing Rule maintenance document, results in a final document 027 * 028 * @author Kuali Rice Team (rice.collab@kuali.org) 029 */ 030 public class WorkFlowRouteRulesBlanketAppIT extends UpgradedSeleniumITBase { 031 @Override 032 public String getTestUrl() { 033 return ITUtil.PORTAL; 034 } 035 @Test 036 public void testUntitled() throws Exception { 037 assertEquals("Kuali Portal Index", getTitle()); 038 // click on the main menu Routing Rules link 039 waitAndClick("link=Routing Rules"); 040 waitForPageToLoad(); 041 assertEquals("Kuali Portal Index", getTitle()); 042 selectFrame("iframeportlet"); 043 // click on the create new button 044 waitAndClick("//img[@alt='create new']"); 045 waitForPageToLoad(); 046 // lookup on the Document Type Name 047 waitAndClick("methodToCall.performLookup.(!!org.kuali.rice.kew.doctype.bo.DocumentType!!).(((name:documentTypeName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor"); 048 waitForPageToLoad(); 049 // type in the name field the text RoutingRuleDocument 050 waitAndType("name", "RoutingRuleDocument"); 051 // click the search button 052 waitAndClick("//input[@name='methodToCall.search' and @value='search']"); 053 waitForPageToLoad(); 054 // click the return value link 055 waitAndClick("link=return value"); 056 waitForPageToLoad(); 057 // lookup on the Rule Template Name 058 waitAndClick("methodToCall.performLookup.(!!org.kuali.rice.kew.rule.bo.RuleTemplateBo!!).(((name:ruleTemplateName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor"); 059 waitForPageToLoad(); 060 // type in the name field the text RuleRoutingTemplate 061 waitAndType("name", "RuleRoutingTemplate"); 062 // click the search button 063 waitAndClick("//input[@name='methodToCall.search' and @value='search']"); 064 waitForPageToLoad(); 065 // click the return value link 066 waitAndClick("link=return value"); 067 waitForPageToLoad(); 068 // click the create new button 069 waitAndClick("methodToCall.createRule"); 070 waitForPageToLoad(); 071 String docId = getText("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]"); 072 assertTrue(isElementPresent("methodToCall.cancel")); 073 // type in the Document Overview Description the text Test Routing Rule 074 waitAndType("//input[@id='document.documentHeader.documentDescription']", "Test Routing Rule"); 075 // click the Force Action checkbox 076 waitAndClick("//input[@id='document.newMaintainableObject.forceAction']"); 077 // type in the Description text area the text Test Routing Rule1 078 waitAndType("//textarea[@id='document.newMaintainableObject.description']", "Test Routing Rule1"); 079 // type in the Document type name field the text DocumentTypeDocument 080 waitAndType("//input[@id='document.newMaintainableObject.fieldValues(1321~docTypeFullName)']", "DocumentTypeDocument"); 081 // lookup on Person 082 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"); 083 waitForPageToLoad(); 084 // click the search button 085 waitAndClick("//input[@name='methodToCall.search' and @value='search']"); 086 waitForPageToLoad(); 087 // click the return value 088 waitAndClick("link=return value"); 089 waitForPageToLoad(); 090 // select from the Action Request ACKNOWLEDGE 091 select("//select[@id='document.newMaintainableObject.add.personResponsibilities.actionRequestedCd']", "label=ACKNOWLEDGE"); 092 // type in the Priority field the text 1 093 waitAndType("//input[@id='document.newMaintainableObject.add.personResponsibilities.priority']", "1"); 094 // click the add button 095 waitAndClick("methodToCall.addLine.personResponsibilities.(!!org.kuali.rice.kew.rule.PersonRuleResponsibility!!)"); 096 waitForPageToLoad(); 097 checkForIncidentReport("methodToCall.blanketApprove"); 098 waitAndClick("methodToCall.blanketApprove"); 099 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 }