Skip to content

feat: --debug=cli exposes external playwright-cli session#39113

Open
dgozman wants to merge 3 commits intomicrosoft:mainfrom
dgozman:feat-pause-for-cli
Open

feat: --debug=cli exposes external playwright-cli session#39113
dgozman wants to merge 3 commits intomicrosoft:mainfrom
dgozman:feat-pause-for-cli

Conversation

@dgozman
Copy link
Contributor

@dgozman dgozman commented Feb 3, 2026

No description provided.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@dgozman dgozman force-pushed the feat-pause-for-cli branch from b4867eb to 60ac35d Compare February 5, 2026 15:53
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

Test results for "MCP"

13 fatal errors, not part of any test
0 passed


Merge workflow run.

@github-actions
Copy link
Contributor

Test results for "tests 1"

10 failed
❌ [playwright-test] › loader.spec.ts:757 › should resolve .js import to .tsx file in non-ESM mode for components @macos-latest-node20
❌ [playwright-test] › playwright.spec.ts:899 › window.playwright should be undefined by default @macos-latest-node20
❌ [playwright-test] › reporter-junit.spec.ts:310 › created › should render existing attachments, but not missing ones @macos-latest-node20
❌ [playwright-test] › reporter-junit.spec.ts:337 › created › should render attachment paths relative to report file when report file name is specified @macos-latest-node20
❌ [playwright-test] › reporter-line.spec.ts:193 › merged › should show error context with relative path @macos-latest-node20
❌ [playwright-test] › reporter.spec.ts:251 › merged › should not have internal error when steps are finished after timeout @macos-latest-node20
❌ [playwright-test] › snapshot-path-template.spec.ts:50 › tokens should expand property @macos-latest-node20
❌ [playwright-test] › to-have-screenshot.spec.ts:1335 › should throw pretty error if expected PNG file is not a PNG @macos-latest-node20
❌ [playwright-test] › ui-mode-test-network-tab.spec.ts:371 › should not preserve selection across test runs @macos-latest-node20
❌ [playwright-test] › ui-mode-trace.spec.ts:812 › should update state on subsequent run @macos-latest-node20

2 flaky ⚠️ [chromium-library] › library/popup.spec.ts:258 › should not throw when click closes popup `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-page] › page/page-event-request.spec.ts:182 › should return response body when Cross-Origin-Opener-Policy is set `@firefox-ubuntu-22.04-node20`

38513 passed, 843 skipped


Merge workflow run.


const sessionConfigFile = this._sessionFile('.session');
this.config.version = this._clientInfo.version;
this.config.timestamp = Date.now();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where did the timestamp go?

}

export async function handleOnTestFunctionEnd(testInfo: TestInfo, context: playwright.BrowserContext) {
const sessionConfig = sessionConfigFromArgs(createClientInfo(), createGuid().slice(0, 8), { _: [] });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer the session name to be readable, not a GUID. maybe the test title?


To debug a failing test, run it with Playwright as usual, but append `--debug=cli` option. This command will pause the test at the point of failure, and print the "socket path" and instructions.

IMPORTANT: run the command in the background and check the output until instructions are available.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

speculative: let's mention a pattern it can wait for, i imagine that some harnesses can wait for the stdout to match a regex like "Listening on".

Suggested change
IMPORTANT: run the command in the background and check the output until instructions are available.
IMPORTANT: run the command in the background and check the output until instructions are available, it'll print `Debugging Instructions`

Keep the test running in the background while you explore and look for a fix. After fixing the test, stop the background test run.

Every action you perform with `playwright-cli` generates corresponding Playwright TypeScript code.
This code appears in the output and can be copied directly into the test. Most of the time, a specific locator or an expectation should be updated.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we mention that sometimes, the test is right and there's an app bug?

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.

3 participants