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 public class DocSearchToAnotherView { 011 private Selenium selenium; 012 013 @Before 014 public void setUp() throws Exception { 015 selenium = new DefaultSelenium("localhost", 4444, "*firefox", System.getProperty("remote.public.url"));//"http://dev1.rice.kuali.org/"); 016 selenium.start(); 017 } 018 019 @Test 020 /** 021 * test that after doc search, navigating to people flow maintenance view does not cause Javascript errors 022 * and therefore interfere with JS functionality like validation 023 */ 024 public void testDocSearchToAnotherView() throws Exception { 025 selenium.open("portal.do"); 026 selenium.waitForPageToLoad("30000"); 027 selenium.selectWindow("null"); 028 selenium.type("name=__login_user", "admin"); 029 selenium.click("css=input[type=\"submit\"]"); 030 selenium.waitForPageToLoad("30000"); 031 selenium.click("css=img[alt=\"doc search\"]"); 032 selenium.waitForPageToLoad("30000"); 033 selenium.selectFrame("iframeportlet"); 034 selenium.click("css=td.infoline > input[name=\"methodToCall.search\"]"); 035 selenium.waitForPageToLoad("30000"); 036 selenium.selectFrame("relative=up"); 037 selenium.click("link=Main Menu"); 038 selenium.waitForPageToLoad("30000"); 039 selenium.click("link=People Flow"); 040 selenium.waitForPageToLoad("30000"); 041 selenium.selectFrame("iframeportlet"); 042 selenium.click("id=19"); 043 selenium.waitForPageToLoad("30000"); 044 selenium.focus("id=160"); 045 selenium.type("id=160", "sample description"); 046 selenium.focus("id=185"); 047 selenium.type("id=185", "sample explanation"); 048 selenium.click("id=143"); 049 assertTrue(selenium.getConfirmation().matches("^Form has unsaved data\\. Do you want to leave anyway[\\s\\S]$")); 050 } 051 052 @After 053 public void tearDown() throws Exception { 054 selenium.stop(); 055 } 056 }