Example usage for org.openqa.selenium.interactions Actions perform

List of usage examples for org.openqa.selenium.interactions Actions perform

Introduction

In this page you can find the example usage for org.openqa.selenium.interactions Actions perform.

Prototype

public void perform() 

Source Link

Document

A convenience method for performing the actions without calling build() first.

Usage

From source file:com.pentaho.ctools.cde.reference.BulletChartTestCase.java

License:Apache License

/**
 * ############################### Test Case 1 ###############################
 *
 * Test Case Name:/*from   w w  w . j a v  a2  s . c o m*/
 *    PageContent
 * Description:
 *    The test case pretends validate charts presented.
 * Steps:
 *    1. Check chart 1 - No data sent
 *    2. Check chart 2 - Returning one value only (65)
 *    3. Check chart 3 - Returning name and value
 *    4. Check chart 4 - Title, value and marker
 *    5. Check chart 5 - Complete dataset
 */
@Test
public void tc01_ChartContent_DisplayedCorrect() {
    this.log.info("tc01_ChartContent_DisplayedCorrect");

    /*
     * ## Step 0
     */
    //Check page title
    wait.until(ExpectedConditions.titleIs("Bullet chart testcase"));
    assertEquals("Bullet chart testcase", driver.getTitle());
    //Check title
    String title = this.elemHelper.WaitForElementPresentGetText(driver, By.cssSelector("#title > span"));
    assertEquals("Bullet chart test case", title);

    /*
     * ## Step 1
     */
    //Chart 1
    //Check title
    String subtitle1 = this.elemHelper.WaitForElementPresentGetText(driver,
            By.cssSelector("#subtitle1 > span"));
    assertEquals("No data sent", subtitle1);
    //Check serie title and subtitle
    String cht1Title1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj1']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][6]/*[local-name()='text']"));
    assertEquals("Title", cht1Title1);
    String cht1Subtitle1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj1']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][7]/*[local-name()='text']"));
    assertEquals("No data", cht1Subtitle1);
    //Check chart
    WebElement cht1SizeBar = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj1']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='rect']"));
    assertNotNull(cht1SizeBar);
    assertEquals("202.11111111111111", cht1SizeBar.getAttribute("width"));
    WebElement cht1RectWhite1 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj1']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='path'][1]"));
    WebElement cht1RectWhite2 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj1']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='path'][2]"));
    assertNotNull(cht1RectWhite1);
    assertNotNull(cht1RectWhite2);
    assertEquals("translate(78.46666666666665,15) ", cht1RectWhite1.getAttribute("transform"));
    assertEquals("translate(156.9333333333333,15) ", cht1RectWhite2.getAttribute("transform"));

    /*
     * ## Step 2
     */
    //Chart 2
    //Check title
    String subtitle2 = this.elemHelper.WaitForElementPresentGetText(driver, By.id("subtitle2"));
    assertEquals("Returning one value only (65)", subtitle2);
    //Check serie title and subtitle
    String cht2Title1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj2']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][6]/*[local-name()='text']"));
    assertEquals("Value only", cht2Title1);
    String cht2Subtitle1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj2']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][7]/*[local-name()='text']"));
    assertEquals("value is 65", cht2Subtitle1);
    //Check chart
    WebElement cht2SizeBar = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj2']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='rect']"));
    assertNotNull(cht2SizeBar);
    assertEquals("154.55555555555554", cht2SizeBar.getAttribute("width"));
    WebElement cht2RectWhite1 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj2']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='path'][1]"));
    assertNotNull(cht2RectWhite1);
    assertEquals("translate(71.33333333333333,12.5) ", cht2RectWhite1.getAttribute("transform"));

    /*
     * ## Step 3
     */
    //>Chart 3
    //>>Chart 31
    //Check title
    String subtitle3 = this.elemHelper.WaitForElementPresentGetText(driver, By.id("subtitle3"));
    assertEquals("Returning name and value", subtitle3);
    //Check series title and subtitle
    String cht31Title1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][6]/*[local-name()='text']"));
    assertEquals("Atelier graphique", cht31Title1);
    String cht31Subtitle1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][7]/*[local-name()='text']"));
    assertEquals("Customer", cht31Subtitle1);
    //Check chart
    WebElement cht31SizeBar = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='rect']"));
    assertNotNull(cht31SizeBar);
    assertEquals("178.26666666666668", cht31SizeBar.getAttribute("width"));
    WebElement cht31RectWhite1 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='path'][1]"));
    assertNotNull(cht31RectWhite1);
    assertEquals("translate(509.3333333333333,10) ", cht31RectWhite1.getAttribute("transform"));
    //>>Chart 32
    //Check series title and subtitle
    String cht32Title1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][6]/*[local-name()='text']"));
    assertEquals("Signal Gift Stores", cht32Title1);
    String cht32Subtitle1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][7]/*[local-name()='text']"));
    assertEquals("Customer", cht32Subtitle1);
    //Check chart
    WebElement cht32SizeBar = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][2]/*[local-name()='rect']"));
    assertNotNull(cht32SizeBar);
    assertEquals("609.5022222222223", cht32SizeBar.getAttribute("width"));
    WebElement cht32RectWhite1 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][3]/*[local-name()='path'][1]"));
    assertNotNull(cht32RectWhite1);
    assertEquals("translate(509.3333333333333,10) ", cht32RectWhite1.getAttribute("transform"));
    //>>Chart 33
    //Check series title and subtitle
    String cht33Title1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g'][6]/*[local-name()='text']"));
    assertEquals("Australian Collectors, Co.", cht33Title1);
    String cht33Subtitle1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g'][7]/*[local-name()='text']"));
    assertEquals("Customer", cht33Subtitle1);
    //Check chart
    WebElement cht33SizeBar = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g'][2]/*[local-name()='rect']"));
    assertNotNull(cht33SizeBar);
    assertEquals("764", cht33SizeBar.getAttribute("width"));
    WebElement cht33RectWhite1 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g'][3]/*[local-name()='path'][1]"));
    assertNotNull(cht33RectWhite1);
    assertEquals("translate(390.79283887468034,10) ", cht33RectWhite1.getAttribute("transform"));
    //>>Chart 34
    String cht34Title1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][4]/*[local-name()='g'][6]/*[local-name()='text']"));
    assertEquals("La Rochelle Gifts", cht34Title1);
    String cht34Subtitle1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][4]/*[local-name()='g'][7]/*[local-name()='text']"));
    assertEquals("Customer", cht34Subtitle1);
    //Check chart
    WebElement cht34SizeBar = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][4]/*[local-name()='g'][2]/*[local-name()='rect']"));
    assertNotNull(cht34SizeBar);
    assertEquals("764", cht34SizeBar.getAttribute("width"));
    WebElement cht34RectWhite1 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][4]/*[local-name()='g'][3]/*[local-name()='path'][1]"));
    assertNotNull(cht34RectWhite1);
    assertEquals("translate(387.8172588832487,10) ", cht34RectWhite1.getAttribute("transform"));
    //>>Chart 35
    String cht35Title1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][5]/*[local-name()='g'][6]/*[local-name()='text']"));
    assertEquals("Baane Mini Imports", cht35Title1);
    String cht35Subtitle1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][5]/*[local-name()='g'][7]/*[local-name()='text']"));
    assertEquals("Customer", cht35Subtitle1);
    //Check chart
    WebElement cht35SizeBar = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][5]/*[local-name()='g'][2]/*[local-name()='rect']"));
    assertNotNull(cht35SizeBar);
    assertEquals("693.5422222222222", cht35SizeBar.getAttribute("width"));
    WebElement cht35RectWhite1 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][5]/*[local-name()='g'][3]/*[local-name()='path'][1]"));
    assertNotNull(cht35RectWhite1);
    assertEquals("translate(509.3333333333333,10) ", cht35RectWhite1.getAttribute("transform"));
    //>>Chart 36
    String cht36Title1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][6]/*[local-name()='g'][6]/*[local-name()='text']"));
    assertEquals("Mini Gifts Distributors Ltd.", cht36Title1);
    String cht36Subtitle1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][6]/*[local-name()='g'][7]/*[local-name()='text']"));
    assertEquals("Customer", cht36Subtitle1);
    //Check chart
    WebElement cht36SizeBar = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][6]/*[local-name()='g'][2]/*[local-name()='rect']"));
    assertNotNull(cht36SizeBar);
    assertEquals("764", cht36SizeBar.getAttribute("width"));
    WebElement cht36RectWhite1 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][6]/*[local-name()='g'][3]/*[local-name()='path'][1]"));
    assertNotNull(cht36RectWhite1);
    assertEquals("translate(217.76722090261282,10) ", cht36RectWhite1.getAttribute("transform"));
    //>>Chart 37
    String cht37Title1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][7]/*[local-name()='g'][6]/*[local-name()='text']"));
    assertEquals("Havel & Zbyszek Co", cht37Title1);
    String cht37Subtitle1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][7]/*[local-name()='g'][7]/*[local-name()='text']"));
    assertEquals("Customer", cht37Subtitle1);
    //Check chart
    WebElement cht37SizeBar = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][7]/*[local-name()='g'][2]/*[local-name()='rect']"),
            1);
    assertNull(cht37SizeBar);
    WebElement cht37RectWhite1 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][7]/*[local-name()='g'][3]/*[local-name()='path'][1]"));
    assertNotNull(cht37RectWhite1);
    assertEquals("translate(509.3333333333333,10) ", cht37RectWhite1.getAttribute("transform"));
    //>>Chart 38
    String cht38Title1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][8]/*[local-name()='g'][6]/*[local-name()='text']"));
    assertEquals("Blauer See Auto, Co.", cht38Title1);
    String cht38Subtitle1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][8]/*[local-name()='g'][7]/*[local-name()='text']"));
    assertEquals("Customer", cht38Subtitle1);
    //Check chart
    WebElement cht38SizeBar = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][8]/*[local-name()='g'][2]/*[local-name()='rect']"));
    assertNotNull(cht38SizeBar);
    assertEquals("506.7866666666667", cht38SizeBar.getAttribute("width"));
    WebElement cht38RectWhite1 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj3']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][8]/*[local-name()='g'][3]/*[local-name()='path'][1]"));
    assertNotNull(cht38RectWhite1);
    assertEquals("translate(509.3333333333333,10) ", cht38RectWhite1.getAttribute("transform"));

    /*
     * ## Step 4
     */
    Actions acts = new Actions(driver);
    acts.moveToElement(this.elemHelper.FindElement(driver, By.cssSelector("div.webdetailsFooterWebdetails")));
    acts.perform();
    //Chart 4
    //Check title
    String subtitle4 = this.elemHelper.WaitForElementPresentGetText(driver, By.id("subtitle4"));
    assertEquals("Title, value and marker", subtitle4);
    //Check serie title and subtitle
    String cht4Title1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj4']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][6]/*[local-name()='text']"));
    assertEquals("Atelier graphique", cht4Title1);
    String cht4Subtitle1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj4']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][7]/*[local-name()='text']"));
    assertEquals("Subtitle", cht4Subtitle1);
    //Check chart
    WebElement cht4SizeBar = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj4']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='rect']"));
    assertNotNull(cht4SizeBar);
    WebElement cht4RectWhite1 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj4']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='path'][1]"));
    assertNotNull(cht4RectWhite1);

    /*
     * ## Step 5
     */
    //Chart 5
    //Check title
    String subtitle5 = this.elemHelper.WaitForElementPresentGetText(driver, By.id("subtitle5"));
    assertEquals("Complete dataset", subtitle5);
    //Check serie title and subtitle
    String cht5Title1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj5']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][6]/*[local-name()='text']"));
    assertEquals("Atelier graphique", cht5Title1);
    String cht5Subtitle1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='obj5']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][7]/*[local-name()='text']"));
    assertEquals("Carine Schmitt", cht5Subtitle1);
    //Check chart
    WebElement cht5SizeBar = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj5']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='rect']"));
    assertNotNull(cht5SizeBar);
    WebElement cht5RectWhite1 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='obj5']/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='path'][1]"));
    assertNotNull(cht5RectWhite1);
}

From source file:com.pentaho.ctools.cde.reference.CCCV2ShowCase.java

License:Apache License

/**
 * ############################### Test Case 1 ###############################
 *
 * Test Case Name:/*from w ww  . j av a  2  s .c  o  m*/
 *    BarChart
 * Description:
 *    The test case pretends validate the bar chart information.
 * Steps:
 *    1. Check Bar Chart
 */
@Test
public void tc01_ChartContent_DisplayedCorrect() {
    this.log.info("tc1_ChartContent_DisplayedCorrect");

    /*
     * ## Step 1 - Bar Chart
     */
    String barChartTitle = this.elemHelper.WaitForElementPresentGetText(driver, By.id("BarChartTitleRow"));
    assertEquals("Bar Chart", barChartTitle);
    // Check bars
    this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='BarChartBodyRow']/div/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='rect'][2]"));
    WebElement barChartRect1 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='BarChartBodyRow']/div/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='rect'][1]"));
    WebElement barChartRect2 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='BarChartBodyRow']/div/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='rect'][2]"));
    WebElement barChartRect3 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='BarChartBodyRow']/div/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='rect'][3]"));
    assertNotNull(barChartRect1);
    assertNotNull(barChartRect2);
    assertNotNull(barChartRect3);
    Double barChartRect1Width = Double.parseDouble(barChartRect1.getAttribute("width"));
    Double barChartRect2Width = Double.parseDouble(barChartRect2.getAttribute("width"));
    Double barChartRect3Width = Double.parseDouble(barChartRect3.getAttribute("width"));
    assertThat("Current width: " + barChartRect1Width, barChartRect1Width, greaterThan(Double.valueOf(192)));
    assertThat("Current width: " + barChartRect2Width, barChartRect2Width, greaterThan(Double.valueOf(250)));
    assertThat("Current width: " + barChartRect3Width, barChartRect3Width, greaterThan(Double.valueOf(100)));
    // Check bars value
    String barChartRectValue1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='BarChartBodyRow']/div/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='text'][1]"));
    String barChartRectValue2 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='BarChartBodyRow']/div/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='text'][2]"));
    String barChartRectValue3 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='BarChartBodyRow']/div/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='text'][3]"));
    assertEquals("3.68M", barChartRectValue1);
    assertEquals("4.99M", barChartRectValue2);
    assertEquals("1.98M", barChartRectValue3);

    // Mouse hover elements
    Actions acts = new Actions(driver);
    acts.moveToElement(barChartRect2);
    acts.perform();
    String seriesLabel = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-s']/div[2]/div/table/tbody/tr[1]/td[1]/span"));
    acts.perform();
    String seriesValue = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-s']/div[2]/div/table/tbody/tr[1]/td[3]/span"));
    acts.perform();
    String timeLabel = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-s']/div[2]/div/table/tbody/tr[2]/td[1]/span"));
    acts.perform();
    String timeValue = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-s']/div[2]/div/table/tbody/tr[2]/td[3]/span"));
    acts.perform();
    String valueLabel = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-s']/div[2]/div/table/tbody/tr[3]/td[1]/span"));
    acts.perform();
    String valueValue = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-s']/div[2]/div/table/tbody/tr[3]/td[3]/span"));
    assertEquals("Series", seriesLabel);
    assertEquals("Sales", seriesValue);
    assertEquals("Time", timeLabel);
    assertEquals("2004", timeValue);
    assertEquals("Value", valueLabel);
    assertEquals("4,987,739.84", valueValue);

    //To move the focus to another element, in order to remove the tooltip
    Actions acts2 = new Actions(driver);
    acts2.moveToElement(this.elemHelper.FindElement(driver, By.id("BarChartTitleRow")));
    acts2.click();
    acts2.perform();
}

From source file:com.pentaho.ctools.cde.reference.CCCV2ShowCase.java

License:Apache License

/**
 * ############################### Test Case 2 ###############################
 *
 * Test Case Name://from ww  w.  ja va2 s.com
 *    LineChart
 * Description:
 *    The test case pretends validate the line chart information.
 * Steps:
 *    1. Check Line Chart
 */
@Test
public void tc02_ChartContent_DisplayedCorrect() {
    this.log.info("tc02_ChartContent_DisplayedCorrect");

    /*
     * ## Step 2 - Line Chart
     */
    String lineChartTitle = this.elemHelper.WaitForElementPresentGetText(driver, By.id("LineChartTitleRow"));
    assertEquals("Line Chart", lineChartTitle);
    // Check lines
    WebElement lineChartCircle1 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='LineChartBodyRow']/div/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='circle'][1]"));
    WebElement lineChartCircle2 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='LineChartBodyRow']/div/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='circle'][7]"));
    WebElement lineChartCircle3 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='LineChartBodyRow']/div/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='circle'][11]"));
    Double lineChartCircle1Cy = Double.parseDouble(lineChartCircle1.getAttribute("cy"));
    Double lineChartCircle2Cy = Double.parseDouble(lineChartCircle2.getAttribute("cy"));
    Double lineChartCircle3Cy = Double.parseDouble(lineChartCircle3.getAttribute("cy"));
    assertThat("Current cy: " + lineChartCircle1Cy, lineChartCircle1Cy, greaterThan(Double.valueOf(120)));
    assertThat("Current cy: " + lineChartCircle2Cy, lineChartCircle2Cy, greaterThan(Double.valueOf(136)));
    assertThat("Current cy: " + lineChartCircle3Cy, lineChartCircle3Cy, greaterThan(Double.valueOf(24)));

    // Mouse hover elements
    WebElement lineChartCircle4 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='LineChartBodyRow']/div/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='circle'][2]"));
    Actions acts = new Actions(driver);
    acts.moveToElement(lineChartCircle4);
    acts.perform();
    String measuresLabel = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-s']/div[2]/div/table/tbody/tr[1]/td[1]/span"));
    acts.perform();
    String measuresValue = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-s']/div[2]/div/table/tbody/tr[1]/td[3]/span"));
    acts.perform();
    String categoryLabel = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-s']/div[2]/div/table/tbody/tr[2]/td[1]/span"));
    acts.perform();
    String categoryValue = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-s']/div[2]/div/table/tbody/tr[2]/td[3]/span"));
    acts.perform();
    String valueLineValue = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-s']/div[2]/div/table/tbody/tr[4]/td[3]/span"));
    assertEquals("Measures", measuresLabel);
    assertEquals("Quantity", measuresValue);
    assertEquals("Category", categoryLabel);
    assertEquals("Feb", categoryValue);
    assertEquals("7,959", valueLineValue);

    //To move the focus to another element, in order to remove the tooltip
    Actions acts2 = new Actions(driver);
    acts2.moveToElement(this.elemHelper.FindElement(driver, By.id("LineChartTitleRow")));
    acts2.click();
    acts2.perform();
}

From source file:com.pentaho.ctools.cde.reference.MapComponentFullTest.java

License:Apache License

/**
 * ############################### Test Case 2 ###############################
 *
 * Test Case Name:/*  w  ww. j  a va  2 s .co  m*/
 *    Full Map with CGG Markers and PopupWindows
 * Description:
 *    In this test case we pretend to check if the markers and popups windows
 *    are displayed.
 * Steps:
 *    1. Check the data exist
 *    2. Chick in each marker
 *    3. Check tooltip
 *    4. Check disabling series in pie chart
 */
@Test
public void tc2_MapCGGMarkersAndPopupWindows_MarkersAndPopupsDisplayed() {
    this.log.info("tc2_MapCGGMarkersAndPopupWindows_MarkersAndPopupsDisplayed");

    /*
     * ## Step 1
     */
    WebElement marker1 = this.elemHelper.FindElement(driver, By.xpath("//*[local-name()='image'][1]"));
    WebElement marker2 = this.elemHelper.FindElement(driver, By.xpath("//*[local-name()='image'][2]"));
    WebElement marker3 = this.elemHelper.FindElement(driver, By.xpath("//*[local-name()='image'][3]"));
    WebElement marker4 = this.elemHelper.FindElement(driver, By.xpath("//*[local-name()='image'][4]"));
    WebElement marker5 = this.elemHelper.FindElement(driver, By.xpath("//*[local-name()='image'][5]"));
    WebElement marker6 = this.elemHelper.FindElement(driver, By.xpath("//*[local-name()='image'][6]"));
    WebElement marker7 = this.elemHelper.FindElement(driver, By.xpath("//*[local-name()='image'][7]"));
    assertNotNull(marker1);
    assertNotNull(marker2);
    assertNotNull(marker3);
    assertNotNull(marker4);
    assertNotNull(marker5);
    assertNotNull(marker6);
    assertNotNull(marker7);

    /*
     *
     * THE BELOW CODE HAVE TO BE MODIFIED TO PASS ON AUTOMATION MACHINE
     * THAT NIGHTLY RUNS THE TESTS.
     *
     */

    /*
     * ## Step 2
     */
    // Zoom in - in order for the elements to be visible
    this.elemHelper.FindElement(driver, By.xpath("//div[@id='testWithGeoLocalization']/div/div[5]/div[3]"))
            .click();
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    Actions acts2 = new Actions(driver);
    acts2.moveToElement(driver.findElement(By.id("dfooter"))).perform();
    // >>> Open Marker 1
    driver.findElement(By.xpath(
            "//div[@id='testWithGeoLocalization']/div/div/div[5]/*[local-name()='svg']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='image']"))
            .click();
    // Wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='HiddenContentCol']"));
    // Check we have the expect series displayed
    String marker1Serie1 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker1Serie2 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][2]//*[local-name()='text']"));
    String marker1Serie3 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][3]//*[local-name()='text']"));
    String marker1Serie4 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker1Serie5 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][2]//*[local-name()='text']"));
    assertEquals("Vintage Cars", marker1Serie1);
    assertEquals("Trucks and Buses", marker1Serie2);
    assertEquals("Ships", marker1Serie3);
    assertEquals("Motorcycles", marker1Serie4);
    assertEquals("Trains", marker1Serie5);
    String popupTitle = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//*[local-name()='svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='text']"));
    assertEquals("Sales For Product", popupTitle);
    // Check the pie chart is present
    WebElement marker1SeriesTrains = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][5]"));
    assertEquals("rgb(148,103,189)", marker1SeriesTrains.getAttribute("fill"));
    // Close popup
    this.elemHelper.FindElement(driver, By.id("featurePopup_close")).click();

    // >>> Open Marker 2
    driver.findElement(By.xpath(
            "//div[@id='testWithGeoLocalization']/div/div/div[5]/*[local-name()='svg']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='image'][2]"))
            .click();
    // Wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='HiddenContentCol']"));
    // Check we have the expect series displayed
    String marker2Serie1 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker2Serie2 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][2]//*[local-name()='text']"));
    String marker2Serie3 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][3]//*[local-name()='text']"));
    assertEquals("Trucks and Buses", marker2Serie1);
    assertEquals("Ships", marker2Serie2);
    assertEquals("Motorcycles", marker2Serie3);
    String marker2PopupTitle = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//*[local-name()='svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='text']"));
    assertEquals("Sales For Product", marker2PopupTitle);
    // Check the pie chart is present
    WebElement marker2SeriesShips = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][3]"));
    assertEquals("rgb(44,160,44)", marker2SeriesShips.getAttribute("fill"));
    // Close popup
    this.elemHelper.FindElement(driver, By.id("featurePopup_close")).click();

    // >>> Open Marker 3
    driver.findElement(By.xpath(
            "//div[@id='testWithGeoLocalization']/div/div/div[5]/*[local-name()='svg']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='image'][3]"))
            .click();
    // Wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='HiddenContentCol']"));
    // Check we have the expect series displayed
    String marker3Serie1 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker3Serie2 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][2]//*[local-name()='text']"));
    assertEquals("Motorcycles", marker3Serie1);
    assertEquals("Trains", marker3Serie2);
    String marker3PopupTitle = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//*[local-name()='svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='text']"));
    assertEquals("Sales For Product", marker3PopupTitle);
    // Check the pie chart is present
    WebElement marker3SeriesMotorcycles = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][2]"));
    assertEquals("rgb(255,127,14)", marker3SeriesMotorcycles.getAttribute("fill"));
    // Close popup
    this.elemHelper.FindElement(driver, By.id("featurePopup_close")).click();

    // >>> Open Marker 4
    driver.findElement(By.xpath(
            "//div[@id='testWithGeoLocalization']/div/div/div[5]/*[local-name()='svg']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='image'][4]"))
            .click();
    // Wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='HiddenContentCol']"));
    // Check we have the expect series displayed
    String marker4Serie1 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker4Serie2 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][2]//*[local-name()='text']"));
    String marker4Serie3 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][3]//*[local-name()='text']"));
    String marker4Serie4 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker4Serie5 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][2]//*[local-name()='text']"));
    String marker4Serie6 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][3]//*[local-name()='text']"));
    assertEquals("Classic Cars", marker4Serie1);
    assertEquals("Vintage Cars", marker4Serie2);
    assertEquals("Trucks and Buses", marker4Serie3);
    assertEquals("Ships", marker4Serie4);
    assertEquals("Motorcycles", marker4Serie5);
    assertEquals("Trains", marker4Serie6);
    String marker4PopupTitle = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//*[local-name()='svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='text']"));
    assertEquals("Sales For Product", marker4PopupTitle);
    // Check the pie chart is present
    WebElement marker4SeriesTrains = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][2]"));
    assertEquals("rgb(255,127,14)", marker4SeriesTrains.getAttribute("fill"));
    // Close popup
    this.elemHelper.FindElement(driver, By.id("featurePopup_close")).click();

    // >>> Open Marker 5
    driver.findElement(By.xpath(
            "//div[@id='testWithGeoLocalization']/div/div/div[5]/*[local-name()='svg']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='image'][5]"))
            .click();
    // Wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='HiddenContentCol']"));
    // Check we have the expect series displayed
    String marker5Serie1 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker5Serie2 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][2]//*[local-name()='text']"));
    String marker5Serie3 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][3]//*[local-name()='text']"));
    String marker5Serie4 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker5Serie5 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][2]//*[local-name()='text']"));
    String marker5Serie6 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][3]//*[local-name()='text']"));
    assertEquals("Classic Cars", marker5Serie1);
    assertEquals("Vintage Cars", marker5Serie2);
    assertEquals("Trucks and Buses", marker5Serie3);
    assertEquals("Ships", marker5Serie4);
    assertEquals("Motorcycles", marker5Serie5);
    assertEquals("Trains", marker5Serie6);
    String marker5PopupTitle = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//*[local-name()='svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='text']"));
    assertEquals("Sales For Product", marker5PopupTitle);
    // Check the pie chart is present
    WebElement marker5SeriesTrains = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][6]"));
    assertEquals("rgb(140,86,75)", marker5SeriesTrains.getAttribute("fill"));
    // Close popup
    this.elemHelper.FindElement(driver, By.id("featurePopup_close")).click();

    // >>> Open Marker 6
    driver.findElement(By.xpath(
            "//div[@id='testWithGeoLocalization']/div/div/div[5]/*[local-name()='svg']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='image'][6]"))
            .click();
    // Wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='HiddenContentCol']"));
    // Check we have the expect series displayed
    String marker6Serie1 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker6Serie2 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][2]//*[local-name()='text']"));
    assertEquals("Trains", marker6Serie1);
    assertEquals("Motorcycles", marker6Serie2);
    String marker6PopupTitle = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//*[local-name()='svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='text']"));
    assertEquals("Sales For Product", marker6PopupTitle);
    // Check the pie chart is present
    WebElement marker6SeriesTrains = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][1]"));
    assertEquals("rgb(31,119,180)", marker6SeriesTrains.getAttribute("fill"));
    // Close popup
    this.elemHelper.FindElement(driver, By.id("featurePopup_close")).click();

    // >>> Open Marker 7
    driver.findElement(By.xpath(
            "//div[@id='testWithGeoLocalization']/div/div/div[5]/*[local-name()='svg']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='image'][7]"))
            .click();
    // Wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='HiddenContentCol']"));
    // Check we have the expect series displayed
    String marker7Serie1 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker7Serie2 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][2]//*[local-name()='text']"));
    String marker7Serie3 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][3]//*[local-name()='text']"));
    String marker7Serie4 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][1]//*[local-name()='text']"));
    assertEquals("Classic Cars", marker7Serie1);
    assertEquals("Vintage Cars", marker7Serie2);
    assertEquals("Trucks and Buses", marker7Serie3);
    assertEquals("Ships", marker7Serie4);
    String marker7PopupTitle = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//*[local-name()='svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='text']"));
    assertEquals("Sales For Product", marker7PopupTitle);
    // Check the pie chart is present
    WebElement marker7SeriesMotorcycles = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][2]"));
    assertEquals("rgb(255,127,14)", marker7SeriesMotorcycles.getAttribute("fill"));
    // Close popup
    this.elemHelper.FindElement(driver, By.id("featurePopup_close")).click();

    /*
     * ## Step 3
     */
    driver.findElement(By.xpath(
            "//div[@id='testWithGeoLocalization']/div/div/div[5]/*[local-name()='svg']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='image'][5]"))
            .click();
    // Wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='HiddenContentCol']"));
    // Move mouse to element
    WebElement marker5SeriesClassicCars = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][1]"));
    Actions acts = new Actions(driver);
    acts.moveToElement(marker5SeriesClassicCars);
    acts.perform();
    String tooltipProduct = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-sww']/div[2]/div/table/tbody/tr[1]/td[1]/span"));
    acts.perform();
    String tooltipProductValue = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-sww']/div[2]/div/table/tbody/tr[1]/td[3]/span"));
    acts.perform();
    String tooltipSeries = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-sww']/div[2]/div/table/tbody/tr[2]/td[1]/span"));
    acts.perform();
    String tooltipSeriesValue = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-sww']/div[2]/div/table/tbody/tr[2]/td[3]/span"));
    acts.perform();
    String tooltipValues = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-sww']/div[2]/div/table/tbody/tr[3]/td[1]/span"));
    acts.perform();
    String tooltipValuesValue = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-sww']/div[2]/div/table/tbody/tr[3]/td[3]/span[1]"));
    acts.perform();
    String tooltipValuesValueP = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-sww']/div[2]/div/table/tbody/tr[3]/td[3]/span[2]"));
    assertEquals("Product", tooltipProduct);
    assertEquals("Classic Cars", tooltipProductValue);
    assertEquals("Series", tooltipSeries);
    assertEquals("Quantity", tooltipSeriesValue);
    assertEquals("Value", tooltipValues);
    assertEquals("2,381", tooltipValuesValue);
    assertEquals("37.4%", tooltipValuesValueP);

    /*
     * ## Step 4
     */
    // Disable 'Classic Cars'
    this.elemHelper.FindElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][1]//*[local-name()='text']"))
            .click();
    this.elemHelper.WaitForElementInvisibility(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][6]"));
    // Disable 'Trucks and Buses'
    this.elemHelper.FindElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][3]//*[local-name()='text']"))
            .click();
    this.elemHelper.WaitForElementInvisibility(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][5]"));
    // Disable 'Ships'
    this.elemHelper.FindElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][1]//*[local-name()='text']"))
            .click();
    this.elemHelper.WaitForElementInvisibility(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][4]"));
    // Disable 'Motorcycles'
    this.elemHelper.FindElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][2]//*[local-name()='text']"))
            .click();
    this.elemHelper.WaitForElementInvisibility(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][3]"));
    // Disable 'Trains'
    this.elemHelper.FindElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][3]//*[local-name()='text']"))
            .click();
    this.elemHelper.WaitForElementInvisibility(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][2]"));
    // Check the values for the pie char for serie Vintage Cars
    String marker5SerieVintageCarsValue = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g'][2]/*[local-name()='g'][2]/*[local-name()='text'][1]"));
    String marker5SerieVintageCarsValuePer = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g'][2]/*[local-name()='g'][2]/*[local-name()='text'][2]"));
    assertEquals("1,753", marker5SerieVintageCarsValue);
    assertEquals("(100%)", marker5SerieVintageCarsValuePer);
}

From source file:com.pentaho.ctools.cde.reference.WidgetReference.java

License:Apache License

/**
 * ############################### Test Case 2 ###############################
 *
 * Test Case Name://from w w w .j  a  v  a2 s.  co  m
 *    Widget Chart
 * Description:
 *    The test case pretends validate the information presented in the chart
 *    when we interact with.
 * Steps:
 *    1. Check contents
 *    2. Check years
 *    3. Disable series
 *    4. Check tooltip
 */
@Test
public void tc02_WidgetChart_ContentsDisplayCorrect() {
    this.log.info("tc02_WidgetChart_ContentsDisplayCorrect");

    /*
     * ## Step 1
     */
    String widgetTitle = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='SampleTitle']"));
    String widgetDesc = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='SampleDescHtml']/p"));
    assertEquals("Sample Widget", widgetTitle);
    assertEquals(
            "This is a simple sample Widget. The widget contains only a single bar chart and a year parameter, and the parameter is linked to the documentation dashboard's year parameter, which is exposed in the pulldown.",
            widgetDesc);

    /*
     * ## Step 2
     */
    Select select = new Select(this.elemHelper.FindElement(driver, By.xpath("//select")));
    //>Select 2003
    select.selectByValue("2003");
    //wait for loading bar disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    WebElement rect = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='widgetSample_chartprotovis']/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]//*[local-name()='rect'][4]"));
    this.log.info(rect.getAttribute("height"));
    assertEquals("185.54946181445413", rect.getAttribute("height")); //185.54946181445413
    //>Select 2004
    select.selectByValue("2004");
    //wait for loading bar disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    rect = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='widgetSample_chartprotovis']/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]//*[local-name()='rect'][4]"));
    this.log.info(rect.getAttribute("height"));
    assertEquals("122.4067513368984", rect.getAttribute("height")); //122.4067513368984
    //>Select 2005
    select.selectByValue("2005");
    //wait for loading bar disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    rect = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='widgetSample_chartprotovis']/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]//*[local-name()='rect'][4]"));
    this.log.info(rect.getAttribute("height"));
    assertEquals("133.12012705746463", rect.getAttribute("height")); //133.12012705746463

    /*
     * ## Step 3
     */
    //Click in Classic Cars
    this.elemHelper.ClickJS(driver, By.xpath(
            "//div[@id='widgetSample_chartprotovis']/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][1]/*[local-name()='g'][2]/*[local-name()='text']"));
    //Click in Motorcycles
    this.elemHelper.ClickJS(driver, By.xpath(
            "//div[@id='widgetSample_chartprotovis']/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][2]/*[local-name()='g'][2]/*[local-name()='text']"));
    //Click Planes
    this.elemHelper.ClickJS(driver, By.xpath(
            "//div[@id='widgetSample_chartprotovis']/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][3]/*[local-name()='g'][2]/*[local-name()='text']"));
    //Click in Ships
    this.elemHelper.ClickJS(driver, By.xpath(
            "//div[@id='widgetSample_chartprotovis']/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][4]/*[local-name()='g'][2]/*[local-name()='text']"));
    //Click in Trains
    this.elemHelper.ClickJS(driver, By.xpath(
            "//div[@id='widgetSample_chartprotovis']/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][1]/*[local-name()='g'][2]/*[local-name()='text']"));
    //Click in Vintage Cars
    this.elemHelper.ClickJS(driver, By.xpath(
            "//div[@id='widgetSample_chartprotovis']/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][3]/*[local-name()='g'][2]/*[local-name()='text']"));
    //Wait for the previous series disable
    this.elemHelper.WaitForElementInvisibility(driver, By.xpath(
            "//div[@id='widgetSample_chartprotovis']/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]"));
    //Check chart
    WebElement rect1 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='widgetSample_chartprotovis']/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='rect'][1]"));
    WebElement rect2 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='widgetSample_chartprotovis']/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='rect'][2]"));
    WebElement rect3 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='widgetSample_chartprotovis']/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='rect'][3]"));
    assertNotNull(rect1);
    assertNotNull(rect2);
    assertNotNull(rect3);
    this.log.info(rect1.getAttribute("height"));
    this.log.info(rect2.getAttribute("height"));
    this.log.info(rect3.getAttribute("height"));
    assertEquals("127.83732057416269", rect1.getAttribute("height")); //127.83732057416269
    assertEquals("219", rect2.getAttribute("height")); //219
    assertEquals("156.39114832535884", rect3.getAttribute("height")); //156.39114832535884

    /*
     * ## Step 4
     */
    //Check tooltip
    Actions acts = new Actions(driver);
    acts.moveToElement(rect1);
    acts.perform();
    String tooltipValue = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-s']/div[2]"));
    assertEquals("Trucks and Buses, APAC: 488", tooltipValue);
}

From source file:com.pentaho.ctools.cde.require.CCCV2ShowCase.java

License:Apache License

/**
 * ############################### Test Case 2 ###############################
 *
 * Test Case Name:/*from w  w w  .  ja  va 2  s. c  om*/
 *    LineChart
 * Description:
 *    The test case pretends validate the line chart information.
 * Steps:
 *    1. Check Line Chart
 */
@Test
public void tc02_ChartContent_DisplayedCorrect() {
    this.log.info("tc2_ChartContent_DisplayedCorrect");

    /*
     * ## Step 1 - Line Chart
     */
    String lineChartTitle = this.elemHelper.WaitForElementPresentGetText(driver, By.id("LineChartTitleRow"));
    assertEquals("Line Chart", lineChartTitle);
    // Check lines
    WebElement lineChartCircle1 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='LineChartBodyRow']/div/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='circle'][1]"));
    WebElement lineChartCircle2 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='LineChartBodyRow']/div/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='circle'][7]"));
    WebElement lineChartCircle3 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='LineChartBodyRow']/div/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='circle'][11]"));
    Double lineChartCircle1Cy = Double.parseDouble(lineChartCircle1.getAttribute("cy"));
    Double lineChartCircle2Cy = Double.parseDouble(lineChartCircle2.getAttribute("cy"));
    Double lineChartCircle3Cy = Double.parseDouble(lineChartCircle3.getAttribute("cy"));
    assertThat("Current cy: " + lineChartCircle1Cy, lineChartCircle1Cy, greaterThan(Double.valueOf(120)));
    assertThat("Current cy: " + lineChartCircle2Cy, lineChartCircle2Cy, greaterThan(Double.valueOf(136)));
    assertThat("Current cy: " + lineChartCircle3Cy, lineChartCircle3Cy, greaterThan(Double.valueOf(24)));

    // Mouse hover elements
    WebElement lineChartCircle4 = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='LineChartBodyRow']/div/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='circle'][2]"));
    Actions acts = new Actions(driver);
    acts.moveToElement(lineChartCircle4);
    acts.perform();
    String measuresLabel = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-s']/div[2]/div/table/tbody/tr[1]/td[1]/span"));
    acts.perform();
    String measuresValue = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-s']/div[2]/div/table/tbody/tr[1]/td[3]/span"));
    acts.perform();
    String categoryLabel = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-s']/div[2]/div/table/tbody/tr[2]/td[1]/span"));
    acts.perform();
    String categoryValue = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-s']/div[2]/div/table/tbody/tr[2]/td[3]/span"));
    acts.perform();
    String valueLineValue = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-s']/div[2]/div/table/tbody/tr[4]/td[3]/span"));
    assertEquals("Measures", measuresLabel);
    assertEquals("Quantity", measuresValue);
    assertEquals("Category", categoryLabel);
    assertEquals("Feb", categoryValue);
    assertEquals("7,959", valueLineValue);

    //To move the focus to another element, in order to remove the tooltip
    Actions acts2 = new Actions(driver);
    acts2.moveToElement(this.elemHelper.FindElement(driver, By.id("LineChartTitleRow")));
    acts2.click();
    acts2.perform();
}

From source file:com.pentaho.ctools.cde.require.MapComponentFullTest.java

License:Apache License

/**
 * ############################### Test Case 2 ###############################
 *
 * Test Case Name://from w  w w. jav a 2 s  .c  o  m
 *    Full Map with CGG Markers and PopupWindows
 * Description:
 *    In this test case we pretend to check if the markers and popups windows
 *    are displayed.
 * Steps:
 *    1. Check the data exist
 *    2. Chick in each marker
 *    3. Check tooltip
 *    4. Check disabling series in pie chart
 */
@Test
public void tc2_MapCGGMarkersAndPopupWindows_MarkersAndPopupsDisplayed() {
    this.log.info("tc2_MapCGGMarkersAndPopupWindows_MarkersAndPopupsDisplayed");

    /*
     * ## Step 1
     */
    WebElement marker1 = this.elemHelper.FindElement(driver, By.xpath("//*[local-name()='image'][1]"));
    WebElement marker2 = this.elemHelper.FindElement(driver, By.xpath("//*[local-name()='image'][2]"));
    WebElement marker3 = this.elemHelper.FindElement(driver, By.xpath("//*[local-name()='image'][3]"));
    WebElement marker4 = this.elemHelper.FindElement(driver, By.xpath("//*[local-name()='image'][4]"));
    WebElement marker5 = this.elemHelper.FindElement(driver, By.xpath("//*[local-name()='image'][5]"));
    WebElement marker6 = this.elemHelper.FindElement(driver, By.xpath("//*[local-name()='image'][6]"));
    WebElement marker7 = this.elemHelper.FindElement(driver, By.xpath("//*[local-name()='image'][7]"));
    assertNotNull(marker1);
    assertNotNull(marker2);
    assertNotNull(marker3);
    assertNotNull(marker4);
    assertNotNull(marker5);
    assertNotNull(marker6);
    assertNotNull(marker7);

    /*
     *
     * THE BELOW CODE HAVE TO BE MODIFIED TO PASS ON AUTOMATION MACHINE
     * THAT NIGHTLY RUNS THE TESTS.
     *
     */

    /*
     * ## Step 2
     */
    // Zoom in - in order for the elements to be visible
    this.elemHelper.FindElement(driver, By.xpath("//div[@id='testWithGeoLocalization']/div/div[5]/div[3]"))
            .click();
    Actions acts2 = new Actions(driver);
    acts2.moveToElement(driver.findElement(By.id("dfooter"))).perform();
    // >>> Open Marker 1
    driver.findElement(By.xpath(
            "//div[@id='testWithGeoLocalization']/div/div/div[5]/*[local-name()='svg']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='image']"))
            .click();
    // Wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='HiddenContentCol']"));
    // Check we have the expect series displayed
    String marker1Serie1 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker1Serie2 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][2]//*[local-name()='text']"));
    String marker1Serie3 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][3]//*[local-name()='text']"));
    String marker1Serie4 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker1Serie5 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][2]//*[local-name()='text']"));
    assertEquals("Vintage Cars", marker1Serie1);
    assertEquals("Trucks and Buses", marker1Serie2);
    assertEquals("Ships", marker1Serie3);
    assertEquals("Motorcycles", marker1Serie4);
    assertEquals("Trains", marker1Serie5);
    String popupTitle = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//*[local-name()='svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='text']"));
    assertEquals("Sales For Product", popupTitle);
    // Check the pie chart is present
    WebElement marker1SeriesTrains = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][5]"));
    assertEquals("rgb(148,103,189)", marker1SeriesTrains.getAttribute("fill"));
    // Close popup
    this.elemHelper.FindElement(driver, By.id("featurePopup_close")).click();

    // >>> Open Marker 2
    driver.findElement(By.xpath(
            "//div[@id='testWithGeoLocalization']/div/div/div[5]/*[local-name()='svg']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='image'][2]"))
            .click();
    // Wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='HiddenContentCol']"));
    // Check we have the expect series displayed
    String marker2Serie1 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker2Serie2 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][2]//*[local-name()='text']"));
    String marker2Serie3 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][3]//*[local-name()='text']"));
    assertEquals("Trucks and Buses", marker2Serie1);
    assertEquals("Ships", marker2Serie2);
    assertEquals("Motorcycles", marker2Serie3);
    String marker2PopupTitle = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//*[local-name()='svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='text']"));
    assertEquals("Sales For Product", marker2PopupTitle);
    // Check the pie chart is present
    WebElement marker2SeriesShips = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][3]"));
    assertEquals("rgb(44,160,44)", marker2SeriesShips.getAttribute("fill"));
    // Close popup
    this.elemHelper.FindElement(driver, By.id("featurePopup_close")).click();

    // >>> Open Marker 3
    driver.findElement(By.xpath(
            "//div[@id='testWithGeoLocalization']/div/div/div[5]/*[local-name()='svg']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='image'][3]"))
            .click();
    // Wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='HiddenContentCol']"));
    // Check we have the expect series displayed
    String marker3Serie1 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker3Serie2 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][2]//*[local-name()='text']"));
    assertEquals("Motorcycles", marker3Serie1);
    assertEquals("Trains", marker3Serie2);
    String marker3PopupTitle = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//*[local-name()='svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='text']"));
    assertEquals("Sales For Product", marker3PopupTitle);
    // Check the pie chart is present
    WebElement marker3SeriesMotorcycles = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][2]"));
    assertEquals("rgb(255,127,14)", marker3SeriesMotorcycles.getAttribute("fill"));
    // Close popup
    this.elemHelper.FindElement(driver, By.id("featurePopup_close")).click();

    // >>> Open Marker 4
    driver.findElement(By.xpath(
            "//div[@id='testWithGeoLocalization']/div/div/div[5]/*[local-name()='svg']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='image'][4]"))
            .click();
    // Wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='HiddenContentCol']"));
    // Check we have the expect series displayed
    String marker4Serie1 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker4Serie2 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][2]//*[local-name()='text']"));
    String marker4Serie3 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][3]//*[local-name()='text']"));
    String marker4Serie4 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker4Serie5 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][2]//*[local-name()='text']"));
    String marker4Serie6 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][3]//*[local-name()='text']"));
    assertEquals("Classic Cars", marker4Serie1);
    assertEquals("Vintage Cars", marker4Serie2);
    assertEquals("Trucks and Buses", marker4Serie3);
    assertEquals("Ships", marker4Serie4);
    assertEquals("Motorcycles", marker4Serie5);
    assertEquals("Trains", marker4Serie6);
    String marker4PopupTitle = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//*[local-name()='svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='text']"));
    assertEquals("Sales For Product", marker4PopupTitle);
    // Check the pie chart is present
    WebElement marker4SeriesTrains = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][2]"));
    assertEquals("rgb(255,127,14)", marker4SeriesTrains.getAttribute("fill"));
    // Close popup
    this.elemHelper.FindElement(driver, By.id("featurePopup_close")).click();

    // >>> Open Marker 5
    driver.findElement(By.xpath(
            "//div[@id='testWithGeoLocalization']/div/div/div[5]/*[local-name()='svg']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='image'][5]"))
            .click();
    // Wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='HiddenContentCol']"));
    // Check we have the expect series displayed
    String marker5Serie1 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker5Serie2 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][2]//*[local-name()='text']"));
    String marker5Serie3 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][3]//*[local-name()='text']"));
    String marker5Serie4 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker5Serie5 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][2]//*[local-name()='text']"));
    String marker5Serie6 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][3]//*[local-name()='text']"));
    assertEquals("Classic Cars", marker5Serie1);
    assertEquals("Vintage Cars", marker5Serie2);
    assertEquals("Trucks and Buses", marker5Serie3);
    assertEquals("Ships", marker5Serie4);
    assertEquals("Motorcycles", marker5Serie5);
    assertEquals("Trains", marker5Serie6);
    String marker5PopupTitle = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//*[local-name()='svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='text']"));
    assertEquals("Sales For Product", marker5PopupTitle);
    // Check the pie chart is present
    WebElement marker5SeriesTrains = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][6]"));
    assertEquals("rgb(140,86,75)", marker5SeriesTrains.getAttribute("fill"));
    // Close popup
    this.elemHelper.FindElement(driver, By.id("featurePopup_close")).click();

    // >>> Open Marker 6
    driver.findElement(By.xpath(
            "//div[@id='testWithGeoLocalization']/div/div/div[5]/*[local-name()='svg']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='image'][6]"))
            .click();
    // Wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='HiddenContentCol']"));
    // Check we have the expect series displayed
    String marker6Serie1 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker6Serie2 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][2]//*[local-name()='text']"));
    assertEquals("Trains", marker6Serie1);
    assertEquals("Motorcycles", marker6Serie2);
    String marker6PopupTitle = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//*[local-name()='svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='text']"));
    assertEquals("Sales For Product", marker6PopupTitle);
    // Check the pie chart is present
    WebElement marker6SeriesTrains = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][1]"));
    assertEquals("rgb(31,119,180)", marker6SeriesTrains.getAttribute("fill"));
    // Close popup
    this.elemHelper.FindElement(driver, By.id("featurePopup_close")).click();

    // >>> Open Marker 7
    driver.findElement(By.xpath(
            "//div[@id='testWithGeoLocalization']/div/div/div[5]/*[local-name()='svg']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='image'][7]"))
            .click();
    // Wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='HiddenContentCol']"));
    // Check we have the expect series displayed
    String marker7Serie1 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][1]//*[local-name()='text']"));
    String marker7Serie2 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][2]//*[local-name()='text']"));
    String marker7Serie3 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][3]//*[local-name()='text']"));
    String marker7Serie4 = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][1]//*[local-name()='text']"));
    assertEquals("Classic Cars", marker7Serie1);
    assertEquals("Vintage Cars", marker7Serie2);
    assertEquals("Trucks and Buses", marker7Serie3);
    assertEquals("Ships", marker7Serie4);
    String marker7PopupTitle = this.elemHelper.GetTextElementInvisible(driver, By.xpath(
            "//*[local-name()='svg']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='text']"));
    assertEquals("Sales For Product", marker7PopupTitle);
    // Check the pie chart is present
    WebElement marker7SeriesMotorcycles = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][2]"));
    assertEquals("rgb(255,127,14)", marker7SeriesMotorcycles.getAttribute("fill"));
    // Close popup
    this.elemHelper.FindElement(driver, By.id("featurePopup_close")).click();

    /*
     * ## Step 3
     */
    driver.findElement(By.xpath(
            "//div[@id='testWithGeoLocalization']/div/div/div[5]/*[local-name()='svg']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='image'][5]"))
            .click();
    // Wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='HiddenContentCol']"));
    // Move mouse to element
    WebElement marker5SeriesClassicCars = this.elemHelper.FindElement(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][1]"));
    Actions acts = new Actions(driver);
    acts.moveToElement(marker5SeriesClassicCars);
    acts.perform();
    String tooltipProduct = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-sww']/div[2]/div/table/tbody/tr[1]/td[1]/span"));
    acts.perform();
    String tooltipProductValue = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-sww']/div[2]/div/table/tbody/tr[1]/td[3]/span"));
    acts.perform();
    String tooltipSeries = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-sww']/div[2]/div/table/tbody/tr[2]/td[1]/span"));
    acts.perform();
    String tooltipSeriesValue = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-sww']/div[2]/div/table/tbody/tr[2]/td[3]/span"));
    acts.perform();
    String tooltipValues = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-sww']/div[2]/div/table/tbody/tr[3]/td[1]/span"));
    acts.perform();
    String tooltipValuesValue = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-sww']/div[2]/div/table/tbody/tr[3]/td[3]/span[1]"));
    acts.perform();
    String tooltipValuesValueP = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@class='tipsy tipsy-sww']/div[2]/div/table/tbody/tr[3]/td[3]/span[2]"));
    assertEquals("Product", tooltipProduct);
    assertEquals("Classic Cars", tooltipProductValue);
    assertEquals("Series", tooltipSeries);
    assertEquals("Quantity", tooltipSeriesValue);
    assertEquals("Value", tooltipValues);
    assertEquals("2,381", tooltipValuesValue);
    assertEquals("37.4%", tooltipValuesValueP);

    /*
     * ## Step 4
     */
    // Disable 'Classic Cars'
    this.elemHelper.FindElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][1]//*[local-name()='text']"))
            .click();
    this.elemHelper.WaitForElementInvisibility(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][6]"));
    // Disable 'Trucks and Buses'
    this.elemHelper.FindElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][1]/*[local-name()='g'][3]//*[local-name()='text']"))
            .click();
    this.elemHelper.WaitForElementInvisibility(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][5]"));
    // Disable 'Ships'
    this.elemHelper.FindElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][1]//*[local-name()='text']"))
            .click();
    this.elemHelper.WaitForElementInvisibility(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][4]"));
    // Disable 'Motorcycles'
    this.elemHelper.FindElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][2]//*[local-name()='text']"))
            .click();
    this.elemHelper.WaitForElementInvisibility(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][3]"));
    // Disable 'Trains'
    this.elemHelper.FindElementInvisible(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g'][3]//*[local-name()='text']"))
            .click();
    this.elemHelper.WaitForElementInvisibility(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='path'][2]"));
    // Check the values for the pie char for serie Vintage Cars
    String marker5SerieVintageCarsValue = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g'][2]/*[local-name()='g'][2]/*[local-name()='text'][1]"));
    String marker5SerieVintageCarsValuePer = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath(
            "//div[@id='HiddenContentCol']/div/*[local-name()='svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g'][2]/*[local-name()='g'][2]/*[local-name()='text'][2]"));
    assertEquals("1,753", marker5SerieVintageCarsValue);
    assertEquals("(100%)", marker5SerieVintageCarsValuePer);
}

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

License:Apache License

/**
 * ############################### Test Case 5 ###############################
 *
 * Test Case Name:/*from ww  w  .j a va2  s .c  o  m*/
 *    Display Page
 * Description:
 *    We pretend validate to check if a comment is removed.
 * Steps:
 *    1. Add a comment
 *    2. Remove added comment
 */
@Test
public void tc5_RemoveCoomment_CommentRemoved() {
    this.log.info("tc5_RemoveCoomment_CommentRemoved");
    this.tcRemoveComment = true;
    /*
     * Guarantee no comments displayed
     */
    cleanAllComments();

    String commentText = "Some comment!";
    String noComments = this.elemHelper.WaitForElementPresentGetText(driver, By.cssSelector("div.comment"));
    assertEquals("No Comments to show!", noComments);
    String addComments = this.elemHelper.WaitForElementPresentGetText(driver, By.cssSelector("div.addComment"));
    assertEquals("Add Comment", addComments);

    /*
     * ## Step 1
     */
    this.elemHelper.ClickJS(driver, By.cssSelector("div.addComment"));
    //Insert the text
    this.elemHelper.FindElement(driver, By.cssSelector("textarea.addCommentText")).sendKeys(commentText);
    this.elemHelper.ClickJS(driver, By.cssSelector("div.saveComment"));
    //wait for the page rendered
    wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("div.navigateRefresh")));
    //Check if the comment was added
    String commentAdded = this.elemHelper.WaitForElementPresentGetText(driver,
            By.xpath("//div[@id='sampleObject']/div/div/div[1]/div[2]/div"));
    assertEquals(commentAdded, commentText);

    /*
     * ## Step 2
     */
    Actions acts = new Actions(driver);
    acts.moveToElement(this.elemHelper.FindElement(driver,
            By.xpath("//div[@id='sampleObject']/div/div/div[1]/div[2]/div")));
    acts.build().perform();
    acts.perform();
    acts.moveToElement(this.elemHelper.FindElement(driver, By.cssSelector("div.archive")));
    acts.click();
    acts.perform();
    //Check we don't have more comments
    noComments = this.elemHelper.WaitForElementPresentGetText(driver, By.cssSelector("div.comment"));
    assertEquals("No Comments to show!", noComments);
    addComments = this.elemHelper.WaitForElementPresentGetText(driver, By.cssSelector("div.addComment"));
    assertEquals("Add Comment", addComments);
    String refreshComments = this.elemHelper.WaitForElementPresentGetText(driver,
            By.cssSelector("div.navigateRefresh"));
    assertEquals("Refresh", refreshComments);
}

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

License:Apache License

/**
 * This method shall clean all existence comments.
 *//*from   w w w  .j a  v  a  2  s  .  c o  m*/
private void cleanAllComments() {
    this.log.info("Remove comments");
    ElementHelper nElemHelper = new ElementHelper();

    driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);

    List<WebElement> listEraseComments = driver.findElements(By.cssSelector("div.archive"));
    int nIteractions = listEraseComments.size();
    this.log.info("Number elements to remove: " + nIteractions);
    if (nIteractions > 0) {
        this.log.debug("We have comments to remove");
        for (int i = 1; i <= nIteractions; i++) {
            Actions acts = new Actions(driver);
            acts.moveToElement(nElemHelper.FindElement(driver,
                    By.xpath("//div[@id='sampleObject']/div/div/div[1]/div[2]/div")));
            acts.perform();
            acts.moveToElement(nElemHelper.FindElement(driver, By.cssSelector("div.archive")));
            acts.click();
            acts.perform();
            this.log.debug("One comment removed.");
        }
    }
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

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

License:Apache License

/**
 * ############################### Test Case 3 ###############################
 *
 * Test Case Name://from ww w.ja  va  2 s  .  c  o m
 *    Select Month
 * Description:
 *    The test case pretends to validate an alert is displayed after select
 *    a month and the alert displayed the selected month.
 * Steps:
 *    1. Open Pie Chart
 *    2. Click on chart
 *    3. Open Bar Chart
 *    4. Click on chart
 */
@Test
public void tc3_ClickOnChart_AlertDisplayed() {
    this.log.info("tc3_ClickOnChart_AlertDisplayed");
    String title = "";

    String firstChart = this.elemHelper.GetAttribute(driver, By.xpath("//img[@id='sampleObjectimage']"), "src");

    ActionsHelper actsHelper = new ActionsHelper(driver);
    actsHelper.MouseOver(By.xpath("//div[contains(text(),'Details')]"));
    title = this.elemHelper.WaitForElementPresentGetText(driver, By.id("sampleObjectcaptiontitle"));
    assertTrue(title.equals("Top 10 Customers"));
    this.elemHelper.Click(driver, By.xpath("//div[@id='sampleObjectcaptionchartType']"));
    // NOTE - we have to wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    //Check if the generated image is different from previews, is not something static
    assertNotNull(this.elemHelper.FindElement(driver, By.xpath("//img[@id='sampleObjectimage']")));
    String secondChart = this.elemHelper.GetAttribute(driver, By.xpath("//img[@id='sampleObjectimage']"),
            "src");
    assertNotEquals(firstChart, secondChart);

    // ## Step 2
    //Click in 'Dragon Souveniers, Ltd.'
    this.elemHelper.Click(driver, By.xpath("//map[@id='sampleObjectimageMap']/area[4]"));
    wait.until(ExpectedConditions.alertIsPresent());
    Alert alert = driver.switchTo().alert();
    String confirmationMsg = alert.getText();
    alert.accept();
    assertEquals("You clicked Dragon Souveniers, Ltd.", confirmationMsg);
    //Click in 'Mini Gifts Distributors Ltd'
    this.elemHelper.FindElement(driver, By.xpath("//map[@id='sampleObjectimageMap']/area[9]")).click();
    wait.until(ExpectedConditions.alertIsPresent());
    alert = driver.switchTo().alert();
    confirmationMsg = alert.getText();
    alert.accept();
    assertEquals("You clicked Mini Gifts Distributors Ltd.", confirmationMsg);

    // ## Step 3
    Actions acts2 = new Actions(driver);
    acts2.moveToElement(this.elemHelper.FindElement(driver, By.xpath("//div[contains(text(),'Details')]")));
    acts2.perform();
    //Open the Pie Chart
    title = this.elemHelper.WaitForElementPresentGetText(driver, By.id("sampleObjectcaptiontitle"));
    assertTrue(title.equals("Top 10 Customers"));
    this.elemHelper.Click(driver, By.xpath("//div[@id='sampleObjectcaptionchartType']"));
    // NOTE - we have to wait for loading disappear
    this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"));
    //Check if the generated image is different from previews, is not something static
    assertNotNull(this.elemHelper.FindElement(driver, By.xpath("//img[@id='sampleObjectimage']")));
    String thirdChart = this.elemHelper.GetAttribute(driver, By.xpath("//img[@id='sampleObjectimage']"), "src");
    assertNotEquals(firstChart, thirdChart);
    assertNotEquals(secondChart, thirdChart);

    // ## Step 3
    //Click in 'Australian Collectors, Co.'
    this.elemHelper.FindElement(driver, By.xpath("//map[@id='sampleObjectimageMap']/area[8]")).click();
    wait.until(ExpectedConditions.alertIsPresent());
    alert = driver.switchTo().alert();
    confirmationMsg = alert.getText();
    alert.accept();
    assertEquals("You clicked Australian Collectors, Co.", confirmationMsg);
    //Click in 'Down Under Souveniers, Inc'
    this.elemHelper.FindElement(driver, By.xpath("//map[@id='sampleObjectimageMap']/area[5]")).click();
    wait.until(ExpectedConditions.alertIsPresent());
    alert = driver.switchTo().alert();
    confirmationMsg = alert.getText();
    alert.accept();
    assertEquals("You clicked Down Under Souveniers, Inc", confirmationMsg);
}