List of usage examples for org.openqa.selenium.interactions Actions Actions
public Actions(WebDriver driver)
From source file:com.pentaho.ctools.cde.reference.PopupComponent.java
License:Apache License
/** * ############################### Test Case 2 ############################### * * Test Case Name://from w ww .j a v a 2s .co m * PopupExample1 * Description: * The test case pretends validate if the popup works as expect. * Steps: * 1. Check page contents * 2. Check popup display */ @Test public void tc02_PopupExample1_PopupDisplay() { this.log.info("tc02_PopupExample1_PopupDisplay"); /* * ## Step 1 */ String strExampleTitle = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//div[@id='Example1Title']")); String strExampleDesc = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//div[@id='Example1Desc']/p")); String strButtonName = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//div[@id='example1Obj']/button")); assertEquals("Example 1", strExampleTitle); assertEquals("Button popup with the default settings. You can drag it around and close on the button", strExampleDesc); assertEquals("Popup", strButtonName); /* * ## Step 2 */ this.elemHelper.ClickJS(driver, By.xpath("//div[@id='example1Obj']/button")); this.elemHelper.WaitForElementPresence(driver, By.xpath("//div[@id='popupContent1']")); //Wait for the charts load this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//*[3][@width>13]")); //Check text String textInPopup = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//div[@id='text']")); assertEquals("This will appear in the popup", textInPopup); //Check rect in chart WebElement elemRect1 = this.elemHelper.FindElement(driver, By.xpath( "//div[@id='popupContent1']/div/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='rect'][1]")); WebElement elemRect2 = this.elemHelper.FindElement(driver, By.xpath( "//div[@id='popupContent1']/div/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='rect'][2]")); WebElement elemRect3 = this.elemHelper.FindElement(driver, By.xpath( "//div[@id='popupContent1']/div/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='rect'][3]")); WebElement elemRect4 = this.elemHelper.FindElement(driver, By.xpath( "//div[@id='popupContent1']/div/div/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='g']/*[local-name()='g']/*[local-name()='rect'][4]")); assertNotNull(elemRect1); assertNotNull(elemRect2); assertNotNull(elemRect3); assertNotNull(elemRect4); assertEquals("35.521816666666666", elemRect1.getAttribute("width")); //36.27305471479055 assertEquals("136.75265000000002", elemRect2.getAttribute("width")); //139.64478231479157 assertEquals("13.579274999999999", elemRect3.getAttribute("width")); //13.866458173700408 assertEquals("104.68426666666666", elemRect4.getAttribute("width")); //106.89819634537434 //Check subtitles Actions acts = new Actions(driver); acts.moveToElement(elemRect2).perform(); String tooltipValue = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//div[@class='tipsy tipsy-s']/div[2]/div/table/tbody/tr[3]/td[3]/span")); assertEquals("49,578", tooltipValue); //Close popup this.elemHelper.ClickJS(driver, By.cssSelector("a.close")); //wait for popup disappear this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("a.close")); WebElement element = driver.findElement(By.cssSelector("a.close")); assertFalse(element.isDisplayed()); }
From source file:com.pentaho.ctools.cde.reference.WidgetReference.java
License:Apache License
/** * ############################### Test Case 2 ############################### * * Test Case Name:/*from w w w . jav 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.AddinReferenceEdit.java
License:Apache License
/** * * @param value//from w w w. j a v a2 s .c om */ private void ChangeFontSize(String value) { this.log.info("ChangeFontSize"); driver.get(PageUrl.ADDIN_REFERENCE_REQUIRE_EDIT); //Expand first row - Title this.elemHelper.ClickJS(driver, By.xpath("//table[@id='table-cdfdd-layout-tree']/tbody/tr[5]/td/span")); //Click in HTML to open the Properties Actions acts = new Actions(driver); acts.click(this.elemHelper.FindElement(driver, By.xpath("//table[@id='table-cdfdd-layout-tree']/tbody/tr[6]/td[1]"))); acts.build().perform(); //Click in field 'Font Size' to be editable this.elemHelper.ClickJS(driver, By.xpath("//table[@id='table-cdfdd-layout-properties']/tbody/tr[3]/td[2]")); //Write 34 this.elemHelper.FindElement(driver, By.name("value")).clear(); this.elemHelper.SendKeys(driver, By.name("value"), value); this.elemHelper.FindElement(driver, By.name("value")).submit(); this.bFontChanged = true; //Save the changes this.elemHelper.ClickJS(driver, By.linkText("Save")); //Wait for element present and invisible this.elemHelper.WaitForElementVisibility(driver, By.xpath("//div[@id='notifyBar']")); this.elemHelper.WaitForElementInvisibility(driver, By.xpath("//div[@id='notifyBar']")); }
From source file:com.pentaho.ctools.cde.require.CCCV2ShowCase.java
License:Apache License
/** * ############################### Test Case 2 ############################### * * Test Case Name:// ww w . j av a2 s .c o m * 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 . ja v a2 s .c om * 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.cde.require.MapComponentReference.java
License:Apache License
/** * ############################### Test Case 6 ############################### * * Test Case Name://from w ww. j a v a 2 s . c o m * Map with Shapes * Description: * Check if the map has shapes and by click in a known shape must change * its color. * Steps: * 1. Check the data exist * 2. Chick in a shape country */ @Test public void tc6_MapWithShapes_ShapesAreClickable() { this.log.info("tc6_MapWithShapes_ShapesAreClickable"); //Zoom in the map this.elemHelper.FindElement(driver, By.xpath("//div[12]/div/div/div[5]/div[3]")).click(); /* * ## Step 1 */ WebElement shape1 = this.elemHelper.FindElement(driver, By.xpath( "//div[@id='testWithShapes']/div/div/div[5]/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='path'][2]")); WebElement shape2 = this.elemHelper.FindElement(driver, By.xpath( "//div[@id='testWithShapes']/div/div/div[5]/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='path'][10]")); WebElement shape3 = this.elemHelper.FindElement(driver, By.xpath( "//div[@id='testWithShapes']/div/div/div[5]/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='path'][13]")); WebElement shape4 = this.elemHelper.FindElement(driver, By.xpath( "//div[@id='testWithShapes']/div/div/div[5]/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='path'][14]")); assertNotNull(shape1); assertNotNull(shape2); assertNotNull(shape3); assertNotNull(shape4); this.elemHelper.WaitForAttributeValue(driver, By.xpath( "//div[@id='testWithShapes']/div/div/div[5]/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='path'][2]"), "fill", "rgba(255,8,0,255)", 10); this.elemHelper.WaitForAttributeValue(driver, By.xpath( "//div[@id='testWithShapes']/div/div/div[5]/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='path'][10]"), "fill", "rgba(183,212,0,255)", 15); this.elemHelper.WaitForAttributeValue(driver, By.xpath( "//div[@id='testWithShapes']/div/div/div[5]/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='path'][13]"), "fill", "rgba(167,202,0,255)", 15); this.elemHelper.WaitForAttributeValue(driver, By.xpath( "//div[@id='testWithShapes']/div/div/div[5]/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='path'][14]"), "fill", "rgba(167,202,0,255)", 15); String attrFillShape1 = this.elemHelper.GetAttribute(driver, By.xpath( "//div[@id='testWithShapes']/div/div/div[5]/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='path'][2]"), "fill"); String attrFillShape2 = this.elemHelper.GetAttribute(driver, By.xpath( "//div[@id='testWithShapes']/div/div/div[5]/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='path'][10]"), "fill"); String attrFillShape3 = this.elemHelper.GetAttribute(driver, By.xpath( "//div[@id='testWithShapes']/div/div/div[5]/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='path'][13]"), "fill"); String attrFillShape4 = this.elemHelper.GetAttribute(driver, By.xpath( "//div[@id='testWithShapes']/div/div/div[5]/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g'][2]/*[local-name()='g']/*[local-name()='path'][14]"), "fill"); assertEquals("rgba(255,8,0,255)", attrFillShape1); assertEquals("rgba(183,212,0,255)", attrFillShape2); assertEquals("rgba(167,202,0,255)", attrFillShape3); assertEquals("rgba(167,202,0,255)", attrFillShape4); /* * ## Step 2 */ //Click in shape4 (England) and check it comes with red. String shapeId = shape1.getAttribute("id"); shape1.click(); //Wait for change color this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//*[local-name()='path' and @fill='red']")); WebElement shapeRed = this.elemHelper.FindElement(driver, By.id(shapeId)); assertEquals("red", shapeRed.getAttribute("fill")); //Related to issue CDE-317 Actions action = new Actions(driver); action.moveToElement(shape2).build().perform(); action.moveToElement(shape1).build().perform(); shapeId = shape1.getAttribute("id"); shapeRed = this.elemHelper.FindElement(driver, By.id(shapeId)); assertEquals("red", shapeRed.getAttribute("fill")); }
From source file:com.pentaho.ctools.cdf.CommentComponent.java
License:Apache License
/** * ############################### Test Case 5 ############################### * * Test Case Name://from w w w. jav a 2 s. co 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 va 2s . 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://w w w . j a v a 2 s .c om * 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); }
From source file:com.pentaho.ctools.cdf.require.CommentComponent.java
License:Apache License
/** * ############################### Test Case 5 ############################### * * Test Case Name:// w ww. j ava 2 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_RemoveComment_CommentRemoved() { this.log.info("tc5_RemoveComment_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 this.elemHelper.WaitForElementPresence(driver, 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); }