Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import {
} from '../../../screens/hosts/events';
import { DEFAULT_TIMEOUT } from '../../lib/util/helpers';

import { clearSearchBar } from '../../../tasks/header';

const defaultHeadersInDefaultEcsCategory = [
{ id: '@timestamp' },
{ id: 'message' },
Expand Down Expand Up @@ -133,11 +135,15 @@ describe('Events Viewer', () => {
before(() => {
loginAndWaitForPage(HOSTS_PAGE);
openEvents();
waitsForEventsToBeLoaded();
});

afterEach(() => {
clearSearchBar();
});

it('filters the events by applying filter criteria from the search bar at the top of the page', () => {
const filterInput = '4bf34c1c-eaa9-46de-8921-67a4ccc49829'; // this will never match real data
waitsForEventsToBeLoaded();
cy.get(HEADER_SUBTITLE)
.invoke('text')
.then(initialNumberOfEvents => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ describe('toggle column in timeline', () => {
'exist'
);

cy.get(
`[data-test-subj="timeline"] [data-test-subj="toggle-field-${timestampField}"]`
).uncheck({ force: true });
cy.get(`[data-test-subj="timeline"] [data-test-subj="toggle-field-${timestampField}"]`, {
timeout: DEFAULT_TIMEOUT,
}).uncheck({ force: true });

cy.get(`[data-test-subj="timeline"] [data-test-subj="header-text-${timestampField}"]`).should(
'not.exist'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,32 @@ describe('url state', () => {
.first()
.click({ force: true });

cy.get(DATE_PICKER_ABSOLUTE_INPUT, { timeout: DEFAULT_TIMEOUT }).type(
`{selectall}{backspace}${ABSOLUTE_DATE_RANGE.newStartTimeTyped}`
);
cy.get(DATE_PICKER_ABSOLUTE_INPUT, { timeout: DEFAULT_TIMEOUT })
.clear()
.type(`${ABSOLUTE_DATE_RANGE.newStartTimeTyped}`);

cy.get(DATE_PICKER_APPLY_BUTTON, { timeout: DEFAULT_TIMEOUT })
.click({ force: true })
.invoke('text')
.invoke('text', { timeout: DEFAULT_TIMEOUT })
.should('not.equal', 'Updating');

cy.get('[data-test-subj="table-topNFlowSource-loading-false"]', {
timeout: DEFAULT_TIMEOUT,
}).should('exist');

cy.get(DATE_PICKER_END_DATE_POPOVER_BUTTON).click({ force: true });

cy.get(DATE_PICKER_ABSOLUTE_TAB)
.first()
.click({ force: true });

cy.get(DATE_PICKER_ABSOLUTE_INPUT, { timeout: DEFAULT_TIMEOUT }).type(
`{selectall}{backspace}${ABSOLUTE_DATE_RANGE.newEndTimeTyped}`
);
cy.get(DATE_PICKER_ABSOLUTE_INPUT, { timeout: DEFAULT_TIMEOUT })
.clear()
.type(`${ABSOLUTE_DATE_RANGE.newEndTimeTyped}`);

cy.get(DATE_PICKER_APPLY_BUTTON, { timeout: DEFAULT_TIMEOUT })
.click({ force: true })
.invoke('text')
.invoke('text', { timeout: DEFAULT_TIMEOUT })
.should('not.equal', 'Updating');

cy.url().should(
Expand Down
9 changes: 9 additions & 0 deletions x-pack/legacy/plugins/siem/cypress/tasks/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { KQL_INPUT } from '../screens/header';
import { DEFAULT_TIMEOUT } from '../tasks/login';

export const navigateFromHeaderTo = (page: string) => {
cy.get(page).click({ force: true });
};

export const clearSearchBar = () => {
cy.get(KQL_INPUT, { timeout: DEFAULT_TIMEOUT })
.clear()
.type('{enter}');
};
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const clearFieldsBrowser = () => {
};

export const filterFieldsBrowser = (fieldName: string) => {
cy.get(FIELDS_BROWSER_FILTER_INPUT)
cy.get(FIELDS_BROWSER_FILTER_INPUT, { timeout: DEFAULT_TIMEOUT })
.type(fieldName)
.should('not.have.class', 'euiFieldSearch-isLoading');
};
Expand Down