Skip to content
masterclass Buddy

Cypress · Method

cy.clock

cy.clock() replaces selected browser time functions with controllable versions. Advance fake time with cy.tick() or the yielded clock object to test timers, dates, and time-based behavior without waiting.

Last updated

Syntax

cy.clock()
cy.clock(now)
cy.clock(now, functionNames)
cy.clock(options)
cy.clock(now, options)
cy.clock(now, functionNames, options)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • cy.tick()
  • clock.tick()
  • clock.restore()
  • clock.setSystemTime()
  • cy.spy()

Source: cy.clock() | Cypress API Documentation. Checked 2026-11-03.