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/** 030 * TODO Administrator don't forget to fill this in. 031 * 032 * @author Kuali Rice Team (rice.collab@kuali.org) 033 */ 034public class ConfigParameterBlanketAppIT { 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 testParameter() 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=Parameter"); 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 assertEquals("", selenium.getText("methodToCall.cancel")); 061 selenium.type("//input[@id='document.documentHeader.documentDescription']", "Validation Test Parameter"); 062 selenium.select("//select[@id='document.newMaintainableObject.namespaceCode']", "label=Kuali Nervous System"); 063 selenium.click("methodToCall.performLookup.(!!ComponentBo!!).(((code:document.newMaintainableObject.componentCode,namespaceCode:document.newMaintainableObject.namespaceCode,))).((`document.newMaintainableObject.componentCode:code,document.newMaintainableObject.namespaceCode:namespaceCode,`)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;" + System.getProperty("remote.public.url") + "kr/lookup.do;::::).anchor4"); 064 selenium.waitForPageToLoad("30000"); 065 selenium.click("//input[@name='methodToCall.search' and @value='search']"); 066 selenium.waitForPageToLoad("30000"); 067 selenium.click("//table[@id='row']/tbody/tr[3]/td[1]/a"); 068 selenium.waitForPageToLoad("30000"); 069 selenium.type("//input[@id='document.newMaintainableObject.name']", "Validation Test Parameter1"); 070 selenium.type("//textarea[@id='document.newMaintainableObject.description']", "Validation Test Parameter Description"); 071 selenium.select("//select[@id='document.newMaintainableObject.parameterTypeCode']", "label=Document Validation"); 072 selenium.click("//input[@id='document.newMaintainableObject.evaluationOperatorCodeAllowed']"); 073 selenium.click("methodToCall.blanketApprove"); 074 selenium.waitForPageToLoad("30000"); 075 selenium.selectWindow("null"); 076 selenium.click("//img[@alt='doc search']"); 077 selenium.waitForPageToLoad("30000"); 078 assertEquals("Kuali Portal Index", selenium.getTitle()); 079 selenium.selectFrame("iframeportlet"); 080 selenium.click("//input[@name='methodToCall.search' and @value='search']"); 081 selenium.waitForPageToLoad("30000"); 082 docId= "link=" + docId; 083 084 assertTrue(selenium.isElementPresent(docId)); 085 if(selenium.isElementPresent(docId)){ 086 assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]")); 087 }else{ 088 assertEquals(docId, selenium.getText("//table[@id='row']/tbody/tr[1]/td[1]")); 089 assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]")); 090 } 091 } 092 093 @After 094 public void tearDown() throws Exception { 095 selenium.stop(); 096 } 097}