Skip to content

Commit

Permalink
Clean query to make the test more robust (#1601) (#1602)
Browse files Browse the repository at this point in the history
Signed-off-by: Anan <[email protected]>
(cherry picked from commit 0cca77b)

Co-authored-by: Anan Zhuang <[email protected]>
  • Loading branch information
opensearch-trigger-bot[bot] and ananzh authored Oct 29, 2024
1 parent 30639d2 commit ab28794
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ describe('discover app', { scrollBehavior: false }, () => {
cy.get('[data-test-subj~="filter-key-extension.raw"]').should(
'be.visible'
);
cy.clearTopNavQuery();
});
});

Expand Down
16 changes: 16 additions & 0 deletions cypress/utils/dashboards/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ Cypress.Commands.add('setTopNavQuery', (value, submit = true) => {
}
});

Cypress.Commands.add('clearTopNavQuery', (submit = true) => {
const opts = { log: false };

Cypress.log({
name: 'clearTopNavQuery',
displayName: 'clear query',
message: 'clearing query field',
});

cy.getElementByTestId('queryInput', opts).clear(opts).blur(opts);

if (submit) {
cy.updateTopNav(opts);
}
});

Cypress.Commands.add('setTopNavDate', (start, end, submit = true) => {
const opts = { log: false };

Expand Down

0 comments on commit ab28794

Please sign in to comment.