Skip to content

fix: recover after a failed Playwright initialize - #275

Open
tiagoabsantos wants to merge 2 commits into
pestphp:5.xfrom
tiagoabsantos:fix/failed-initialize-recovery
Open

tiagoabsantos wants to merge 2 commits into
pestphp:5.xfrom
tiagoabsantos:fix/failed-initialize-recovery

Conversation

@tiagoabsantos

Copy link
Copy Markdown

Summary

Fixes pestphp/pest#1938.

Playwright accepts initialize once per WebSocket and sets that flag before the browser launch finishes. If the launch hits the action timeout, $browserTypes stays empty, so the next browser test sends initialize again and every later test fails with Assertion error.

  • The one-time launch now uses a 30s timeout, separate from the action timeout.
  • A failed initialize closes the socket. The next browser test connects again and can initialize.

Test plan

  • tests/Browser/Visit/InitializeRecoveryTest.php forces a second initialize on the same connection, expects Assertion error, then opens a page on a new connection
  • Action timeout is unchanged after a successful launch and after the failed initialize
  • CI on PHP 8.4 and 8.5

Tiago Santos and others added 2 commits September 29, 2026 16:47
Playwright marks a connection initialized before the browser finishes launching, and it accepts that call only once. Give the launch its own timeout, and drop the socket when initialize fails so the next test can connect again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[pest-plugin-browser] Timed-out initialize corrupts every later browser test

1 participant