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    /**
030     * TODO Administrator don't forget to fill this in. 
031     * 
032     * @author Kuali Rice Team (rice.collab@kuali.org)
033     */
034    public class LocationStateBlanketAppIT {
035        private Selenium selenium;
036        @Before
037        public void setUp() throws Exception {
038            selenium = new DefaultSelenium("localhost", 4444, "*firefox", System.getProperty("remote.public.url"));
039            selenium.start();
040        }
041    
042        @Test
043        public void testState() throws Exception {
044            selenium.open(System.getProperty("remote.public.url"));
045            assertEquals("Login", selenium.getTitle());
046            selenium.type("__login_user", "admin");
047            selenium.click("//input[@value='Login']");
048            selenium.waitForPageToLoad("30000");
049            assertEquals("Kuali Portal Index", selenium.getTitle());
050            selenium.click("link=Administration");
051            selenium.waitForPageToLoad("30000");
052            assertEquals("Kuali Portal Index", selenium.getTitle());
053            selenium.click("link=State");
054            selenium.waitForPageToLoad("30000");
055            assertEquals("Kuali Portal Index", selenium.getTitle());
056            selenium.selectFrame("iframeportlet");
057            selenium.click("//img[@alt='create new']");
058            selenium.waitForPageToLoad("30000");
059            String docId = selenium.getText("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
060            assertTrue(selenium.isElementPresent("methodToCall.cancel"));
061            selenium.type("//input[@id='document.documentHeader.documentDescription']", "Validation Test State");
062            selenium.click("methodToCall.performLookup.(!!org.kuali.rice.location.impl.country.CountryBo!!).(((code:document.newMaintainableObject.countryCode,))).((`document.newMaintainableObject.countryCode:code,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;" + System.getProperty("remote.public.url") + "kr/lookup.do;::::).anchor4");
063            selenium.waitForPageToLoad("30000");
064            selenium.click("//input[@name='methodToCall.search' and @value='search']");
065            selenium.waitForPageToLoad("30000");
066            selenium.click("link=return value");
067            selenium.waitForPageToLoad("30000");
068            selenium.type("//input[@id='document.newMaintainableObject.code']", "TS");
069            selenium.type("//input[@id='document.newMaintainableObject.name']", "Validation Test State");
070            selenium.click("//input[@id='document.newMaintainableObject.active']");
071            selenium.click("methodToCall.blanketApprove");
072            selenium.waitForPageToLoad("30000");
073            selenium.selectWindow("null");
074            selenium.click("//img[@alt='doc search']");
075            selenium.waitForPageToLoad("30000");
076            assertEquals("Kuali Portal Index", selenium.getTitle());
077            selenium.selectFrame("iframeportlet");
078            selenium.click("//input[@name='methodToCall.search' and @value='search']");
079            selenium.waitForPageToLoad("30000");
080            
081            docId= "link=" + docId;
082            assertTrue(selenium.isElementPresent(docId));       
083            if(selenium.isElementPresent(docId)){            
084                assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
085            }else{
086                assertEquals(docId, selenium.getText("//table[@id='row']/tbody/tr[1]/td[1]"));            
087                assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
088            }
089        }
090    
091        @After
092        public void tearDown() throws Exception {
093            selenium.stop();
094        }
095    }