View Javadoc

1   package edu.samplu.mainmenu.test;
2   
3   import junit.framework.Assert;
4   
5   import edu.samplu.common.ITUtil;
6   import edu.samplu.common.WebDriverLegacyITBase;
7   
8   import org.junit.Test;
9   import org.openqa.selenium.Alert;
10  import org.openqa.selenium.JavascriptExecutor;
11  import org.openqa.selenium.WebDriver.Window;
12  
13  import static junit.framework.Assert.assertTrue;
14  import static org.junit.Assert.assertTrue;
15  
16  /**
17   * test that after doc search, navigating to people flow maintenance view does not cause Javascript errors
18   * and therefore interfere with JS functionality like validation
19   *
20   * @author Kuali Rice Team (rice.collab@kuali.org)
21   */
22  public class DocSearchToAnotherViewLegacyIT extends WebDriverLegacyITBase {
23      @Override
24      public String getTestUrl() {
25          return ITUtil.PORTAL;
26      }
27  
28  	@Test
29      /**
30       * test that after doc search, navigating to people flow maintenance view does not cause Javascript errors
31       * and therefore interfere with JS functionality like validation
32       */
33  	public void testDocSearchToAnotherView() throws Exception {
34  		waitAndClick("img[alt=\"doc search\"]");
35  		waitForPageToLoad();
36  		selectFrame("iframeportlet");
37  		waitAndClick("td.infoline > input[name=\"methodToCall.search\"]");
38  		waitForPageToLoad();
39  	//	selectFrame("relative=top");
40  		driver.switchTo().defaultContent();
41  		waitAndClickByLinkText("Main Menu");
42          waitForPageToLoad();
43  		//setSpeed("2000");
44  		waitAndClickByLinkText("People Flow");
45  		waitForPageToLoad();
46  		selectFrame("iframeportlet");
47  		waitAndClickByLinkText("Create New");
48  		waitForPageToLoad();
49  		fireEvent("document.documentHeader.documentDescription", "focus");
50  		waitAndTypeByName("document.documentHeader.documentDescription", "sample description");
51  		fireEvent("document.documentHeader.explanation", "focus");
52  		waitAndTypeByName("document.documentHeader.explanation", "sample explanation");		
53  		((JavascriptExecutor)driver).executeScript("document.getElementById(\"uif-cancel\").focus();");
54  		waitAndClickByLinkText("Cancel");
55  		Thread.sleep(5000);
56  		final String text = "Form has unsaved data. Do you want to leave anyway?";
57  		Alert a=driver.switchTo().alert();
58  		Assert.assertTrue(a.getText().equals(text));
59  		a.dismiss();
60          passed();
61  	}
62  }