From d1eb50eb92d230fd4454ef551638203e6d863447 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Thu, 15 Oct 2026 14:56:12 -0700 Subject: [PATCH] test(evaluate): drop page timers from the overwritten Promise test The assertions added in #43436 resolved the promise and set the flag with setTimeout in the page. The frozen-clock project pauses page timers, so page.evaluateHandle never returned and the test timed out on the frozen-time-library-chromium-linux bot on every commit since. Resolve the promise from a microtask and set the flag before polling instead. Against the pre-#43436 utility script the test still fails on Firefox and WebKit, where jsonValue() does not return 42. Failing runs: https://github.com/microsoft/playwright/actions/runs/38803229595 https://github.com/microsoft/playwright/actions/runs/38803289664 https://github.com/microsoft/playwright/actions/runs/38808174514 --- tests/page/page-evaluate.spec.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/page/page-evaluate.spec.ts b/tests/page/page-evaluate.spec.ts index 85b7246d07a27..d66687af52f45 100644 --- a/tests/page/page-evaluate.spec.ts +++ b/tests/page/page-evaluate.spec.ts @@ -341,11 +341,12 @@ it('should work with overwritten Promise', async ({ page }) => { // Now, the new promise should be awaitable. expect(await page.evaluate(() => Promise.resolve(42))).toBe(42); - const handle = await page.evaluateHandle(() => new Promise(f => setTimeout(() => f(42), 50))); + // No page timers below: the frozen-clock project never fires them. + const handle = await page.evaluateHandle(() => new Promise(f => queueMicrotask(() => f(42)))); expect(await handle.jsonValue()).toBe(42); const error = await page.waitForFunction(() => false, undefined, { timeout: 500 }).catch(e => e); expect(error.message).toContain('Timeout 500ms exceeded'); - await page.evaluate(() => setTimeout(() => (window as any).__done = true, 50)); + await page.evaluate(() => (window as any).__done = true); await page.waitForFunction(() => (window as any).__done); });