Skip to content

feat: Abblility to mock the current date #3292

@ryuran

Description

@ryuran

Prerequisites

Describe the Feature Request

For test purpose we need to fake the current date.

Describe the Use Case

For test purpose we need to fake the current date.

We work on a calendar component and use screenshot tests.
Sadly each time we run test and the current date changed, the component will render differently and it's expected.

It's why we need to fixe a date to run a test on it.

We tested :

  • to proxy the Date object in the browser without success.
  • to use jest.useFakeTimers('modern').setSystemTime(…) but we encounter a bunch of Timeout errors in e2e tests

Describe Preferred Solution

Don't have a preference :

  • parameter in newE2ePage to set a date as "now"
  • a way to reach the puppeteer browser before to run a page

Describe Alternatives

No response

Related Code

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature: Want this? Upvote it!This PR or Issue may be a great consideration for a future idea.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions