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 org.junit.After;
022    import org.junit.Before;
023    import org.junit.Test;
024    
025    import com.thoughtworks.selenium.DefaultSelenium;
026    import com.thoughtworks.selenium.Selenium;
027    
028    
029    /**
030     * tests that user admin's blanket approve of the Parameter maintenance document results in a final document
031     * The component is chosen from a lookup screen
032     * 
033     * @author Kuali Rice Team (rice.collab@kuali.org)
034     */
035    public class ConfigParameterBlanketAppIT {
036        private Selenium selenium;
037        @Before
038        public void setUp() throws Exception {
039            selenium = new DefaultSelenium("localhost", 4444, "*firefox", System.getProperty("remote.public.url"));
040            selenium.start();
041            //selenium.setSpeed("1000");
042        }
043    
044        @Test
045        public void testParameter() throws Exception {
046            selenium.open(System.getProperty("remote.public.url"));
047            assertEquals("Login", selenium.getTitle());
048            selenium.type("__login_user", "admin");
049            selenium.click("//input[@value='Login']");
050            selenium.waitForPageToLoad("30000");
051            assertEquals("Kuali Portal Index", selenium.getTitle());
052            selenium.click("link=Administration");
053            selenium.waitForPageToLoad("30000");
054            assertEquals("Kuali Portal Index", selenium.getTitle());
055            selenium.click("link=Parameter");
056            selenium.waitForPageToLoad("30000");
057            assertEquals("Kuali Portal Index", selenium.getTitle());
058            selenium.selectFrame("iframeportlet");
059            selenium.click("//img[@alt='create new']");
060            selenium.waitForPageToLoad("30000");
061            String docId = selenium.getText("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
062            assertEquals("", selenium.getText("methodToCall.cancel"));
063            selenium.type("//input[@id='document.documentHeader.documentDescription']", "Validation Test Parameter");          
064            selenium.select("//select[@id='document.newMaintainableObject.namespaceCode']", "label=Kuali Nervous System");
065            selenium.click("methodToCall.performLookup.(!!org.kuali.rice.coreservice.impl.component.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");
066            selenium.waitForPageToLoad("30000");
067            selenium.click("//input[@name='methodToCall.search' and @value='search']");
068            selenium.waitForPageToLoad("30000");
069            selenium.click("//table[@id='row']/tbody/tr[3]/td[1]/a");
070            selenium.waitForPageToLoad("30000");
071            selenium.type("//input[@id='document.newMaintainableObject.name']", "Validation Test Parameter1");
072            selenium.type("//textarea[@id='document.newMaintainableObject.description']", "Validation Test Parameter Description");
073            selenium.select("//select[@id='document.newMaintainableObject.parameterTypeCode']", "label=Document Validation");
074            selenium.click("//input[@id='document.newMaintainableObject.evaluationOperatorCodeAllowed']");
075            selenium.click("methodToCall.blanketApprove");
076            selenium.waitForPageToLoad("30000");
077            selenium.selectWindow("null");
078            selenium.click("//img[@alt='doc search']");
079            selenium.waitForPageToLoad("30000");
080            assertEquals("Kuali Portal Index", selenium.getTitle());
081            selenium.selectFrame("iframeportlet");
082            selenium.click("//input[@name='methodToCall.search' and @value='search']");
083            selenium.waitForPageToLoad("30000");
084            docId= "link=" + docId;
085            
086            assertTrue(selenium.isElementPresent(docId));       
087            if(selenium.isElementPresent(docId)){            
088                assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
089            }else{
090                assertEquals(docId, selenium.getText("//table[@id='row']/tbody/tr[1]/td[1]"));            
091                assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
092            }
093        }
094    
095        @After
096        public void tearDown() throws Exception {
097            selenium.stop();
098        }
099    }