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 static org.junit.Assert.assertEquals; 019 import static org.junit.Assert.assertTrue; 020 021 import org.apache.commons.lang.StringUtils; 022 import org.junit.After; 023 import org.junit.Before; 024 import org.junit.Test; 025 026 import com.thoughtworks.selenium.DefaultSelenium; 027 import com.thoughtworks.selenium.Selenium; 028 029 /** 030 * tests that user 'admin', on blanket approving a new Routing Rule maintenance document, results in a final document 031 * 032 * @author Kuali Rice Team (rice.collab@kuali.org) 033 */ 034 public class WorkFlowRouteRulesBlanketAppIT { 035 private Selenium selenium; 036 @Before 037 public void setUp() throws Exception { 038 selenium = new DefaultSelenium("localhost", 4444, "*firefox", System.getProperty("remote.public.url")); 039 selenium.start(); 040 } 041 042 @Test 043 public void testUntitled() throws Exception { 044 String remotePublicUrl = System.getProperty("remote.public.url"); 045 // remove the trailing slash to allow for correction concatenation in locating the lookup buttons below 046 if (StringUtils.endsWith(remotePublicUrl, "/")) { 047 remotePublicUrl = StringUtils.removeEnd(remotePublicUrl, "/"); 048 } 049 selenium.open(remotePublicUrl); 050 assertEquals("Login", selenium.getTitle()); 051 selenium.type("__login_user", "admin"); 052 selenium.click("//input[@value='Login']"); 053 selenium.waitForPageToLoad("30000"); 054 assertEquals("Kuali Portal Index", selenium.getTitle()); 055 selenium.click("link=Routing Rules"); 056 selenium.waitForPageToLoad("30000"); 057 assertEquals("Kuali Portal Index", selenium.getTitle()); 058 selenium.selectFrame("iframeportlet"); 059 selenium.click("//img[@alt='create new']"); 060 selenium.waitForPageToLoad("30000"); 061 selenium.click("methodToCall.performLookup.(!!org.kuali.rice.kew.doctype.bo.DocumentType!!).(((name:documentTypeName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor"); 062 selenium.waitForPageToLoad("30000"); 063 selenium.type("name", "RoutingRuleDocument"); 064 selenium.click("//input[@name='methodToCall.search' and @value='search']"); 065 selenium.waitForPageToLoad("30000"); 066 selenium.click("link=return value"); 067 selenium.waitForPageToLoad("30000"); 068 selenium.click("methodToCall.performLookup.(!!org.kuali.rice.kew.rule.bo.RuleTemplateBo!!).(((name:ruleTemplateName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor"); 069 selenium.waitForPageToLoad("30000"); 070 selenium.type("name", "RuleRoutingTemplate"); 071 selenium.click("//input[@name='methodToCall.search' and @value='search']"); 072 selenium.waitForPageToLoad("30000"); 073 selenium.click("link=return value"); 074 selenium.waitForPageToLoad("30000"); 075 selenium.click("methodToCall.createRule"); 076 selenium.waitForPageToLoad("30000"); 077 String docId = selenium.getText("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]"); 078 assertTrue(selenium.isElementPresent("methodToCall.cancel")); 079 selenium.type("//input[@id='document.documentHeader.documentDescription']", "Test Routing Rule"); 080 selenium.click("//input[@id='document.newMaintainableObject.forceAction']"); 081 selenium.type("//textarea[@id='document.newMaintainableObject.description']", "Test Routing Rule1"); 082 selenium.type("//input[@id='document.newMaintainableObject.fieldValues(1321:docTypeFullName)']", "DocumentTypeDocument"); 083 selenium.click("methodToCall.performLookup.(!!org.kuali.rice.kim.impl.identity.PersonImpl!!).(((principalName:document.newMaintainableObject.add.personResponsibilities.principalName,))).((`document.newMaintainableObject.add.personResponsibilities.principalName:principalName,`)).((<>)).(([])).((**)).((^^)).((&&)).((/personImpl/)).((~~)).(::::;" + remotePublicUrl + "/kr/lookup.do;::::).anchor15"); 084 selenium.waitForPageToLoad("30000"); 085 selenium.click("//input[@name='methodToCall.search' and @value='search']"); 086 selenium.waitForPageToLoad("30000"); 087 selenium.click("link=return value"); 088 selenium.waitForPageToLoad("30000"); 089 selenium.select("//select[@id='document.newMaintainableObject.add.personResponsibilities.actionRequestedCd']", "label=ACKNOWLEDGE"); 090 selenium.type("//input[@id='document.newMaintainableObject.add.personResponsibilities.priority']", "1"); 091 selenium.click("methodToCall.addLine.personResponsibilities.(!!org.kuali.rice.kew.rule.PersonRuleResponsibility!!)"); 092 selenium.waitForPageToLoad("30000"); 093 selenium.click("methodToCall.blanketApprove"); 094 selenium.waitForPageToLoad("30000"); 095 selenium.selectWindow("null"); 096 selenium.click("//img[@alt='doc search']"); 097 selenium.waitForPageToLoad("30000"); 098 assertEquals("Kuali Portal Index", selenium.getTitle()); 099 selenium.selectFrame("iframeportlet"); 100 selenium.click("//input[@name='methodToCall.search' and @value='search']"); 101 selenium.waitForPageToLoad("30000"); 102 103 docId= "link=" + docId; 104 assertTrue(selenium.isElementPresent(docId)); 105 if(selenium.isElementPresent(docId)){ 106 assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]")); 107 }else{ 108 assertEquals(docId, selenium.getText("//table[@id='row']/tbody/tr[1]/td[1]")); 109 assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]")); 110 } 111 } 112 113 @After 114 public void tearDown() throws Exception { 115 selenium.stop(); 116 } 117 }