React-dates: DayPickerRangeController not rendering when changing date using Cypress/lolex clock

Created on 19 Oct 2018  路  4Comments  路  Source: airbnb/react-dates

Hi there,

I have a problem with testing my app with Cypress/lolex clock.
For my e2e tests I want to set a specific date as today date with clock, so I can easily assume the output of my react-dates calendar.

However if I do that - the calendar doesn't render at all and there is no error in the console.
I've spent hours on debugging and looking for the problem, but haven't found any.

Could anybody give me a hint on what to do?

Everything works fine if I don't use the clock.

Most helpful comment

@davebream cypress allows you to pass a list of time related functions that clock should override - https://docs.cypress.io/api/commands/clock.html#Function-Names. React dates is attempting to animate into view but the animation is prevented by clock overriding timing functions.

cy.clock(2527372800000, [ 'Date' ]) fixed the issue for me

All 4 comments

That sounds like a bug with clock then - moment is dependent on the only two date apis that provide the current time, Date.now and new Date, and any proper clock mocking should be working with it.

@davebream cypress allows you to pass a list of time related functions that clock should override - https://docs.cypress.io/api/commands/clock.html#Function-Names. React dates is attempting to animate into view but the animation is prevented by clock overriding timing functions.

cy.clock(2527372800000, [ 'Date' ]) fixed the issue for me

@stuart-williams Wow, you are right, everything works now! thanks!

@stuart-williams Thanks so much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

easwee picture easwee  路  55Comments

AntiFish03 picture AntiFish03  路  19Comments

aaronjensen picture aaronjensen  路  52Comments

jnrepo picture jnrepo  路  40Comments

wub picture wub  路  20Comments