List of usage examples for org.openqa.selenium WebElement clear
void clear();
From source file:com.nuxeo.functionaltests.ITAssetViewTest.java
License:Open Source License
@Test public void testIntellectualProperty() throws Exception { login("leela", "test"); DAMPage damPage = getDAMPage();//from ww w.j a va2s. c o m damPage = damPage.createAsset("File", "One File", "One File description", "Leela", "1/1/2012"); AssetViewFragment assetViewFragment = damPage.getAssetViewFragment(); FoldableBoxFragment ipBox = assetViewFragment.getFoldableBox("Intellectual Property", true); ipBox.checkTextToBeNotPresent("New holder"); ipBox.edit(); WebElement copyrightHolderInput = driver.findElement( By.id("nxl_gridDamLayout:nxw_damAssetViewIpRights_toggledForm:nxl_ip_rights:nxw_copyright_holder")); copyrightHolderInput.clear(); copyrightHolderInput.sendKeys("New holder"); ipBox.save(); Wait<WebDriver> wait = new FluentWait<WebDriver>(driver).withTimeout(5, TimeUnit.SECONDS) .pollingEvery(100, TimeUnit.MILLISECONDS).ignoring(NoSuchElementException.class); try { wait.until(new Function<WebDriver, WebElement>() { public WebElement apply(WebDriver driver) { return driver .findElement(By.xpath("//div[contains(.,'" + FILE_MODIFIED_NOTIFICATION_LABEL + "')]")); } }); } catch (TimeoutException e) { log.warn("Could not see saved message, maybe I was too slow and it " + "has already disappeared. Let's see if I can restore."); } ipBox.open(); ipBox.waitForTextToBePresent("New holder"); logout(); }
From source file:com.partnet.automation.HtmlView.java
License:Apache License
/** * Replaces the text in a WebElement with the provided text. * * <p>//from w w w .j ava 2s . c o m * This method uses the {@link HtmlView#clickElem(WebElement)} method. * * @param webElement * - target for update * @param value * - new value for the text of the WebElement * @return The {@link HtmlView} instance that invoked this method; enables * fluent calls */ protected HtmlView setValue(WebElement webElement, String value) { final String previousValue = getValue(webElement); LOG.debug("Replacing '{}' with '{}' on WebElement {}", previousValue, value, webElement); // htmlunit may not actually be replacing/putting in an empty value if (value == null) { value = ""; } for (int i = 0; i < 3; i++) { // click on elm, as suggested in // http://stackoverflow.com/questions/20936403/sendkeys-are-not-working-in-selenium-webdriver clickElem(webElement); webElement.clear(); webElement.sendKeys(value); String elmContent = webElement.getAttribute("value"); LOG.debug("New content of WebElement: '{}'", elmContent); if (!(elmContent.equalsIgnoreCase(value))) { LOG.warn("Setting WebElm {}\n" + "was not set to '{}'\n" + " but actually '{}'", webElement, value, elmContent); } // if the target field is not filled, retry. Do not retry with the equals // ignore case, because sometimes it // is actually testing if the field can be filled with x amount of chars. if (StringUtils.isBlank(elmContent) && StringUtils.isNotBlank(value)) { LOG.debug("Retry set web elm: {}", i); continue; } // field was correctly set break; } return this; }
From source file:com.pentaho.ctools.cdf.require.samples.Xmla.java
License:Apache License
/** * ############################### Test Case 1 ############################### * * Test Case Name:// ww w . j av a 2 s . c o m * Assert query results for XMLA first sample */ @Test public void tc1_XmlaQueryEnable_CheckForEnable() { this.log.info("tc1_XmlaQueryEnable_CheckForEnable"); //To set up this test we must enable xmla for SteelWheels datasource this.elemHelper.Get(driver, PageUrl.PUC); // NOTE - we have to wait for loading disappear this.elemHelper.WaitForElementPresence(driver, By.cssSelector("div.busy-indicator-container.waitPopup"), 20); this.elemHelper.WaitForElementNotPresent(driver, By.cssSelector("div.busy-indicator-container.waitPopup")); //Wait to load the new page this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='pucUserDropDown']/table/tbody/tr/td/div")); this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//iframe[@id='home.perspective']")); //Open File menu and select Manage Data Sources WebElement fileMenu = this.elemHelper.FindElement(driver, By.id("filemenu")); assertNotNull(fileMenu); fileMenu.click(); WebElement manageSources = this.elemHelper.FindElement(driver, By.id("manageDatasourceItem")); assertNotNull(manageSources); manageSources.click(); //Wait for datasources popup to open click "SteelWheels Analysis" and click edit WebElement dataPopup = this.elemHelper.FindElement(driver, By.xpath("//div[@class='pentaho-dialog']")); assertNotNull(dataPopup); WebElement steelSource = this.elemHelper.FindElement(driver, By.xpath("//div[@class='pentaho-dialog']//tbody//div[contains(text(),'SteelWheels')]")); assertNotNull(steelSource); steelSource.click(); WebElement settingsButton = this.elemHelper.FindElement(driver, By.xpath("//div[@class='pentaho-dialog']//div[@id='datasourceDropdownButton']/img")); assertNotNull(settingsButton); settingsButton.click(); WebElement optionsPopup = this.elemHelper.FindElement(driver, By.xpath("//div[@class='popupContent']")); assertNotNull(optionsPopup); WebElement editButton = this.elemHelper.FindElement(driver, By.xpath("//div[@class='popupContent']//td[contains(text(),'Edit...')]")); assertNotNull(editButton); editButton.click(); //On new popup select "Manual enter" and set Enable Xmla as true WebElement manualButton = this.elemHelper.FindElement(driver, By.xpath("//table[@id='manualRadio']//input")); assertNotNull(manualButton); this.elemHelper.ClickJS(driver, By.xpath("//table[@id='manualRadio']//input")); //Check if is already "TRUE" String setAsTrue = this.elemHelper.WaitForTextDifferentEmpty(driver, By.xpath("//div[@id='analysisParametersTree']//div[2]//tr[3]/td[2]")); if (setAsTrue.equalsIgnoreCase("true")) { assertEquals(setAsTrue, "true"); } else { WebElement enableXmla = this.elemHelper.FindElement(driver, By.xpath("//div[@id='analysisPreferencesDeck']//div[contains(text(),'EnableXmla')]")); assertNotNull(enableXmla); enableXmla.click(); WebElement editXmla = this.elemHelper.FindElement(driver, By.xpath("//div[@id='editutton']/img")); assertNotNull(editXmla); editXmla.click(); WebElement editXmlaInput = this.elemHelper.FindElement(driver, By.id("paramValueTextBox")); assertNotNull(editXmlaInput); editXmlaInput.clear(); editXmlaInput.sendKeys("true"); WebElement okButton = this.elemHelper.FindElement(driver, By.id("analysisParametersDialog_accept")); assertNotNull(okButton); okButton.click(); this.elemHelper.WaitForElementNotPresent(driver, By.xpath("//div[@class='pentaho-dialog'][3]")); setAsTrue = this.elemHelper .FindElement(driver, By.xpath("//div[@id='analysisParametersTree']//div[2]//tr[3]/td[2]")) .getText(); assertEquals(setAsTrue, "true"); WebElement saveButton = this.elemHelper.FindElementInvisible(driver, By.id("importDialog_accept")); assertNotNull(saveButton); this.elemHelper.ClickElementInvisible(driver, By.id("importDialog_accept")); this.elemHelper.WaitForElementNotPresent(driver, By.id("importDialog_accept")); WebElement closeButton = this.elemHelper.FindElement(driver, By.id("datasourceAdminDialog_cancel")); assertNotNull(closeButton); closeButton.click(); this.elemHelper.WaitForElementNotPresent(driver, By.id("datasourceAdminDialog_cancel")); } }
From source file:com.pentaho.ctools.cdf.samples.Xmla.java
License:Apache License
/** * ############################### Test Case 1 ############################### * * Test Case Name:// w w w.j av a 2s .c o m * Assert query results for XMLA first sample */ @Test public void tc1_XmlaQueryEnable_CheckForEnable() { this.log.info("tc1_XmlaQueryEnable_CheckForEnable"); //To set up this test we must enable xmla for SteelWheels datasource this.elemHelper.Get(driver, PageUrl.PUC); // NOTE //wait for visibility of waiting pop-up this.elemHelper.WaitForElementPresence(driver, By.cssSelector("div.busy-indicator-container.waitPopup"), 20); this.elemHelper.WaitForElementNotPresent(driver, By.cssSelector("div.busy-indicator-container.waitPopup")); //Wait to load the new page this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='pucUserDropDown']/table/tbody/tr/td/div")); this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//iframe[@id='home.perspective']")); //Open File menu and select Manage Data Sources WebElement fileMenu = this.elemHelper.FindElement(driver, By.id("filemenu")); assertNotNull(fileMenu); fileMenu.click(); WebElement manageSources = this.elemHelper.FindElement(driver, By.id("manageDatasourceItem")); assertNotNull(manageSources); manageSources.click(); //Wait for datasources popup to open click "SteelWheels Analysis" and click edit WebElement dataPopup = this.elemHelper.FindElement(driver, By.xpath("//div[@class='pentaho-dialog']")); assertNotNull(dataPopup); WebElement steelSource = this.elemHelper.FindElement(driver, By.xpath("//div[@class='pentaho-dialog']//tbody//div[contains(text(),'SteelWheels')]")); assertNotNull(steelSource); steelSource.click(); WebElement settingsButton = this.elemHelper.FindElement(driver, By.xpath("//div[@class='pentaho-dialog']//div[@id='datasourceDropdownButton']/img")); assertNotNull(settingsButton); settingsButton.click(); WebElement optionsPopup = this.elemHelper.FindElement(driver, By.xpath("//div[@class='popupContent']")); assertNotNull(optionsPopup); WebElement editButton = this.elemHelper.FindElement(driver, By.xpath("//div[@class='popupContent']//td[contains(text(),'Edit...')]")); assertNotNull(editButton); editButton.click(); //On new popup select "Manual enter" and set Enable Xmla as true WebElement manualButton = this.elemHelper.FindElement(driver, By.xpath("//table[@id='manualRadio']//input")); assertNotNull(manualButton); this.elemHelper.ClickJS(driver, By.xpath("//table[@id='manualRadio']//input")); //Check if is already "TRUE" String setAsTrue = this.elemHelper.WaitForTextDifferentEmpty(driver, By.xpath("//div[@id='analysisParametersTree']//div[2]//tr[3]/td[2]")); if (setAsTrue.equalsIgnoreCase("true")) { assertEquals(setAsTrue, "true"); } else { WebElement enableXmla = this.elemHelper.FindElement(driver, By.xpath("//div[@id='analysisPreferencesDeck']//div[contains(text(),'EnableXmla')]")); assertNotNull(enableXmla); enableXmla.click(); WebElement editXmla = this.elemHelper.FindElement(driver, By.xpath("//div[@id='editutton']/img")); assertNotNull(editXmla); editXmla.click(); WebElement editXmlaInput = this.elemHelper.FindElement(driver, By.id("paramValueTextBox")); assertNotNull(editXmlaInput); editXmlaInput.clear(); editXmlaInput.sendKeys("true"); WebElement okButton = this.elemHelper.FindElement(driver, By.id("analysisParametersDialog_accept")); assertNotNull(okButton); okButton.click(); this.elemHelper.WaitForElementNotPresent(driver, By.xpath("//div[@class='pentaho-dialog'][3]")); setAsTrue = this.elemHelper .FindElement(driver, By.xpath("//div[@id='analysisParametersTree']//div[2]//tr[3]/td[2]")) .getText(); assertEquals(setAsTrue, "true"); WebElement saveButton = this.elemHelper.FindElementInvisible(driver, By.id("importDialog_accept")); assertNotNull(saveButton); this.elemHelper.ClickElementInvisible(driver, By.id("importDialog_accept")); this.elemHelper.WaitForElementNotPresent(driver, By.id("importDialog_accept")); WebElement closeButton = this.elemHelper.FindElement(driver, By.id("datasourceAdminDialog_cancel")); assertNotNull(closeButton); closeButton.click(); this.elemHelper.WaitForElementNotPresent(driver, By.id("datasourceAdminDialog_cancel")); } }
From source file:com.pentaho.ctools.issues.cda.CDAExportToXls.java
License:Apache License
/** * ############################### Test Case 4 ############################### * * Test Case Name://from w ww . j a va 2 s . c om * Asserting that export to excel of query with String Array parameter empty works * Description: * The test pretends validate the CDA-144 issue, asserting that export to excel of query with String Array parameter empty works. * * Steps: * 1. Open sql-stringArrayjndi CDA sample and assert elements on page and select "Sql Query with String Array on SampleData - Jndi" on "dataAccessSelector" * 2. Wait for and assert elements and text on page. Clear parameter and refresh query * 3. Assert new text and elementss * 4. Export file and assure it has same md5 as expected * */ @Test public void tc04_CdaFileViewer_ExportEmptyStringArray() { this.log.info("tc04_CdaFileViewer_ExportEmptyStringArray"); /* * ## Step 1 */ //Go to sql-jdbc CDA sample driver.get(baseUrl + "plugin/cda/api/previewQuery?path=/public/plugin-samples/cda/cdafiles/sql-stringArray-jndi.cda"); //wait for invisibility of waiting pop-up this.elemHelper.WaitForElementInvisibility(driver, By.xpath("//div[@class='busy-indicator-container waitPopup']"), 180); //Wait for buttons: button, Cache This AND Query URL WebElement DataSelector = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.id("dataAccessSelector")); assertNotNull(DataSelector); Select select = new Select(this.elemHelper.FindElement(driver, By.id("dataAccessSelector"))); select.selectByVisibleText("Sql Query with String Array on SampleData - Jndi"); this.elemHelper.FindElement(driver, By.cssSelector("div.blockUI.blockOverlay")); this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"), 180); WebElement refreshButton = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//button[@id='button']")); assertNotNull(refreshButton); WebElement cacheButton = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//button[@id='cachethis']")); assertNotNull(cacheButton); WebElement queryButton = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//button[@id='queryUrl']")); assertNotNull(queryButton); WebElement element = this.elemHelper.FindElement(driver, By.id("dataAccessSelector")); assertNotNull(element); /* * ## Step 2 */ //Check the presented contains WebElement elemStatus = this.elemHelper.FindElement(driver, By.id("countries")); assertEquals("France;USA", elemStatus.getAttribute("value")); //Check text on table String columnOneRowOne = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//table[@id='contents']/tbody/tr/td")); String columnTwoRowOne = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//table[@id='contents']/tbody/tr/td[2]")); assertEquals("Alpha Cognac", columnOneRowOne); assertEquals("61100", columnTwoRowOne); elemStatus = this.elemHelper.FindElement(driver, By.id("countries")); elemStatus.clear(); refreshButton = this.elemHelper.FindElement(driver, By.xpath("//button[@id='button']")); assertNotNull(refreshButton); refreshButton.click(); /* * ## Step 3 */ //wait to render page this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay"), 180); //Check the presented contains elemStatus = this.elemHelper.FindElement(driver, By.id("countries")); assertEquals("", elemStatus.getAttribute("value")); //Check text on table columnOneRowOne = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//table[@id='contents']/tbody/tr/td")); assertEquals("No results.", columnOneRowOne); //Export query WebElement buttonExport = this.elemHelper.FindElement(driver, By.id("export")); assertNotNull(buttonExport); try { //Delete the existence if exist new File(this.exportFilePath).delete(); this.log.info(this.exportFilePath); //Click to export buttonExport.click(); //Wait for file to be created in the destination dir DirectoryWatcher dw = new DirectoryWatcher(); dw.WatchForCreate(downloadDir); //Check if the file really exist File exportFile = new File(this.exportFilePath); assertTrue(exportFile.exists()); //Wait for the file to be downloaded totally for (int i = 0; i < 50; i++) { //we only try 50 times == 5000 ms long nSize = FileUtils.sizeOf(exportFile); //Since the file always contents the same data, we wait for the expected bytes if (nSize >= 249856) { break; } Thread.sleep(100); } //Check if the file downloaded is the expected String md5 = DigestUtils.md5Hex(Files.readAllBytes(exportFile.toPath())); assertEquals(md5, "ae1fb420a78099b25fa03d7e10207d47"); //The delete file DeleteFile(); } catch (Exception e) { this.log.error(e.getMessage()); } }
From source file:com.pentaho.ctools.issues.cda.CDAQueryFail.java
License:Apache License
/** * ############################### Test Case 1 ############################### * * Test Case Name:/*from w w w . j a va2 s. c o m*/ * Asserting functionalities on query fail * Description: * CDA-123: Feedback given when query fails * CDA-147: Can change parameter when query fails and refresh query * CDA-145: Adding outputColumnName to the URL filters the query results * * Steps: * 1. Select "Sql Query on SampleData - Jndi" on "dataAccessSelector" and assert error message * 2. Change value on salesParam box to 10000 and refresh query * 3. Wait for and assert elements and text on page * 4. Open the query with outpuColumnName in the URL and assert results were filtered * */ @Test public void tc01_CdaFileViewer_QueryFail() { this.log.info("tc01_CdaFileViewer_QueryFail"); /* * ## Step 1 */ //Open Issue Sample driver.get(baseUrl + "plugin/cda/api/previewQuery?path=/public/Issues/CDA/CDA-118/sql-jndi.cda"); //wait for invisibility of waiting pop-up this.elemHelper.WaitForElementInvisibility(driver, By.xpath("//div[@class='busy-indicator-container waitPopup']")); //Wait for data selector and select available option WebElement dataAccess = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.id("dataAccessSelector")); assertNotNull(dataAccess); Select select = new Select(this.elemHelper.FindElement(driver, By.id("dataAccessSelector"))); select.selectByVisibleText("Sql Query on SampleData - Jndi"); //wait to render page this.elemHelper.FindElement(driver, By.cssSelector("div.blockUI.blockOverlay")); this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay")); //Assert error message String errorMessage = this.elemHelper.WaitForElementPresentGetText(driver, By.cssSelector("span.error-status")); assertEquals("Error Executing Query", errorMessage); /* * ## Step 2 */ WebElement salesParam = this.elemHelper.FindElement(driver, By.id("sales")); assertNotNull(salesParam); salesParam.clear(); salesParam.sendKeys("10000"); WebElement refreshButton = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//button[@id='button']")); assertNotNull(refreshButton); refreshButton.click(); /* * ## Step 3 */ //wait to render page this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay")); //Assert elements on page WebElement cacheButton = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//button[@id='cachethis']")); assertNotNull(cacheButton); WebElement queryButton = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//button[@id='queryUrl']")); assertNotNull(queryButton); //Check the presented contains WebElement newSalesParam = this.elemHelper.FindElement(driver, By.id("sales")); assertEquals("10000", newSalesParam.getAttribute("value")); //Check text on table String columnOneRowOne = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//table[@id='contents']/tbody/tr/td")); String columnTwoRowOne = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//table[@id='contents']/tbody/tr/td[2]")); assertEquals("Cancelled", columnOneRowOne); assertEquals("2004", columnTwoRowOne); /* * ## Step 4 */ //Open Sample with outpuColumnName in the URL driver.get(baseUrl + "plugin/cda/api/doQuery?paramsales=10000¶morderDate=2004-03-01&path=%2Fpublic%2FIssues%2FCDA%2FCDA-118%2Fsql-jndi.cda&dataAccessId=1&outputIndexId=1&&outputColumnName=STATUS"); //Assert query result String result = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//body")); assertEquals( "{\"queryInfo\":{\"totalRows\":\"6\"},\"resultset\":[[\"Shipped\"],[\"Cancelled\"],[\"Shipped\"],[\"Disputed\"],[\"On Hold\"],[\"In Process\"]],\"metadata\":[{\"colIndex\":0,\"colType\":\"String\",\"colName\":\"STATUS\"}]}", result); }
From source file:com.pentaho.ctools.issues.cde.CDE417.java
License:Apache License
/** * ############################### Test Case 1 ############################### * * Test Case Name: //w w w . j a va 2 s.c om * Popup Export issues * * Description: * CDE-417 issue, so when user clicks to export chart, popup shown has chart preview. * CDE-424 issue we'll delete the .js file prior to opening the dashboard and saving the dashboard should create * the .js file again and enable exporting. * CDF-448 exporting chart with skip ticks (chart is too small to show all labels) is successful * CDF-502 export chart with array parameters is successful * CDE-514 all charts are available on charts to export property and all elements are available on the data to export property * * Steps: * 424 * 1. Open PUC and click Browse Files * 2. Go to dashboard folder, click countryChart.js file and click Move To Trash * 3. Open created sample and save Dashboard * 514 * 4. Go to Export Component and assert all charts appear on the Chart to Export property * 5. Assert all charts and the table appear on data to export property * * 417/448/502 * 6. Click to export chart, click export, assert chart is shown and assert export works as expected (448 and 502) * 7. Click to export chart2, click export, assert chart is shown and assert export works as expected * * @throws InterruptedException * */ @Test public void tc01_PopupExportComponent_PreviewerRendersChart() throws InterruptedException { this.log.info("tc01_PopupExportComponent_PreviewerRendersChart"); /* * ## Step 1 */ //Show Hidden Files BrowseFiles browser = new BrowseFiles(driver); if (!PUCSettings.SHOWHIDDENFILES) { browser.CheckShowHiddenFiles(); } /* * ## Step 2 */ //String pathChart = "/public/Issues/CDF/CDF-548/chart.js"; //String pathCdfChart = "/public/Issues/CDF/CDF-548/CDF-548_chart.js"; String pathCountryChart = "/public/Issues/CDF/CDF-548/countryChart.js"; String pathCdfCountryChart = "/public/Issues/CDF/CDF-548/CDF-548_countryChart.js"; //boolean fileDeleteChart = browser.DeleteFile( pathChart ); //boolean fileDeleteCdfChart = browser.DeleteFile( pathCdfChart ); boolean fileDeleteCountryChart = browser.DeleteFile(pathCountryChart); boolean fileDeleteCdfCountryChart = browser.DeleteFile(pathCdfCountryChart); //assertTrue( fileDeleteChart ); //assertTrue( fileDeleteCdfChart ); assertTrue(fileDeleteCountryChart); assertTrue(fileDeleteCdfCountryChart); driver.switchTo().defaultContent(); WebDriver frame = driver.switchTo().frame("browser.perspective"); this.elemHelper.WaitForAttributeValue(frame, By.xpath("//div[@id='fileBrowserFiles']/div[2]/div[1]"), "title", "CDF-548.cda"); String nameOfCdf548Wcdf = this.elemHelper.GetAttribute(frame, By.xpath("//div[@id='fileBrowserFiles']/div[2]/div[1]"), "title"); assertEquals("CDF-548.cda", nameOfCdf548Wcdf); /* * ## Step 3 */ // Go to Export Popup Component sample in Edit mode driver.get(baseUrl + "api/repos/%3Apublic%3AIssues%3ACDF%3ACDF-548%3ACDF-548.wcdf/edit"); //Save Dashboard WebElement saveButton = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.id("Save")); assertNotNull(saveButton); this.elemHelper.Click(driver, By.id("Save")); WebElement saveNotify = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.cssSelector("div.notify-bar-message")); assertNotNull(saveNotify); String saveMessage = this.elemHelper.WaitForElementPresentGetText(driver, By.cssSelector("div.notify-bar-message")); assertEquals("Dashboard saved successfully", saveMessage); /* * ## Step 4 */ //Go to components panel and expand "Others" WebElement componentsPanelButton = this.elemHelper.FindElement(driver, By.cssSelector("div.componentsPanelButton")); assertNotNull(componentsPanelButton); componentsPanelButton.click(); WebElement componentsTable = this.elemHelper.FindElement(driver, By.id("cdfdd-components-components")); assertNotNull(componentsTable); WebElement othersExpander = this.elemHelper.FindElement(driver, By.xpath("//table[@id='table-cdfdd-components-components']//tr[@id='OTHERCOMPONENTS']/td/span")); assertNotNull(othersExpander); othersExpander.click(); //Select Export Popup Component WebElement exportPopupElement = this.elemHelper.FindElement(driver, By.xpath("//table[@id='table-cdfdd-components-components']//td[contains(text(),'exportPopup')]")); assertNotNull(exportPopupElement); exportPopupElement.click(); //Open options for Chart Component to Export and assert "chart" and "countryChart" WebElement chartExportProperty = this.elemHelper.FindElement(driver, By.xpath( "//table[@id='table-cdfdd-components-properties']//td[@title='Id for Chart Component to Export']/../td[2]")); assertNotNull(chartExportProperty); chartExportProperty.click(); WebElement chartExportInput = this.elemHelper.FindElement(driver, By.xpath( "//table[@id='table-cdfdd-components-properties']//td[@title='Id for Chart Component to Export']/../td[2]/form/input")); assertNotNull(chartExportInput); chartExportInput.clear(); Robot robot; try { robot = new Robot(); robot.keyPress(KeyEvent.VK_DOWN); robot.keyRelease(KeyEvent.VK_DOWN); } catch (AWTException e) { e.printStackTrace(); } WebElement chartExportOptions = this.elemHelper.FindElement(driver, By.xpath("//body/ul")); assertNotNull(chartExportOptions); String chartOption1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//body/ul/li/a")); String chartOption2 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//body/ul/li[2]/a")); assertEquals("chart", chartOption1); assertEquals("countryChart", chartOption2); this.elemHelper.Click(driver, By.xpath("//body/ul/li/a")); /* * ## Step 5 */ //Open options for Data Component to Export and assert "table", "chart" and "countryChart" WebElement dataExportProperty = this.elemHelper.FindElement(driver, By.xpath( "//table[@id='table-cdfdd-components-properties']//td[@title='Id for Data Component to Export']/../td[2]")); assertNotNull(dataExportProperty); dataExportProperty.click(); WebElement dataExportInput = this.elemHelper.FindElement(driver, By.xpath( "//table[@id='table-cdfdd-components-properties']//td[@title='Id for Data Component to Export']/../td[2]/form/input")); assertNotNull(dataExportInput); dataExportInput.clear(); Robot robot1; try { robot1 = new Robot(); robot1.keyPress(KeyEvent.VK_DOWN); robot1.keyRelease(KeyEvent.VK_DOWN); } catch (AWTException e) { e.printStackTrace(); } WebElement dataExportOptions = this.elemHelper.FindElement(driver, By.xpath("//body/ul")); assertNotNull(dataExportOptions); String dataOption1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//body/ul/li/a")); String dataOption2 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//body/ul/li[2]/a")); String dataOption3 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//body/ul/li[3]/a")); assertEquals("table", dataOption1); assertEquals("chart", dataOption2); assertEquals("countryChart", dataOption3); /* * ## Step 6 */ driver.get(baseUrl + "api/repos/%3Apublic%3AIssues%3ACDF%3ACDF-548%3ACDF-548.wcdf/generatedContent"); this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay")); //Click export Button WebElement exportChartButton = this.elemHelper.FindElement(driver, By.xpath("//div[@id='export']/div")); assertNotNull(exportChartButton); exportChartButton.click(); //Assert popup and click Export Chart link WebElement exportChartLink = this.elemHelper.FindElement(driver, By.cssSelector("div.exportElement")); assertNotNull(exportChartLink); exportChartLink.click(); //Assert chart popup WebElement exportChartPopup = this.elemHelper.FindElement(driver, By.id("fancybox-content")); assertNotNull(exportChartPopup); // Check URL of displayed image String chartSRCUrl = this.elemHelper.GetAttribute(driver, By.xpath("//div[@id='fancybox-content']/div/div/div/div[2]/img"), "src"); assertEquals(baseUrl + "plugin/cgg/api/services/draw?outputType=png&script=%2Fpublic%2FIssues%2FCDF%2FCDF-548%2Fchart.js¶mcountries=France¶mcountries=USA¶mwidth=400¶mheight=400", chartSRCUrl); assertEquals(200, HttpUtils.GetResponseCode(chartSRCUrl, "admin", "password")); // Export chart and assert export was successful WebElement chartExportButton = this.elemHelper.FindElement(driver, By.cssSelector("div.exportChartPopupButton.exportChartOkButton")); assertNotNull(chartExportButton); //Click export and assert file is correctly downloaded try { //Delete the existence if exist new File(this.exportFilePath).delete(); //Click to export chartExportButton.click(); //Wait for file to be created in the destination dir DirectoryWatcher dw = new DirectoryWatcher(); dw.WatchForCreate(downloadDir); //Check if the file really exist File exportFile = new File(this.exportFilePath); // assertTrue(exportFile.exists()); //Wait for the file to be downloaded totally for (int i = 0; i < 50; i++) { //we only try 50 times == 5000 ms long nSize = FileUtils.sizeOf(exportFile); //Since the file always contents the same data, we wait for the expected bytes if (nSize >= 10000) { break; } this.log.info("BeforeSleep " + nSize); Thread.sleep(100); } this.log.info("File size :" + FileUtils.sizeOf(exportFile)); //Check if the file downloaded is the expected String md5 = DigestUtils.md5Hex(Files.readAllBytes(exportFile.toPath())); assertEquals(md5, "c8c3ad02461f7b5c8a36ee2aec0eca95"); //The delete file DeleteFile(); } catch (Exception e) { this.log.error(e.getMessage()); } // Close dialog box this.elemHelper.Click(driver, By.id("fancybox-close")); assertTrue(this.elemHelper.WaitForElementNotPresent(driver, By.xpath("//div[@id='fancybox-content']/div/div/div/div/div[1]"))); /* * ## Step 7 */ this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.exportElement")); //Click export Button WebElement exportCountryChartButton = this.elemHelper.FindElement(driver, By.xpath("//div[@id='export2']/div")); assertNotNull(exportCountryChartButton); exportCountryChartButton.click(); //Assert popup and click Export Chart link WebElement exportCountryChartLink = this.elemHelper.FindElement(driver, By.xpath("//div[contains(text(),'Export Chart2')]")); assertNotNull(exportCountryChartLink); exportCountryChartLink.click(); //Assert chart popup WebElement exportCountryChartPopup = this.elemHelper.FindElement(driver, By.id("fancybox-content")); assertNotNull(exportCountryChartPopup); // Check URL of displayed image String countryChartSRCUrl = this.elemHelper.GetAttribute(driver, By.xpath("//div[@id='fancybox-content']/div/div/div/div[2]/img"), "src"); assertEquals(baseUrl + "plugin/cgg/api/services/draw?outputType=svg&script=%2Fpublic%2FIssues%2FCDF%2FCDF-548%2FcountryChart.js¶mwidth=400¶mheight=300", countryChartSRCUrl); assertEquals(200, HttpUtils.GetResponseCode(countryChartSRCUrl, "admin", "password")); // Export chart and assert export was successful WebElement countryChartExportButton = this.elemHelper.FindElement(driver, By.cssSelector("div.exportChartPopupButton.exportChartOkButton")); assertNotNull(countryChartExportButton); //Click export and assert file is correctly downloaded try { //Delete the existence if exist new File(this.exportFilePath2).delete(); //Click to export countryChartExportButton.click(); //Wait for file to be created in the destination dir DirectoryWatcher dw = new DirectoryWatcher(); dw.WatchForCreate(downloadDir); //Check if the file really exist File exportFile = new File(this.exportFilePath2); // assertTrue(exportFile.exists()); //Wait for the file to be downloaded totally for (int i = 0; i < 50; i++) { //we only try 50 times == 5000 ms long nSize = FileUtils.sizeOf(exportFile); //Since the file always contents the same data, we wait for the expected bytes if (nSize >= 30000) { break; } this.log.info("BeforeSleep " + nSize); Thread.sleep(100); } this.log.info("File size :" + FileUtils.sizeOf(exportFile)); //Check if the file downloaded is the expected String md5 = DigestUtils.md5Hex(Files.readAllBytes(exportFile.toPath())); assertEquals(md5, "c0d04625306dd1f32afed115c0bf94be"); //The delete file DeleteFile(); } catch (Exception e) { this.log.error(e.getMessage()); } // Close dialog box this.elemHelper.Click(driver, By.id("fancybox-close")); assertTrue(this.elemHelper.WaitForElementNotPresent(driver, By.xpath("//div[@id='fancybox-content']/div/div/div/div/div[1]"))); }
From source file:com.pentaho.ctools.issues.cde.CDE430.java
License:Apache License
/** * ############################### Test Case 1 ############################### * * Test Case Name: /* w ww .j av a 2 s . c o m*/ * Assert Popup Export Component properties show list with type options * * Description: * The test pretends validate the CDE-430 issue, so when user clicks the down arron when Chart Exprt or Data Export Types are * selected, a drop down list is shown with valid type options * * Steps: * 1. Open new CDE dashboard and go to Components Panel * 2. Add Export Popup Component and go to Advanced Properties * 3. Assert list is shown for Chart Export Type * 4. Assert list is shown for Data Export Type */ @Test public void tc01_PopupExportComponent_TypeListShown() { this.log.info("tc01_PopupExportComponent_TypeListShown"); /* * ## Step 1 */ //New CDE dashboard driver.get(PageUrl.CDE_DASHBOARD); this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay")); //Go to components Panel WebElement componentsButton = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@class='componentsPanelButton']")); assertNotNull(componentsButton); componentsButton.click(); WebElement componentsPanel = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.id("panel-componentens_panel")); assertNotNull(componentsPanel); /* * ## Step 2 */ //Add Export Popup Component WebElement expandOthers = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath( "//div[@id='cdfdd-components-pallete']/div[@id='cdfdd-components-palletePallete']/div[2]/h3/a")); assertNotNull(expandOthers); expandOthers.click(); WebElement exportPopup = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='cdfdd-components-palletePallete']//a[@title='Export Popup Component']")); assertNotNull(exportPopup); exportPopup.click(); //Click Advanced Properties WebElement advancedProperties = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath( "//div[@id='cdfdd-components-properties']/div/div/div[@class='advancedProperties propertiesUnSelected']")); assertNotNull(advancedProperties); advancedProperties.click(); this.elemHelper.WaitForAttributeValueEqualsTo(driver, By.xpath("//div[@id='cdfdd-components-properties']/div/div/div[3]"), "class", "advancedProperties propertiesSelected"); /* * ## Step 3 */ //Assert list appears for Chart Types to Export WebElement chartType = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//td[@title='Type for Chart Image to Export']/../td[2]")); assertNotNull(chartType); chartType.click(); WebElement inputChart = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//td[@title='Type for Chart Image to Export']/../td[2]/form/input")); assertNotNull(inputChart); inputChart.clear(); /* Robot robot1; try { robot1 = new Robot(); robot1.keyPress( KeyEvent.VK_ENTER ); robot1.keyRelease( KeyEvent.VK_ENTER ); robot1.keyPress( KeyEvent.VK_ENTER ); robot1.keyRelease( KeyEvent.VK_ENTER ); robot1.keyPress( KeyEvent.VK_DOWN ); robot1.keyRelease( KeyEvent.VK_DOWN ); } catch ( AWTException e ) { e.printStackTrace(); }*/ Actions a = new Actions(driver); a.sendKeys(Keys.ENTER).sendKeys(Keys.ENTER).sendKeys(Keys.DOWN).build().perform(); WebElement listOption1 = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//body/ul/li/a")); assertNotNull(listOption1); String textOption1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//body/ul/li/a")); assertEquals("png", textOption1); WebElement listOption2 = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//body/ul/li[2]/a")); assertNotNull(listOption2); String textOption2 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//body/ul/li[2]/a")); assertEquals("svg", textOption2); a.sendKeys(Keys.ENTER).sendKeys(Keys.ENTER).build().perform(); this.elemHelper.WaitForElementNotPresent(driver, By.xpath("//body/ul/li/a")); /* * ## Step 4 */ //Assert list appears for Data Types to Export WebElement dataType = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//td[@title='Type for Data File to Export']/../td[2]")); assertNotNull(dataType); dataType.click(); WebElement inputData = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//td[@title='Type for Data File to Export']/../td[2]/form/input")); assertNotNull(inputData); inputData.clear(); /*try { robot1 = new Robot(); robot1.keyPress( KeyEvent.VK_ENTER ); robot1.keyRelease( KeyEvent.VK_ENTER ); robot1.keyPress( KeyEvent.VK_ENTER ); robot1.keyRelease( KeyEvent.VK_ENTER ); robot1.keyPress( KeyEvent.VK_DOWN ); robot1.keyRelease( KeyEvent.VK_DOWN ); } catch ( AWTException e ) { e.printStackTrace(); }*/ a.sendKeys(Keys.ENTER).sendKeys(Keys.ENTER).sendKeys(Keys.DOWN).build().perform(); listOption1 = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//body/ul/li/a")); assertNotNull(listOption1); textOption1 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//body/ul/li/a")); assertEquals("xls", textOption1); listOption2 = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//body/ul/li[2]/a")); assertNotNull(listOption2); textOption2 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//body/ul/li[2]/a")); assertEquals("csv", textOption2); WebElement listOption3 = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//body/ul/li[3]/a")); assertNotNull(listOption3); String textOption3 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//body/ul/li[3]/a")); assertEquals("xml", textOption3); WebElement listOption4 = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//body/ul/li[4]/a")); assertNotNull(listOption4); String textOption4 = this.elemHelper.WaitForElementPresentGetText(driver, By.xpath("//body/ul/li[4]/a")); assertEquals("json", textOption4); }
From source file:com.pentaho.ctools.issues.cde.CDEMapComponentReference.java
License:Apache License
/** * ############################### Test Case 1 ############################### * * Test Case Name://from w w w .j a va 2s . c o m * Changing width and height of map popup has desired effect * * Description: * The test pretends validate the CDE-267 issue, editing the width and * height of the popup generated when clicking a map's marker has the * desired effect. * * Steps: * 1. Open sample in edit mode, go to components Panel and select GeoLocalized Map * 2. Go to advanced properties, set popupWidth to 300 and popupHeight to 100 and click preview * 3. Find map with alterations, click a marker and assert shown popup has chosen width and height */ @Test public void tc01_CdeDashboard_MapPopupDimensions() { this.log.info("tc01_CdeDashboard_MapPopupDimensions"); /* * ## Step 1 */ //Open sample in edit mode driver.get(PageUrl.MAP_COMPONENT_REFERENCE_EDIT_6x); this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay")); //assert buttons and go to Components Panel WebElement layoutPanel = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@class='layoutPanelButton']")); assertNotNull(layoutPanel); WebElement componentPanel = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@class='componentsPanelButton']")); assertNotNull(componentPanel); WebElement dataPanel = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@class='datasourcesPanelButton']")); assertNotNull(dataPanel); componentPanel.click(); //Assert components table and expand Maps this.elemHelper.WaitForElementInvisibility(driver, By.xpath("//div[@id='cdfdd-panels']/div[@id='panel-layout_panel']")); WebElement componentsPanel = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='cdfdd-panels']/div[@id='panel-componentens_panel']")); assertNotNull(componentsPanel); WebElement tableTitle = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath( "//div[@id='panel-componentens_panel']//div[@id='cdfdd-components-components']/div/div/div")); assertNotNull(tableTitle); WebElement groupExpander = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='cdfdd-components-components']/div/div[2]/table/tbody/tr/td/span")); assertNotNull(groupExpander); groupExpander.click(); //Find and select GeoLocalized Map WebElement geoMap = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath( "//div[@id='cdfdd-components-components']/div/div[2]/table/tbody//td[contains(text(), 'GeoLocalizedMap')]")); assertNotNull(geoMap); geoMap.click(); /* * ## Step 2 */ //Click Advanced Properties and wait for it to be selected WebElement advancedProperties = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath( "//div[@id='cdfdd-components-properties']/div/div/div[@class='advancedProperties propertiesUnSelected']")); assertNotNull(advancedProperties); this.elemHelper.ClickJS(driver, By.xpath( "//div[@id='cdfdd-components-properties']/div/div/div[@class='advancedProperties propertiesUnSelected']")); this.elemHelper.WaitForAttributeValueEqualsTo(driver, By.xpath("//div[@id='cdfdd-components-properties']/div/div/div[2]"), "class", "advancedProperties propertiesSelected"); //Look for Popup Height and change it's value to 100 WebElement popupHeight = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath( "//table[@id='table-cdfdd-components-properties']/tbody//td[@title=' Height for the popup window']/../td[2]")); assertNotNull(popupHeight); popupHeight.click(); WebElement inputHeight = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath( "//table[@id='table-cdfdd-components-properties']/tbody//td[@title=' Height for the popup window']/../td[2]/form/input")); inputHeight.clear(); inputHeight.sendKeys("100"); this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath( "//table[@id='table-cdfdd-components-properties']/tbody//td[@title=' Height for the popup window']")) .click(); //Look for Popup Width and change it's value to 300 WebElement popupWidth = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath( "//table[@id='table-cdfdd-components-properties']/tbody//td[@title=' Width for the popup window ']/../td[2]")); assertNotNull(popupWidth); popupWidth.click(); WebElement inputWidth = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath( "//table[@id='table-cdfdd-components-properties']/tbody//td[@title=' Width for the popup window ']/../td[2]/form/input")); inputWidth.clear(); inputWidth.sendKeys("300"); this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath( "//table[@id='table-cdfdd-components-properties']/tbody//td[@title=' Width for the popup window ']")) .click(); //Click Preview and wait for fancybox to show WebElement previewButton = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.id("previewButton")); assertNotNull(previewButton); previewButton.click(); WebElement fancyboxFrame = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.id("fancybox-frame")); assertNotNull(fancyboxFrame); /* * ## Step 3 */ //Switch to iFrame driver.switchTo().frame(fancyboxFrame); //Wait for blocker to disappear this.elemHelper.WaitForElementPresenceAndVisible(driver, By.cssSelector("div.blockUI.blockOverlay")); this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay")); //Look for map that was changed and assert it's width and height WebElement mapWithGeo = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.id("testWithGeoLocalization")); assertNotNull(mapWithGeo); WebElement marker = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath( "//div[@id='testWithGeoLocalization']/div[2]/div/div/div[5]/*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']/*[local-name()='g'][3]/*[local-name()='g']/*[local-name()='circle'][4]")); assertNotNull(marker); marker.click(); WebElement popup = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.cssSelector("div.olPopupContent")); assertNotNull(popup); assertEquals(popup.getAttribute("style"), "width: 300px; height: 100px; position: relative;"); }
From source file:com.pentaho.ctools.issues.cdf.CDF149.java
License:Apache License
/** * ############################### Test Case 1 ############################### * * Test Case Name:// w ww . j a v a2 s .c o m * Assert Values Normalized property is exposed and working * * Description: * The test pretends validate the CDF-149 issue, so Values Normalized property is exposed and when set * to True makes chart bars appear as percentage. * * Steps: * 1. Open CDE Sample, go to Components Panel and select the Bar Chart * 2. Click Advanced Properties and set Values Normalized to true * 3. Click Preview and assert bars are rendered as percentage of total */ @Test public void tc01_CCCBarChart_ValuesNormalized() { this.log.info("tc01_CCCBarChart_ValuesNormalized"); /* * ## Step 1 */ //Open CDE Sample driver.get(baseUrl + "api/repos/%3Apublic%3Aplugin-samples%3Apentaho-cdf-dd%3Acde_sample1.wcdf/wcdf.edit"); //Assert Panel selectors and select Components WebElement element = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@class='cdfdd-modes']/div[@title='Datasources Panel']")); assertNotNull(element); element = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@class='cdfdd-modes']/div[@title='Components Panel']")); assertNotNull(element); element = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@class='cdfdd-modes']/div[@title='Layout Panel']")); assertNotNull(element); this.elemHelper.Click(driver, By.xpath("//div[@class='cdfdd-modes']/div[@title='Components Panel']/a")); String text = this.elemHelper.GetAttribute(driver, By.xpath("//div[@class='cdfdd-modes']/div[@title='Components Panel']"), "class"); assertEquals("panelButton panelButton-active", text); //Select Bar Chart element = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='cdfdd-components-components']//tr[@id='CHARTS']/td/span")); assertNotNull(element); element.click(); element = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//div[@id='cdfdd-components-components']//tr[2]/td")); assertNotNull(element); text = element.getText(); assertEquals("CCC Bar Chart", text); element.click(); text = this.elemHelper.GetAttribute(driver, By.xpath("//div[@id='cdfdd-components-components']//tr[2]"), "class"); assertEquals("child-of-CHARTS initialized collapsed ui-state-active", text); /* * ## Step 2 */ //Click Advanced Properties element = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.cssSelector("div.advancedProperties.propertiesUnSelected")); assertNotNull(element); element.click(); element = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath( "//table[@id='table-cdfdd-components-properties']//td[@title='Priority for component execution component. Lower values have higher priority']")); assertNotNull(element); element = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.cssSelector("div.advancedProperties.propertiesSelected")); assertNotNull(element); //Find Values Normalized property and set it's value to True element = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath("//table[@id='table-cdfdd-components-properties']//td[text()='valuesNormalized']")); assertNotNull(element); element = this.elemHelper.WaitForElementPresenceAndVisible(driver, By .xpath("//table[@id='table-cdfdd-components-properties']//td[text()='valuesNormalized']/../td[2]")); assertNotNull(element); element.click(); WebElement normalizedInput = this.elemHelper.WaitForElementPresenceAndVisible(driver, By.xpath( "//table[@id='table-cdfdd-components-properties']//td[text()='valuesNormalized']/../td[2]/form/input")); normalizedInput.clear(); normalizedInput.sendKeys("True"); normalizedInput.sendKeys(Keys.ENTER); text = this.elemHelper.WaitForElementPresentGetText(driver, By .xpath("//table[@id='table-cdfdd-components-properties']//td[text()='valuesNormalized']/../td[2]")); assertEquals("True", text); /* * ## Step 3 */ //Click Preview button this.elemHelper.Click(driver, By.id("previewButton")); //Wait for fancybox and assert chart is rendered and height legends are to 100 WebElement elementFrame = this.elemHelper.FindElement(driver, By.xpath("//iframe")); WebDriver frame = driver.switchTo().frame(elementFrame); this.elemHelper.WaitForElementInvisibility(driver, By.cssSelector("div.blockUI.blockOverlay")); element = this.elemHelper.WaitForElementPresenceAndVisible(frame, By.id("chartprotovis")); assertNotNull(element); element = this.elemHelper.WaitForElementPresenceAndVisible(frame, By.xpath( "//div[@id='chartprotovis']/*[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'][4]/*[local-name()='rect'][2]")); assertNotNull(element); element = this.elemHelper.WaitForElementPresenceAndVisible(frame, By.xpath( "//div[@id='chartprotovis']/*[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'][4]/*[local-name()='rect'][3]")); assertNotNull(element); element = this.elemHelper.WaitForElementPresenceAndVisible(frame, By.xpath( "//div[@id='chartprotovis']/*[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'][4]/*[local-name()='rect'][1]")); assertNotNull(element); element = this.elemHelper.WaitForElementPresenceAndVisible(frame, By.xpath( "//div[@id='chartprotovis']/*[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'][4]/*[local-name()='rect'][4]")); assertNotNull(element); element = this.elemHelper.WaitForElementPresenceAndVisible(frame, By.xpath( "//div[@id='chartprotovis']/*[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'][4]/*[local-name()='rect'][5]")); assertNotNull(element); element = this.elemHelper.WaitForElementPresenceAndVisible(frame, By.xpath( "//div[@id='chartprotovis']/*[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'][4]/*[local-name()='rect'][6]")); assertNotNull(element); element = this.elemHelper.WaitForElementPresenceAndVisible(frame, By.xpath( "//div[@id='chartprotovis']/*[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'][4]/*[local-name()='rect'][7]")); assertNotNull(element); element = this.elemHelper.WaitForElementPresenceAndVisible(frame, By.xpath( "//div[@id='chartprotovis']/*[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'][5]/*[local-name()='g']//*[local-name()='text'][text()='100']")); assertNotNull(element); }