From 4f2b023f24777d82004909daa27a0c7d5b149c1e Mon Sep 17 00:00:00 2001 From: Gloria Hornero Date: Wed, 12 Aug 2020 10:26:37 +0200 Subject: [PATCH 1/5] fixes search bar test --- .../cypress/integration/search_bar.spec.ts | 8 ++++++-- .../security_solution/cypress/screens/search_bar.ts | 3 +-- .../plugins/security_solution/cypress/tasks/search_bar.ts | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) 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..551126dffea43 100644 --- a/x-pack/plugins/security_solution/cypress/screens/search_bar.ts +++ b/x-pack/plugins/security_solution/cypress/screens/search_bar.ts @@ -28,5 +28,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 = '.globalFilterItem'; 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..30dfc15923cde 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/search_bar.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/search_bar.ts @@ -32,4 +32,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'); }; From aad56ff07f99e9a9af4588e707e0a3cdc25baf06 Mon Sep 17 00:00:00 2001 From: Gloria Hornero Date: Wed, 12 Aug 2020 15:36:39 +0200 Subject: [PATCH 2/5] fixes typecheck issue --- x-pack/plugins/security_solution/cypress/screens/search_bar.ts | 2 -- 1 file changed, 2 deletions(-) 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 551126dffea43..89dea31fdebdc 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"]'; From 18ee6e0052acf51b65552a2011da934c63a24cb3 Mon Sep 17 00:00:00 2001 From: Gloria Hornero Date: Wed, 12 Aug 2020 15:37:48 +0200 Subject: [PATCH 3/5] fixes test --- .../plugins/security_solution/cypress/tasks/hosts/all_hosts.ts | 2 +- x-pack/plugins/security_solution/cypress/tasks/search_bar.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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 30dfc15923cde..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) => { From 1f0ca79c28fddf2c9bd732132ec35720e1917c1c Mon Sep 17 00:00:00 2001 From: Gloria Hornero Date: Sun, 16 Aug 2020 12:45:19 +0200 Subject: [PATCH 4/5] uses data-test-subj locator instead of class --- src/plugins/data/public/ui/filter_bar/filter_item.tsx | 1 + x-pack/plugins/security_solution/cypress/screens/search_bar.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/data/public/ui/filter_bar/filter_item.tsx b/src/plugins/data/public/ui/filter_bar/filter_item.tsx index 078fc8c9e1a8f..02665dc9635bd 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_item.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_item.tsx @@ -347,6 +347,7 @@ export function FilterItem(props: Props) { anchorPosition="downLeft" withTitle={true} panelPaddingSize="none" + data-test-subj="filter" > 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 89dea31fdebdc..003ba22235c6c 100644 --- a/x-pack/plugins/security_solution/cypress/screens/search_bar.ts +++ b/x-pack/plugins/security_solution/cypress/screens/search_bar.ts @@ -26,4 +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 = '.globalFilterItem'; +export const GLOBAL_SEARCH_BAR_FILTER_ITEM = '[data-test-subj="filter"]'; From bebf201f0be3b5ece9474de1782487499d1d38d0 Mon Sep 17 00:00:00 2001 From: Gloria Hornero Date: Mon, 17 Aug 2020 15:28:19 +0200 Subject: [PATCH 5/5] fixes failing kibana tests --- src/plugins/data/public/ui/filter_bar/filter_item.tsx | 1 - x-pack/plugins/security_solution/cypress/screens/search_bar.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/data/public/ui/filter_bar/filter_item.tsx b/src/plugins/data/public/ui/filter_bar/filter_item.tsx index 02665dc9635bd..078fc8c9e1a8f 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_item.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_item.tsx @@ -347,7 +347,6 @@ export function FilterItem(props: Props) { anchorPosition="downLeft" withTitle={true} panelPaddingSize="none" - data-test-subj="filter" > 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 003ba22235c6c..07e9de137826c 100644 --- a/x-pack/plugins/security_solution/cypress/screens/search_bar.ts +++ b/x-pack/plugins/security_solution/cypress/screens/search_bar.ts @@ -26,4 +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 = '[data-test-subj="filter"]'; +export const GLOBAL_SEARCH_BAR_FILTER_ITEM = '#popoverFor_filter0';