From d4468c8990b56e0155a641d367ec673b8ed32cf9 Mon Sep 17 00:00:00 2001 From: Anan Zhuang Date: Thu, 6 Jun 2024 16:11:29 -0700 Subject: [PATCH] Don't need to force DatePickerMenu open (#1358) Due to https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6167, we don't have the double render issue when global state is updated. Therefore we don't need to call makeDatePickerMenuOpen function, which is just to reclick the DatePickerToggle to make the menu re-open. This function is a tmp solution to allow test passing. In this PR, we will remove the function and all the usages. Signed-off-by: Anan (cherry picked from commit 2881c0fc82fb7909ce41efa68dc6bf7f7f580ccc) --- .../apps/data_explorer/discover.spec.js | 3 --- cypress/utils/dashboards/data_explorer/commands.js | 12 ------------ cypress/utils/dashboards/data_explorer/index.d.ts | 1 - 3 files changed, 16 deletions(-) diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover.spec.js index 57bbfd1fa..9fccc0265 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover.spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover.spec.js @@ -279,15 +279,12 @@ describe('discover app', { scrollBehavior: false }, () => { .should('be.visible') .clear() .type('2'); - - cy.makeDatePickerMenuOpen(); cy.getElementByTestId('superDatePickerToggleRefreshButton').click(); // Let auto refresh run cy.wait(100); // Close the auto refresh - cy.makeDatePickerMenuOpen(); cy.getElementByTestId('superDatePickerToggleRefreshButton').click(); // Check the timestamp of the last request, it should be different than the first timestamp diff --git a/cypress/utils/dashboards/data_explorer/commands.js b/cypress/utils/dashboards/data_explorer/commands.js index b33ed750e..a0ccff2e2 100644 --- a/cypress/utils/dashboards/data_explorer/commands.js +++ b/cypress/utils/dashboards/data_explorer/commands.js @@ -156,18 +156,6 @@ Cypress.Commands.add('switchDiscoverTable', (name) => { }); }); -Cypress.Commands.add('makeDatePickerMenuOpen', () => { - cy.get( - '[class="euiFormControlLayout euiFormControlLayout--group euiSuperDatePicker"]' - ).then(($popover) => { - // Check if the popover does not have the 'euiPopover-isOpen' class - if (!$popover.hasClass('euiPopover-isOpen')) { - // If not open, click the button to open the quick menu - cy.getElementByTestId('superDatePickerToggleQuickMenuButton').click(); - } - }); -}); - function checkForElementVisibility() { cy.getElementsByTestIds('queryInput') .should('be.visible') diff --git a/cypress/utils/dashboards/data_explorer/index.d.ts b/cypress/utils/dashboards/data_explorer/index.d.ts index bc71c6ade..703906af3 100644 --- a/cypress/utils/dashboards/data_explorer/index.d.ts +++ b/cypress/utils/dashboards/data_explorer/index.d.ts @@ -17,6 +17,5 @@ declare namespace Cypress { clearSaveQuery(): Chainable; deleteSaveQuery(name: string): Chainable; switchDiscoverTable(name: string): Chainable; - makeDatePickerMenuOpen(): Chainable; } } \ No newline at end of file