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

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

Introduction

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

Prototype

public static ExpectedCondition<List<WebElement>> visibilityOfAllElementsLocatedBy(final By locator) 

Source Link

Document

An expectation for checking that all elements present on the web page that match the locator are visible.

Usage

From source file:org.wso2.es.ui.integration.test.store.ESStoreAnonCategorySortingTestCase.java

License:Open Source License

@Test(groups = "wso2.es.store", description = "Testing sorting on created time")
public void testStoreSortOnCreatedTime() throws Exception {
    driver.get(baseUrl + STORE_GADGET_LIST_PAGE);
    //sort by created time ( no need to click on hte link for sorting on created time since this is the default case )
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(
            By.cssSelector(".assets-container section div.ctrl-wr-asset:first-child a.ast-name")));
    assertEquals(assetName,//w  w  w. j a v  a  2 s  . com
            driver.findElement(
                    By.cssSelector(".assets-container section div.ctrl-wr-asset:first-child a.ast-name"))
                    .getText(),
            "Alphabetical Sort failed");

}

From source file:org.wso2.es.ui.integration.test.store.ESStoreAnonCategorySortingTestCase.java

License:Open Source License

@Test(groups = "wso2.es.store", description = "Testing category Google")
public void testCategoryGoogle() throws Exception {
    driver.get(baseUrl + STORE_GADGET_LIST_PAGE);
    //google category
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.id("advanced-search-btn")));
    driver.findElement(By.id("advanced-search-btn")).click();
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.id("search-button2")));
    driver.findElement(By.id("search-button2")).click();
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("div.ctrl-wr-asset")));
    assertTrue(isElementPresent(driver, By.cssSelector("div.ctrl-wr-asset")), "Google Category wrong");
}

From source file:org.wso2.es.ui.integration.test.store.ESStoreAnonCategorySortingTestCase.java

License:Open Source License

@Test(groups = "wso2.es.store", description = "Testing category WSO2")
public void testCategoryWSO2() throws Exception {
    driver.get(baseUrl + STORE_GADGET_LIST_PAGE);
    //google category
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.id("advanced-search-btn")));
    driver.findElement(By.id("advanced-search-btn")).click();
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.id("search-button2")));
    new Select(driver.findElement(By.id("overview_category"))).selectByVisibleText("WSO2");
    driver.findElement(By.id("search-button2")).click();
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("div.ctrl-wr-asset")));
    assertTrue(isElementPresent(driver, By.cssSelector("div.ctrl-wr-asset")), "WSO2 Category wrong");
}

From source file:org.wso2.es.ui.integration.test.store.ESStoreAnonCategorySortingTestCase.java

License:Open Source License

@Test(groups = "wso2.es.store", description = "Testing category template")
public void testCategoryTemplate() throws Exception {
    driver.get(baseUrl + STORE_GADGET_LIST_PAGE);
    //google category
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.id("advanced-search-btn")));
    driver.findElement(By.id("advanced-search-btn")).click();
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.id("search-button2")));
    new Select(driver.findElement(By.id("overview_category"))).selectByVisibleText("Templates");
    driver.findElement(By.id("search-button2")).click();
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("div.ctrl-wr-asset")));
    assertTrue(isElementPresent(driver, By.cssSelector("div.ctrl-wr-asset")), "WSO2 Category wrong");

}

From source file:org.wso2.es.ui.integration.test.store.ESStoreAnonTenantHomePageTestCase.java

License:Open Source License

@Override
@Test(groups = "wso2.es.store", description = "Test if the homepage loads when using /t/domain as anon user")
public void testAnonHomePage() throws Exception {
    //test appearance
    driver.get(resolveStoreUrl());//w  w  w  .  j  av a2 s  .  com
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector("span.btn-asset")));
    assertTrue(isElementPresent(driver, By.cssSelector(".app-logo")), "Home Page error: Logo missing");
    driver.findElement(By.cssSelector("span.btn-asset")).click();
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.linkText("Gadget")));
    assertTrue(isElementPresent(driver, By.linkText("Gadget")), "Home Page error: Gadget menu missing");
    assertTrue(isElementPresent(driver, By.linkText("Site")), "Home Page error: Site menu missing");

}

From source file:org.wso2.es.ui.integration.test.store.ESStoreAnonTenantHomePageTestCase.java

License:Open Source License

@Test(groups = "wso2.es.store", description = "Test if the asset listing page loads when using /t/domain as anon "
        + "user")
public void testAnonAssetListingPage() throws Exception {
    driver.get(baseUrl + STORE_GADGET_LIST_PAGE);
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector(".ctrl-wr-asset")));
    assertTrue(isElementPresent(driver, By.cssSelector(".app-logo")), "Home Page error: Logo missing");
    assertTrue(isElementPresent(driver, By.cssSelector(".ctrl-wr-asset")),
            "Home Page error: Gadgets list is not populated");

}

From source file:org.wso2.es.ui.integration.test.store.ESStoreBookmarkTestCase.java

License:Open Source License

@Test(groups = "wso2.es.store", description = "Test Bookmarking")
public void testESStoreBookmarkTestCase() throws Exception {

    driver.get(baseUrl + STORE_GADGET_LIST_PAGE);
    //get the first element from the gadget list
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(
            By.cssSelector(".assets-container section div.ctrl-wr-asset:first-child a.ast-name")));
    String bookmarkedAsset = driver
            .findElement(By.cssSelector(".assets-container section div.ctrl-wr-asset:first-child a.ast-name"))
            .getText();//from ww w.j  av a2 s  . c om
    driver.findElement(By.cssSelector(".assets-container section div.ctrl-wr-asset:first-child a.ast-name"))
            .click();

    //bookmark the asset
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.id("btn-add-gadget")));
    driver.findElement(By.id("btn-add-gadget")).click();

    wait.until(ExpectedConditions.textToBePresentInElementLocated(By.id("btn-add-gadget"), "Bookmarked"));
    assertEquals("Bookmarked", driver.findElement(By.id("btn-add-gadget")).getText(), "Bookmarking failed");

    //check if shown in My Items page
    /*
            wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("div.ast-title a.ast-name")));
            assertEquals(bookmarkedAsset, driver.findElement(By.cssSelector("div.ast-title a.ast-name")).getText(),
        "Bookmarked asset not shown in My Items page");
            wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(".bookmark-link")));
            driver.findElement(By.cssSelector(".bookmark-link")).click();
            */

}

From source file:org.wso2.es.ui.integration.util.AssetUtil.java

License:Open Source License

/**
 * Publish a new asset to store//from w  ww . j a va 2  s .c o m
 *
 * @param driver    WebDriver instance
 * @param assetName asset name
 */
public static void publishAssetToStore(WebDriver driver, String assetName) {
    WebDriverWait wait = new WebDriverWait(driver, MAX_POLL_COUNT);
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.id("LifeCycle")));
    driver.findElement(By.id("LifeCycle")).click();
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.id("lifecycle-comment")));
    driver.findElement(By.id("lifecycle-comment")).clear();
    driver.findElement(By.id("lifecycle-comment")).sendKeys("Promoting to review");
    driver.findElement(By.id("lcActionPromote")).click();
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector(".alert-success")));

    driver.findElement(By.id("lifecycle-comment")).clear();
    driver.findElement(By.id("lifecycle-comment")).sendKeys("Promoting to published");
    driver.findElement(By.id("lcActionPromote")).click();
    wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.cssSelector(".alert-success")));
}

From source file:org.wso2.es.ui.integration.util.ESUtil.java

License:Open Source License

/**
 * To login to store or publisher/*  w ww  .j  a v  a  2 s  . c  om*/
 *
 * @param driver   WebDriver instance
 * @param url      base url of the server
 * @param webApp   store or publisher
 * @param userName user name
 * @param pwd      password
 * @throws javax.xml.xpath.XPathExpressionException
 *
 */
public static void login(ESWebDriver driver, String url, String webApp, String userName, String pwd)
        throws InterruptedException, XPathExpressionException {
    String fullUrl = "";
    WebDriverWait wait = new WebDriverWait(driver, MAX_POLL_COUNT);

    if ("store".equalsIgnoreCase(webApp)) {
        fullUrl = url + STORE_SUFFIX;
        driver.get(fullUrl);
        wait.until(ExpectedConditions
                .visibilityOfElementLocated(By.cssSelector("ul.navbar-right li:first-child a")));
        driver.findElement(By.cssSelector("ul.navbar-right li:first-child a")).click();
    } else if ("publisher".equalsIgnoreCase(webApp)) {
        fullUrl = url + PUBLISHER_SUFFIX;
        driver.get(fullUrl);
    }
    driver.findElementPoll(By.id("username"), MAX_POLL_COUNT);
    driver.findElement(By.id("username")).clear();
    driver.findElement(By.id("username")).sendKeys(userName);
    driver.findElement(By.id("password")).clear();
    driver.findElement(By.id("password")).sendKeys(pwd);
    driver.findElement(By.xpath("//button[@type='submit']")).click();
    //driver.get(fullUrl);
    wait.until(ExpectedConditions
            .visibilityOfAllElementsLocatedBy(By.cssSelector(".wr-global-header h2.app-title")));
}

From source file:PageComponents.LeftNavigationPane.java

public void clickForTaxes() {
    WebDriverWait w = new WebDriverWait(driver, 10);
    List<WebElement> menuItems = w
            .until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.className("dynatree-title")));
    menuItems.get(5).click();/*w ww . j  a v  a  2 s . co  m*/
}