public MetricsAreaFragment getMetricsArea(String title) { ////// add property By selector = By.xpath( ".//table[contains(@class, '" + PropUtils.get("metrics.container.class") + "')][.//h3[text()='" + title + "']]"); WebElement element = null; try { element = getContentRoot().findElement(selector); } catch (NoSuchElementException exc) { return null; } MetricsAreaFragment area = Graphene.createPageFragment(MetricsAreaFragment.class, element); Map<String, String> metricGrid = element .findElement(By.className(PropUtils.get("metrics.grid.class"))) .findElements(By.tagName("tr")) .stream() .collect( Collectors.toMap( e -> e.findElement(By.className(PropUtils.get("metrics.grid.nominal.class"))) .getText(), e -> e.findElement(By.className(PropUtils.get("metrics.grid.numerical.class"))) .getText())); area.setMetricGrid(metricGrid); return area; }
private void waitForNewLine() { String emptyNameLabel = PropUtils.get("editor.shared.property.empty.key.label"); String emptyValueLabel = PropUtils.get("editor.shared.property.empty.value.label"); By selector = ByJQuery.selector( "tr:contains('" + emptyNameLabel + "')" + ":contains('" + emptyValueLabel + "')"); Graphene.waitGui().until().element(getTable().getRoot(), selector); }
public TestConnectionWindow testConnection() { String label = PropUtils.get("config.datasources.configarea.connection.test.label"); clickButton(label); Console.withBrowser(browser).waitUntilFinished(); String windowTitle = PropUtils.get("config.datasources.window.connection.test.head.label"); TestConnectionWindow window = Console.withBrowser(browser).openedWindow(windowTitle, TestConnectionWindow.class); return window; }
private ResourceTableRowFragment clickAddButton() { String cssClass = PropUtils.get("editor.shared.property.add.id"); By selector = ByJQuery.selector("button[id$='" + cssClass + "']"); WebElement button = root.findElement(selector); button.click(); waitForNewLine(); ResourceTableRowFragment row = getTable().getLastRow(); return row; }