Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykkopycinski committed Jun 16, 2020
1 parent e71605b commit 740038c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { loginAndWaitForPage } from '../tasks/login';
import { openAddFilterPopover, fillAddFilterForm } from '../tasks/search_bar';
import { GLOBAL_SEARCH_BAR_FILTER_ITEM } from '../screens/search_bar';
import { SearchBarFilter } from '../objects/filter';
import { hostIpFilter } from '../objects/filter';

import { HOSTS_PAGE } from '../urls/navigation';

Expand All @@ -17,13 +17,8 @@ describe('SearchBar', () => {
});

it('adds correctly a filter to the global search bar', () => {
const filter: SearchBarFilter = {
key: 'host.ip',
value: '1.1.1.1',
};

openAddFilterPopover();
fillAddFilterForm(filter);
cy.get(GLOBAL_SEARCH_BAR_FILTER_ITEM(filter)).should('be.visible');
fillAddFilterForm(hostIpFilter);
cy.get(GLOBAL_SEARCH_BAR_FILTER_ITEM(hostIpFilter)).should('be.visible');
});
});
5 changes: 5 additions & 0 deletions x-pack/plugins/security_solution/cypress/objects/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ export interface SearchBarFilter {
key: string;
value: string;
}

export const hostIpFilter: SearchBarFilter = {
key: 'host.ip',
value: '1.1.1.1',
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import { SearchBarFilter } from '../objects/filter';
export const GLOBAL_SEARCH_BAR_ADD_FILTER =
'[data-test-subj="globalDatePicker"] [data-test-subj="addFilter"]';

export const GLOBAL_SEARCH_BAR_SUBMIT_BUTTON =
'[data-test-subj="globalDatePicker"] [data-test-subj="querySubmitButton"]';

export const ADD_FILTER_FORM_FIELD_INPUT =
'[data-test-subj="filterFieldSuggestionList"] input[data-test-subj="comboBoxSearchInput"]';

Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/security_solution/cypress/tasks/search_bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { SearchBarFilter } from '../objects/filter';

import {
GLOBAL_SEARCH_BAR_ADD_FILTER,
GLOBAL_SEARCH_BAR_SUBMIT_BUTTON,
ADD_FILTER_FORM_SAVE_BUTTON,
ADD_FILTER_FORM_FIELD_INPUT,
ADD_FILTER_FORM_OPERATOR_OPTION_IS,
Expand All @@ -17,6 +18,7 @@ import {
} from '../screens/search_bar';

export const openAddFilterPopover = () => {
cy.get(GLOBAL_SEARCH_BAR_SUBMIT_BUTTON).should('be.enabled');
cy.get(GLOBAL_SEARCH_BAR_ADD_FILTER).click({ force: true });
};

Expand Down

0 comments on commit 740038c

Please sign in to comment.