001 package edu.samplu.mainmenu.test; 002 003 import junit.framework.Assert; 004 005 import org.kuali.rice.testtools.selenium.ITUtil; 006 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase; 007 008 import org.junit.Test; 009 import org.openqa.selenium.Alert; 010 011 import static junit.framework.Assert.assertTrue; 012 import static org.junit.Assert.assertTrue; 013 014 /** 015 * test that after doc search, navigating to people flow maintenance view does not cause Javascript errors 016 * and therefore interfere with JS functionality like validation 017 * 018 * @author Kuali Rice Team (rice.collab@kuali.org) 019 */ 020 public class DocSearchToAnotherViewWDIT extends WebDriverLegacyITBase { 021 022 @Override 023 public void fail(String message) { 024 org.junit.Assert.fail(message); 025 } 026 027 @Override 028 public String getTestUrl() { 029 return ITUtil.PORTAL; 030 } 031 032 @Test 033 /** 034 * test that after doc search, navigating to people flow maintenance view does not cause Javascript errors 035 * and therefore interfere with JS functionality like validation 036 */ 037 public void testDocSearchToAnotherView() throws Exception { 038 waitAndClick("img[alt=\"doc search\"]"); 039 waitForPageToLoad(); 040 selectFrame("iframeportlet"); 041 waitAndClick("td.infoline > input[name=\"methodToCall.search\"]"); 042 waitForPageToLoad(); 043 // selectFrame("relative=top"); 044 driver.switchTo().defaultContent(); 045 waitAndClickByLinkText("Main Menu"); 046 waitForPageToLoad(); 047 //setSpeed("2000"); 048 waitAndClickByLinkText("People Flow"); 049 waitForPageToLoad(); 050 selectFrame("iframeportlet"); 051 waitAndClickByLinkText("Create New"); 052 waitForPageToLoad(); 053 fireEvent("document.documentHeader.documentDescription", "focus"); 054 waitAndTypeByName("document.documentHeader.documentDescription", "sample description"); 055 fireEvent("document.documentHeader.explanation", "focus"); 056 waitAndTypeByName("document.documentHeader.explanation", "sample explanation"); 057 // ((JavascriptExecutor)driver).executeScript("document.getElementById(\"uif-cancel\").focus();"); 058 waitAndClickByLinkText("Cancel"); 059 Thread.sleep(5000); 060 final String text = "Form has unsaved data. Do you want to leave anyway?"; 061 Alert a=driver.switchTo().alert(); 062 Assert.assertTrue(a.getText().equals(text)); 063 a.dismiss(); 064 passed(); 065 } 066 }