kgress / scaffold

A Java based Selenium WebDriver abstraction
MIT License
4 stars 7 forks source link

isOnPage() does not contain logic to fail test when result is false #74

Closed kgress closed 3 years ago

kgress commented 4 years ago

Bug

The method public abstract boolean isOnPage(); on BasePage is missing logic that fails the navigation if the result is false. It is currently designed and being used as a way to receive a true or false on whether or not certain elements on the page are displayed when instantiation of the page is made.

Expected

The current design needs to be expanded upon a bit. While it's nice to have even just the boolean response to verify the page, we need logic that actually does something with the value. In this case, during the page instantiation, we should be using isOnPage() to determine whether or not we need to fail the test early. We can also include some minimal retry logic.

For example: In a test, it navigates to the login page. The login page has a 500 error message on it. The automation instantiates the page but returns a false value during isOnPage(). In this scenario, the automation will continue and fail when it tries to make the assertion against the login page. Therefore, the stacktrace can be some what confusing since it didn't actually fail at the assertion but it failed during navigation.