Skip to content

Feat: Add helper command for cross-month date selection #2287

@LuizFNJ

Description

@LuizFNJ

Background Information

Currently, tests that require selecting a date spanning across different months (e.g., selecting a date from the past month when the current view is the present month) fail. The Cypress command tries to click on a day number, but since the calendar hasn't navigated to the correct month, the target day is either disabled or incorrect (e.g., clicking on the 20th of the current month instead of the 20th of the previous month).

How

  1. Created a new command: Implemented a global Cypress command called selectDatePickerDate.
  2. Used dayjs: The command accepts a dayjs object to determine the target month and year.
  3. Automatic Navigation: The command checks the current calendar view:
    • If the target date is in a past month, it clicks the "Previous month" button.
    • If the target date is in a future month, it clicks the "Next month" button.
  4. Click Day: After navigating, it clicks the specific day number.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

In Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions