Skip to content

fix(clock): make Temporal.Now follow page.clock - #42838

Merged
Yury Semikhatsky (yury-s) merged 2 commits into
microsoft:mainfrom
yury-s:fix-42830
Sep 21, 2026
Merged

Yury Semikhatsky (yury-s) merged 2 commits into
microsoft:mainfrom
yury-s:fix-42830

Conversation

@yury-s

Copy link
Copy Markdown
Member

Summary

  • page.clock faked Date, timers, performance and Intl.DateTimeFormat, but Temporal.Now kept reading the host clock.
  • Mirror Temporal and override the clock-reading Temporal.Now methods (instant, zonedDateTimeISO, plainDateTimeISO, plainDateISO, plainTimeISO); timeZoneId() and the rest of Temporal stay native.

Fixes #42830

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

12 flaky ⚠️ [installation tests] › playwright-cli-install-should-work.spec.ts:144 › install command should work with HTTPS proxy for HTTP downloads `@package-installations-ubuntu-latest`
⚠️ [installation tests] › playwright-test-package-managers.spec.ts:19 › npm: @playwright/test should work `@package-installations-ubuntu-latest`
⚠️ [chromium-library] › library/video.spec.ts:521 › screencast › should capture static page in persistent context Radoslav Kirilov (@smoke) `@frozen-time-library-chromium-linux`
⚠️ [chromium-library] › library/video.spec.ts:690 › screencast › should capture full viewport `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:762 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:521 › screencast › should capture static page in persistent context Radoslav Kirilov (@smoke) `@chromium-ubuntu-22.04-node22`
⚠️ [chromium-library] › library/video.spec.ts:690 › screencast › should capture full viewport `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@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-event-request.spec.ts:181 › should return response body when Cross-Origin-Opener-Policy is set `@firefox-ubuntu-22.04-node20`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:827 › should update state on subsequent run `@windows-latest-node22`

52057 passed, 1252 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

6 failed
❌ [firefox] › mcp/annotate.spec.ts:446 › should switch screencast to -s session on show --annotate @mcp-windows-latest-firefox
❌ [firefox] › mcp/cli-core.spec.ts:115 › hover @mcp-windows-latest-firefox
❌ [firefox] › mcp/cli-core.spec.ts:276 › click button with role locator @mcp-windows-latest-firefox
❌ [firefox] › mcp/cli-session.spec.ts:54 › idle timeout shuts the session down @mcp-windows-latest-firefox
❌ [firefox] › mcp/http.spec.ts:145 › http transport browser sigint @mcp-windows-latest-firefox
❌ [firefox] › mcp/idle-timeout.spec.ts:19 › closes the browser after the idle timeout and relaunches it on the next call @mcp-windows-latest-firefox

8686 passed, 1474 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

🟢 All six failures are pre-existing flakes on mcp-windows-latest-firefox — this PR is clear

Hi, I'm the Playwright bot and I triaged the CI failures here.

Every failure in the latest MCP report landed on a single bot, mcp-windows-latest-firefox, and each one has a failure history on that bot across unrelated PRs. The "tests 1" report has no failures — only flaky.

Details

Overall: the diff is clock-only — packages/injected/src/clock.ts, the Temporal builtin capture in utilityScript.ts, the clock docs, generated types and tests/library/page-clock.spec.ts. The new Temporal builtin is captured behind an originals.Temporal ? … : undefined guard and createTemporal only runs when page.clock is installed; the MCP suite never installs a clock. So the diff doesn't reach any of the failing tests.

Pre-existing flake / infra

All six are the same story: this bot is noisy, and each test flips verdict across SHAs this PR can't be responsible for. Numbers below are from the aggregated CI results DB, project_name='firefox', bot_name='mcp-windows-latest-firefox'.

test failed / total runs on this bot other PRs it failed on error signature
mcp/annotate.spec.ts:446 › should switch screencast to -s session on show --annotate 74 / 699 #42186, #42785, #42751, #42736, #42723, … (33 distinct) toHaveAccessibleName on the session region times out
mcp/cli-session.spec.ts:54 › idle timeout shuts the session down 45 / 144 #42843, #42834, #42833, #42832, #42784, … (25 distinct) expected "(no browsers)", got a still-open firefox browser
mcp/cli-core.spec.ts:276 › click button with role locator 8 / 701 #42787, #42744, #42431, #42395, #42239 expect(received).toBeTruthy()undefined
mcp/cli-core.spec.ts:115 › hover 8 / 701 #42513, #42395, #42301 expected "mouse move 50 50", got ""
mcp/http.spec.ts:145 › http transport browser sigint 9 / 701 #42833, #42663, #42550, #42383, #42275 missing "close browser" in the event tally
mcp/idle-timeout.spec.ts:19 › closes the browser after the idle timeout and relaunches it on the next call 5 / 169 #42785, #42760, #42758, #42718 snapshot: undefined instead of "Hello, world!"

Each error message here matches the one the run on this PR produced, so it's the same failure mode, not a coincidence of name. cli-session.spec.ts:54 at a 31% fail rate on this bot is the loudest — that one looks worth a separate look independent of this PR.

The whole mcp-windows-latest-firefox bot is the common factor: the same MCP tests are green on mcp-ubuntu-latest-firefox and mcp-macos-latest-firefox (1–2 failures in ~710 runs each), which fits a slow-Windows timing problem in session teardown rather than anything in the diff.

Not triaged

The 12 entries in the "tests 1" report are flaky (passed on retry), not failures — library/video.spec.ts screencast, browsercontext-cookies-third-party.spec.ts, ui-mode-trace.spec.ts, the package-installation tests. None go near the clock.

I'm a first pass, not the final word — a re-run should confirm, and I'd expect it green.

Triaged by the Playwright bot - agent 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.

[Bug]: page.clock does not control Temporal.Now

2 participants