feat(playwright): configurable default timeout and retrying visibility assertions - #208
Open
Amoifr wants to merge 1 commit into
Open
Conversation
…y assertions Two changes from the issue: - a default_timeout option (BROWSER_DEFAULT_TIMEOUT env var), applied as the page's default timeout: it covers actions and the waitUntil*() methods, which otherwise use Playwright's 30 second default. - assertVisible()/assertNotVisible() now retry client-side (100ms poll, 5 second cap) instead of being one-shot checks, using the same shape as playwright-symfony's locator expectations. Failure messages are unchanged. Fixes zenstruck#199
Amoifr
force-pushed
the
feat-199-playwright-timeout-retrying-assertions
branch
from
August 25, 2026 09:42
c7ba979 to
2c31e50
Compare
Author
|
The two red jobs on the first run were a pre-existing race, not related to this diff: the file-saving tests share the same |
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.
Fixes #199
Both points from the issue:
default_timeoutoption (ms) onPlaywrightBrowser, wired to aBROWSER_DEFAULT_TIMEOUTenv var inHasBrowser. It is applied viapage->setDefaultTimeout(), so it covers actions and thewaitUntil*()methods. When not set, Playwright's 30 second default stays as is.assertVisible()/assertNotVisible()now poll client-side (100ms interval, 5 second cap) throughPlaywright\Testing\Expect, the same shape as Use auto-waiting locator assertions playwright-php/playwright-symfony#35. Failure messages are unchanged, and both still go throughsession()->assert()first so exception-page detection keeps working.Tests: the retry is proven against
#timeout-box(visible 500ms after load, asserted without anywaitUntil*()), and the timeout by asserting a 250ms configured wait fails well under Playwright's 30s default.As noted in the issue this makes
waitUntilVisible()/waitUntilNotVisible()mostly redundant; I left them untouched, happy to deprecate them here or in a follow-up if you prefer.