Skip to content

test: unflake har-websocket timing assertions - #42126

Merged
yury-s merged 2 commits into
microsoft:mainfrom
yury-s:unflake-har-websocket
Aug 4, 2026
Merged

test: unflake har-websocket timing assertions#42126
yury-s merged 2 commits into
microsoft:mainfrom
yury-s:unflake-har-websocket

Conversation

@yury-s

@yury-s yury-s commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

  • tolerate 100ms clock skew between browser-reported wall times and Date.now() — flaked exclusively on Windows bots, where the browser's monotonic-based wall-time estimate and Node's clock disagree at the millisecond level
  • allow the recorded websocket duration to slightly under-run the nominal setTimeout delays
  • harTracer: report zero HAR entry duration instead of -1 when all websocket frames share a single coarse-clock timestamp

- tolerate 100ms clock skew between browser-reported wall times and
  Date.now() (flaked on Windows bots only, where the browser clock and
  the Node clock can disagree at the millisecond level)
- allow the recorded websocket duration to slightly under-run the
  nominal setTimeout delays
- report zero HAR entry duration instead of -1 when all websocket
  frames share a single coarse-clock timestamp
@yury-s
yury-s requested a review from dcrousso August 4, 2026 20:31
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Comment thread tests/library/har-websocket.spec.ts Outdated
expect(wsEntry.time).toBeGreaterThanOrEqual(delayMs * (incomingCount + outgoingCount));
// setTimeout may fire marginally early and browser-reported timestamps are
// coarse on some platforms, so the measured span can under-run the nominal delays.
expect(wsEntry.time).toBeGreaterThanOrEqual(delayMs * (incomingCount + outgoingCount) - clockSkewMs);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Dropped the check.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Hi, I'm the Playwright bot and I took a first look at the CI failures here.

🟢 CI is clear — the failures don't come from this PR

This is a test-only change to the HAR websocket timing assertions (harTracer.ts + har-websocket.spec.ts). None of the three MCP failures touch that code path, and two of them are already-known flakes; the third is bot-level infra on the same run.

Details

Overall: the diff only changes HAR websocket duration reporting and its test. The tests 1 report has no failures (7 flaky only). The 3 MCP failures are all in mcp/* CLI/annotate flows, which this PR doesn't exercise.

Pre-existing flake / infra

  • [firefox] › mcp/annotate.spec.ts:446 › should switch screencast to -s session on show --annotate — pre-existing flake. Across the results DB it failed 26 of 624 runs, on many unrelated PRs and push SHAs (e.g. PRs fix(cli): don't crash the response when navigating closes the last tab #41675, feat(devops): add PR CI failure triage bot #41616, fix(trace-viewer): remove speculative 1s isUnderTest startup delay #42071 and push commits). Unrelated to HAR websocket code.
  • [chrome] › mcp/cli-core.spec.ts:115 › hover — pre-existing flake. Besides this run it failed on two unrelated push SHAs (75689d18, 63ff5dc1) on mcp-windows-latest-chrome. Here it timedOut on mcp-macos-latest-chrome.
  • [chrome] › mcp/cli-route.spec.ts:19 › route-list shows no routes when empty — infra. It timedOut on mcp-macos-latest-chrome in this exact run, the same bot where hover also timed out in the same run — a bot-level hiccup, not a test regression. I couldn't find this specific test failing on any other SHA, so I'm calling it infra rather than a proven flake, but the diff can't reach MCP CLI route listing.

I'm a first pass, not the final word — but I'd merge on the CI signal here.

Triaged by the Playwright bot - agent run

@yury-s
yury-s merged commit 5f58876 into microsoft:main Aug 4, 2026
48 checks passed
@yury-s
yury-s deleted the unflake-har-websocket branch August 4, 2026 22:14
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

8 flaky ⚠️ [installation tests] › playwright-cli.spec.ts:21 › cli should work `@package-installations-ubuntu-latest`
⚠️ [chromium-library] › library/video.spec.ts:664 › screencast › should capture full viewport `@frozen-time-library-chromium-linux`
⚠️ [chromium-library] › library/beforeunload.spec.ts:130 › should support dismissing the dialog multiple times `@realtime-time-library-chromium-linux`
⚠️ [chromium-library] › library/video.spec.ts:699 › screencast › should capture full viewport on hidpi `@realtime-time-library-chromium-linux`
⚠️ [firefox-library] › library/heap.spec.ts:223 › should not leak workers `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-emulate-media.spec.ts:144 › should keep reduced motion and color emulation after reload `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-goto.spec.ts:90 › should work with Cross-Origin-Opener-Policy `@firefox-ubuntu-22.04-node20`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:715 › should indicate current test status `@windows-latest-node22`

51191 passed, 1188 skipped


Merge workflow run.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Test results for "MCP"

8050 passed, 1284 skipped


Merge workflow run.

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