Skip to content

test: relaunch a disconnected cached browser in tests#2368

Open
thomasbachem wants to merge 1 commit into
ChromeDevTools:mainfrom
thomasbachem:fix/relaunch-disconnected-cached-browser
Open

test: relaunch a disconnected cached browser in tests#2368
thomasbachem wants to merge 1 commit into
ChromeDevTools:mainfrom
thomasbachem:fix/relaunch-disconnected-cached-browser

Conversation

@thomasbachem

Copy link
Copy Markdown
Contributor

The Windows screenshot flakes in #2137 are TargetCloseErrors (Target closed), which is what you get from reusing a browser that already died.

withBrowser (tests/utils.ts) caches one browser per launchOptions key, but the cache-hit path only checks that an entry exists, not that it's still connected – and nothing evicts a dead one. So a single browser death mid-run (a pipe drop, an OOM, a teardown race) leaves every later same-key test reusing the dead handle, turning one failure into a run of them.

#2205's concurrency limit lowers how often a browser dies; a liveness check on cache hit bounds the blast radius when one still does – a disconnected browser is dropped and relaunched, so a death fails only its own test. Inert on a healthy run, since connected only goes false once the connection is actually gone.

The test closes a cached browser and asserts the next withBrowser call gets a fresh, connected one – it fails on main and passes with the check.

@OrKoN OrKoN changed the title fix: relaunch a disconnected cached browser in tests test: relaunch a disconnected cached browser in tests Jul 15, 2026

@OrKoN OrKoN left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks!

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.

2 participants