Example usage for org.openqa.selenium.support.ui ExpectedConditions textToBePresentInElement

List of usage examples for org.openqa.selenium.support.ui ExpectedConditions textToBePresentInElement

Introduction

In this page you can find the example usage for org.openqa.selenium.support.ui ExpectedConditions textToBePresentInElement.

Prototype

public static ExpectedCondition<Boolean> textToBePresentInElement(final WebElement element, final String text) 

Source Link

Document

An expectation for checking if the given text is present in the specified element.

Usage

From source file:org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc004.ViewConfigTestDrone.java

License:Apache License

@Test
@RunAsClient/*from   www . j  a va  2s. c  o  m*/
public void testNavigationActionMethod() throws MalformedURLException {
    driver.get(new URL(contextPath, "origin.xhtml").toString());

    WebElement button = driver.findElement(By.id("destination:pb004ActionMethod"));
    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.uc004.ViewConfigTestDrone.java

License:Apache License

@Test
@RunAsClient/*  w w w  . jav a2  s . c  om*/
public void testNavigationActionMethod2() throws MalformedURLException {
    driver.get(new URL(contextPath, "origin.xhtml").toString());

    WebElement button = driver.findElement(By.id("destination:pb004ActionMethod2"));
    button.click();
    Assert.assertTrue(ExpectedConditions
            .textToBePresentInElement(By.id("overviewPage"), "You arrived at overview page").apply(driver));
}

From source file:org.apache.deltaspike.test.jsf.impl.config.view.navigation.destination.uc006.ViewConfigTestDrone.java

License:Apache License

@Test
@RunAsClient// w  w  w . ja  va2  s. c om
public void testNavigationActionMethod() throws MalformedURLException {
    driver.get(new URL(contextPath, "origin.xhtml").toString());

    WebElement button = driver.findElement(By.id("destination:pb006ActionMethod"));
    button.click();
    Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("step1"), "You arrived at step1 page")
            .apply(driver));
}

From source file:org.apache.deltaspike.test.jsf.impl.config.view.navigation.event.uc001.PreViewConfigNavigateEventTest.java

License:Apache License

@Test
@RunAsClient/*from   w w w  .j  av  a 2  s . co  m*/
public void testNavigationActionWithError() throws MalformedURLException {
    driver.get(new URL(contextPath, "origin.xhtml").toString());

    WebElement button = driver.findElement(By.id("event:pb002ActionWithError"));
    button.click();
    // Index Page is shown instead of DefaultErrorView because PreViewConfigNavigateEvent changed the navigation
    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.parameter.uc003.NavigationParameterTest.java

License:Apache License

@Test
@RunAsClient/*w  ww .j  a v  a2 s.  c  o  m*/
public void testNavigationActionWithParameter() throws MalformedURLException {
    driver.get(new URL(contextPath, "origin.xhtml").toString());
    WebElement button = driver.findElement(By.id("parameter:pb003ActionMethod"));
    button.click();

    Assert.assertTrue(ExpectedConditions
            .textToBePresentInElement(By.id("simplePageConfig"), "You arrived at simplePageConfig page")
            .apply(driver));
    System.out.println(driver.getCurrentUrl());
    Assert.assertTrue(driver.getCurrentUrl().contains("param1=0"));
}

From source file:org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc004.NavigationParameterTest.java

License:Apache License

@Test
@RunAsClient// w w w .j  a va  2  s .  co  m
public void testNavigationActionWithParameter() throws MalformedURLException {
    //first click
    driver.get(new URL(contextPath, "origin.xhtml").toString());
    WebElement button = driver.findElement(By.id("parameter:pb004ActionMethod"));
    button.click();

    //second click
    driver.get(new URL(contextPath, "origin.xhtml").toString());
    button = driver.findElement(By.id("parameter:pb004ActionMethod"));
    button.click();

    Assert.assertTrue(ExpectedConditions
            .textToBePresentInElement(By.id("simplePageConfig"), "You arrived at simplePageConfig page")
            .apply(driver));
    Assert.assertTrue(driver.getCurrentUrl().contains("cv="));
}

From source file:org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc005.NavigationParameterTest.java

License:Apache License

@Test
@RunAsClient//from   w w  w  . ja  v  a2 s . co m
public void testNavigationActionOverview() throws MalformedURLException {
    driver.get(new URL(contextPath, "origin.xhtml").toString());

    WebElement button = driver.findElement(By.id("parameter:pb005Overview"));
    button.click();
    Assert.assertTrue(ExpectedConditions
            .textToBePresentInElement(By.id("overviewPage"), "You arrived at overview page").apply(driver));
    System.out.println(driver.getCurrentUrl());
    Assert.assertTrue(driver.getCurrentUrl().contains("param1=staticValue2"));
    Assert.assertTrue(driver.getCurrentUrl().contains("param2=aValue"));
}

From source file:org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc005.NavigationParameterTest.java

License:Apache License

@Test
@RunAsClient/*w w w  .ja  v  a 2 s  . c o m*/
public void testNavigationActionIndex() throws MalformedURLException {
    driver.get(new URL(contextPath, "origin.xhtml").toString());

    WebElement button = driver.findElement(By.id("parameter:pb005Index"));
    button.click();
    Assert.assertTrue(ExpectedConditions
            .textToBePresentInElement(By.id("indexPage"), "You arrived at index page").apply(driver));
    System.out.println(driver.getCurrentUrl());
    Assert.assertTrue(driver.getCurrentUrl().contains("param1=staticValue2"));
}

From source file:org.apache.deltaspike.test.jsf.impl.config.view.navigation.parameter.uc006.NavigationParameterTest.java

License:Apache License

@Test
@RunAsClient//from ww  w  .  ja  v  a2s  .co m
public void testNavigationActionWithParameter() throws MalformedURLException {
    driver.get(new URL(contextPath, "origin.xhtml").toString());

    WebElement button = driver.findElement(By.id("parameter:pb006AnyMethod"));
    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.injection.uc001.InjectionDroneTest.java

License:Apache License

@Test
@RunAsClient//from   w  w w  .j a va 2 s.  c om
public void testConverter() throws MalformedURLException {
    driver.get(new URL(contextPath, "testValidatorConverter.xhtml").toString());
    WebElement convertedValue = driver.findElement(By.id("converter:convertedValue"));
    convertedValue.sendKeys("123");
    WebElement testConveterButton = driver.findElement(By.id("converter:testConveterButton"));
    testConveterButton.click();
    Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("messages"), "Worked").apply(driver));
}