0

I am using cypress to automate countdown content block, I need to test recurrence scenarios by using Cypress. In Example,

At the Start - Days - 00 | Hrs - 00 | Mins - 00

I need to validate, after one hour, count down will be started (Days - 23 | Hrs - 59 | Mins - 59)

I cannot use hard-coded wait times, so I try the following cypress script but It won't work.

const now = new Date().getTime()
cy.clock(now)
cy.tick(3600000)

Anything worng in this? Or help me to find a good solution.

1 Answers1

0

I would recommend to use moment library, so it will take current time + one hour, and so on

const afterOneHour = moment().add(+1, 'h').format('HH:mm');

like on example here

Evgenii Bazhanov
  • 898
  • 1
  • 7
  • 19