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