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 edu.samplu.common.UpgradedSeleniumITBase;
022 import org.apache.commons.lang.RandomStringUtils;
023 import org.junit.Test;
024
025 /**
026 * tests that user 'admin', on blanket approving a new County maintenance document, results in a final document
027 *
028 * @author Kuali Rice Team (rice.collab@kuali.org)
029 */
030 public class LocationCountyBlanketAppIT extends UpgradedSeleniumITBase {
031 @Override
032 public String getTestUrl() {
033 return PORTAL;
034 }
035
036 @Test
037 public void testCounty() throws Exception {
038 String remotePublicUrl = getBaseUrlString();
039 assertEquals("Kuali Portal Index", selenium.getTitle());
040 selenium.click("link=Administration");
041 selenium.waitForPageToLoad("30000");
042 assertEquals("Kuali Portal Index", selenium.getTitle());
043 selenium.click("link=County");
044 selenium.waitForPageToLoad("30000");
045 assertEquals("Kuali Portal Index", selenium.getTitle());
046 selenium.selectFrame("iframeportlet");
047 selenium.click("//img[@alt='create new']");
048 selenium.waitForPageToLoad("30000");
049 //selenium.setSpeed("2000");
050 String docId = selenium.getText("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
051 assertTrue(selenium.isElementPresent("methodToCall.cancel"));
052 selenium.type("//input[@id='document.documentHeader.documentDescription']", "Validation Test County");
053 selenium.click("methodToCall.performLookup.(!!org.kuali.rice.location.impl.country.CountryBo!!).(((code:document.newMaintainableObject.countryCode,))).((`document.newMaintainableObject.countryCode:code,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;" + remotePublicUrl
054 + "/kr/lookup.do;::::).anchor4");
055 selenium.waitForPageToLoad("30000");
056 selenium.type("code", "US");
057 selenium.click("//input[@name='methodToCall.search' and @value='search']");
058 selenium.waitForPageToLoad("30000");
059 selenium.click("link=return value");
060 selenium.waitForPageToLoad("30000");
061 selenium.type("//input[@id='document.newMaintainableObject.code']", RandomStringUtils.randomAlphabetic(2).toUpperCase());
062 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,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;" + remotePublicUrl
063 + "/kr/lookup.do;::::).anchor4");
064 selenium.waitForPageToLoad("30000");
065 selenium.type("code", "IN");
066 selenium.click("//input[@name='methodToCall.search' and @value='search']");
067 selenium.waitForPageToLoad("30000");
068 selenium.click("link=return value");
069 selenium.waitForPageToLoad("30000");
070 selenium.type("//input[@id='document.newMaintainableObject.name']", "Validation Test County");
071 selenium.click("//input[@id='document.newMaintainableObject.active']");
072 selenium.click("methodToCall.blanketApprove");
073 selenium.waitForPageToLoad("30000");
074 selenium.selectWindow("null");
075 selenium.click("//img[@alt='doc search']");
076 selenium.waitForPageToLoad("30000");
077 assertEquals("Kuali Portal Index", selenium.getTitle());
078 selenium.selectFrame("iframeportlet");
079 selenium.click("//input[@name='methodToCall.search' and @value='search']");
080 selenium.waitForPageToLoad("30000");
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 }