From e742f88175990ffc4cf1e31aae8353bdc0f38922 Mon Sep 17 00:00:00 2001 From: Kawika Avilla Date: Mon, 18 Mar 2024 16:16:07 -0700 Subject: [PATCH] Revert "[Discover] toggle for legacy mode (#1148)" This reverts commit 861f8b2253c5d986a7a2d2351722e03ab1d83758. Signed-off-by: Kawika Avilla --- .../apps/data_explorer/date_nanos.spec.js | 2 +- .../data_explorer/date_nanos_mixed.spec.js | 2 +- .../apps/data_explorer/discover.spec.js | 5 +++- .../apps/data_explorer/field_data.spec.js | 2 +- .../index_pattern_with_encoded_id.spec.js | 2 +- .../index_pattern_without_field.spec.js | 2 ++ .../apps/data_explorer/saved_queries.spec.js | 2 +- .../dashboards/data_explorer/commands.js | 25 ++++++++----------- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/date_nanos.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/date_nanos.spec.js index 4283e0f4f..5a0dc3659 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/date_nanos.spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/date_nanos.spec.js @@ -34,10 +34,10 @@ describe('date_nanos', () => { }); miscUtils.visitPage('app/data-explorer/discover#/'); cy.waitForLoader(); + cy.switchDiscoverTable('new'); cy.setTopNavDate(fromTime, toTime); cy.waitForSearch(); - cy.switchDiscoverTable('new'); }); after(() => { diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/date_nanos_mixed.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/date_nanos_mixed.spec.js index 6cc468c6a..b56b2ab54 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/date_nanos_mixed.spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/date_nanos_mixed.spec.js @@ -31,12 +31,12 @@ describe('date_nanos_mixed', () => { }); miscUtils.visitPage('app/data-explorer/discover#/'); cy.waitForLoader(); + cy.switchDiscoverTable('new'); const fromTime = 'Jan 1, 2019 @ 00:00:00.000'; const toTime = 'Jan 1, 2019 @ 23:59:59.999'; cy.setTopNavDate(fromTime, toTime); cy.waitForSearch(); - cy.switchDiscoverTable('new'); }); after(() => { 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 220cd0d3c..a11258d08 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 @@ -62,8 +62,8 @@ describe('discover app', { scrollBehavior: false }, () => { `app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))` ); cy.waitForLoader(); - cy.waitForSearch(); cy.switchDiscoverTable('new'); + cy.waitForSearch(); }); after(() => {}); @@ -71,6 +71,9 @@ describe('discover app', { scrollBehavior: false }, () => { describe('save search', () => { const saveSearch1 = 'Save Search # 1'; const saveSearch2 = 'Modified Save Search # 1'; + beforeEach(() => { + cy.switchDiscoverTable('new'); + }); it('should show correct time range string by timepicker', function () { cy.verifyTimeConfig(DE_DEFAULT_START_TIME, DE_DEFAULT_END_TIME); diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/field_data.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/field_data.spec.js index 3b5676bf8..6f350710c 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/field_data.spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/field_data.spec.js @@ -46,8 +46,8 @@ describe('discover tab', () => { `app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))` ); cy.waitForLoader(); - cy.waitForSearch(); cy.switchDiscoverTable('new'); + cy.waitForSearch(); }); after(() => {}); diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/index_pattern_with_encoded_id.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/index_pattern_with_encoded_id.spec.js index d101b2897..8e4d4766f 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/index_pattern_with_encoded_id.spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/index_pattern_with_encoded_id.spec.js @@ -36,8 +36,8 @@ describe('index pattern with encoded id', () => { // Go to the Discover page miscUtils.visitPage('app/data-explorer/discover#/'); - cy.setTopNavDate(DE_DEFAULT_START_TIME, DE_DEFAULT_END_TIME); cy.switchDiscoverTable('new'); + cy.setTopNavDate(DE_DEFAULT_START_TIME, DE_DEFAULT_END_TIME); cy.waitForLoader(); }); diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/index_pattern_without_field.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/index_pattern_without_field.spec.js index bc09964e2..5eeb2a57e 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/index_pattern_without_field.spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/index_pattern_without_field.spec.js @@ -33,6 +33,7 @@ describe('index pattern without field spec', () => { // Go to the Discover page miscUtils.visitPage('app/data-explorer/discover#/'); cy.waitForLoader(); + cy.switchDiscoverTable('new'); }); after(() => { @@ -49,6 +50,7 @@ describe('index pattern without field spec', () => { it('should display a timepicker after switching to an index pattern with timefield', () => { const indexName = 'with-timefield'; + cy.switchDiscoverTable('new'); cy.getElementByTestId('comboBoxToggleListButton') .should('be.visible') .click(); diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/saved_queries.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/saved_queries.spec.js index 315e10f31..f6b5bf711 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/saved_queries.spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/saved_queries.spec.js @@ -51,10 +51,10 @@ describe.skip('saved queries saved objects', () => { // Go to the Discover page miscUtils.visitPage('app/data-explorer/discover#/'); cy.waitForLoader(); + cy.switchDiscoverTable('new'); // Set time filter cy.setTopNavDate(fromTime, toTime); - cy.switchDiscoverTable('new'); // Set up query and filter cy.setTopNavQuery('response:200'); diff --git a/cypress/utils/dashboards/data_explorer/commands.js b/cypress/utils/dashboards/data_explorer/commands.js index c1f94dae9..8170089d6 100644 --- a/cypress/utils/dashboards/data_explorer/commands.js +++ b/cypress/utils/dashboards/data_explorer/commands.js @@ -135,22 +135,17 @@ Cypress.Commands.add('deleteSaveQuery', (name) => { }); Cypress.Commands.add('switchDiscoverTable', (name) => { - cy.getElementByTestId('discoverOptionsButton') + cy.getElementByTestId('datagridTableButton') .then(($button) => { - cy.wrap($button).click(); - - cy.getElementByTestId('discoverOptionsLegacySwitch').then( - ($switchButton) => { - const isLegacyChecked = $switchButton.checked; - if (name === 'new' && !isLegacyChecked) { - cy.wrap($switchButton).click(); - } - if (name === 'legacy' && isLegacyChecked) { - cy.wrap($switchButton).click(); - } - cy.waitForLoader(); - } - ); + const buttonText = $button.text(); + + if (name === 'new' && buttonText.includes('Try new Discover')) { + cy.wrap($button).click(); + } + if (name === 'legacy' && buttonText.includes('Use legacy Discover')) { + cy.wrap($button).click(); + } + cy.waitForLoader(); }) .then(() => { checkForElementVisibility();