Skip to main content

tick

Move the clock the specified number of milliseconds. Any timers within the affected range of time will be called.

Usage
const clock = await browser.emulate('clock', { ... })
await clock.tick(ms)
Parameters
NameTypeDetails
msnumberThe number of milliseconds to move the clock.
Example
tick.js
const clock = await browser.emulate('clock', { now: new Date(2021, 3, 14) })
console.log(await browser.execute(() => new Date().getTime())) // returns 1618383600000

await clock.tick(1000)
console.log(await browser.execute(() => new Date().getTime())) // returns 1618383601000

Welcome! How can I help?

WebdriverIO AI Copilot