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    import static org.junit.Assert.assertEquals;
018    import static org.junit.Assert.assertTrue;
019    
020    import org.junit.After;
021    import org.junit.Before;
022    import org.junit.Test;
023    
024    import com.thoughtworks.selenium.DefaultSelenium;
025    import com.thoughtworks.selenium.Selenium;
026    
027    
028    /**
029     * tests creating and cancelling new and edit Group maintenance screens
030     * 
031     * @author Kuali Rice Team (rice.collab@kuali.org)
032     */
033    public class IdentityGroupIT {
034        private Selenium selenium;
035        @Before
036        public void setUp() throws Exception {
037            selenium = new DefaultSelenium("localhost", 4444, "*firefox", System.getProperty("remote.public.url"));
038            selenium.start();
039        }
040    
041        @Test
042        /**
043         * tests that a new Group maintenance document can be cancelled
044         */
045        public void testCreateNew() throws Exception {
046            selenium.open(System.getProperty("remote.public.url"));
047            assertEquals("Login", selenium.getTitle());
048            selenium.type("__login_user", "admin");
049            selenium.click("//input[@value='Login']");
050            selenium.waitForPageToLoad("30000");
051            assertEquals("Kuali Portal Index", selenium.getTitle());
052            selenium.click("link=Administration");
053            selenium.waitForPageToLoad("30000");
054            assertEquals("Kuali Portal Index", selenium.getTitle());
055            selenium.click("link=Group");
056            selenium.waitForPageToLoad("30000");
057            assertEquals("Kuali Portal Index", selenium.getTitle());
058            selenium.selectFrame("iframeportlet");
059            selenium.click("//img[@alt='create new']");        
060            selenium.selectFrame("relative=up");        
061            selenium.waitForPageToLoad("30000");
062            assertTrue(selenium.isElementPresent("methodToCall.cancel"));
063            selenium.click("methodToCall.cancel");
064            selenium.waitForPageToLoad("30000");
065            selenium.click("methodToCall.processAnswer.button0");
066            selenium.waitForPageToLoad("30000");
067        }
068     
069        
070        @Test
071        /**
072         * tests that a Group maintenance document is created for an edit operation originating from a lookup screen
073         */
074        public void testEditGroup() 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=Group");
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        
100        @After
101        public void tearDown() throws Exception {
102            selenium.stop();
103        }
104    }