public HtmlElement hoverOnNextSlide() { logger.info("Hovering on next slide indicator ..."); String prop = CSS2Properties.BACKGROUND_POSITION.getStringValue(); HtmlElement row = findDataRows().get(0); String backgroundPosition = findNextSlideAnchor(row).getCssValue(prop); next.hover(); next.waitCssPropertyToMatch( prop, JMatchers.not(JMatchers.is(backgroundPosition)), TimeConstants.FIVE_SECONDS); return next; }
public void clickOnPrevSlide(HtmlElement buttonParent) { logger.info("clicking on previous slide indicator ..."); HtmlElement row = findDataRows().get(0); findPrevSlideAnchor(row).click(); buttonParent.waitAttributeToMatch( "class", JMatchers.is("cycle-pager-active"), TimeConstants.THREE_SECONDS); }
@Override protected void validatePageInitialState() { logger.info( "validating page initial state for: <{}>, name:<{}>...", getQualifier(), getLogicalName()); String REASON = "Validate that comparison is among/between " + compareShipsCount + " ships"; String ACTUAL_RESULT_STR = findContentBlockDiv().getAttribute("class"); Matcher<String> EXPECTED_OF_STR = JMatchers.endsWith(String.format("comparing-%d", compareShipsCount)); getDriver().assertThat(REASON, ACTUAL_RESULT_STR, EXPECTED_OF_STR); REASON = "Validate Legend keys"; ACTUAL_RESULT_STR = findLegendDiv().getAttribute("textContent").trim(); EXPECTED_OF_STR = JMatchers.allOf( JMatchers.containsString("Key:"), JMatchers.containsString("Available"), JMatchers.containsString("| Not Available")); getDriver().assertThat(REASON, ACTUAL_RESULT_STR, EXPECTED_OF_STR); List<HtmlElement> images = findLegendImages(); REASON = "Validate Legend Image Available"; ACTUAL_RESULT_STR = images.get(0).getAttribute("class"); EXPECTED_OF_STR = JMatchers.is("availableIcon"); getDriver().assertThat(REASON, ACTUAL_RESULT_STR, EXPECTED_OF_STR); REASON = "Validate Legend Image Not Available"; ACTUAL_RESULT_STR = images.get(1).getAttribute("class"); EXPECTED_OF_STR = JMatchers.is("notAvailableIcon"); getDriver().assertThat(REASON, ACTUAL_RESULT_STR, EXPECTED_OF_STR); }
@Override protected void initWebObject() { logger.debug( "validating static elements for web object id: <{}>, name:<{}>...", getQualifier(), getLogicalName()); final String REASON = "assert that element \"%s\" exits"; JAssertion assertion = getRoot().createAssertion(); Optional<HtmlElement> e = getRoot().childExists(By.cssSelector(".nav-tooltip li.title"), FIVE_SECONDS); assertion.assertThat( String.format(REASON, ".nav-tooltip li.title"), e.isPresent(), JMatchers.is(true)); }
private void clickCarouselButton(HtmlElement button, HtmlElement parent) { button.click(); parent.waitAttributeToMatch( "class", JMatchers.is("cycle-pager-active"), TimeConstants.THREE_SECONDS); }