001 package edu.samplu.mainmenu.test; 002 003 import com.thoughtworks.selenium.*; 004 import org.junit.After; 005 import org.junit.Before; 006 import org.junit.Test; 007 import java.util.regex.Pattern; 008 import static org.junit.Assert.assertTrue; 009 010 /** 011 * test that after doc search, navigating to people flow maintenance view does not cause Javascript errors 012 * and therefore interfere with JS functionality like validation 013 * 014 * @author Kuali Rice Team (rice.collab@kuali.org) 015 */ 016 public class DocSearchToAnotherViewIT { 017 private Selenium selenium; 018 019 @Before 020 public void setUp() throws Exception { 021 selenium = new DefaultSelenium("localhost", 4444, "*firefox", System.getProperty("remote.public.url"));//"http://dev1.rice.kuali.org/"); 022 selenium.start(); 023 } 024 025 @Test 026 /** 027 * test that after doc search, navigating to people flow maintenance view does not cause Javascript errors 028 * and therefore interfere with JS functionality like validation 029 */ 030 public void testDocSearchToAnotherView() throws Exception { 031 selenium.open(System.getProperty("remote.public.url")); 032 selenium.waitForPageToLoad("30000"); 033 selenium.type("name=__login_user", "admin"); 034 selenium.click("css=input[type=\"submit\"]"); 035 selenium.waitForPageToLoad("30000"); 036 selenium.click("css=img[alt=\"doc search\"]"); 037 selenium.waitForPageToLoad("30000"); 038 selenium.selectFrame("iframeportlet"); 039 selenium.click("css=td.infoline > input[name=\"methodToCall.search\"]"); 040 selenium.waitForPageToLoad("30000"); 041 selenium.selectFrame("relative=up"); 042 selenium.click("link=Main Menu"); 043 selenium.waitForPageToLoad("30000"); 044 selenium.setSpeed("2000"); 045 selenium.click("link=People Flow"); 046 selenium.waitForPageToLoad("30000"); 047 selenium.selectFrame("iframeportlet"); 048 selenium.click("id=19"); 049 selenium.waitForPageToLoad("30000"); 050 selenium.focus("id=160"); 051 selenium.type("id=160", "sample description"); 052 selenium.focus("id=185"); 053 selenium.type("id=185", "sample explanation"); 054 selenium.click("id=143"); 055 assertTrue(selenium.getConfirmation().matches("^Form has unsaved data\\. Do you want to leave anyway[\\s\\S]$")); 056 } 057 058 @After 059 public void tearDown() throws Exception { 060 selenium.stop(); 061 } 062 }