[SIEM] Improves flyout button Cypress tests time execution (#54463)
* refactor * replaces 'clearTimeline' for 'createNewTimeline' Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
043573e264
commit
81a7f89448
|
@ -7,9 +7,12 @@
|
|||
import { drag, drop } from '../drag_n_drop/helpers';
|
||||
import { ALL_HOSTS_WIDGET_DRAGGABLE_HOSTS } from '../hosts/selectors';
|
||||
import {
|
||||
CLOSE_TIMELINE_BTN,
|
||||
CREATE_NEW_TIMELINE,
|
||||
SEARCH_OR_FILTER_CONTAINER,
|
||||
SERVER_SIDE_EVENT_COUNT,
|
||||
TIMELINE_DATA_PROVIDERS,
|
||||
TIMELINE_SETTINGS,
|
||||
TIMELINE_TOGGLE_BUTTON,
|
||||
TOGGLE_TIMELINE_EXPAND_EVENT,
|
||||
} from './selectors';
|
||||
|
@ -19,12 +22,17 @@ import { DEFAULT_TIMEOUT } from '../util/helpers';
|
|||
export const toggleTimelineVisibility = () =>
|
||||
cy.get(TIMELINE_TOGGLE_BUTTON, { timeout: DEFAULT_TIMEOUT }).click();
|
||||
|
||||
export const createNewTimeline = () => {
|
||||
cy.get(TIMELINE_SETTINGS).click();
|
||||
cy.get(CREATE_NEW_TIMELINE).click();
|
||||
cy.get(CLOSE_TIMELINE_BTN).click({ force: true });
|
||||
};
|
||||
|
||||
/** Drags and drops a host from the `All Hosts` widget on the `Hosts` page to the timeline */
|
||||
export const dragFromAllHostsToTimeline = () => {
|
||||
cy.get(ALL_HOSTS_WIDGET_DRAGGABLE_HOSTS)
|
||||
.first()
|
||||
.then(host => drag(host));
|
||||
|
||||
cy.get(TIMELINE_DATA_PROVIDERS).then(dataProvidersDropArea => drop(dataProvidersDropArea));
|
||||
};
|
||||
|
||||
|
|
|
@ -36,3 +36,9 @@ export const TOGGLE_TIMELINE_EXPAND_EVENT = '[data-test-subj="expand-event"]';
|
|||
|
||||
/** The body of the timeline flyout */
|
||||
export const TIMELINE_FLYOUT_BODY = '[data-test-subj="eui-flyout-body"]';
|
||||
|
||||
export const CLOSE_TIMELINE_BTN = '[data-test-subj="close-timeline"]';
|
||||
|
||||
export const TIMELINE_SETTINGS = '[data-test-subj="settings-gear"]';
|
||||
|
||||
export const CREATE_NEW_TIMELINE = '[data-test-subj="timeline-new"]';
|
||||
|
|
|
@ -13,13 +13,23 @@ import { HOSTS_PAGE } from '../../lib/urls';
|
|||
import { waitForAllHostsWidget } from '../../lib/hosts/helpers';
|
||||
import { loginAndWaitForPage } from '../../lib/util/helpers';
|
||||
import { drag } from '../../lib/drag_n_drop/helpers';
|
||||
import { toggleTimelineVisibility } from '../../lib/timeline/helpers';
|
||||
import { createNewTimeline, toggleTimelineVisibility } from '../../lib/timeline/helpers';
|
||||
|
||||
describe('timeline flyout button', () => {
|
||||
beforeEach(() => {
|
||||
before(() => {
|
||||
loginAndWaitForPage(HOSTS_PAGE);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cy.get('[data-test-subj="kibanaChrome"]').then($page => {
|
||||
if ($page.find('[data-test-subj="flyoutOverlay"]').length === 1) {
|
||||
toggleTimelineVisibility();
|
||||
}
|
||||
});
|
||||
|
||||
createNewTimeline();
|
||||
});
|
||||
|
||||
it('toggles open the timeline', () => {
|
||||
toggleTimelineVisibility();
|
||||
|
||||
|
|
Loading…
Reference in a new issue