Skip to content

test(ui5-dynamic-date-range): add test #11813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 108 additions & 22 deletions packages/main/cypress/specs/DynamicDateRange.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,36 +75,122 @@ describe('DynamicDateRange Component', () => {
cy.get("@input").should('have.value', 'Today');
});

// Unstable test, needs investigation
it.skip('selects the Date option and updates the current value', () => {
cy.window().then((win) => {
cy.stub(win.Date, 'now').returns(new Date(2025, 4, 15).getTime());
});

cy.get('[ui5-dynamic-date-range]').as("ddr");
cy.get("@ddr").shadow().find('[ui5-input]').as("input");
it('selects the Date option and updates the current value', () => {
cy.get('[ui5-dynamic-date-range]')
.as("ddr");

cy.get("@ddr")
.shadow()
.find('[ui5-input]')
.as("input");

cy.get("@input").should('exist');
cy.get("@input")
.should('exist');

cy.get("@input").find('[ui5-icon]').as("icon");
cy.get("@icon").realClick();

cy.get("@ddr").shadow().find("[ui5-responsive-popover]").as("popover");
cy.get("@popover").should('exist');
cy.get("@input")
.find('[ui5-icon]')
.as("icon");

cy.get("@popover").find("[ui5-list]").as("list");
cy.get("@list").find("[ui5-li]").contains('Date').realClick();
cy.get("@icon")
.realClick();

cy.get("@popover").find("[ui5-calendar]").as("calendar");
cy.get("@calendar").should('exist');
cy.get("@ddr")
.shadow()
.find("[ui5-responsive-popover]")
.as("popover");

cy.get("@popover")
.should('exist');

cy.get("@popover")
.find("[ui5-list]")
.as("list");

cy.get("@list")
.find("[ui5-li]")
.contains('Date')
.realClick();

cy.get("@calendar").shadow().find("ui5-daypicker").as("dayPicker");
cy.get("@dayPicker").shadow().find("div[data-sap-timestamp='1747785600']").realClick();
cy.get("@popover")
.find("[ui5-calendar]")
.as("calendar");

cy.get("@popover").find("[ui5-button][design='Emphasized']").as("submitButton");
cy.get("@submitButton").should('exist').realClick();
cy.get("@calendar")
.should('exist');

cy.get("@input").shadow().find("input").should('have.value', 'May 21, 2025');
cy.realPress("Tab");
cy.realPress("Tab");
cy.realPress("Tab");

cy.get("@calendar")
.shadow()
.find("[data-ui5-cal-header-btn-year='true']")
.as("yearButton");

cy.get("@yearButton")
.should("be.focused");

cy.realPress("Space");

cy.get("@calendar")
.shadow()
.find("ui5-yearpicker")
.as("yearPicker");

cy.get("@yearPicker")
.shadow()
.find(".ui5-dp-yeartext")
.contains('2035')
.realClick();

cy.realPress("Tab");
cy.realPress("Tab");

cy.get("@calendar")
.shadow()
.find("[data-ui5-cal-header-btn-month='true']")
.as("monthButton");

cy.get("@monthButton")
.should("be.focused");

cy.realPress("Space");

cy.get("@calendar")
.shadow()
.find("ui5-monthpicker")
.as("monthPicker");

cy.get("@monthPicker")
.shadow()
.find(".ui5-dp-monthtext")
.contains('May')
.realClick();

cy.get("@calendar")
.shadow()
.find("ui5-daypicker")
.as("dayPicker");

cy.get("@dayPicker")
.shadow()
.find(".ui5-dp-daytext")
.eq(22) // May 21, 2035 is the 21st day
.realClick();

cy.get("@popover")
.find("[ui5-button][design='Emphasized']")
.as("submitButton");

cy.get("@submitButton")
.should('exist')
.realClick();

cy.get("@input")
.shadow()
.find("input")
.should('have.value', 'May 21, 2035');
});

it('writes a date in the input and verifies it is selected in the calendar for the Date option', () => {
Expand Down
Loading