Control virtual browser time — expire a countdown and grow a relative-time label with page.clock instead of waiting real seconds
A live countdown, a relative-time label and a trial banner all read the browser clock — pin or fast-forward virtual time instead of waiting real seconds
Every widget below depends on the current time. A naive test would sleep(60) to watch the countdown expire — slow and flaky. Instead, install a virtual clock and travel through time deterministically.
The server clock is exposed separately at GET /api/lab/now and can be pinned with the X-Mock-Now header.
Countdown, relative time, trial expiry and server time
Countdown
—
Relative time
—
Server now
loading…
Automation hints
page.clock.install({ time }) before navigating so #countdown and #relative-time read your virtual clock instead of the real onepage.clock.fastForward("01:00") to expire #countdown instantly, then assert #countdown[data-expired="true"] and #trial-banner[data-state="expired"]#relative-time contains the word ago — fast-forward the clock to watch the elapsed value grow deterministicallyX-Mock-Now header to /api/lab/now and assert the echoed value appears in #server-nowwaitForTimeout(60000) for real wall-clock seconds — control virtual time with page.clock for fast, stable runs