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.junit.After;
022 import org.junit.Before;
023 import org.junit.Test;
024
025 import com.thoughtworks.selenium.DefaultSelenium;
026 import com.thoughtworks.selenium.Selenium;
027
028
029 /**
030 * tests creating and cancelling new and edit Routing Rule Delegation maintenance screens
031 *
032 * @author Kuali Rice Team (rice.collab@kuali.org)
033 */
034 public 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 /**
044 * tests that a new Routing Rule Delegation maintenance document can be cancelled
045 */
046 public void testCreateNew() throws Exception {
047 selenium.open(System.getProperty("remote.public.url"));
048 assertEquals("Login", selenium.getTitle());
049 selenium.type("__login_user", "admin");
050 selenium.click("//input[@value='Login']");
051 selenium.waitForPageToLoad("30000");
052 assertEquals("Kuali Portal Index", selenium.getTitle());
053 selenium.click("link=Routing Rules Delegation");
054 selenium.waitForPageToLoad("30000");
055 assertEquals("Kuali Portal Index", selenium.getTitle());
056 selenium.selectFrame("iframeportlet");
057 selenium.click("//img[@alt='create new']");
058 selenium.selectFrame("relative=up");
059 selenium.waitForPageToLoad("30000");
060 selenium.click("name=methodToCall.performLookup.(!!org.kuali.rice.kew.rule.RuleBaseValues!!).(((id:parentRuleId))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor");
061 selenium.waitForPageToLoad("30000");
062 selenium.click("css=td.infoline > input[name=\"methodToCall.search\"]");
063 selenium.waitForPageToLoad("30000");
064 selenium.click("css=a[title=\"return valueRule Id=1046 \"]");
065 selenium.waitForPageToLoad("30000");
066 selenium.click("name=parentResponsibilityId");
067 selenium.click("name=methodToCall.createDelegateRule");
068 selenium.waitForPageToLoad("30000");
069 assertTrue(selenium.isElementPresent("methodToCall.cancel"));
070 selenium.click("methodToCall.cancel");
071 selenium.waitForPageToLoad("30000");
072 selenium.click("methodToCall.processAnswer.button0");
073 selenium.waitForPageToLoad("30000");
074 }
075
076 @Test
077 /**
078 * tests that a Routing Rule Delegation maintenance document is created for an edit operation originating from a lookup screen
079 */
080 public void testEditRouteRulesDelegation() throws Exception {
081 selenium.open(System.getProperty("remote.public.url"));
082 assertEquals("Login", selenium.getTitle());
083 selenium.type("__login_user", "admin");
084 selenium.click("//input[@value='Login']");
085 selenium.waitForPageToLoad("30000");
086 assertEquals("Kuali Portal Index", selenium.getTitle());
087 selenium.click("link=Routing Rules Delegation");
088 selenium.waitForPageToLoad("30000");
089 assertEquals("Kuali Portal Index", selenium.getTitle());
090 selenium.selectFrame("iframeportlet");
091 selenium.setSpeed("2000");
092 selenium.click("//input[@name='methodToCall.search' and @value='search']");
093 selenium.waitForPageToLoad("30000");
094 selenium.click("link=edit");
095 selenium.waitForPageToLoad("30000");
096 assertTrue(selenium.isElementPresent("methodToCall.cancel"));
097 selenium.click("methodToCall.cancel");
098 selenium.waitForPageToLoad("30000");
099 selenium.click("methodToCall.processAnswer.button0");
100 selenium.waitForPageToLoad("30000");
101
102 }
103
104 @Test
105 public void testCreateNewRRDTravelRequestDestRouting() throws Exception {
106 selenium.open(System.getProperty("remote.public.url"));
107 selenium.type("name=__login_user", "admin");
108 selenium.click("css=input[type=\"submit\"]");
109 selenium.waitForPageToLoad("30000");
110 selenium.click("link=Routing Rules Delegation");
111 selenium.waitForPageToLoad("30000");
112 selenium.selectFrame("iframeportlet");
113 selenium.click("css=img[alt=\"create new\"]");
114 selenium.waitForPageToLoad("30000");
115 selenium.click("name=methodToCall.performLookup.(!!org.kuali.rice.kew.rule.RuleBaseValues!!).(((id:parentRuleId))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor");
116 selenium.waitForPageToLoad("30000");
117 selenium.click("css=td.infoline > input[name=\"methodToCall.search\"]");
118 selenium.waitForPageToLoad("30000");
119 selenium.click("css=a[title=\"return valueRule Id=1046 \"]");
120 selenium.waitForPageToLoad("30000");
121 selenium.click("name=parentResponsibilityId");
122 selenium.click("name=methodToCall.createDelegateRule");
123 selenium.waitForPageToLoad("30000");
124 selenium.click("name=methodToCall.cancel");
125 selenium.waitForPageToLoad("30000");
126 selenium.click("name=methodToCall.processAnswer.button0");
127 selenium.waitForPageToLoad("30000");
128 selenium.selectWindow("null");
129 selenium.click("xpath=(//input[@name='imageField'])[2]");
130 selenium.waitForPageToLoad("30000");
131
132
133 }
134
135 @After
136 public void tearDown() throws Exception {
137 selenium.stop();
138 }
139 }