@Override public void perform() { Graphene.waitGui().until().element(item).attribute("class").contains(OrderingListInPickList.SELECTED_ITEM_CLASS); } })
@Override protected void performWait(FluentWait<WebDriver, Void> wait) { wait.until().element(getMenuPopup()).is().visible(); } }.withMessage("The " + getNameOfFragment() + " did not show in the given timeout!")
@Override protected void performWait(FluentWait<WebDriver, Void> wait) { wait.until().element(getRootElement()).is().visible(); } }.withMessage("Waiting for day picker to be visible.");
@Override protected void performWait(FluentWait<WebDriver, Void> wait) { wait.until().element(getRoot()).is().not().visible(); } }.withMessage("Waiting for header controls to be not visible.")
@Override protected void performWait(FluentWait<WebDriver, Void> wait) { wait.until().element(getMenuPopup()).is().not().visible(); } }.withMessage("Waiting for menu to hide.")
public void cleanDate() { if (!isVisible()) { throw new RuntimeException("Footer controls are not displayed, cannot interact with clean button"); } if (!getCleanButtonElement().isDisplayed()) { throw new RuntimeException("Clean button is not displayed."); } getCleanButtonElement().click(); Graphene.waitGui().withMessage("Waiting for clean button to be not visible.").until().element(getCleanButtonElement()).is().not().visible(); }
@Override protected void performWait(FluentWait<WebDriver, Void> wait) { wait.until().element(getRootElement()).is().not().visible(); } }.withMessage("Waiting for day picker to be not visible.");
public void nextMonth() { if (!isVisible() || !getNextMonthElement().isDisplayed()) { throw new RuntimeException("Cannot interact with nextMonth button. " + "Ensure that calendar popup and header controls are displayed."); } String before = getYearAndMonthEditorOpenerElement().getText(); getNextMonthElement().click(); Graphene.waitAjax().withMessage("Waiting for month to change.").until().element(getYearAndMonthEditorOpenerElement()).text().not().equalTo(before); }
public void previousYear() { if (!isVisible() || !getPreviousYearElement().isDisplayed()) { throw new RuntimeException("Cannot interact with previousYear button. " + "Ensure that calendar popup and header controls are displayed."); } String before = getYearAndMonthEditorOpenerElement().getText(); getPreviousYearElement().click(); Graphene.waitAjax().withMessage("Waiting for year to change.").until().element(getYearAndMonthEditorOpenerElement()).text().not().equalTo(before); }
@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()); } })
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()); }
@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 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 testElementTextEquals() { textInput.clear(); textInput.sendKeys("florence and the machine"); updateButton.click(); Graphene.waitModel().until().element(header).text().equalTo("florence and the machine"); textInput.sendKeys("Tested Header"); updateButton.click(); Graphene.waitModel().until().element(header).text().not().equalTo("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 testElementTextContains() { textInput.clear(); textInput.sendKeys("florence and the machine"); updateButton.click(); Graphene.waitModel().until().element(header).text().contains("machine"); textInput.clear(); textInput.sendKeys("Tested Header"); updateButton.click(); Graphene.waitModel().until().element(header).text().not().contains("machine"); }