From b7a808af0917e937144ab78834f0035cbd12d841 Mon Sep 17 00:00:00 2001 From: Suchit Sahoo Date: Fri, 4 Oct 2024 12:22:06 -0700 Subject: [PATCH] Updated the Discover Saved Search Tests Signed-off-by: Suchit Sahoo --- .../apps/data_explorer/discover.spec.js | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 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 a8b0a349f..c566767e4 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 @@ -28,6 +28,9 @@ describe('discover app', { scrollBehavior: false }, () => { before(() => { CURRENT_TENANT.newTenant = 'global'; cy.fleshTenantSettings(); + // delete all saved searches + cy.deleteSavedObjectByType('search'); + // import logstash functional testFixtureHandler.importJSONDocIfNeeded( indexSet, @@ -61,7 +64,9 @@ describe('discover app', { scrollBehavior: false }, () => { cy.fleshTenantSettings(); }); - after(() => {}); + after(() => { + cy.deleteSavedObjectByType('search'); + }); describe('filters and queries', () => { after(() => { @@ -126,7 +131,7 @@ describe('discover app', { scrollBehavior: false }, () => { it('should show the correct hit count', function () { cy.loadSaveSearch(saveSearch2); cy.setTopNavDate(DE_DEFAULT_START_TIME, DE_DEFAULT_END_TIME); - const expectedHitCount = '14,004'; + const expectedHitCount = '12,891'; cy.verifyHitCount(expectedHitCount); }); @@ -155,9 +160,23 @@ describe('discover app', { scrollBehavior: false }, () => { // reset to persisted state cy.getElementByTestId('resetSavedSearch').click(); - const expectedHitCount = '14,004'; + const expectedHitCount = '12,891'; cy.verifyHitCount(expectedHitCount); }); + + it('after adding a filter to a saved search and reloading the page the added filter should persist', function () { + cy.loadSaveSearch(saveSearch2); + cy.setTopNavDate(DE_DEFAULT_START_TIME, DE_DEFAULT_END_TIME); + cy.submitFilterFromDropDown('@tags.raw', 'is', 'success'); + cy.reload(); + cy.get('[data-test-subj~="filter-key-@tags.raw"]').should('be.visible'); + }); + + it('reset filters while we create a new search', function () { + cy.get('[data-test-subj~="filter-key-@tags.raw"]').should('be.visible'); + cy.get('[data-test-subj="discoverNewButton"]').click({ force: true }); + cy.get('[data-test-subj~="filter-key-@tags.raw"]').should('not.exist'); + }); }); describe(