Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SIEM] Fixes search bar Cypress test #74833

Merged
merged 10 commits into from
Aug 19, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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}`
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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"]';

Expand All @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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');
};
4 changes: 3 additions & 1 deletion x-pack/plugins/security_solution/cypress/tasks/search_bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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');
};