@Override public void perform() { Graphene.waitGui().until().element(item).attribute("class").contains(OrderingListInPickList.SELECTED_ITEM_CLASS); } })
@When("^I eat (\\d+) cukes$") public void eatCukes(int cukes) throws IOException { waitAjax()/*we just loaded the page*/.until().element(bellyMouth).is().present(); bellyMouth.sendKeys(Integer.toString(cukes)); final File screenshot = new File("target/screenshots/eatCukes.png"); screenshot.getParentFile().mkdirs(); try (final OutputStream os = new FileOutputStream(screenshot)) { os.write(TakesScreenshot.class.cast(browser).getScreenshotAs(OutputType.BYTES)); } waitGui()/*we are already on the page so faster wait cycle*/.until().element(bellyEat).is().present(); bellyEat.click(); }
@Override public void selectAllRowsWithKeyShortcut() { advanced().getTableBodyElement().sendKeys(Keys.chord(Keys.CONTROL, "a")); if (advanced().getTableRowsElements().size() >= 1) { Graphene.waitAjax().until().element(advanced().getTableRowsElements().get(0)).attribute("class") .contains(advanced().getStyleClassForSelectedRow()); Graphene.waitAjax().until() .element(advanced().getTableRowsElements().get(advanced().getTableRowsElements().size() - 1)) .attribute("class").contains(advanced().getStyleClassForSelectedRow()); } }
@Override public void perform() { Graphene.waitGui().until().element(getRootElement()).attribute("class").contains(getStyleClassForSelectedItem()); } })
@Override public void switchTo(DataScrollerSwitchButton btn) { String prevPageText = advanced().getActivePageElement().getText(); advanced().getButtonElement(btn).click(); Graphene.waitModel().until().element(advanced().getActivePageElement()).text().not().equalTo(prevPageText); }
private void switchTo(By by) { WebElement element = advanced().getRootElement().findElement(by); element.click(); Graphene.waitModel().until().element(element).attribute("class").contains(advanced().getActiveClass()); }
@Override public void deselectRow(int rowIndex, Keys... keys) { clickOnRow(rowIndex, keys); Graphene.waitAjax().until().element(advanced().getTableRowsElements().get(rowIndex)).attribute("class").not() .contains(advanced().getStyleClassForSelectedRow()); }
@Override public void perform() { Graphene.waitGui().until().element(getRootElement()).attribute("class").not().contains(getStyleClassForSelectedItem()); } })
@Test public void testElementTextEqualsIgnoreCase() { textInput.clear(); textInput.sendKeys("florence and the machine"); updateButton.click(); Graphene.waitModel().until().element(header).text().equalToIgnoreCase("FLORENCE aNd THE machIne"); textInput.sendKeys("Tested Header"); updateButton.click(); Graphene.waitModel().until().element(header).text().not().equalToIgnoreCase("FLORENCE aNd THE machIne"); }
@Test public void testElementTextContainsWithBy() { textInput.clear(); textInput.sendKeys("florence and the machine"); updateButton.click(); Graphene.waitModel().until().element(BY_HEADER).text().contains("machine"); textInput.clear(); textInput.sendKeys("Tested Header"); updateButton.click(); Graphene.waitModel().until().element(BY_HEADER).text().not().contains("machine"); }
@Test public void testElementIsClickable() { Graphene.waitModel().until().element(hideButton).is().clickable(); hideButton.click(); Graphene.waitModel().until().element(hideButton).is().not().clickable(); Graphene.waitModel().until().element(appearButton).is().clickable(); appearButton.click(); Graphene.waitModel().until().element(appearButton).is().not().clickable(); }
@Test public void textElementIsPresent() { loadPage(); checkElementIsPresent(Graphene.waitModel().until().element(BY_JQUERY_HEADER)); }
@Test public void testElementIsSelected() { loadPage(); checkElementIsSelected(Graphene.waitModel().until().element(BY_JQUERY_OPTION1)); }
@Test public void testElementIsVisible() { loadPage(); checkElementIsVisible(Graphene.waitModel().until().element(BY_JQUERY_HEADER)); }
@Test public void testValueEquals() { checkAttributeValueEquals(Graphene.waitModel().until().element(BY_TEXT_INPUT).value()); } }
@Test public void testElementIsSelected() { loadPage(); checkElementIsSelected(Graphene.waitModel().until().element(BY_JQUERY_OPTION1)); }
@Test public void testEmptyAttribute() { Graphene.waitModel().until().element(BY_INPUT_WITH_EMPTY_STYLE).attribute("style").is().not().present(); Graphene.waitModel().until().element(BY_INPUT_WITH_NO_STYLE_DEFINED).attribute("style").is().not().present(); Graphene.waitModel().until().element(BY_INPUT_WITH_EMPTY_STYLE_WHITE_SPACES).attribute("style").is().not().present(); Graphene.waitModel().until().element(BY_INPUT_WITH_EMPTY_READONLY).attribute("readonly").is().present(); }