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

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

Introduction

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

Prototype

public static ExpectedCondition<Boolean> textToBePresentInElementLocated(final By locator, final String text) 

Source Link

Document

An expectation for checking if the given text is present in the element that matches the given locator.

Usage

From source file:org.keycloak.quickstart.ArquillianAngular2Test.java

License:Apache License

@Test
public void testAdminResource() {
    try {//from w w w .  j ava 2  s  . c  o  m
        indexPage.clickAdmin();
        assertTrue(Graphene.waitGui().withTimeout(60, TimeUnit.SECONDS)
                .until(ExpectedConditions.textToBePresentInElementLocated(By.id("message"), UNAUTHORIZED)));
    } catch (Exception e) {
        debugTest(e);
        fail("Should display an error message");
    }
}

From source file:org.keycloak.quickstart.ArquillianAngular2Test.java

License:Apache License

@Test
public void testPublicResource() {
    try {//from  w w  w  .  j  ava 2  s.  c o m
        indexPage.clickPublic();
        assertTrue(Graphene.waitGui().withTimeout(60, TimeUnit.SECONDS).until(
                ExpectedConditions.textToBePresentInElementLocated(By.id("message"), "Message: public")));
    } catch (Exception e) {
        debugTest(e);
        fail("Should display an error message");
    }
}

From source file:org.keycloak.quickstart.ArquillianAngular2Test.java

License:Apache License

@Test
public void testAdminWithAuthAndRole() throws MalformedURLException, InterruptedException {
    try {/* w ww .  j a va  2s. co m*/
        indexPage.clickLogin();
        loginPage.login("test-admin", "password");
        waitNg2Init();
        indexPage.clickAdmin();
        assertTrue(Graphene.waitGui().withTimeout(60, TimeUnit.SECONDS).until(
                ExpectedConditions.textToBePresentInElementLocated(By.className("message"), "Message: admin")));
        indexPage.clickLogout();
    } catch (Exception e) {
        debugTest(e);
        fail("Should display logged in user");
    }
}

From source file:org.keycloak.quickstart.ArquillianAngular2Test.java

License:Apache License

@Test
public void testUserWithAuthAndRole() throws MalformedURLException, InterruptedException {
    try {/*from  w w  w .  j a  v  a 2s  . c om*/
        indexPage.clickLogin();
        loginPage.login("alice", "password");
        waitNg2Init();
        indexPage.clickSecured();
        assertTrue(Graphene.waitGui().withTimeout(60, TimeUnit.SECONDS).until(
                ExpectedConditions.textToBePresentInElementLocated(By.id("message"), "Message: secured")));
        indexPage.clickLogout();
    } catch (Exception e) {
        debugTest(e);
        fail("Should display logged in user");
    }
}

From source file:org.keycloak.quickstart.ArquillianJeeHtml5Test.java

License:Apache License

@Test
public void testSecuredResource() throws InterruptedException {
    try {// w w w.  ja v  a  2s.  c  om
        indexPage.clickSecured();
        assertTrue(Graphene.waitGui().until(
                ExpectedConditions.textToBePresentInElementLocated(By.className("error"), UNAUTHORIZED)));
    } catch (Exception e) {
        debugTest(e);
        fail("Should display an error message");
    }
}

From source file:org.keycloak.quickstart.ArquillianJeeHtml5Test.java

License:Apache License

@Test
public void testAdminResource() {
    try {/*from www.j ava  2  s  .com*/
        indexPage.clickAdmin();
        assertTrue(Graphene.waitGui().until(
                ExpectedConditions.textToBePresentInElementLocated(By.className("error"), UNAUTHORIZED)));
    } catch (Exception e) {
        debugTest(e);
        fail("Should display an error message");
    }
}

From source file:org.keycloak.quickstart.ArquillianJeeHtml5Test.java

License:Apache License

@Test
public void testPublicResource() {
    try {//  w  ww.  ja  va  2 s  .co m
        indexPage.clickPublic();
        assertTrue(Graphene.waitGui().until(ExpectedConditions
                .textToBePresentInElementLocated(By.className("message"), "Message: public")));
    } catch (Exception e) {
        debugTest(e);
        fail("Should display an error message");
    }
}

From source file:org.keycloak.quickstart.ArquillianJeeHtml5Test.java

License:Apache License

@Test
public void testAdminWithAuthAndRole() throws MalformedURLException, InterruptedException {
    try {/* www. j  a  v a2 s  . co  m*/
        indexPage.clickLogin();
        loginPage.login("test-admin", "password");
        indexPage.clickAdmin();
        assertTrue(Graphene.waitGui().until(
                ExpectedConditions.textToBePresentInElementLocated(By.className("message"), "Message: admin")));
        indexPage.clickLogout();
    } catch (Exception e) {
        debugTest(e);
        fail("Should display logged in user");
    }
}

From source file:org.keycloak.quickstart.ArquillianJeeHtml5Test.java

License:Apache License

@Test
public void testUserWithAuthAndRole() throws MalformedURLException, InterruptedException {
    try {//from  w  ww  . j a v a 2s  .  com
        indexPage.clickLogin();
        loginPage.login("alice", "password");
        indexPage.clickSecured();
        assertTrue(Graphene.waitGui().until(ExpectedConditions
                .textToBePresentInElementLocated(By.className("message"), "Message: secured")));
        indexPage.clickLogout();
    } catch (Exception e) {
        //  indexPage.clickLogout();
        debugTest(e);
        fail("Should display logged in user");
    }
}

From source file:org.keycloak.quickstart.ArquillianJeeJspTest.java

License:Apache License

@Test
public void testUserWithAuthAndRole() throws MalformedURLException, InterruptedException {
    try {//from w w w.  j a v  a  2s. c o  m
        indexPage.clickLogin();
        loginPage.login("alice", "password");
        indexPage.clickSecured();
        assertTrue(Graphene.waitGui().until(ExpectedConditions
                .textToBePresentInElementLocated(By.className("message"), "Message: secured")));
        indexPage.clickLogout();
    } catch (Exception e) {
        debugTest(e);
        fail("Should display logged in user");
    }
}