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 edu.samplu.common.ITUtil;
019    import edu.samplu.common.WebDriverLegacyITBase;
020    import org.junit.Test;
021    
022    import static org.junit.Assert.assertEquals;
023    
024    /**
025     * tests creating and cancelling new and edit Role maintenance screens
026     * 
027     * @author Kuali Rice Team (rice.collab@kuali.org)
028     */
029    public class IdentityRoleLegacyIT extends WebDriverLegacyITBase{
030        @Override
031        public String getTestUrl() {
032            return ITUtil.PORTAL;
033        }
034    
035        @Test
036        /**
037         * tests that a new Role maintenance document can be cancelled
038         */
039        public void testCreateNew() throws Exception {
040            assertEquals("Kuali Portal Index", getTitle());
041            waitAndClickByLinkText("Administration");
042            waitForPageToLoad();
043            assertEquals("Kuali Portal Index", getTitle());
044            waitAndClickByLinkText("Role");
045            waitForPageToLoad();
046            assertEquals("Kuali Portal Index", getTitle());
047            selectFrame("iframeportlet");
048            waitAndClickByXpath("//img[@alt='create new']");
049            waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
050            waitAndClickByLinkText("return value");
051            waitForPageToLoad();
052            assertElementPresentByName("methodToCall.cancel");
053            waitAndClickByName("methodToCall.cancel");
054            waitAndClickByName("methodToCall.processAnswer.button0");
055            passed();
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            waitAndClickByLinkText("Administration");
065            waitForPageToLoad();
066            assertEquals("Kuali Portal Index", getTitle());
067            waitAndClickByLinkText("Role");
068            waitForPageToLoad();
069            assertEquals("Kuali Portal Index", getTitle());
070            selectFrame("iframeportlet");
071            waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
072            waitAndClickByLinkText("edit");
073            waitForPageToLoad();
074            assertElementPresentByName("methodToCall.cancel");
075            waitAndClickByName("methodToCall.cancel");
076            waitAndClickByName("methodToCall.processAnswer.button0");
077            passed();
078        }
079    }