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 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 Role maintenance screens
027     * 
028     * @author Kuali Rice Team (rice.collab@kuali.org)
029     */
030    public class IdentityRoleIT extends UpgradedSeleniumITBase{
031        @Override
032        public String getTestUrl() {
033            return ITUtil.PORTAL;
034        }
035    
036        @Test
037        /**
038         * tests that a new Role maintenance document can be cancelled
039         */
040        public void testCreateNew() throws Exception {
041            assertEquals("Kuali Portal Index", getTitle());
042            waitAndClick("link=Administration");
043            waitForPageToLoad();
044            assertEquals("Kuali Portal Index", getTitle());
045            waitAndClick("link=Role");
046            waitForPageToLoad();
047            assertEquals("Kuali Portal Index", getTitle());
048            selectFrame("iframeportlet");
049            waitAndClick("//img[@alt='create new']");
050            waitAndClick("//input[@name='methodToCall.search' and @value='search']");
051            waitAndClick("link=return value");
052            waitForPageToLoad();
053            assertTrue(isElementPresent("methodToCall.cancel"));
054            waitAndClick("methodToCall.cancel");
055            waitAndClick("methodToCall.processAnswer.button0");
056        }
057    
058        @Test
059        /**
060         * tests that a Role maintenance document is created for an edit operation originating from a lookup screen
061         */
062        public void testEditRole() throws Exception {
063            assertEquals("Kuali Portal Index", getTitle());
064            waitAndClick("link=Administration");
065            waitForPageToLoad();
066            assertEquals("Kuali Portal Index", getTitle());
067            waitAndClick("link=Role");
068            waitForPageToLoad();
069            assertEquals("Kuali Portal Index", getTitle());
070            selectFrame("iframeportlet");
071            waitAndClick("//input[@name='methodToCall.search' and @value='search']");
072            waitAndClick("link=edit");
073            waitForPageToLoad();
074            assertTrue(isElementPresent("methodToCall.cancel"));
075            waitAndClick("methodToCall.cancel");
076            waitAndClick("methodToCall.processAnswer.button0");
077        }
078    }