List of usage examples for org.openqa.selenium.support.ui ExpectedConditions textToBePresentInElement
public static ExpectedCondition<Boolean> textToBePresentInElement(final WebElement element, final String text)
From source file:jscover.server.WebDriverJasmineTestBase.java
License:Open Source License
@Test public void shouldRunJasmineTestAndStoreResultViaJavaScriptCall() throws Exception { File jsonFile = new File(getReportDir() + "/directory/jscoverage.json"); if (jsonFile.exists()) jsonFile.delete();/*from ww w . j a v a2 s .co m*/ webClient.get("http://localhost:8081/jscoverage.html"); webClient.findElement(By.id("location")).clear(); webClient.findElement(By.id("location")).sendKeys("http://localhost:8081/" + getTestUrl()); webClient.findElement(By.id("openInWindowButton")).click(); String handle = webClient.getWindowHandle(); Set<String> allHandles = webClient.getWindowHandles(); for (String currentHandle : allHandles) { if (!currentHandle.equals(handle)) { webClient.switchTo().window(currentHandle); break; } } new WebDriverWait(webClient, 1) .until(ExpectedConditions.presenceOfElementLocated(By.className("duration"))); new WebDriverWait(webClient, 1) .until(ExpectedConditions.textToBePresentInElement(By.className("duration"), "finished")); verifyJasmineTestsPassed(); webClient.switchTo().window(handle); verifyTotal(webClient, 100, 0, 100); webClient.switchTo().window("jscoverage_window"); ((JavascriptExecutor) webClient).executeScript("jscoverage_report('directory')"); webClient.get(format("http://localhost:8081/%s/directory/jscoverage.html", getReportDir())); verifyTotal(webClient, 100, 0, 100); }
From source file:org.apache.deltaspike.test.jsf.impl.config.view.controller.uc001.ViewConfigTestDrone.java
License:Apache License
@Test @RunAsClient/*from w w w . j a v a 2s.com*/ public void testNavigation() throws MalformedURLException { driver.get(new URL(contextPath, "simplePageConfig.xhtml").toString()); Assert.assertTrue( ExpectedConditions.textToBePresentInElement(By.id("pageBean001Called"), "true").apply(driver)); }
From source file:org.apache.deltaspike.test.jsf.impl.config.view.controller.uc002.ViewConfigTestDrone.java
License:Apache License
@Test @RunAsClient//from ww w. j a v a2s . c o m public void testNavigation() throws MalformedURLException { driver.get(new URL(contextPath, "simplePageConfig.xhtml").toString()); Assert.assertTrue( ExpectedConditions.textToBePresentInElement(By.id("pageBean002Called"), "true").apply(driver)); }
From source file:org.apache.deltaspike.test.jsf.impl.config.view.controller.uc003.ViewConfigTestDrone.java
License:Apache License
@Test @RunAsClient// w w w. j a v a 2s . co m public void testNavigation() throws MalformedURLException { driver.get(new URL(contextPath, "simplePageConfig.xhtml").toString()); Assert.assertTrue( ExpectedConditions.textToBePresentInElement(By.id("pageBean003Called"), "true").apply(driver)); }
From source file:org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc001.ViewConfigTestDrone.java
License:Apache License
@Test @RunAsClient// w ww . j a v a 2 s . c o m public void testNavigationActionMethod() throws MalformedURLException { driver.get(new URL(contextPath, "origin.xhtml").toString()); WebElement button = driver.findElement(By.id("destination:pb001ActionMethod")); button.click(); Assert.assertTrue(ExpectedConditions .textToBePresentInElement(By.id("indexPage"), "You arrived at index page").apply(driver)); }
From source file:org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc002.ViewConfigTestDrone.java
License:Apache License
@Test @RunAsClient//from ww w .j a v a2 s. c o m public void testNavigationActionWithoutError() throws MalformedURLException { driver.get(new URL(contextPath, "origin.xhtml").toString()); WebElement button = driver.findElement(By.id("destination:pb002ActionWithoutError")); button.click(); Assert.assertTrue(ExpectedConditions .textToBePresentInElement(By.id("overviewPage"), "You arrived at overview page").apply(driver)); // Was redirected ? Assert.assertTrue(driver.getCurrentUrl().contains("overview.xhtml")); }
From source file:org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc002.ViewConfigTestDrone.java
License:Apache License
@Test @RunAsClient/*from w w w .j a va2 s. co m*/ public void testNavigationActionWithError() throws MalformedURLException { driver.get(new URL(contextPath, "origin.xhtml").toString()); WebElement button = driver.findElement(By.id("destination:pb002ActionWithError")); button.click(); Assert.assertTrue(ExpectedConditions .textToBePresentInElement(By.id("customErrorPage"), "This is a custom error page").apply(driver)); }
From source file:org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc002.ViewConfigTestDrone.java
License:Apache License
@Test @RunAsClient/* w ww . j a v a 2s .c o m*/ public void testNavigationRestrictedToPages() throws MalformedURLException { driver.get(new URL(contextPath, "origin.xhtml").toString()); WebElement button = driver.findElement(By.id("destination:pb002RestrictedToPages")); button.click(); Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("homePage"), "You arrived at home page") .apply(driver)); // Was fowarded ? Assert.assertTrue(driver.getCurrentUrl().contains("origin.xhtml")); }
From source file:org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc003.ViewConfigTestDrone.java
License:Apache License
@Test @RunAsClient//from ww w . j av a 2s.com public void testNavigationActionMethod() throws MalformedURLException { driver.get(new URL(contextPath, "origin.xhtml").toString()); WebElement button = driver.findElement(By.id("destination:pb003ActionMethod")); button.click(); Assert.assertTrue(ExpectedConditions .textToBePresentInElement(By.id("indexPage"), "You arrived at index page").apply(driver)); }
From source file:org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc003.ViewConfigTestDrone.java
License:Apache License
@Test @RunAsClient//from www .j av a 2 s .c o m public void testNavigationActionMethod2() throws MalformedURLException { driver.get(new URL(contextPath, "origin.xhtml").toString()); WebElement button = driver.findElement(By.id("destination:pb003ActionMethod2")); button.click(); Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("homePage"), "You arrived at home page") .apply(driver)); }