Repository navigation
Conversation
…r an e2e page An app's e2e test could not press a key (Tab, Enter, Escape, a shortcut) or check that the page logged no console error. pressKey(page, key) sends a trusted key press or chord (Shift+Tab, Control+k); consoleMessages(page) answers every console line and uncaught exception since the running test began; expectNoConsoleErrors(page) refuses with X_E2E_CONSOLE_ERRORS. Free functions over PageLike, which does not grow; E2eBrowserPage gains optional press?() and consoleMessages?(), and cdpE2eTab implements both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…index regenerated Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sebyx07
force-pushed
the
fix/e2e-keys-console
branch
from
November 24, 2026 09:11
bcf28b6 to
bd181a2
Compare
This branch has not been deployed
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.
Problem
The page an app's e2e test holds (
PageLike) has no key presses and no console capture, so an app cannot check keyboard order (Tab, Enter, Escape, shortcuts) or that a page logs no console error. The raw-CDP tab already hadpress(key), but only for single keys, and nothing reached it fromPageLike.Change (additive)
App-facing, from
@ultimat3/testing— free functions overPageLike, because adding required members toPageLikeis a public-API break (X_PUBLIC_API_BREAK_UNDECLARED) and optional members would make every callpage.press?.(), a silent no-op on a page without it:pressKey(page, key): Promise<void>PRESS_KEYSname, one letter or digit, or a chord withAlt/Control/Meta/Shiftheld (Shift+Tab,Control+k,Meta+Shift+Enter)consoleMessages(page): Promise<readonly E2eConsoleMessage[]>console.*line and uncaught exception since the runninge2eTestbegan, after one round trip so a line printed just before is included.E2eConsoleMessage = { level: 'debug'|'log'|'info'|'warning'|'error', text, source: 'console'|'exception' }expectNoConsoleErrors(page): Promise<void>X_E2E_CONSOLE_ERRORS, quoting every error (console.error, failedconsole.assert, uncaught throw); warnings passUnderneath:
E2eBrowserPagegains optionalpress?(key)andconsoleMessages?()(optional = compatible, asoffline?is). A page whose port lacks one, or aPageLikeno e2e driver built, isX_TEST_FIXTURE_UNAVAILABLEnaming what is missing.cdpE2eTab:press()takes chords (CDPmodifiersbitmask; no text typed under Control/Meta/Alt, upper case under Shift); the tab capturesRuntime.consoleAPICalled/Runtime.exceptionThrownfor its own session and stops listening onclose(). New modulescdp-key-chord.ts,cdp-console-capture.ts,e2e-console.ts,e2e-page-input.ts.e2ePage()binds thePageLiketo its port (aWeakMap);e2eRunnermarks the console start as each test begins, so a suite-shared tab does not carry the previous test's errors.X_E2E_CONSOLE_ERRORSregistered ine2e-error-codes.ts, rows inwiki/Error-Codes*.md, manifest regenerated.wiki/Testing.md(example + table),packages/testing/README.md, CHANGELOG (Added).Tests
cdp-e2e-page-input.test.ts(fake connection, written first): chord modifiers and text, unchanged single keys, refusals; console capture filters by session, maps levels and exceptions,close()unsubscribes.e2e-page-input.test.ts: forwarding, refusals by name, test-scoped console with the flush round trip,X_E2E_CONSOLE_ERRORScontent.cdp-e2e-page.e2e.test.ts(real Chrome, run locally: 4 pass):Shift+Tabmoves focus back,Control+kreaches akeydownwithctrlKey, aconsole.errorand an uncaught throw are captured.🤖 Generated with Claude Code