Skip to content

Organization browser tests: say in the log whether a lost page crashed or was closed - #2310

Merged
davidmckayv merged 2 commits into
mainfrom
test/browser-harness-says-crash-or-close
Nov 27, 2026
Merged

davidmckayv merged 2 commits into
mainfrom
test/browser-harness-says-crash-or-close

Conversation

@davidmckayv

Copy link
Copy Markdown
Contributor

Why

organization-unavailable-chat has failed three times in the WebKit job with "Target page, context or browser has been closed", always in the audit log's filter step (jobs 139604506143, 140034085631, 140356745256). It never failed in over 600 runs on a Linux box in the CI's Playwright image, under load, or in 192 rounds of a test that styles the open filter menu again and again. Playwright gives those same words whether the browser crashed the page or something closed it, so the failures can't say which it was.

What changed

The shared harness behind the organization browser tests (app/tests/organization-notices-browser.ts) now logs a line starting [browser lost] when:

  • a page crashes (the page's crash event),
  • a page closes without the test closing it,
  • a browser disconnects before the tests are done with it (crashed or killed).

Each line names the engine, the window and where the page was. Bun gives a test no way to read its own name, so the failing test's name is the (fail) line that follows. Playwright doesn't expose the WebKit process's exit code, so the browser line says only that it disconnected.

Nothing changes for a test that passes: no retries, no waits, no assertions.

Proof

  • A throwaway test, not committed, in Chromium: a page whose context was closed from outside logged "the page closed, not by the test", a page sent to chrome://crash logged "the page crashed", and a page the test closed, plus stop() closing the browsers, logged nothing.
  • organization-unavailable-chat.test.tsx in Chromium and WebKit: 18 of 18 pass, and no [browser lost] line.
  • Lint passes.
  • This doesn't clash with Browser tests wait for the page to be still, not a fixed time #2309, which changes style() and the imports in the same file; this changes start, stop and open.

…d or was closed

organization-unavailable-chat has failed three times in the WebKit job with
"Target page, context or browser has been closed", always in the audit log's
filter step, and never on a Linux box running it hundreds of times. Playwright
gives those same words whether the browser crashed the page or something
closed it, so the failures said nothing of which.

The shared harness for these tests now logs a line starting [browser lost]
when a page crashes, when a page closes without the test closing it, or when
a browser disconnects before the tests are done with it, naming the engine,
the window and where the page was. The failing test's name follows those
lines in the output. Nothing changes for a test that passes.
@davidmckayv
davidmckayv merged commit 8082414 into main Nov 27, 2026
18 checks passed
@davidmckayv
davidmckayv deleted the test/browser-harness-says-crash-or-close branch November 27, 2026 08:46
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.

1 participant