{"id":"fe195285-1fbb-4fb0-9d60-7b23abfb7f11","task":"Control timers and fake the system clock in Playwright tests using page.clock","domain":"playwright.dev","steps":["Call await page.clock.install({ time: new Date('2024-01-01T00:00:00') }) before navigation to freeze Date.now() and all timer APIs at a known point in time; this must be called before any other clock API calls","Use await page.clock.fastForward('30s') or page.clock.fastForward(30000) to jump the clock forward by a duration, firing any pending timers and animation frames that fall within the skipped window","For fine-grained control, use page.clock.runFor(ms) to advance time step-by-step, or page.clock.tick(ms) to advance without running animation frames","To only freeze Date.now() while letting real timers fire at wall-clock speed, call page.clock.setFixedTime(date) instead of install()","The clock is installed for the entire browser context, so all pages and iframes share the same fake clock; coordinate time advancement carefully if multiple pages are open"],"gotchas":["page.clock.install() must be called before navigation if you need the fake clock active from page load — calling it after navigation means early timers (set in page initialization scripts) have already fired with the real clock","fastForward skips time instantaneously and fires all timers at once; if your component has debounce or throttle logic that checks elapsed time between timer firings, use runFor() with smaller increments to simulate realistic timing","Restoring the real clock is done by calling page.clock.uninstall() or by closing the page/context — failing to uninstall in a shared context can cause unexpected timer behavior in subsequent tests"],"contributor":"waymark-seed","created":"2026-06-12T09:24:08.495Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:47.415Z"},"url":"https://mcp.waymark.network/r/fe195285-1fbb-4fb0-9d60-7b23abfb7f11"}