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 */
016package edu.samplu.admin.test;
017
018import static org.junit.Assert.assertEquals;
019import static org.junit.Assert.assertTrue;
020
021import org.junit.After;
022import org.junit.Before;
023import org.junit.Test;
024
025import com.thoughtworks.selenium.DefaultSelenium;
026import com.thoughtworks.selenium.Selenium;
027
028/**
029 * TODO Administrator don't forget to fill this in. 
030 * 
031 * @author Kuali Rice Team (rice.collab@kuali.org)
032 */
033public class LocationCountryBlanketAppIT {
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 testCountry() 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=Country");
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        assertTrue(selenium.isElementPresent("methodToCall.cancel"));
060        selenium.type("//input[@id='document.documentHeader.documentDescription']", "Validation Test Country");
061        selenium.type("//input[@id='document.newMaintainableObject.code']", "CT");
062        selenium.type("//input[@id='document.newMaintainableObject.name']", "Validation Test Country");
063        selenium.type("//input[@id='document.newMaintainableObject.alternateCode']", "VTC");
064        selenium.click("methodToCall.blanketApprove");
065        selenium.waitForPageToLoad("30000");
066        selenium.selectWindow("null");
067        selenium.click("//img[@alt='doc search']");
068        selenium.waitForPageToLoad("30000");
069        assertEquals("Kuali Portal Index", selenium.getTitle());
070        selenium.selectFrame("iframeportlet");
071        selenium.click("//input[@name='methodToCall.search' and @value='search']");
072        selenium.waitForPageToLoad("30000");
073      
074        docId= "link=" + docId;
075        assertTrue(selenium.isElementPresent(docId));       
076        if(selenium.isElementPresent(docId)){            
077            assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
078        }else{
079            assertEquals(docId, selenium.getText("//table[@id='row']/tbody/tr[1]/td[1]"));            
080            assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
081        }
082    }
083
084    @After
085    public void tearDown() throws Exception {
086        selenium.stop();
087    }
088}