diff --git a/x-pack/plugins/security_solution/cypress/integration/search_bar.spec.ts b/x-pack/plugins/security_solution/cypress/integration/search_bar.spec.ts index 9104f494e3e6b..15ca92714d4a3 100644 --- a/x-pack/plugins/security_solution/cypress/integration/search_bar.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/search_bar.spec.ts @@ -12,7 +12,7 @@ import { hostIpFilter } from '../objects/filter'; import { HOSTS_URL } from '../urls/navigation'; import { waitForAllHostsToBeLoaded } from '../tasks/hosts/all_hosts'; -describe.skip('SearchBar', () => { +describe('SearchBar', () => { before(() => { loginAndWaitForPage(HOSTS_URL); waitForAllHostsToBeLoaded(); @@ -21,6 +21,10 @@ describe.skip('SearchBar', () => { it('adds correctly a filter to the global search bar', () => { openAddFilterPopover(); fillAddFilterForm(hostIpFilter); - cy.get(GLOBAL_SEARCH_BAR_FILTER_ITEM(hostIpFilter)).should('be.visible'); + + cy.get(GLOBAL_SEARCH_BAR_FILTER_ITEM).should( + 'have.text', + `${hostIpFilter.key}: ${hostIpFilter.value}` + ); }); }); diff --git a/x-pack/plugins/security_solution/cypress/screens/search_bar.ts b/x-pack/plugins/security_solution/cypress/screens/search_bar.ts index 35864749a4065..07e9de137826c 100644 --- a/x-pack/plugins/security_solution/cypress/screens/search_bar.ts +++ b/x-pack/plugins/security_solution/cypress/screens/search_bar.ts @@ -4,8 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import { SearchBarFilter } from '../objects/filter'; - export const GLOBAL_SEARCH_BAR_ADD_FILTER = '[data-test-subj="globalDatePicker"] [data-test-subj="addFilter"]'; @@ -28,5 +26,4 @@ export const ADD_FILTER_FORM_FILTER_VALUE_INPUT = '[data-test-subj="filterParams export const ADD_FILTER_FORM_SAVE_BUTTON = '[data-test-subj="saveFilter"]'; -export const GLOBAL_SEARCH_BAR_FILTER_ITEM = ({ key, value }: SearchBarFilter) => - `[data-test-subj="filter filter-enabled filter-key-${key} filter-value-${value} filter-unpinned"]`; +export const GLOBAL_SEARCH_BAR_FILTER_ITEM = '#popoverFor_filter0'; diff --git a/x-pack/plugins/security_solution/cypress/tasks/hosts/all_hosts.ts b/x-pack/plugins/security_solution/cypress/tasks/hosts/all_hosts.ts index f9f902c3de8c7..27d17f966d8fc 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/hosts/all_hosts.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/hosts/all_hosts.ts @@ -36,5 +36,5 @@ export const openFirstHostDetails = () => { }; export const waitForAllHostsToBeLoaded = () => { - cy.get(ALL_HOSTS_TABLE).should('exist'); + cy.get(ALL_HOSTS_TABLE).should('be.visible'); }; diff --git a/x-pack/plugins/security_solution/cypress/tasks/search_bar.ts b/x-pack/plugins/security_solution/cypress/tasks/search_bar.ts index a32c38a97fce5..4b194d1233f25 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/search_bar.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/search_bar.ts @@ -19,7 +19,8 @@ import { export const openAddFilterPopover = () => { cy.get(GLOBAL_SEARCH_BAR_SUBMIT_BUTTON).should('be.enabled'); - cy.get(GLOBAL_SEARCH_BAR_ADD_FILTER).click({ force: true }); + cy.get(GLOBAL_SEARCH_BAR_ADD_FILTER).should('be.visible'); + cy.get(GLOBAL_SEARCH_BAR_ADD_FILTER).click(); }; export const fillAddFilterForm = ({ key, value }: SearchBarFilter) => { @@ -32,4 +33,5 @@ export const fillAddFilterForm = ({ key, value }: SearchBarFilter) => { cy.get(ADD_FILTER_FORM_OPERATOR_OPTION_IS).click(); cy.get(ADD_FILTER_FORM_FILTER_VALUE_INPUT).type(value); cy.get(ADD_FILTER_FORM_SAVE_BUTTON).click(); + cy.get(ADD_FILTER_FORM_SAVE_BUTTON).should('not.exist'); };