Skip to content

fix(cli): render tab state when navigation closes the last tab#41842

Open
microsoft-playwright-automation[bot] wants to merge 1 commit into
mainfrom
fix-flakes/windows-latest-29561876001
Open

fix(cli): render tab state when navigation closes the last tab#41842
microsoft-playwright-automation[bot] wants to merge 1 commit into
mainfrom
fix-flakes/windows-latest-29561876001

Conversation

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor

Navigating to a page that closes the last tab (e.g. chrome://extensions/)
rejects page.goto, which skipped response.setIncludeSnapshot(), so the CLI
returned a raw "Target page, context or browser has been closed" error
instead of the graceful "No open tabs" state. The closing tab is also
removed asynchronously, so it could still appear in the tab list. Set the
snapshot flag before navigating and ignore already-closed tabs when
building the response.

DB evidence (rolling CI window): mcp/cli-navigation.spec.ts:56 "goto
chrome:// page that closes the tab does not crash the response" was flaky
only on mcp-windows-latest-chrome — 25/225 runs failed (~11%), while every
other bot (chromium/chrome/msedge/firefox/webkit on ubuntu/macos/windows)
was green. Most recent failure 2026-07-17, so not previously fixed.

Run history (mcp-windows-latest-chrome, oldest first):
🟩🟩🟥🟩🟩🟥

Verified locally on windows-latest with the chrome channel:

  • Before: reproduced 1/40 failures (--project=chrome ...:56 --repeat-each=40).
  • After: 80/80 passed (--repeat-each=80); chromium navigation suite 18/18.

CI run for this change:
https://github.com/microsoft/playwright/actions/runs/29561876001

Suggested-reviewer: Skn0tt

Navigating to a page that closes the last tab (e.g. chrome://extensions/)
rejects page.goto, which skipped response.setIncludeSnapshot(), so the CLI
returned a raw "Target page, context or browser has been closed" error
instead of the graceful "No open tabs" state. The closing tab is also
removed asynchronously, so it could still appear in the tab list. Set the
snapshot flag before navigating and ignore already-closed tabs when
building the response.

DB evidence (rolling CI window): mcp/cli-navigation.spec.ts:56 "goto
chrome:// page that closes the tab does not crash the response" was flaky
only on mcp-windows-latest-chrome — 25/225 runs failed (~11%), while every
other bot (chromium/chrome/msedge/firefox/webkit on ubuntu/macos/windows)
was green. Most recent failure 2026-07-17, so not previously fixed.

Run history (mcp-windows-latest-chrome, oldest first):
[🟩](https://github.com/microsoft/playwright/actions/runs/29501622244/attempts/1)[🟩](https://github.com/microsoft/playwright/actions/runs/29513768518/attempts/1)[🟥](https://github.com/microsoft/playwright/actions/runs/29516107891/attempts/1)[🟩](https://github.com/microsoft/playwright/actions/runs/29525081343/attempts/1)[🟩](https://github.com/microsoft/playwright/actions/runs/29544632336/attempts/1)[🟥](https://github.com/microsoft/playwright/actions/runs/29544830119/attempts/1)

Verified locally on windows-latest with the chrome channel:
- Before: reproduced 1/40 failures (--project=chrome ...:56 --repeat-each=40).
- After: 80/80 passed (--repeat-each=80); chromium navigation suite 18/18.

CI run for this change:
https://github.com/microsoft/playwright/actions/runs/29561876001

Suggested-reviewer: Skn0tt
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

3 failed
❌ [chromium] › mcp/cli-killall.spec.ts:42 › kill-all kills filtered dashboard pid @mcp-macos-latest-chromium
❌ [firefox] › mcp/annotate.spec.ts:173 › user-initiated annotate downloads zip with feedback.md @mcp-macos-latest-firefox
❌ [webkit] › mcp/annotate.spec.ts:230 › should capture annotations via show --annotate @mcp-ubuntu-latest-webkit

7757 passed, 1249 skipped


Merge workflow run.

@dgozman
dgozman requested a review from yury-s July 17, 2026 14:38
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.

1 participant