fix(cli): persist traces when CLI attaches to existing CDP browser#40810
Conversation
The MCP browser_start_tracing tool advertised trace files under `.playwright-cli/traces/`, but for CDP-attached browsers the underlying server used an auto-created temp `artifactsDir`, so trace files never appeared at the advertised paths. Add an optional `artifactsDir` parameter to `BrowserType.connectOverCDP` and have the MCP browser factory pass the desired directory through. The server uses the supplied directory directly (creating it if missing) and skips cleanup on disconnect when the directory was provided by the caller. Fixes: microsoft/playwright-cli#378
This comment has been minimized.
This comment has been minimized.
The client's _wrapApiCall prepends the API frame name to error messages, so the actual error is "Error: async initializeServer: connect ECONNREFUSED ..." rather than "Error: connect ECONNREFUSED ...". Match on the underlying socket error substring instead.
This comment has been minimized.
This comment has been minimized.
Test results for "MCP"6 failed 7071 passed, 1074 skipped Merge workflow run. |
Test results for "tests 1"3 flaky41769 passed, 850 skipped Merge workflow run. |
Summary
Fixes microsoft/playwright-cli#378