1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  package edu.sampleu.main;
17  
18  import org.junit.Test;
19  import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
20  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21  import org.kuali.rice.testtools.selenium.WebDriverUtils;
22  import org.openqa.selenium.Alert;
23  
24  
25  
26  
27  
28  
29  
30  public class DocSearchToAnotherViewAft extends WebDriverLegacyITBase {
31  
32      @Override
33      protected String getBookmarkUrl() {
34          return AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Document%20Search&channelUrl=" + WebDriverUtils
35                  .getBaseUrlString()
36                  + "/kew/DocumentSearch.do?docFormKey=88888888&returnLocation=" + AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK;
37      }
38  
39  	@Test
40      
41  
42  
43  
44  	public void testDocSearchToAnotherViewBookmark() throws Exception {
45  		waitAndClick("img[alt=\"doc search\"]");
46  		waitForPageToLoad();
47  		selectFrame("iframeportlet");
48  		waitAndClick("td.infoline > input[name=\"methodToCall.search\"]");
49  	
50  		driver.switchTo().defaultContent();
51  		waitAndClickByLinkText("Main Menu");
52  		waitAndClickByLinkText("People Flow");
53  		waitForPageToLoad();
54  		selectFrame("iframeportlet");
55  		waitAndClickByLinkText("Create New");
56  		waitForPageToLoad();
57  		fireEvent("document.documentHeader.documentDescription", "focus");
58  		waitAndTypeByName("document.documentHeader.documentDescription", "sample description");
59  		fireEvent("document.documentHeader.explanation", "focus");
60  		waitAndTypeByName("document.documentHeader.explanation", "sample explanation");		
61  
62          jGrowl("Click Cancel");
63          waitAndClickByXpath("//div[@class='uif-footer clearfix']/button[contains(text(), 'Cancel')]");
64  		Thread.sleep(5000);
65  		final String text = "Form has unsaved data. Do you want to leave anyway?";
66  		Alert a=driver.switchTo().alert();
67  		assertTrue(a.getText().equals(text));
68  		a.dismiss();
69          passed();
70  	}
71  }