Skip to content

Commit

Permalink
Updated the Discover Saved Search Tests
Browse files Browse the repository at this point in the history
Signed-off-by: Suchit Sahoo <[email protected]>
  • Loading branch information
LDrago27 committed Oct 7, 2024
1 parent fb85e41 commit b7a808a
Showing 1 changed file with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -61,7 +64,9 @@ describe('discover app', { scrollBehavior: false }, () => {
cy.fleshTenantSettings();
});

after(() => {});
after(() => {
cy.deleteSavedObjectByType('search');
});

describe('filters and queries', () => {
after(() => {
Expand Down Expand Up @@ -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);
});

Expand Down Expand Up @@ -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~="[email protected]"]').should('be.visible');
});

it('reset filters while we create a new search', function () {
cy.get('[data-test-subj~="[email protected]"]').should('be.visible');
cy.get('[data-test-subj="discoverNewButton"]').click({ force: true });
cy.get('[data-test-subj~="[email protected]"]').should('not.exist');
});
});

describe(
Expand Down

0 comments on commit b7a808a

Please sign in to comment.