Skip to content

Commit d090345

Browse files
committed
fix
Signed-off-by: Qingyang(Abby) Hu <abigailhu2000@gmail.com>
1 parent d42d288 commit d090345

1 file changed

Lines changed: 27 additions & 10 deletions

File tree

  • cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover.spec.js

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ describe('discover app', { scrollBehavior: false }, () => {
6161
cy.fleshTenantSettings();
6262
});
6363

64-
after(() => {});
64+
after(() => {
65+
cy.deleteSavedObjectByType('save-search');
66+
});
6567

6668
describe('filters and queries', () => {
6769
after(() => {
@@ -94,25 +96,40 @@ describe('discover app', { scrollBehavior: false }, () => {
9496
const saveSearch1 = 'Save Search # 1';
9597
const saveSearch2 = 'Modified Save Search # 1';
9698

97-
it('should show correct time range string by timepicker', function () {
98-
cy.verifyTimeConfig(DE_DEFAULT_START_TIME, DE_DEFAULT_END_TIME);
99-
cy.waitForLoader();
100-
});
101-
10299
it('save search should display save search name in breadcrumb', function () {
103100
cy.log('save search should display save search name in breadcrumb');
101+
// Set up query and filter
102+
cy.setTopNavQuery('response:200');
103+
cy.submitFilterFromDropDown('extension.raw', 'is one of', 'jpg');
104104
cy.saveSearch(saveSearch1);
105105
cy.getElementByTestId('breadcrumb last')
106106
.should('be.visible')
107107
.should('have.text', saveSearch1);
108108
});
109109

110-
it('load save search should show save search name in breadcrumb', function () {
110+
it('load save search should show save search name in breadcrumb, and show the correct query and filter', function () {
111+
// Change time filter to something other than default time filter
112+
const fromTime = 'Sep 20, 2015 @ 00:00:00.000';
113+
const toTime = 'Sep 21, 2015 @ 00:00:00.000';
114+
cy.setTopNavDate(fromTime, toTime);
115+
116+
// Click new discover
117+
cy.getElementByTestId('discoverNewButton').click();
111118
cy.loadSaveSearch(saveSearch1);
112119

120+
// Check if breadcrumb is updated
113121
cy.getElementByTestId('breadcrumb last')
114122
.should('be.visible')
115123
.should('have.text', saveSearch1);
124+
125+
// Check if the correct query and filter are updated
126+
cy.getElementByTestId(`queryInput`).should('have.text', 'response:200');
127+
cy.get('[data-test-subj~="filter-key-extension.raw"]').should(
128+
'be.visible'
129+
);
130+
131+
// Check that time filter should not be updated with loading saved search; the time filter that we changed before should still be persisted
132+
cy.verifyTimeConfig(fromTime, toTime);
116133
});
117134

118135
it('renaming a save search should modify name in breadcrumb', function () {
@@ -127,7 +144,7 @@ describe('discover app', { scrollBehavior: false }, () => {
127144
it('should show the correct hit count', function () {
128145
cy.loadSaveSearch(saveSearch2);
129146
cy.setTopNavDate(DE_DEFAULT_START_TIME, DE_DEFAULT_END_TIME);
130-
const expectedHitCount = '14,004';
147+
const expectedHitCount = '8,366';
131148
cy.verifyHitCount(expectedHitCount);
132149
});
133150

@@ -152,11 +169,11 @@ describe('discover app', { scrollBehavior: false }, () => {
152169
it('should reload the saved search with persisted query to show the initial hit count', function () {
153170
// apply query some changes
154171
cy.setTopNavQuery('test');
155-
cy.verifyHitCount('22');
172+
cy.verifyHitCount('15');
156173

157174
// reset to persisted state
158175
cy.getElementByTestId('resetSavedSearch').click();
159-
const expectedHitCount = '14,004';
176+
const expectedHitCount = '8,366';
160177
cy.verifyHitCount(expectedHitCount);
161178
});
162179
});

0 commit comments

Comments
 (0)