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.mainmenu.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     * tests that user 'admin' can display the Context lookup screen, search,
030     * initiate an Context maintenance document via an edit action on the search results and
031     * finally cancel the maintenance document
032     * 
033     * @author Kuali Rice Team (rice.collab@kuali.org)
034     */
035    public class ContextLookUpIT {
036    
037        private Selenium selenium;
038        @Before
039        public void setUp() throws Exception {
040            selenium = new DefaultSelenium("localhost", 4444, "*firefox", System.getProperty("remote.public.url"));
041            selenium.start();
042            // selenium.setSpeed("2000");
043        }
044        
045        @Test
046        public void testContextLookUp() throws Exception {
047            
048            selenium.open(System.getProperty("remote.public.url"));
049                    selenium.type("name=__login_user", "admin");
050                    selenium.click("css=input[type=\"submit\"]");
051                    selenium.waitForPageToLoad("30000");
052                    selenium.click("link=Context Lookup");
053                    selenium.waitForPageToLoad("30000");
054                    selenium.selectFrame("iframeportlet");
055                    selenium.click("//button");
056                    selenium.waitForPageToLoad("30000");
057                    selenium.click("link=edit");
058                    selenium.waitForPageToLoad("30000");
059                    assertTrue(selenium.isTextPresent("cancel"));
060                    selenium.click("link=cancel");
061                    selenium.waitForPageToLoad("30000");
062            
063        }
064        
065        @After
066        public void tearDown() throws Exception {
067            selenium.stop();
068        }
069    
070    }