Repository navigation
Conversation
Read the active tab's console messages and its uncaught errors and unhandled rejections since it opened, from Playwright's own per-page lists, so a test no longer wraps console.error in an init script. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r review findings Chrome replays a tab's earlier console messages and errors to a new CDP client, so the persistent browser's own first tab started the attempt with output from before it. Type console messages with Playwright's type union, cover non-Error values and app.restart() on the testbed, and say what the lists hold more exactly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
🟢 e2e web: 95 passedAll 95 tests in 43 files
Tested by e2e 0.24.0 · 1m 6s · web · run artifacts |
Contributor
🟢 e2e web agent: 34 passed35 agent steps · 26 replayed from cache · 27 model calls · 147.9k tokens (94% cached) · $0.0061 All 34 tests in 5 files
Tested by e2e 0.24.0 · 1m 43s · web · run artifacts |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 of 5 tasks
Collaborator
Author
|
Moved to #2113 |
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.
What and why
browser.consoleMessages()andbrowser.pageErrors()on@e2e-dev/webreturn the active tab's console messages, uncaught errors, and unhandled rejections since the tab opened. Before this, you had to add an init script that wrappedconsole.errorand listened forerrorandunhandledrejection, then read the results back withevaluate.{ filter: 'all' }(packages/web/src/browser.ts). Playwright's default,'since-navigation', would drop entries at each navigation. Playwright keeps up to 200 of the latest entries per list.app.restart(), the lists only have the new page's entries, because a restart closes the tab and opens a new page.connect.reconnectEndpoint, or a provider inattemptscope) reuses its own first tab. Chrome replays that tab's earlier console output and errors to a new CDP client, so the engine now clears both lists after it moves that tab toabout:blank(packages/web/src/attempt-session.ts).browser.consoleMessagesandbrowser.pageErrorswithout a label, and this change doesn't write the text to any report or artifact. Console output still shows up in the app log, as before.Error codes the new methods can throw:
APP_NOT_OPENACTION_FAILEDactionTimeout.ENGINE_FAILUREThere are no new error codes.
docs/reference/errors.mdxalready lists all three.Docs:
docs/reference/web.mdx(two entries, the summary table, theBrowserblock, the type exports), the Playwright migration guide (a mapping row, and the workaround row now covers onlypage.clock), andskills/e2e/references/writing-tests.md.Verified
Ran it locally: yes, on Chromium.
Firefox wasn't verified. Playwright's Firefox 159 (revision 1572) exits at launch on this Mac with
Could not find profile folder. It fails the same way when started directly (firefox -headless -profile <dir> --screenshot) and from a fresh install. No CI job runs Firefox.e2e run tests/browser.e2e.ts. The new test logs withconsole.error, leaves a rejection unhandled, and throws from a timer. All three are read back, and the lists are empty afterapp.restart():.e2e/report.jsononly has the step namesbrowser.consoleMessagesandbrowser.pageErrors. Thebroken 42and error lines in it come from the existing app log.packages/web/tests/integration/console-messages.test.ts. A remote Chrome's tab logs and throws, then the engine attaches withreconnectEndpoint:pageErrors()returnsthrownandrejectedfrom before the attempt[]Checklist
pnpm changeset) for any change to a published package, or the change is testbed, docs, or CI only.!, the changeset body names what breaks and what replaces it, and the deprecation warning landed a window earlier (stability policy in CONTRIBUTING.md).docs/**/*.mdxpage for the behavior, andskills/e2e/if the skill describes it..d.tsreviewed,tests/types/sdk-types.tsupdated; wire change edits the schema and both fixtures.e2e/engine): changesets fore2e,@e2e-dev/web, and@e2e-dev/mobile.🤖 Generated with Claude Code