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 Role maintenance screens 031 * 032 * @author Kuali Rice Team (rice.collab@kuali.org) 033 */ 034 public class IdentityRoleIT { 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 Role maintenance document can be cancelled 045 */ 046 public void testCreateNew() throws Exception { 047 048 selenium.open(System.getProperty("remote.public.url")); 049 assertEquals("Login", selenium.getTitle()); 050 selenium.type("__login_user", "admin"); 051 selenium.click("//input[@value='Login']"); 052 selenium.waitForPageToLoad("30000"); 053 assertEquals("Kuali Portal Index", selenium.getTitle()); 054 selenium.click("link=Administration"); 055 selenium.waitForPageToLoad("30000"); 056 assertEquals("Kuali Portal Index", selenium.getTitle()); 057 selenium.click("link=Role"); 058 selenium.waitForPageToLoad("30000"); 059 assertEquals("Kuali Portal Index", selenium.getTitle()); 060 selenium.selectFrame("iframeportlet"); 061 selenium.click("//img[@alt='create new']"); 062 selenium.waitForPageToLoad("30000"); 063 selenium.click("//input[@name='methodToCall.search' and @value='search']"); 064 selenium.waitForPageToLoad("30000"); 065 selenium.click("link=return value"); 066 selenium.waitForPageToLoad("30000"); 067 assertTrue(selenium.isElementPresent("methodToCall.cancel")); 068 selenium.click("methodToCall.cancel"); 069 selenium.waitForPageToLoad("30000"); 070 selenium.click("methodToCall.processAnswer.button0"); 071 selenium.waitForPageToLoad("30000"); 072 } 073 074 @Test 075 /** 076 * tests that a Role maintenance document is created for an edit operation originating from a lookup screen 077 */ 078 public void testEditRole() throws Exception { 079 selenium.open(System.getProperty("remote.public.url")); 080 assertEquals("Login", selenium.getTitle()); 081 selenium.type("__login_user", "admin"); 082 selenium.click("//input[@value='Login']"); 083 selenium.waitForPageToLoad("30000"); 084 assertEquals("Kuali Portal Index", selenium.getTitle()); 085 selenium.click("link=Administration"); 086 selenium.waitForPageToLoad("30000"); 087 assertEquals("Kuali Portal Index", selenium.getTitle()); 088 selenium.click("link=Role"); 089 selenium.waitForPageToLoad("30000"); 090 assertEquals("Kuali Portal Index", selenium.getTitle()); 091 selenium.selectFrame("iframeportlet"); 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 @After 104 public void tearDown() throws Exception { 105 selenium.stop(); 106 } 107 }