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/**
030 * TODO Administrator don't forget to fill this in. 
031 * 
032 * @author Kuali Rice Team (rice.collab@kuali.org)
033 */
034public class WorkFlowRouteRulesDelegationIT {
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 testCreateNew() throws Exception {
044        selenium.open(System.getProperty("remote.public.url"));
045        assertEquals("Login", selenium.getTitle());
046        selenium.type("__login_user", "admin");
047        selenium.click("//input[@value='Login']");
048        selenium.waitForPageToLoad("30000");
049        assertEquals("Kuali Portal Index", selenium.getTitle());
050        selenium.click("link=Routing Rules Delegation");
051        selenium.waitForPageToLoad("30000");
052        assertEquals("Kuali Portal Index", selenium.getTitle());
053        selenium.selectFrame("iframeportlet");
054        selenium.click("//img[@alt='create new']");        
055        selenium.selectFrame("relative=up");        
056        selenium.waitForPageToLoad("30000");
057        assertTrue(selenium.isElementPresent("methodToCall.cancel"));
058        selenium.click("methodToCall.cancel");
059        selenium.waitForPageToLoad("30000");
060        selenium.click("methodToCall.processAnswer.button0");
061        selenium.waitForPageToLoad("30000");
062    }
063
064    @Test
065    public void testEditRouteRulesDelegation() throws Exception {
066        selenium.open(System.getProperty("remote.public.url"));
067        assertEquals("Login", selenium.getTitle());
068        selenium.type("__login_user", "admin");
069        selenium.click("//input[@value='Login']");
070        selenium.waitForPageToLoad("30000");
071        assertEquals("Kuali Portal Index", selenium.getTitle());
072        selenium.click("link=Routing Rules Delegation");
073        selenium.waitForPageToLoad("30000");
074        assertEquals("Kuali Portal Index", selenium.getTitle());
075        selenium.selectFrame("iframeportlet");
076        selenium.click("//input[@name='methodToCall.search' and @value='search']");
077        selenium.waitForPageToLoad("30000");
078        selenium.click("link=edit");
079        selenium.waitForPageToLoad("30000");
080        assertTrue(selenium.isElementPresent("methodToCall.cancel"));
081        selenium.click("methodToCall.cancel");
082        selenium.waitForPageToLoad("30000");
083        selenium.click("methodToCall.processAnswer.button0");
084        selenium.waitForPageToLoad("30000");
085              
086    }
087    
088    @Test
089    public void testCreateNewRRDTravelRequestDestRouting() throws Exception {
090        selenium.open(System.getProperty("remote.public.url"));
091        selenium.type("name=__login_user", "admin");
092        selenium.click("css=input[type=\"submit\"]");
093        selenium.waitForPageToLoad("30000");
094        selenium.click("link=Routing Rules Delegation");
095        selenium.waitForPageToLoad("30000");
096        selenium.selectFrame("iframeportlet");
097        selenium.click("css=img[alt=\"create new\"]");
098        selenium.waitForPageToLoad("30000");
099        selenium.click("name=methodToCall.performLookup.(!!org.kuali.rice.kew.rule.RuleBaseValues!!).(((id:parentRuleId))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor");
100        selenium.waitForPageToLoad("30000");
101        selenium.click("css=td.infoline > input[name=\"methodToCall.search\"]");
102        selenium.waitForPageToLoad("30000");
103        selenium.click("css=a[title=\"return valueRule Id=1046 \"]");
104        selenium.waitForPageToLoad("30000");
105        selenium.click("name=parentResponsibilityId");
106        selenium.click("name=methodToCall.createDelegateRule");
107        selenium.waitForPageToLoad("30000");
108        selenium.click("name=methodToCall.cancel");
109        selenium.waitForPageToLoad("30000");
110        selenium.click("name=methodToCall.processAnswer.button0");
111        selenium.waitForPageToLoad("30000");
112        selenium.selectWindow("null");
113        selenium.click("xpath=(//input[@name='imageField'])[2]");
114        selenium.waitForPageToLoad("30000");
115        
116              
117    }
118    
119    @After
120    public void tearDown() throws Exception {
121        selenium.stop();
122    }
123}