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 edu.samplu.common.ITUtil;
022    import edu.samplu.common.UpgradedSeleniumITBase;
023    import org.junit.Test;
024    
025    /**
026     * tests creating and cancelling new and edit Routing Rule Delegation maintenance screens
027     * 
028     * @author Kuali Rice Team (rice.collab@kuali.org)
029     */
030    public class WorkFlowRouteRulesDelegationIT extends UpgradedSeleniumITBase {
031        @Override
032        public String getTestUrl() {
033            return ITUtil.PORTAL;
034        }
035    
036        @Test
037        /**
038         * tests that a new Routing Rule Delegation maintenance document can be cancelled
039         */
040        public void testCreateNew() throws Exception {
041            assertEquals("Kuali Portal Index", getTitle());
042            waitAndClick("link=Routing Rules Delegation");
043            waitForPageToLoad();
044            assertEquals("Kuali Portal Index", getTitle());
045            selectFrame("iframeportlet");
046            waitAndClick("//img[@alt='create new']");
047    //        selectFrame("relative=up");
048            waitForPageToLoad();
049            waitAndClick("name=methodToCall.performLookup.(!!org.kuali.rice.kew.rule.RuleBaseValues!!).(((id:parentRuleId))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor");
050            waitForPageToLoad();
051            waitAndClick("css=td.infoline > input[name=\"methodToCall.search\"]");
052            waitForPageToLoad();
053            waitAndClick("css=a[title=\"return valueRule Id=1046 \"]");
054            waitForPageToLoad();
055            waitAndClick("name=parentResponsibilityId");
056            waitAndClick("name=methodToCall.createDelegateRule");
057            waitForPageToLoad();
058            assertTrue(isElementPresent("methodToCall.cancel"));
059            waitAndClick("methodToCall.cancel");
060            waitForPageToLoad();
061            waitAndClick("methodToCall.processAnswer.button0");
062            waitForPageToLoad();
063        }
064    
065    //    @Test // There are no results from the search so no edit link to click on
066        /**
067         * tests that a Routing Rule Delegation maintenance document is created for an edit operation originating from a lookup screen
068         */
069        public void testEditRouteRulesDelegation() throws Exception {
070            assertEquals("Kuali Portal Index", getTitle());
071            waitAndClick("link=Routing Rules Delegation");
072            waitForPageToLoad();
073            assertEquals("Kuali Portal Index", getTitle());
074            selectFrame("iframeportlet");
075            setSpeed("2000");
076            waitAndClick("//input[@name='methodToCall.search' and @value='search']");
077            waitForPageToLoad();
078            waitAndClick("link=edit");
079            waitForPageToLoad();
080            assertTrue(isElementPresent("methodToCall.cancel"));
081            waitAndClick("methodToCall.cancel");
082            waitForPageToLoad();
083            waitAndClick("methodToCall.processAnswer.button0");
084            waitForPageToLoad();
085                  
086        }
087        
088        @Test
089        public void testCreateNewRRDTravelRequestDestRouting() throws Exception {
090            waitAndClick("link=Routing Rules Delegation");
091            waitForPageToLoad();
092            selectFrame("iframeportlet");
093            waitAndClick("css=img[alt=\"create new\"]");
094            waitForPageToLoad();
095            waitAndClick("name=methodToCall.performLookup.(!!org.kuali.rice.kew.rule.RuleBaseValues!!).(((id:parentRuleId))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor");
096            waitForPageToLoad();
097            waitAndClick("css=td.infoline > input[name=\"methodToCall.search\"]");
098            waitForPageToLoad();
099            waitAndClick("css=a[title=\"return valueRule Id=1046 \"]");
100            waitForPageToLoad();
101            waitAndClick("name=parentResponsibilityId");
102            waitAndClick("name=methodToCall.createDelegateRule");
103            waitForPageToLoad();
104            waitAndClick("name=methodToCall.cancel");
105            waitForPageToLoad();
106            waitAndClick("name=methodToCall.processAnswer.button0");
107            waitForPageToLoad();
108            selectWindow("null");
109            waitAndClick("xpath=(//input[@name='imageField'])[2]");
110            waitForPageToLoad();
111        }
112    }