Skip to content

Commit

Permalink
replace createTimeline with openTimelineUsingToggle
Browse files Browse the repository at this point in the history
  • Loading branch information
janmonschke committed Jan 9, 2024
1 parent 9d1f16a commit 729e5ce
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ALERTS_URL, TIMELINES_URL } from '../../../urls/navigation';
import { ALERTS_HISTOGRAM_SERIES, ALERT_RULE_NAME, MESSAGE } from '../../../screens/alerts';
import { TIMELINE_QUERY, TIMELINE_VIEW_IN_ANALYZER } from '../../../screens/timeline';
import { selectAlertsHistogram } from '../../../tasks/alerts';
import { createTimeline } from '../../../tasks/timelines';
import { openTimelineUsingToggle } from '../../../tasks/security_main';
import { deleteTimelines } from '../../../tasks/api_calls/common';

describe('Ransomware Detection Alerts', { tags: ['@ess', '@serverless'] }, () => {
Expand Down Expand Up @@ -53,10 +53,10 @@ describe('Ransomware Detection Alerts', { tags: ['@ess', '@serverless'] }, () =>
deleteTimelines();
login();
visitWithTimeRange(TIMELINES_URL);
createTimeline();
});

it('should show ransomware entries in timelines table', () => {
openTimelineUsingToggle();
cy.get(TIMELINE_QUERY).type('event.code: "ransomware"{enter}');

// Wait for grid to load, it should have an analyzer icon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {
addNameToTimelineAndSave,
addNameToTimelineAndSaveAsNew,
} from '../../../tasks/timeline';
import { createTimeline, waitForTimelinesPanelToBeLoaded } from '../../../tasks/timelines';
import { waitForTimelinesPanelToBeLoaded } from '../../../tasks/timelines';

import { OVERVIEW_URL, TIMELINE_TEMPLATES_URL, TIMELINES_URL } from '../../../urls/navigation';

Expand Down Expand Up @@ -117,7 +117,7 @@ describe('Timelines', { tags: ['@ess', '@serverless'] }, (): void => {
it('should show the different timeline states', () => {
login();
visitWithTimeRange(TIMELINES_URL);
createTimeline();
openTimelineUsingToggle();

// Unsaved
cy.get(TIMELINE_PANEL).should('be.visible');
Expand Down Expand Up @@ -150,7 +150,7 @@ describe('Timelines', { tags: ['@ess', '@serverless'] }, (): void => {
visitWithTimeRange(TIMELINES_URL);
cy.get(ROWS).should('have.length', '0');

createTimeline();
openTimelineUsingToggle();
addNameToTimelineAndSave('First');

// Offsetting the extra save that is happening in the background
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export const COMBO_BOX_INPUT = '[data-test-subj="comboBoxInput"]';

export const CREATE_NEW_TIMELINE = '[data-test-subj="timeline-new"]';

export const CREATE_NEW_TIMELINE_WITH_BORDER = '[data-test-subj="timeline-new-with-border"]';

export const CREATE_NEW_TIMELINE_TEMPLATE = '[data-test-subj="template-timeline-new"]';

export const DATA_PROVIDERS = '.field-value';
Expand Down
11 changes: 0 additions & 11 deletions x-pack/test/security_solution_cypress/cypress/tasks/timelines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
} from '../screens/timelines';
import { SELECT_ALL_CHECKBOX } from '../screens/shared';
import {
CREATE_NEW_TIMELINE_WITH_BORDER,
TIMELINE_COLLAPSED_ITEMS_BTN,
TIMELINE_CREATE_TIMELINE_FROM_TEMPLATE_BTN,
TIMELINE_WRAPPER,
Expand Down Expand Up @@ -70,16 +69,6 @@ export const exportSelectedTimelines = () => {
cy.get(EXPORT_TIMELINE_ACTION).click();
};

export const createTimeline = () =>
recurse(
() => {
cy.get(CREATE_NEW_TIMELINE_WITH_BORDER).click();
return cy.get(TIMELINE_WRAPPER);
},
// Retry if somehow the timeline wrapper is still hidden
($timelineWrapper) => !$timelineWrapper.hasClass('timeline-wrapper--hidden')
);

export const createTimelineFromFirstTemplateInList = () => {
cy.get(TIMELINE_COLLAPSED_ITEMS_BTN).first().click();
cy.get(TIMELINE_CREATE_TIMELINE_FROM_TEMPLATE_BTN).click();
Expand Down

0 comments on commit 729e5ce

Please sign in to comment.