Skip to main content
Version: 1.x

Class: Ui5Clock

Controls the browser clock for date-driven SAP tests.

Remarks​

Call install first — the other methods throw until you do, because Playwright silently ignores clock control on an uninstalled clock, which is a confusing way to lose an afternoon.

Capability​

ui5Clock.install

Example​

const clock = new Ui5Clock({ page });
await clock.install('2026-03-31T12:00:00Z');
await clock.fastForward('30:00'); // 30 minutes later

Constructors​

Constructor​

new Ui5Clock(options): Ui5Clock

Parameters​

options​

Ui5ClockOptions

Returns​

Ui5Clock

Accessors​

installed​

Get Signature​

get installed(): boolean

Whether install has run.

Example​
if (!clock.installed) await clock.install();
Returns​

boolean

Methods​

fastForward()​

fastForward(ticks): Promise<void>

Jumps forward, firing any timers scheduled in between.

Parameters​

ticks​

string | number

Milliseconds, or a "mm:ss" / "hh:mm:ss" string.

Returns​

Promise<void>

Capability​

ui5Clock.fastForward

Example​

await clock.fastForward('30:00'); // 30 minutes

install()​

install(time?): Promise<void>

Installs the fake clock, optionally at a specific time.

Parameters​

time?​

ClockTime

Initial time. Omit to install at the current real time.

Returns​

Promise<void>

Remarks​

Install before navigating where possible, so the application sees the faked time from its first render.

Throws​

PramanError with ERR_COMPAT_FEATURE_UNAVAILABLE when Playwright predates 1.45.

Capability​

ui5Clock.install

Example​

await clock.install('2026-03-31T12:00:00Z');

pauseAt()​

pauseAt(time): Promise<void>

Advances to a time, pausing there.

Parameters​

time​

ClockTime

The time to pause at.

Returns​

Promise<void>

Capability​

ui5Clock.pauseAt

Example​

await clock.pauseAt('2026-06-30T00:00:00Z'); // period close

resume()​

resume(): Promise<void>

Resumes normal time flow after a pause.

Returns​

Promise<void>

Capability​

ui5Clock.resume

Example​

await clock.resume();

runFor()​

runFor(ticks): Promise<void>

Runs the clock forward, firing timers, without jumping.

Parameters​

ticks​

string | number

Milliseconds, or a "mm:ss" / "hh:mm:ss" string.

Returns​

Promise<void>

Capability​

ui5Clock.runFor

Example​

await clock.runFor(5_000);

setFixedTime()​

setFixedTime(time): Promise<void>

Pins the clock to a fixed time without affecting timers.

Parameters​

time​

ClockTime

The time to report.

Returns​

Promise<void>

Capability​

ui5Clock.setFixedTime

Example​

await clock.setFixedTime('2026-12-31T23:59:00Z');