fix(cli): render tab state when navigation closes the last tab#41842
Open
microsoft-playwright-automation[bot] wants to merge 1 commit into
Open
fix(cli): render tab state when navigation closes the last tab#41842microsoft-playwright-automation[bot] wants to merge 1 commit into
microsoft-playwright-automation[bot] wants to merge 1 commit into
Conversation
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
Contributor
Test results for "MCP"3 failed 7757 passed, 1249 skipped Merge workflow run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
CI run for this change:
https://github.com/microsoft/playwright/actions/runs/29561876001
Suggested-reviewer: Skn0tt