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     * tests that user 'admin', on blanket approving a new Responsibility maintenance document, results in a final document
030     * 
031     * @author Kuali Rice Team (rice.collab@kuali.org)
032     */
033    public class IdentityResponsibilityBlanketAppIT {
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        public void testResponsibility() throws Exception {
043            selenium.open(System.getProperty("remote.public.url"));
044            assertEquals("Login", selenium.getTitle());
045            selenium.type("__login_user", "admin");
046            selenium.click("//input[@value='Login']");
047            selenium.waitForPageToLoad("30000");
048            assertEquals("Kuali Portal Index", selenium.getTitle());
049            selenium.click("link=Administration");
050            selenium.waitForPageToLoad("30000");
051            assertEquals("Kuali Portal Index", selenium.getTitle());
052            selenium.click("link=Responsibility");
053            selenium.waitForPageToLoad("30000");
054            assertEquals("Kuali Portal Index", selenium.getTitle());
055            selenium.selectFrame("iframeportlet");
056            selenium.click("//img[@alt='create new']");
057            selenium.waitForPageToLoad("30000");
058            String docId = selenium.getText("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
059            selenium.type("//input[@id='document.documentHeader.documentDescription']", "Validation Test Responsibility");
060            selenium.select("//select[@id='document.newMaintainableObject.namespaceCode']", "label=Kuali Systems");
061            selenium.type("//input[@id='document.newMaintainableObject.name']", "Validation Test Responsibility1");
062            selenium.type("//input[@id='document.newMaintainableObject.documentTypeName']", "Test");
063            selenium.type("//input[@id='document.newMaintainableObject.routeNodeName']", "Test");
064            selenium.click("//input[@id='document.newMaintainableObject.actionDetailsAtRoleMemberLevel']");
065            selenium.click("//input[@id='document.newMaintainableObject.required']");
066            selenium.click("methodToCall.blanketApprove");
067            selenium.waitForPageToLoad("30000");
068            selenium.selectWindow("null");
069            selenium.click("//img[@alt='doc search']");
070            selenium.waitForPageToLoad("30000");
071            assertEquals("Kuali Portal Index", selenium.getTitle());
072            selenium.selectFrame("iframeportlet");
073            selenium.click("//input[@name='methodToCall.search' and @value='search']");
074            selenium.waitForPageToLoad("30000");
075            docId= "link=" + docId;
076            assertTrue(selenium.isElementPresent(docId));
077            if(selenium.isElementPresent(docId)){            
078                assertEquals("ENROUTE", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
079            }else{
080                assertEquals(docId, selenium.getText("//table[@id='row']/tbody/tr[1]/td[1]"));
081                assertEquals("ENROUTE", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
082            }
083        }
084    
085        @After
086        public void tearDown() throws Exception {
087            selenium.stop();
088        }
089    }