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

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

Introduction

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

Prototype

public static ExpectedCondition<Boolean> titleContains(final String title) 

Source Link

Document

An expectation for checking that the title contains a case-sensitive substring

Usage

From source file:com.pentaho.ctools.cdf.OpenFlashChartComponent.java

License:Apache License

/**
 * ############################### Test Case 1 ###############################
 *
 * Test Case Name:/* w w  w  . j ava  2  s  .c  o  m*/
 *    Reload Sample
 * Description:
 *    Reload the sample (not refresh page).
 * Steps:
 *    1. Click in Code and then click in button 'Try me'.
 */
@Test
public void tc1_PageContent_DisplayTitle() {
    this.log.info("tc1_PageContent_DisplayTitle");

    // Wait for title become visible and with value 'Community Dashboard Framework'
    wait.until(ExpectedConditions.titleContains("Community Dashboard Framework"));
    // Wait for visibility of 'VisualizationAPIComponent'
    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]")));

    // Validate the sample that we are testing is the one
    assertEquals("Community Dashboard Framework", driver.getTitle());
    assertEquals("OpenFlashChartComponent", this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]")));
}

From source file:com.pentaho.ctools.cdf.PrptComponent.java

License:Apache License

/**
 * ############################### Test Case 1 ###############################
 *
 * Test Case Name://from   w  w w . j  a v  a 2  s .c  o  m
 *    Display Content
 * Description:
 *    Check if the contents present in page is the expected.
 * Steps:
 *    1. Check title web page and sample title.
 */
@Test
public void tc1_PageContent_DisplayTitle() {
    this.log.info("tc1_PageContent_DisplayTitle");
    // Wait for title become visible and with value 'Community Dashboard Framework'
    wait.until(ExpectedConditions.titleContains("Community Dashboard Framework"));
    // Wait for visibility of 'VisualizationAPIComponent'
    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]")));

    // Validate the sample that we are testing is the one
    assertEquals("Community Dashboard Framework", driver.getTitle());
    assertEquals("PrptComponent", this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]")));
}

From source file:com.pentaho.ctools.cdf.QueryComponent.java

License:Apache License

/**
 * ############################### Test Case 1 ###############################
 *
 * Test Case Name://from w w w. j a  va2  s  . co m
 *    Reload Sample
 * Description:
 *    Reload the sample (not refresh page).
 * Steps:
 *    1. Click in Code and then click in button 'Try me'.
 */
@Test
public void tc1_PageContent_DisplayTitle() {
    this.log.info("tc1_PageContent_DisplayTitle");

    // Wait for title become visible and with value 'Community Dashboard Framework'
    wait.until(ExpectedConditions.titleContains("Community Dashboard Framework"));
    // Wait for visibility of 'VisualizationAPIComponent'
    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]")));

    // Validate the sample that we are testing is the one
    assertEquals("Community Dashboard Framework", driver.getTitle());
    assertEquals("QueryComponent", this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]")));
}

From source file:com.pentaho.ctools.cdf.RadioComponent.java

License:Apache License

/**
 * ############################### Test Case 1 ###############################
 *
 * Test Case Name://from   w  w  w.ja v a2 s  . c  o  m
 *    Reload Sample
 * Description:
 *    Reload the sample (not refresh page).
 * Steps:
 *    1. Click in Code and then click in button 'Try me'.
 */
@Test
public void tc1_PageContent_DisplayTitle() {
    this.log.info("tc1_PageContent_DisplayTitle");

    // wait for title become visible and with value 'Community Dashboard Framework'
    wait.until(ExpectedConditions.titleContains("Community Dashboard Framework"));
    // wait for visibility of 'VisualizationAPIComponent'
    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]")));

    // Validate the sample that we are testing is the one
    assertEquals("Community Dashboard Framework", driver.getTitle());
    assertEquals("RadioComponent", this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]")));
}

From source file:com.pentaho.ctools.cdf.require.ExecutePrptComponent.java

License:Apache License

/**
 * ############################### Test Case 1 ###############################
 *
 * Test Case Name://from  w ww . j a  v  a  2s.c  o  m
 *    Display Content
 * Description:
 *    Check if the contents present in page is the expected.
 * Steps:
 *    1. Check title web page and sample title.
 */
@Test
public void tc1_PageContent_DisplayTitle() {
    this.log.info("tc1_PageContent_DisplayTitle");

    // Wait for title become visible and with value 'Community Dashboard Framework'
    wait.until(ExpectedConditions.titleContains("Community Dashboard Framework"));
    // Wait for visibility of 'VisualizationAPIComponent'
    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]")));

    // Validate the sample that we are testing is the one
    assertEquals("Community Dashboard Framework", driver.getTitle());
    assertEquals("ExecutePrptComponent", this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]")));
}

From source file:com.pentaho.ctools.cdf.require.ExecuteXactionComponent.java

License:Apache License

/**
 * ############################### Test Case 1 ###############################
 *
 * Test Case Name://from   w w w .  jav  a  2s . c  om
 *    Reload Sample
 * Description:
 *    Reload the sample (not refresh page).
 * Steps:
 *    1. Click in Code and then click in button 'Try me'.
 */
@Test
public void tc1_PageContent_DisplayTitle() {
    this.log.info("tc1_PageContent_DisplayTitle");

    // Wait for title become visible and with value 'Community Dashboard Framework'
    wait.until(ExpectedConditions.titleContains("Community Dashboard Framework"));
    // Wait for visibility of 'VisualizationAPIComponent'
    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]")));

    // Validate the sample that we are testing is the one
    assertEquals("Community Dashboard Framework", driver.getTitle());
    assertEquals("ExecuteXactionComponent", this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]")));
}

From source file:com.pentaho.ctools.cdf.require.JFreeChartComponent.java

License:Apache License

/**
 * ############################### Test Case 1 ###############################
 *
 * Test Case Name:// w w w. j ava  2  s.c  om
 *    Check Page Content
 * Description:
 *    Validate the page content.
 * Steps:
 *    1. Check for web page title and sample title.
 */
@Test
public void tc1_PageContent_DisplayTitle() {
    this.log.info("tc1_PageContent_DisplayTitle");

    // Wait for title become visible and with value 'Community Dashboard Framework'
    wait.until(ExpectedConditions.titleContains("Community Dashboard Framework"));
    // Wait for visibility of 'VisualizationAPIComponent'
    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]")));

    // Validate the sample that we are testing is the one
    assertEquals("Community Dashboard Framework", driver.getTitle());
    assertEquals("jFreeChartComponent", this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]")));
}

From source file:com.pentaho.ctools.cdf.require.MetaLayerHomeDashboard.java

License:Apache License

/**
 * ############################### Test Case 1 ###############################
 *
 * Test Case Name:// ww w. j  ava  2s  .co m
 *    MetaLayer Home Dashboard - clicking details
 * Description:
 *    We pretend to validate when user click on 'Details...' a pop-up message
 *    is displayed.
 * Steps:
 *    1. Open the MetaLayer Home Dashboard.
 *    2. Click in 'Details...'.
 *    3. Check if we have width = 500 and height = 600
 */
@Test
public void tc1_LinkDetails_PopupJPivot() {
    this.log.info("tc1_LinkDetails_PopupJPivot");

    /*
     * ## Step 1
     */
    driver.get(baseUrl
            + "api/repos/%3Apublic%3Aplugin-samples%3Apentaho-cdf%3Apentaho-cdf-require%3A20-samples%3Ahome_dashboard_2%3Ahome_dashboard_metalayer.xcdf/generatedContent");

    //NOTE - we have to wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));

    //Wait for title become visible and with value 'Community Dashboard Framework'
    wait.until(ExpectedConditions.titleContains("Community Dashboard Framework"));
    //Wait for visibility of 'Top Ten Customers'
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@id='titleObject']")));
    // Validate the sample that we are testing is the one
    assertEquals("Community Dashboard Framework", driver.getTitle());
    assertEquals("Top Ten Customers",
            this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//div[@id='titleObject']")));

    /*
     * ## Step 2
     */
    //Wait for visibility of 'topTenCustomersDetailsObject' the text 'Details'
    WebElement linkDetails = this.elemHelper.FindElement(driver, By.linkText("Details..."));
    assertEquals("Details...", linkDetails.getText());
    //click on the 'Details...'
    linkDetails.click();

    /*
     * ## Step 3
     */
    //Wait for the frame
    this.elemHelper.WaitForElementPresenceAndVisible(driver, By.id("fancybox-content"));
    this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//iframe"));
    WebElement frame = this.elemHelper.FindElement(driver, By.xpath("//iframe"));
    String valueFrameAttrSrc = frame.getAttribute("src");

    //Check if we have the sizes 500 and 600
    assertTrue(StringUtils.containsIgnoreCase(valueFrameAttrSrc, "&width=500&height=600"));

    //NOTE - we have to wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));

    //Wait for the element be visible.
    WebDriver driverFrame = driver.switchTo().frame(frame);
    assertNotNull(this.elemHelper.FindElement(driverFrame, By.xpath("//div[@id='internal_content']")));
    assertEquals("Measures", this.elemHelper.WaitForElementPresentGetText(driverFrame,
            By.xpath("//div[@id='internal_content']/table/tbody/tr[2]/td[2]/p/table/tbody/tr/th[2]")));
    assertEquals("Australian Collectors, Co.", this.elemHelper.WaitForElementPresentGetText(driverFrame, By
            .xpath("//div[@id='internal_content']/table[1]/tbody/tr[2]/td[2]/p[1]/table/tbody/tr[5]/th/div")));
    assertEquals("180,125", this.elemHelper.WaitForElementPresentGetText(driverFrame,
            By.xpath("//div[@id='internal_content']/table[1]/tbody/tr[2]/td[2]/p[1]/table/tbody/tr[7]/td")));

    //Close pop-up
    driver.switchTo().defaultContent();
    wait.until(ExpectedConditions.elementToBeClickable(By.id("fancybox-close")));
    String background = this.elemHelper.FindElement(driver, By.cssSelector("#fancybox-close"))
            .getCssValue("background-image");
    String background1 = background.substring(background.indexOf(34) + 1, background.lastIndexOf(34));
    assertEquals(baseUrl + "plugin/pentaho-cdf/api/resources/js/compressed/lib/fancybox/fancybox.png",
            background1);
    this.elemHelper.ClickJS(driver, By.id("fancybox-close"));
    this.elemHelper.WaitForElementInvisibility(driver, By.id("fancybox-content"));
    assertEquals("200", Integer.toString(HttpUtils.GetResponseCode(background1, "admin", "password")));
}

From source file:com.pentaho.ctools.cdf.require.MonthPickerComponent.java

License:Apache License

/**
 * ############################### Test Case 1 ###############################
 *
 * Test Case Name:/*w w  w. j  av  a  2 s  . c o  m*/
 *    Reload Sample
 * Description:
 *    Reload the sample (not refresh page).
 * Steps:
 *    1. Click in Code and then click in button 'Try me'.
 */
@Test
public void tc1_PageContent_DisplayTitle() {
    this.log.info("tc1_PageContent_DisplayTitle");

    // Wait for title become visible and with value 'Community Dashboard Framework'
    wait.until(ExpectedConditions.titleContains("Community Dashboard Framework"));
    // Wait for visibility of 'VisualizationAPIComponent'
    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]")));

    // Validate the sample that we are testing is the one
    assertEquals("Community Dashboard Framework", driver.getTitle());
    assertEquals("MonthPickerComponent", this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]")));
}

From source file:com.pentaho.ctools.cdf.require.MultiButtonComponent.java

License:Apache License

/**
 * ############################### Test Case 2 ###############################
 *
 * Test Case Name://from   w w  w .j av a 2  s.c  om
 *    Reload Sample
 * Description:
 *    Reload the sample (not refresh page).
 * Steps:
 *    1. Click in Code and then click in button 'Try me'.
 */
@Test
public void tc1_PageContent_DisplayTitle() {
    this.log.info("tc1_PageContent_DisplayTitle");

    // Wait for title become visible and with value 'Community Dashboard Framework'
    wait.until(ExpectedConditions.titleContains("Community Dashboard Framework"));
    // Wait for visibility of 'VisualizationAPIComponent'
    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]")));

    // Validate the sample that we are testing is the one
    assertEquals("Community Dashboard Framework", driver.getTitle());
    assertEquals("MultiButtonComponent", this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='dashboardContent']/div/div/div/h2/span[2]")));
}