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.admin.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 Campus maintenance screens
031 *
032 * @author Kuali Rice Team (rice.collab@kuali.org)
033 */
034 public class LocationCampusIT {
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 Campus 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=Administration");
054 selenium.waitForPageToLoad("30000");
055 assertEquals("Kuali Portal Index", selenium.getTitle());
056 selenium.click("link=Campus");
057 selenium.waitForPageToLoad("30000");
058 assertEquals("Kuali Portal Index", selenium.getTitle());
059 selenium.selectFrame("iframeportlet");
060 selenium.click("//img[@alt='create new']");
061 selenium.selectFrame("relative=up");
062 selenium.waitForPageToLoad("30000");
063 assertTrue(selenium.isElementPresent("methodToCall.cancel"));
064 selenium.click("methodToCall.cancel");
065 selenium.waitForPageToLoad("30000");
066 selenium.click("methodToCall.processAnswer.button0");
067 selenium.waitForPageToLoad("30000");
068 }
069
070 @Test
071 /**
072 * tests that a Campus maintenance document is created for an edit operation originating from a lookup screen
073 */
074 public void testEditCampus() throws Exception {
075 selenium.open(System.getProperty("remote.public.url"));
076 assertEquals("Login", selenium.getTitle());
077 selenium.type("__login_user", "admin");
078 selenium.click("//input[@value='Login']");
079 selenium.waitForPageToLoad("30000");
080 assertEquals("Kuali Portal Index", selenium.getTitle());
081 selenium.click("link=Administration");
082 selenium.waitForPageToLoad("30000");
083 assertEquals("Kuali Portal Index", selenium.getTitle());
084 selenium.click("link=Campus");
085 selenium.waitForPageToLoad("30000");
086 assertEquals("Kuali Portal Index", selenium.getTitle());
087 selenium.selectFrame("iframeportlet");
088 selenium.click("//input[@name='methodToCall.search' and @value='search']");
089 selenium.waitForPageToLoad("30000");
090 selenium.click("link=edit");
091 selenium.waitForPageToLoad("30000");
092 assertTrue(selenium.isElementPresent("methodToCall.cancel"));
093 selenium.click("methodToCall.cancel");
094 selenium.waitForPageToLoad("30000");
095 selenium.click("methodToCall.processAnswer.button0");
096 selenium.waitForPageToLoad("30000");
097 }
098
099 @After
100 public void tearDown() throws Exception {
101 selenium.stop();
102 }
103 }