Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web): PageElement-releated expectations now also check if the el…
…ement is present Expectations that a PageElement isActive, isClickable, isEnabled, isSelected, or isVisible will now assume that if the element is not present, it cannot therefore be active, clickable, enabled, selected, or visible, respectively. This should be reasonable and intuitive behaviour in most cases. However, note that if in your scenario you want to ensure that the element is, for example, "not enabled", and there is a possibility for the element to not be there at all, you might want to compose expectations as follows: ``` Ensure.that(element, and(isPresent(), not(isEnabled())) ``` This way you prevent an error that might be caused by `not(isEnabled())` returning `true` when the element is also not present. Another thing to note is that this change will make it easier for you to perform expectations on PageElements that might not return an element. For example, the following code will now work: ``` const listItems = PageElements.located(By.css('li')) Wait.until(listItems.first(), isVisible()) ``` Before this change, you had to make sure you checked if the element was also present to avoid the test throwing an error when there were no elements returned: ``` const listItems = PageElements.located(By.css('li')) Wait.until(listItems.first(), and(isPresent(), isVisible())) ``` closes #1255
- Loading branch information
Showing
9 changed files
with
195 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.