View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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   * test that after doc search, navigating to people flow maintenance view does not cause Javascript errors
26   * and therefore interfere with JS functionality like validation
27   *
28   * @author Kuali Rice Team (rice.collab@kuali.org)
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       * test that after doc search, navigating to people flow maintenance view does not cause Javascript errors
42       * and therefore interfere with JS functionality like validation
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  	//	selectFrame("relative=top");
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  //		((JavascriptExecutor)driver).executeScript("document.getElementById(\"uif-cancel\").focus();");
62  		waitAndClickByLinkText("Cancel");
63  		Thread.sleep(5000);
64  		final String text = "Form has unsaved data. Do you want to leave anyway?";
65  		Alert a=driver.switchTo().alert();
66  		assertTrue(a.getText().equals(text));
67  		a.dismiss();
68          passed();
69  	}
70  }