Commit Graph

77 Commits

Author SHA1 Message Date
Tommy D. Rossi fd6ce49a2d test: update assertion for new error message 2026-01-22 20:16:06 +01:00
Tommy D. Rossi 0ba4acfbce fix: disable Network buffering by default to fix SSE streaming
Fixes #22

CDP's Network.enable buffers response bodies by default, which breaks
SSE/streaming - data arrives at Chrome but ReadableStream never receives it.

Changes:
- Intercept Network.enable in relay, default maxTotalBufferSize: 0
- Agents can re-enable buffering via Network.disable + Network.enable
  with explicit buffer sizes when they need response.body()
- Added test and documentation for reading response bodies
2026-01-15 15:55:18 +01:00
Tommy D. Rossi 171317f8cb fix: auto-switch to another page when default page is closed 2026-01-15 13:43:45 +01:00
Tommy D. Rossi 32dca5743b fix: filter non-page targets from Playwright (issue #14)
Service workers, web workers, and iframes are now filtered out at the
server level, preventing Playwright from trying to initialize these
targets which caused timeouts and errors.
2026-01-12 18:10:54 +01:00
Tommy D. Rossi 481cb4ddc8 feat: add CDP discovery endpoints (/json/version, /json/list)
Standard Chrome DevTools Protocol HTTP discovery endpoints that allow
tools like Playwright to connect using just the HTTP URL without needing
to call getCdpUrl() first.

- /json/version returns browser info and webSocketDebuggerUrl
- /json/list returns array of connected targets
- Supports GET/PUT methods and trailing slashes for compatibility
2026-01-12 17:16:20 +01:00
Tommy D. Rossi 7e7edac856 feat: add 5 lines context around search matches in accessibilitySnapshot, getCleanHTML, getLatestLogs 2026-01-12 15:36:51 +01:00
Tommy D. Rossi 69d2d24815 release: playwriter@0.0.43 2026-01-11 22:24:40 +01:00
Tommy D. Rossi 8f2285a63c bigger labels. fix screenshots sizes 2026-01-05 11:11:00 +01:00
Tommy D. Rossi 09a363d2dc screenshotWithAccessibilityLabels 2026-01-05 10:11:36 +01:00
Tommy D. Rossi b4689f390f fix tests adding more await globalThis.disconnectEverything() 2026-01-04 16:06:32 +01:00
Tommy D. Rossi 802e6768e2 add showAriaRefLabels/hideAriaRefLabels for Vimium-style visual labels
- getAriaSnapshot() discovers aria refs and caches ElementHandles
- showAriaRefLabels() overlays yellow badges on interactive elements
- hideAriaRefLabels() removes labels from page
- test captures screenshots from HN, Google, GitHub
2026-01-03 15:17:47 +01:00
Tommy D. Rossi 7630ab7538 Update mcp.test.ts 2026-01-02 14:39:50 +01:00
Tommy D. Rossi e3cb7fd1fd add test to find out how to remove sleep after extension connect 2026-01-02 14:24:15 +01:00
Tommy D. Rossi ef6ab59351 Fix auto-enable to work without delay by skipping duplicate Target.attachedToTarget
Move auto-create logic from onOpen to Target.setAutoAttach handler so it runs
synchronously in the CDP command flow. Add skipAttachedEvent option to extension's
attachTab to prevent sending Target.attachedToTarget when the relay will send it
via the Target.setAutoAttach response handler.
2026-01-01 02:53:10 +01:00
Tommy D. Rossi 178387ec97 Persistent WS connection and auto-create initial tab
- Connect WS at extension startup via maintainConnection() loop
- Auto-retry every 5 seconds silently (no connecting badge)
- Never disconnect WS based on tab count
- Rename ConnectionState 'disconnected' to 'idle', remove global 'connecting'
- Fix race condition with tabGroupQueue for syncTabGroup/disconnectEverything/onTabUpdated
- Add auto-create initial tab when Playwright connects (PLAYWRITER_AUTO_ENABLE env var)
- Add test for auto-create feature
2026-01-01 01:14:16 +01:00
Tommy D. Rossi 169ba48a77 Fix Editor/Debugger script listing after page load 2025-12-29 16:46:34 +01:00
Tommy D. Rossi 5e0cd2dd98 Add getReactSource to extract React component source location
- Add bippy library for React fiber introspection
- Create build-bippy.ts and build-selector-generator.ts using Bun.build
- Use CDP Runtime.evaluate instead of addScriptTag to bypass CSP
- Add getReactSource utility function exposed in MCP VMContext
- Works on local React dev servers with JSX transform (not production builds)
2025-12-29 16:11:13 +01:00
Tommy D. Rossi 56e4e1566e Update mcp.test.ts 2025-12-28 23:38:49 +01:00
Tommy D. Rossi 5c5608cbb7 add support for styles 2025-12-28 23:10:33 +01:00
Tommy D. Rossi a4e7ce10bd move cdp-relay and protocol out of extension subfolder 2025-12-28 21:05:04 +01:00
Tommy D. Rossi 63856afb0b fix Runtime.enable race condition with event-based synchronization
Replace arbitrary sleep(200ms) with proper wait for Runtime.executionContextCreated
event in the relay server. This ensures pages are fully ready before Runtime.enable
returns to Playwright, fixing intermittent 'page not found' errors.
2025-12-28 20:29:21 +01:00
Tommy D. Rossi cb2c14b874 Update mcp.test.ts 2025-12-28 12:24:50 +01:00
Tommy D. Rossi e4695e231d add support for remote agent in different host than extension. add
support for editing css.
2025-12-27 18:48:52 +01:00
Tommy D. Rossi 3631cfe233 further reduce sleeps while fixing timing-sensitive tests 2025-12-26 12:41:25 +01:00
Tommy D. Rossi 484020a092 reduce 300ms sleeps to 200ms and 500ms to 300ms 2025-12-26 12:37:11 +01:00
Tommy D. Rossi 6218a80981 reduce 200ms sleeps to 100ms 2025-12-26 12:35:36 +01:00
Tommy D. Rossi 2fea0612b5 use domcontentloaded for accessibility snapshot tests 2025-12-26 12:34:05 +01:00
Tommy D. Rossi 587f90bf6d replace slow external sites with example.com/org and use domcontentloaded 2025-12-26 12:28:50 +01:00
Tommy D. Rossi 3e9517c551 speed up tests by reducing sleeps and replacing slow external sites 2025-12-26 12:23:49 +01:00
Tommy D. Rossi c2d13c0363 add editor. use different port in tests 2025-12-26 00:01:05 +01:00
Tommy D. Rossi c693c7d775 add more debugger methods 2025-12-25 23:37:19 +01:00
Tommy D. Rossi 6dadc97779 nicer debugger api 2025-12-25 22:04:19 +01:00
Tommy D. Rossi 91c30bbd3e Add Debugger class tests using CDP session directly
## Debugger Tests Summary

### 1. should use Debugger class to set breakpoints and inspect variables

Tests the core debugging workflow when paused at a debugger statement:

- Creates a Debugger instance with a CDP session
- Verifies isPaused() returns false initially
- Executes code with a debugger statement that pauses execution
- Verifies isPaused() returns true when paused
- Calls getLocation() and verifies:
  - callstack[0].functionName is 'testFunction'
  - sourceContext contains the debugger keyword
- Calls inspectVariables({ scope: 'local' }) and verifies local variables:
  { localVar: "hello", numberVar: 42 }
- Calls evaluate({ expression }) in paused context and verifies it can access local variables
- Calls resume() and verifies isPaused() returns false

### 2. should list scripts with Debugger class

Tests script discovery after page load:

- Navigates to news.ycombinator.com (has external JS files)
- Enables debugger, reloads page to trigger Debugger.scriptParsed events
- Calls listScripts() and verifies:
  - Returns array with scriptId and url properties
  - At least one script exists
- Calls listScripts({ search: 'hn' }) and verifies filtering works

### 3. should manage breakpoints with Debugger class

Tests breakpoint CRUD operations:

- Verifies listBreakpoints() returns empty array initially
- Calls setBreakpoint({ file, line }) and verifies:
  - Returns a breakpoint ID string
  - listBreakpoints() now has 1 entry with correct id, file, line
- Calls deleteBreakpoint({ breakpointId }) and verifies:
  - listBreakpoints() returns empty array again

### 4. should step through code with Debugger class

Tests stepping methods and call stack navigation:

- Executes nested functions (outer calls inner) with debugger in inner
- When paused, verifies getLocation().callstack:
  - Has at least 2 frames
  - Frame 0 is inner, frame 1 is outer
- Calls stepOver() and verifies line number advances
- Calls stepOut() and verifies:
  - Now in outer function (stepped out of inner)
- Calls resume() to finish
2025-12-25 21:33:33 +01:00
Tommy D. Rossi 3d852fcfa7 little prompt thing 2025-12-23 19:03:35 +01:00
Tommy D. Rossi b8b2b468d2 add new test for the cdp session function 2025-12-22 18:17:47 +01:00
Tommy D. Rossi 581f283cb8 update cdp relay state on page navigation 2025-12-22 18:11:23 +01:00
Tommy D. Rossi 43e1862cdb wait 3s for extension after MCP starts relay server 2025-12-21 16:53:19 +01:00
Tommy D. Rossi 6809ebea72 restart ws process if already running with different version 2025-12-21 16:48:07 +01:00
Tommy D. Rossi f64e7498cd fix: use os.tmpdir for logs, improving Windows compatibility 2025-12-20 22:13:13 +01:00
Tommy D. Rossi 660fb4c014 nn 2025-12-19 19:23:06 +01:00
Tommy D. Rossi b0f786a166 less root crashes in mcp. more error logs. 2025-12-19 19:08:24 +01:00
Tommy D. Rossi e73c935da0 add timestamped log files with automatic cleanup 2025-12-19 12:23:42 +01:00
Tommy D. Rossi 71c8507b55 add type-safe event emitter to relay server for CDP message interception 2025-12-19 01:39:57 +01:00
Tommy D. Rossi b7ff5c6d75 run relay server in-process during tests for WS message interception 2025-12-18 16:11:10 +01:00
Tommy D. Rossi db4f7ef5a5 add test for getLocatorStringForElement 2025-12-17 18:45:30 +01:00
Tommy D. Rossi 7aacc619cb nn 2025-12-16 19:48:15 +01:00
Tommy D. Rossi 0a36692371 add cdp session. fix tests with it 2025-12-16 19:46:38 +01:00
Tommy D. Rossi d593e20a3c new getcdpsession 2025-12-16 19:40:58 +01:00
Tommy D. Rossi be1dddf2b6 fix tests for DPI 2025-12-16 19:04:48 +01:00
Tommy D. Rossi bf9c80bad0 release: playwriter 0.0.18 2025-12-13 18:07:35 +01:00