feat(playwright): auto-wait for actions and assertions - #211
Open
kbond wants to merge 1 commit into
Open
Conversation
Actions wait for their element to appear and assertions retry until they pass, so `waitUntil*()` is rarely needed. Whole operations are retried rather than individual lookups: a waiting lookup would invert the "not" assertions and make every speculative miss cost the full timeout. Non-playwright drivers get a zero budget, which is one attempt and no sleep.
Member
Author
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Actions and assertions now wait for the page to catch up, so
waitUntil*()is rarely needed. Clicking or filling waits for the element to appear, assertions retry until they pass, and "not" assertions pass as soon as they hold. Everything gives up afterBROWSER_DEFAULT_TIMEOUT(2 second default) and fails as before.This helps most with Turbo, where visits, frames and streams all update the page without a navigation to wait on - assertions following a Turbo-driven click, or a stream broadcast that arrives on its own, simply wait for the new content to land.
Only
PlaywrightBrowseris affected -KernelBrowserandPantherBrowserbehave exactly as they did. Page loads keep Playwright's 30 second limit, since a cold kernel boot is far slower than anything an assertion should wait for.The trade is that an assertion destined to fail can only be reported once the timeout expires, so failures cost 2 seconds (default) instead of returning instantly.
timeout()adjusts it per test.Closes #199. Supersedes #208.