use waitForSelector instead of until#10852
Merged
brad-decker merged 2 commits intodevelopfrom Apr 13, 2021
Merged
Conversation
45ab932 to
fed5bdb
Compare
fed5bdb to
db0f57e
Compare
Collaborator
Builds ready [db0f57e]
Page Load Metrics (622 ± 56 ms)
|
Gudahtt
reviewed
Apr 13, 2021
test/e2e/webdriver/driver.js
Outdated
| case 'visible': | ||
| return await driver.wait(until.elementIsVisible(element), timeout); | ||
| default: | ||
| return null; |
Member
There was a problem hiding this comment.
Should this throw? I'm having trouble imagining how this could be useful.
Contributor
Author
There was a problem hiding this comment.
Probably, yeah.
| await driver.wait(until.elementTextMatches(balances[0], /1/u), 15000); | ||
| const balance = await balances[0].getText(); | ||
|
|
||
| assert.equal(balance, '1'); |
Member
There was a problem hiding this comment.
I believe the intent of this assertion was to ensure this test doesn't pass if the balance is a number containing the digit 1 (e.g. 1.51, 100, etc.). It might be worth preserving this assertion, both here and below where a similar assertion was removed.
Contributor
Author
There was a problem hiding this comment.
will do! Thanks
Member
|
I think this is the last step in completing #10755 |
Collaborator
Builds ready [7a49c63]
Page Load Metrics (561 ± 32 ms)
|
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR completes the abstraction of the until utility from Selenium.
When refactoring to use the work completed in #10844 I ran into a few cases where I believe a race condition made tests flakey at best. The waitForSelector method when passed the
{ state: 'detached' }options bag would try to find an element with the provided selector and wait for it to be removed from the DOM. However, in every case we used the detached flag we are triggering the close of the modal/element before we callwaitForSelector. If the modal is removed from the DOM before the waitForSelector is called then it would timeout.To fix this I have added another item into the Element API wrapper that matches the API from playwright. The new utility method is
waitForElementState. It works in much the same way as the page levelwaitForSelectorbut the element handle is stable and the race condition is abated. I have left the detached support in waitForSelector because it exists in the playwright APi that it is modeled after.