From e3fdf0f1ca012a7d2a6f7dec2f8a03af7a8cb191 Mon Sep 17 00:00:00 2001 From: "Qingyang(Abby) Hu" Date: Thu, 26 Sep 2024 10:45:30 -0700 Subject: [PATCH] Add query and filter syncing up (#1576) Follow up PR of opensearch-project/OpenSearch-Dashboards#8168 to add test to make sure queries and filters are persisted across refresh, and switching between new and legacy tables. Signed-off-by: Qingyang(Abby) Hu (cherry picked from commit fb85e41994f560eb9bb42c1c96c6c1ed03105df9) --- .../apps/data_explorer/discover.spec.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) 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 9fccc0265..a8b0a349f 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 @@ -63,6 +63,32 @@ describe('discover app', { scrollBehavior: false }, () => { after(() => {}); + describe('filters and queries', () => { + after(() => { + cy.get('[data-test-subj~="filter-key-extension.raw"]').click(); + cy.getElementByTestId(`deleteFilter`).click(); + cy.switchDiscoverTable('legacy'); + }); + it('should persist across refresh', function () { + // Set up query and filter + cy.setTopNavQuery('response:200'); + cy.submitFilterFromDropDown('extension.raw', 'is one of', 'jpg'); + cy.reload(); + cy.getElementByTestId(`queryInput`).should('have.text', 'response:200'); + cy.get('[data-test-subj~="filter-key-extension.raw"]').should( + 'be.visible' + ); + }); + + it('should persist across switching table', function () { + cy.switchDiscoverTable('new'); + cy.getElementByTestId(`queryInput`).should('have.text', 'response:200'); + cy.get('[data-test-subj~="filter-key-extension.raw"]').should( + 'be.visible' + ); + }); + }); + describe('save search', () => { const saveSearch1 = 'Save Search # 1'; const saveSearch2 = 'Modified Save Search # 1';