Skip to content

Commit

Permalink
[Security Solution] Making ransomware tests more robust and reliable (e…
Browse files Browse the repository at this point in the history
  • Loading branch information
MadameSheema authored Nov 7, 2023
1 parent 8485e37 commit 6d28192
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ describe('Ransomware Detection Alerts', { tags: ['@ess', '@serverless'] }, () =>
});
});

// FLAKY: https://github.com/elastic/kibana/issues/168602
describe.skip('Ransomware in Timelines', () => {
describe('Ransomware in Timelines', () => {
before(() => {
login();
visitWithTimeRange(TIMELINES_URL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
* 2.0.
*/

import { waitForAlertsToPopulate } from '../../../tasks/create_new_rule';
import { login } from '../../../tasks/login';
import { visitWithTimeRange } from '../../../tasks/navigation';
import { visitTimeline, visitWithTimeRange } from '../../../tasks/navigation';

import { ALERTS_URL, TIMELINES_URL } from '../../../urls/navigation';
import { ALERTS_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 { TIMELINE_VIEW_IN_ANALYZER } from '../../../screens/timeline';
import { selectAlertsHistogram } from '../../../tasks/alerts';
import { createTimeline } from '../../../tasks/timelines';
import { deleteTimelines } from '../../../tasks/common';
import { createTimeline } from '../../../tasks/api_calls/timelines';
import { getTimeline } from '../../../objects/timeline';

describe('Ransomware Prevention Alerts', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
Expand All @@ -32,7 +33,6 @@ describe('Ransomware Prevention Alerts', { tags: ['@ess', '@serverless'] }, () =
beforeEach(() => {
login();
visitWithTimeRange(ALERTS_URL);
waitForAlertsToPopulate();
});

describe('Alerts table', () => {
Expand All @@ -52,17 +52,18 @@ describe('Ransomware Prevention Alerts', { tags: ['@ess', '@serverless'] }, () =
});
});

describe('Ransomware in Timelines', () => {
beforeEach(() => {
login();
visitWithTimeRange(TIMELINES_URL);

createTimeline();
describe('Ransomware in Timelines', function () {
before(() => {
deleteTimelines();
createTimeline({ ...getTimeline(), query: 'event.code: "ransomware"' }).then((response) => {
cy.wrap(response.body.data.persistTimeline.timeline.savedObjectId).as('timelineId');
});
});

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

it('Renders ransomware entries in timelines table', function () {
login();
const timeline = this.timelineId;
visitTimeline(timeline);
// Wait for grid to load, it should have an analyzer icon
cy.get(TIMELINE_VIEW_IN_ANALYZER).should('exist');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export const expectedExportedTimeline = (timelineResponse: Cypress.Response<Time
{ id: 'event.category' },
{ id: 'event.action' },
{ id: 'host.name' },
{ id: 'message' },
],
kqlMode: 'filter',
kqlQuery: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export const createTimeline = (timeline: CompleteTimeline) =>
{
id: 'host.name',
},
{
id: 'message',
},
],
kqlMode: 'filter',
kqlQuery: {
Expand All @@ -42,7 +45,7 @@ export const createTimeline = (timeline: CompleteTimeline) =>
},
},
dateRange: {
end: '2022-04-01T12:22:56.000Z',
end: '2023-04-01T12:22:56.000Z',
start: '2018-01-01T12:22:56.000Z',
},
description: timeline.description,
Expand Down

0 comments on commit 6d28192

Please sign in to comment.