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    
019    import static org.junit.Assert.assertEquals;
020    import static org.junit.Assert.assertTrue;
021    
022    import edu.samplu.common.UpgradedSeleniumITBase;
023    import org.junit.After;
024    import org.junit.Before;
025    import org.junit.Test;
026    
027    import com.thoughtworks.selenium.DefaultSelenium;
028    import com.thoughtworks.selenium.Selenium;
029    /**
030     * tests that user 'admin', on blanket approving a new Campus maintenance document, results in a final document
031     * 
032     * @author Kuali Rice Team (rice.collab@kuali.org)
033     */
034    public class LocationCampusBlanketAppIT extends UpgradedSeleniumITBase {
035        @Override
036        public String getTestUrl() {
037            return PORTAL;
038        }
039    
040        @Test
041        public void testCampus() throws Exception {
042            assertEquals("Kuali Portal Index", selenium.getTitle());
043            selenium.click("link=Administration");
044            selenium.waitForPageToLoad("30000");
045            assertEquals("Kuali Portal Index", selenium.getTitle());
046            selenium.click("link=Campus");
047            selenium.waitForPageToLoad("30000");
048            assertEquals("Kuali Portal Index", selenium.getTitle());
049            selenium.selectFrame("iframeportlet");
050            selenium.click("//img[@alt='create new']");        
051            selenium.waitForPageToLoad("30000");
052            assertTrue(selenium.isElementPresent("name=methodToCall.cancel"));
053            String docId = selenium.getText("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
054           
055            selenium.type("id=document.documentHeader.documentDescription", "Validation Test Campus");
056            selenium.type("id=document.newMaintainableObject.code", "VC");
057            selenium.type("id=document.newMaintainableObject.name", "Validation Test Campus");
058            selenium.type("id=document.newMaintainableObject.shortName", "VTC");
059            selenium.select("id=document.newMaintainableObject.campusTypeCode", "label=B - BOTH");
060            selenium.click("name=methodToCall.blanketApprove");
061            selenium.waitForPageToLoad("30000");
062            selenium.selectWindow("null");
063            selenium.click("//img[@alt='doc search']");
064            selenium.waitForPageToLoad("30000");
065            assertEquals("Kuali Portal Index", selenium.getTitle());
066            selenium.selectFrame("iframeportlet");
067            selenium.click("//input[@name='methodToCall.search' and @value='search']");
068            selenium.waitForPageToLoad("30000");
069            docId= "link=" + docId;
070            assertTrue(selenium.isElementPresent(docId));       
071            if(selenium.isElementPresent(docId)){            
072                assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
073            }else{
074                assertEquals(docId, selenium.getText("//table[@id='row']/tbody/tr[1]/td[1]"));            
075                assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
076            }
077            
078        }
079    }