View Javadoc

1   package edu.samplu.mainmenu.test;
2   
3   import com.thoughtworks.selenium.*;
4   import org.junit.After;
5   import org.junit.Before;
6   import org.junit.Test;
7   import java.util.regex.Pattern;
8   import static org.junit.Assert.assertTrue;
9   
10  public class DocSearchToAnotherView {
11      private Selenium selenium;
12  
13      @Before
14  	public void setUp() throws Exception {
15  		selenium = new DefaultSelenium("localhost", 4444, "*firefox", System.getProperty("remote.public.url"));//"http://dev1.rice.kuali.org/");
16  		selenium.start();
17  	}
18  
19  	@Test
20      /**
21       * test that after doc search, navigating to people flow maintenance view does not cause Javascript errors
22       * and therefore interfere with JS functionality like validation
23       */
24  	public void testDocSearchToAnotherView() throws Exception {
25          selenium.open("portal.do");
26          selenium.waitForPageToLoad("30000");
27  		selenium.selectWindow("null");
28  		selenium.type("name=__login_user", "admin");
29  		selenium.click("css=input[type=\"submit\"]");
30  		selenium.waitForPageToLoad("30000");
31  		selenium.click("css=img[alt=\"doc search\"]");
32  		selenium.waitForPageToLoad("30000");
33  		selenium.selectFrame("iframeportlet");
34  		selenium.click("css=td.infoline > input[name=\"methodToCall.search\"]");
35  		selenium.waitForPageToLoad("30000");
36  		selenium.selectFrame("relative=up");
37  		selenium.click("link=Main Menu");
38  		selenium.waitForPageToLoad("30000");
39  		selenium.click("link=People Flow");
40  		selenium.waitForPageToLoad("30000");
41  		selenium.selectFrame("iframeportlet");
42  		selenium.click("id=19");
43  		selenium.waitForPageToLoad("30000");
44          selenium.focus("id=160");
45  		selenium.type("id=160", "sample description");
46          selenium.focus("id=185");
47  		selenium.type("id=185", "sample explanation");
48  		selenium.click("id=143");
49  		assertTrue(selenium.getConfirmation().matches("^Form has unsaved data\\. Do you want to leave anyway[\\s\\S]$"));
50  	}
51  
52  	@After
53  	public void tearDown() throws Exception {
54  		selenium.stop();
55  	}
56  }