Skip to content

fix(test): support multiple contexts with --debug=cli - #42503

Merged
Dmitry Gozman (dgozman) merged 1 commit into
microsoft:mainfrom
dgozman:fix-42485
Sep 3, 2026
Merged

fix(test): support multiple contexts with --debug=cli#42503
Dmitry Gozman (dgozman) merged 1 commit into
microsoft:mainfrom
dgozman:fix-42485

Conversation

@dgozman

Copy link
Copy Markdown
Collaborator

Summary

  • browser.bind() was called for every context created in a test, so a second browser.newContext() failed with Server is already started. Bind the browser once and reuse the session name.
  • The same crash happened for the second test in a worker, so --debug=cli only ever worked for a single test with a single context. Pausing and printing the attach instructions is now done once per test.

Fixes #42485

Bind the browser once instead of once per context, and pause with
debugging instructions once per test.

Fixes: microsoft#42485
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

4 flaky ⚠️ [chromium-library] › library/video.spec.ts:736 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:179 › serviceWorker(), and fromServiceWorker() work `@chromium-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-ubuntu-22.04-node20`

46302 passed, 1149 skipped


Merge workflow run.

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🟢 Green — the failures are pre-existing flake and infra, not this PR

Hi, I'm the Playwright bot and I took a look at the CI failures here. None of them are caused by this change — one is a known Firefox-only flake, the other two are a transient Google Chrome mirror hiccup on the runners.

Details

This PR only touches the --debug=cli daemon binding in browserBackend.ts and adds --debug=cli tests in cli-test.spec.ts. None of the failing jobs run through that code path.

Pre-existing flake / infra

  • [firefox] › mcp/cli-devtools.spec.ts:138 › request* and response* commands support --filename — Firefox-only flake. The list.match(/… \[POST\] …\/api =>/) returns null when the POST request hasn't landed in the requests list yet. Across the test-results DB this test failed 4 of 716 Firefox runs (+2 more rescued on retry), and 0 of ~2900 runs on chrome/chromium/webkit/msedge — it's flaked on unrelated PRs feat(locator): introduce locator.visible() #42479, chore: remove experimental component testing #42168, test: roll stable-test-runner to 1.63.0-alpha-2026-08-03 #42091 and on push runs aca9de8d/974edd3f. The test uses plain cli/server, not --debug=cli, so the diff can't reach it.

  • ubuntu-latest - chrome and ubuntu-22.04 (chromium - Node.js 22) — both died at npx playwright install --with-deps after ~40s with E: Failed to fetch https://dl.google.com/linux/chrome-stable/deb/…/Packages.gz File has unexpected size (1410 != 1412). Mirror sync in progress?. That's a transient Google apt-mirror sync, pure infra, nothing to do with the diff. A re-run should clear both.

Triaged by the Playwright bot - agent run

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Test results for "MCP"

8301 passed, 1371 skipped


Merge workflow run.

Comment thread packages/playwright/src/mcp/test/browserBackend.ts
@dgozman
Dmitry Gozman (dgozman) merged commit 612050e into microsoft:main Sep 3, 2026
55 of 58 checks passed
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.

[BUG] --debug=cli fails when a test creates multiple BrowserContexts

2 participants