1 package edu.samplu.mainmenu.test;
2
3 import junit.framework.Assert;
4
5 import org.kuali.rice.testtools.selenium.ITUtil;
6 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
7
8 import org.junit.Test;
9 import org.openqa.selenium.Alert;
10
11 import static junit.framework.Assert.assertTrue;
12 import static org.junit.Assert.assertTrue;
13
14
15
16
17
18
19
20 public class DocSearchToAnotherViewWDIT extends WebDriverLegacyITBase {
21
22 @Override
23 public void fail(String message) {
24 org.junit.Assert.fail(message);
25 }
26
27 @Override
28 public String getTestUrl() {
29 return ITUtil.PORTAL;
30 }
31
32 @Test
33
34
35
36
37 public void testDocSearchToAnotherView() throws Exception {
38 waitAndClick("img[alt=\"doc search\"]");
39 waitForPageToLoad();
40 selectFrame("iframeportlet");
41 waitAndClick("td.infoline > input[name=\"methodToCall.search\"]");
42 waitForPageToLoad();
43
44 driver.switchTo().defaultContent();
45 waitAndClickByLinkText("Main Menu");
46 waitForPageToLoad();
47
48 waitAndClickByLinkText("People Flow");
49 waitForPageToLoad();
50 selectFrame("iframeportlet");
51 waitAndClickByLinkText("Create New");
52 waitForPageToLoad();
53 fireEvent("document.documentHeader.documentDescription", "focus");
54 waitAndTypeByName("document.documentHeader.documentDescription", "sample description");
55 fireEvent("document.documentHeader.explanation", "focus");
56 waitAndTypeByName("document.documentHeader.explanation", "sample explanation");
57
58 waitAndClickByLinkText("Cancel");
59 Thread.sleep(5000);
60 final String text = "Form has unsaved data. Do you want to leave anyway?";
61 Alert a=driver.switchTo().alert();
62 Assert.assertTrue(a.getText().equals(text));
63 a.dismiss();
64 passed();
65 }
66 }