Reputation: 699
We use Cypress and cypress-image-snapshot
for snapshot testing. Unfortunately we have issues with our colleagues based in another countries running the tests since they fail because of different timezones.
In our date related components we pass strings in ISO 8601 format to set the date.
For our jest tests we use mocks (Components using Date objects produce different snapshots in different timezones) but not quite sure how to handle the situation in Cypress.
Upvotes: 11
Views: 9238
Reputation: 316
You can open browser with different TZ from server by adding specific timezone before open, in this way
"scripts": {
"cypress:open": "TZ=America/New_York cypress open",
"cypress:run": "TZ=America/New_York cypress run"
}
Upvotes: 18