The Page.clock API allows you to manipulate and control time within tests, enabling precise validation of time-dependent features like rendering time, timeouts, and scheduled tasks without real-time delays.
It overrides native global classes and functions including:
Date and performancesetTimeout, clearTimeout, setInterval, clearIntervalrequestAnimationFrame, cancelAnimationFramerequestIdleCallback, cancelIdleCallbackEvent.timeStamp
Important: If you use install, it must be called before any other clock-related calls (like setInterval). Calling them out of order results in undefined behavior because install replaces the native definitions.