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 org.junit.After;
023 import org.junit.Before;
024 import org.junit.Test;
025
026 import com.thoughtworks.selenium.DefaultSelenium;
027 import com.thoughtworks.selenium.Selenium;
028 /**
029 * tests that user 'admin', on blanket approving a new Campus maintenance document, results in a final document
030 *
031 * @author Kuali Rice Team (rice.collab@kuali.org)
032 */
033 public class LocationCampusBlanketAppIT {
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 testCampus() throws Exception {
043 selenium.open(System.getProperty("remote.public.url"));
044 assertEquals("Login", selenium.getTitle());
045 selenium.type("name=__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=Campus");
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 assertTrue(selenium.isElementPresent("name=methodToCall.cancel"));
059 String docId = selenium.getText("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
060
061 selenium.type("id=document.documentHeader.documentDescription", "Validation Test Campus");
062 selenium.type("id=document.newMaintainableObject.code", "VC");
063 selenium.type("id=document.newMaintainableObject.name", "Validation Test Campus");
064 selenium.type("id=document.newMaintainableObject.shortName", "VTC");
065 selenium.select("id=document.newMaintainableObject.campusTypeCode", "label=B - BOTH");
066 selenium.click("name=methodToCall.blanketApprove");
067 selenium.waitForPageToLoad("30000");
068 selenium.selectWindow("null");
069 selenium.click("//img[@alt='doc search']");
070 selenium.waitForPageToLoad("30000");
071 assertEquals("Kuali Portal Index", selenium.getTitle());
072 selenium.selectFrame("iframeportlet");
073 selenium.click("//input[@name='methodToCall.search' and @value='search']");
074 selenium.waitForPageToLoad("30000");
075 docId= "link=" + docId;
076 assertTrue(selenium.isElementPresent(docId));
077 if(selenium.isElementPresent(docId)){
078 assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
079 }else{
080 assertEquals(docId, selenium.getText("//table[@id='row']/tbody/tr[1]/td[1]"));
081 assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
082 }
083
084 }
085
086 @After
087 public void tearDown() throws Exception {
088 selenium.stop();
089 }
090 }