Find file History

README.md

Matchers decoration

Moved here from Htmlelements - Issue #29

Can be used to decorate matcher with waiter, action or condition.

  • Decoration of matcher with timeout:
assertThat(element, should(exists()).whileWaitingUntil(timeoutHasExpired(SECONDS.toMillis(5))));
  • With action:
assertThat(element, should(exists()).after(pageRefresh(driver)));
  • With condition:
assertThat(element, should(hasText("Text")).inCase(element, exists()));

inCase is same as usage of assumeThat before assertion, but uses less code and looks much pretty. Also can be used with combine of action and waitind decorators

Example of all of them used in one statement:

assertThat(mailsList, should(hasMailWithSubject("Subject")).after(pageRefresh(driver)).whileWaitingUntil(timeoutHasExpired());

This example will be refresh page with webdriver every second in 30 sec and try to find element «mail» with subject (custom matcher) on this page.

MatcherDecoratorsBuilder samples