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 LocationCountyBlanketAppIT { 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 testCounty() 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=County"); 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 County"); 061 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"); 062 selenium.waitForPageToLoad("30000"); 063 selenium.type("code", "US"); 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']", "DS"); 069 selenium.click("methodToCall.performLookup.(!!org.kuali.rice.location.impl.state.StateBo!!).(((countryCode:document.newMaintainableObject.countryCode,code:document.newMaintainableObject.stateCode,))).((`document.newMaintainableObject.countryCode:countryCode,document.newMaintainableObject.stateCode:code,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;" + System.getProperty("remote.public.url") + "kr/lookup.do;::::).anchor4"); 070 selenium.waitForPageToLoad("30000"); 071 selenium.type("code", "IN"); 072 selenium.click("//input[@name='methodToCall.search' and @value='search']"); 073 selenium.waitForPageToLoad("30000"); 074 selenium.click("link=return value"); 075 selenium.waitForPageToLoad("30000"); 076 selenium.type("//input[@id='document.newMaintainableObject.name']", "Validation Test County"); 077 selenium.click("//input[@id='document.newMaintainableObject.active']"); 078 selenium.click("methodToCall.blanketApprove"); 079 selenium.waitForPageToLoad("30000"); 080 selenium.selectWindow("null"); 081 selenium.click("//img[@alt='doc search']"); 082 selenium.waitForPageToLoad("30000"); 083 assertEquals("Kuali Portal Index", selenium.getTitle()); 084 selenium.selectFrame("iframeportlet"); 085 selenium.click("//input[@name='methodToCall.search' and @value='search']"); 086 selenium.waitForPageToLoad("30000"); 087 docId= "link=" + docId; 088 assertTrue(selenium.isElementPresent(docId)); 089 if(selenium.isElementPresent(docId)){ 090 assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]")); 091 }else{ 092 assertEquals(docId, selenium.getText("//table[@id='row']/tbody/tr[1]/td[1]")); 093 assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]")); 094 } 095 } 096 097 @After 098 public void tearDown() throws Exception { 099 selenium.stop(); 100 } 101}