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  /**
11   * test that after doc search, navigating to people flow maintenance view does not cause Javascript errors
12   * and therefore interfere with JS functionality like validation
13   *
14   * @author Kuali Rice Team (rice.collab@kuali.org)
15   */
16  public class DocSearchToAnotherViewIT {
17      private Selenium selenium;
18  
19      @Before
20  	public void setUp() throws Exception {
21  		selenium = new DefaultSelenium("localhost", 4444, "*firefox", System.getProperty("remote.public.url"));//"http://dev1.rice.kuali.org/");
22  		selenium.start();
23  	}
24  
25  	@Test
26      /**
27       * test that after doc search, navigating to people flow maintenance view does not cause Javascript errors
28       * and therefore interfere with JS functionality like validation
29       */
30  	public void testDocSearchToAnotherView() throws Exception {
31          selenium.open(System.getProperty("remote.public.url"));
32          selenium.waitForPageToLoad("30000");
33  		selenium.type("name=__login_user", "admin");
34  		selenium.click("css=input[type=\"submit\"]");
35  		selenium.waitForPageToLoad("30000");
36  		selenium.click("css=img[alt=\"doc search\"]");
37  		selenium.waitForPageToLoad("30000");
38  		selenium.selectFrame("iframeportlet");
39  		selenium.click("css=td.infoline > input[name=\"methodToCall.search\"]");
40  		selenium.waitForPageToLoad("30000");
41  		selenium.selectFrame("relative=up");
42  		selenium.click("link=Main Menu");
43  		selenium.waitForPageToLoad("30000");
44          selenium.setSpeed("2000");
45  		selenium.click("link=People Flow");
46  		selenium.waitForPageToLoad("30000");
47  		selenium.selectFrame("iframeportlet");
48  		selenium.click("id=19");
49  		selenium.waitForPageToLoad("30000");
50          selenium.focus("id=160");
51  		selenium.type("id=160", "sample description");
52          selenium.focus("id=185");
53  		selenium.type("id=185", "sample explanation");
54  		selenium.click("id=143");
55  		assertTrue(selenium.getConfirmation().matches("^Form has unsaved data\\. Do you want to leave anyway[\\s\\S]$"));
56  	}
57  
58  	@After
59  	public void tearDown() throws Exception {
60  		selenium.stop();
61  	}
62  }