Skip to content

fix(har): avoid hanging on open page dialogs - #44245

Merged
Pavel Feldman (pavelfeldman) merged 1 commit into
mainfrom
fix-44242-44641681389-1
Nov 20, 2026
Merged

Pavel Feldman (pavelfeldman) merged 1 commit into
mainfrom
fix-44242-44641681389-1

Conversation

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor

HAR page metadata evaluations can stall behind an open JavaScript dialog. Export waits for them before the context closes, so BrowserContext.close() never returns.

Use the existing non-stalling evaluation guard for both DOMContentLoaded and load metadata. Extend the existing page metadata test with an unhandled load-time alert while retaining the title and timing checks for a normal page.

Fixes #44242

Verified on Windows: the regression fails without the fix in Chromium and Firefox and passes with it on all three browsers. HAR suites: 336 passed, 6 skipped. Full build and npm run flint passed.

Triaged on Windows by the Playwright bot - agent run

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

2 failed
❌ [chromium] › mcp/http.spec.ts:92 › http transport browser lifecycle (isolated) @mcp-ubuntu-latest-chromium
❌ [chromium] › mcp/sse.spec.ts:196 › sse transport browser lifecycle (persistent) @mcp-ubuntu-latest-chromium

5244 passed, 641 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

1 flaky ⚠️ [installation tests] › connect-to-selenium.spec.ts:20 › connect to selenium `@package-installations-ubuntu-latest`

23669 passed, 708 skipped


Merge workflow run.

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor Author

🟢 Both failures are pre-existing flakes

Hi, I'm the Playwright bot. I checked the failed MCP run.

Failure evidence

Checked MCP run 44643049109 at 9b7835c5d84e870a3156917599ef03c6cc53648b. Both exact tests failed with the same errors before this PR. The HAR metadata change does not affect the transport or storage behavior these tests check.

Pre-existing flake / infra

  • mcp/http.spec.ts:92 › http transport browser lifecycle (isolated) — Chromium exceeded 30 seconds. The same test had the same timeout in #44107's Chromium job, at unrelated commit f324307a69b32d3d1732f8221c863a0c130657e6.
  • mcp/sse.spec.ts:196 › sse transport browser lifecycle (persistent) — Chromium returned undefined instead of "42" from localStorage.a. The same mismatch occurred in that historical job and on main at b5b158ae5cbc; the browser-exit wait already added in test: fix failing and flaky tests on the bots #44230 did not prevent this occurrence.

The latest saved history contains 730 Chromium run attempts for each test: HTTP passed 718 and failed 12; SSE passed 706 and failed 24. No PR-caused failure was found.

Checked the failures on Linux by the Playwright bot - agent run

@pavelfeldman
Pavel Feldman (pavelfeldman) merged commit f5edf18 into main Nov 20, 2026
31 of 32 checks passed
@pavelfeldman
Pavel Feldman (pavelfeldman) deleted the fix-44242-44641681389-1 branch November 20, 2026 23:26
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]: BrowserContext.close() hangs during HAR export when a page-load alert remains open

2 participants