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(); }
public void nextDecade() { String firstBefore = getFirstYear().getText(); getNextDecadeButtonElement().click(); Graphene.waitGui().withMessage("Waiting for decade to change.").until().element(getFirstYear()).text().not().equalTo(firstBefore); }
public void previousDecade() { String firstBefore = getFirstYear().getText(); getPreviousDecadeButtonElement().click(); Graphene.waitGui().withMessage("Waiting for decade to change.").until().element(getFirstYear()).text().not().equalTo(firstBefore); }
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); }
public void nextYear() { if (!isVisible() || !getNextYearElement().isDisplayed()) { throw new RuntimeException("Cannot interact with nextYear button. " + "Ensure that calendar popup and header controls are displayed."); } String before = getYearAndMonthEditorOpenerElement().getText(); getNextYearElement().click(); Graphene.waitAjax().withMessage("Waiting for year to change.").until().element(getYearAndMonthEditorOpenerElement()).text().not().equalTo(before); }
public void previousMonth() { if (!isVisible() || !getPreviousMonthElement().isDisplayed()) { throw new RuntimeException("Cannot interact with previousMonth button. " + "Ensure that calendar popup and header controls are displayed."); } String before = getYearAndMonthEditorOpenerElement().getText(); getPreviousMonthElement().click(); Graphene.waitAjax().withMessage("Waiting for month to change.").until().element(getYearAndMonthEditorOpenerElement()).text().not().equalTo(before); }
private void selectYear(int year) { int yearsPickerSize = getYears().size(); int yearInTheFirstColumn = Integer.parseInt(getFirstYear().getText()); int diff = year - yearInTheFirstColumn; // scroll to year if (diff > 0 && diff >= yearsPickerSize) { while (diff > 0) { nextDecade(); diff -= yearsPickerSize; } } else { while (diff < 0) { previousDecade(); diff += yearsPickerSize; } } // select year WebElement yearElement = getRootElement().findElement(ByJQuery.selector("div[id*='DateEditorLayoutY']:contains('" + year + "')")); yearElement.click(); Graphene.waitGui().withMessage("Waiting for year to be selected.").until().element(yearElement).attribute("class").contains(getSelectedClass()); }
private void selectMonth(int month) { WebElement monthElement = getRootElement().findElement(By.cssSelector("div[id*='DateEditorLayoutM" + (month - 1) + "']")); monthElement.click(); Graphene.waitGui().withMessage("Waiting for month to be selected.").until().element(monthElement).attribute("class").contains(getSelectedClass()); }
public void waitUntilIsVisible() { Graphene.waitModel().withMessage("Waiting for time spinner to be visible.").until().element(getRootElement()).is().visible(); }
@Test public void testWithMessageAndMessageUntil() { String message = "blah blah blah blah blah"; try { Graphene.waitGui() .withMessage("srhjkfsdbhfjkfbsdnbfm,sndbsdmnbf") .until(message) .element(BY_HEADER) .text() .equalTo("sjkldhkdjfgjlkfg"); Assert.fail(TimeoutException.class.getName() + " should be thrown."); } catch (TimeoutException e) { Assert.assertTrue("The exception message <" + e.getMessage() + "> should contain message <" + message + "> defined by 'withMessage()' method", e.getMessage().contains(message)); } }
@Test public void testWithMessage() { String message = "blah blah blah blah blah"; try { Graphene.waitGui() .withMessage(message) .until() .element(BY_HEADER) .text() .equalTo("sjkldhkdjfgjlkfg"); Assert.fail(TimeoutException.class.getName() + " should be thrown."); } catch (TimeoutException e) { Assert.assertTrue("The exception message <" + e.getMessage() + "> should contain message <" + message + "> defined by 'withMessage()' method", e.getMessage().contains(message)); } }
@Override public void select(boolean deselectOthers) { // https://issues.jboss.org/browse/RF-14033 getRootElement().click(); Graphene.waitGui().withMessage("Waiting for day to be selected.").until().element(getRootElement()).attribute("class").contains(getStyleClassForSelectedItem()); } }
@Override public void close() { new Actions(driver).moveToElement(advanced().getRootElement()).perform(); Graphene.waitModel().until().element(advanced().getCloseIconElement()).is().visible(); final List<WebElement> messages = driver.findElements(By.cssSelector("div.rf-ntf-cnt")); final int sizeBefore = messages.size(); new Actions(driver).click(advanced().getCloseIconElement()).perform(); Graphene.waitModel().withMessage("The message did not disappear.").until(new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver input) { return messages.size() == (sizeBefore - 1); } }); }