Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solution] Reduce flakiness in ransomware tests #173316

Merged
merged 2 commits into from
Dec 14, 2023
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 @@ -14,6 +14,7 @@ import { ALERTS_HISTOGRAM_SERIES, ALERT_RULE_NAME, MESSAGE } from '../../../scre
import { TIMELINE_QUERY, TIMELINE_VIEW_IN_ANALYZER } from '../../../screens/timeline';
import { selectAlertsHistogram } from '../../../tasks/alerts';
import { createTimeline } from '../../../tasks/timelines';
import { deleteTimelines } from '../../../tasks/api_calls/common';

describe('Ransomware Detection Alerts', { tags: ['@ess', '@serverless'] }, () => {
before(() => {
Expand All @@ -24,39 +25,38 @@ describe('Ransomware Detection Alerts', { tags: ['@ess', '@serverless'] }, () =>
});
});

describe('Ransomware display in Alerts Section', () => {
after(() => {
cy.task('esArchiverUnload', 'ransomware_detection');
});

describe('Ransomware in Alerts Page', () => {
beforeEach(() => {
login();
visitWithTimeRange(ALERTS_URL);
waitForAlertsToPopulate();
});

describe('Alerts table', () => {
it('shows Ransomware Alerts', () => {
cy.get(ALERT_RULE_NAME).should('have.text', 'Ransomware Detection Alert');
});
});
it('should show ransomware alerts on alerts page', () => {
cy.log('should show ransomware alerts in alerts table');

describe('Trend Chart', () => {
beforeEach(() => {
selectAlertsHistogram();
});
cy.get(ALERT_RULE_NAME).should('have.text', 'Ransomware Detection Alert');

it('shows Ransomware Detection Alert in the trend chart', () => {
cy.get(ALERTS_HISTOGRAM_SERIES).should('have.text', 'Ransomware Detection Alert');
});
cy.log('should show ransomware prevention alert in the trend chart');

selectAlertsHistogram();
christineweng marked this conversation as resolved.
Show resolved Hide resolved
cy.get(ALERTS_HISTOGRAM_SERIES).should('have.text', 'Ransomware Detection Alert');
});
});

// FLAKY: https://github.com/elastic/kibana/issues/170846
describe.skip('Ransomware in Timelines', () => {
before(() => {
describe('Ransomware in Timelines', () => {
beforeEach(() => {
deleteTimelines();
login();
visitWithTimeRange(TIMELINES_URL);
createTimeline();
});

it('Renders ransomware entries in timelines table', () => {
it('should show ransomware entries in timelines table', () => {
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 @@ -29,39 +29,34 @@ describe('Ransomware Prevention Alerts', { tags: ['@ess', '@serverless'] }, () =
cy.task('esArchiverUnload', 'ransomware_prevention');
});

describe('Ransomware display in Alerts Section', () => {
describe('Ransomware in Alerts Page', () => {
beforeEach(() => {
login();
visitWithTimeRange(ALERTS_URL);
});

describe('Alerts table', () => {
it('shows Ransomware Alerts', () => {
cy.get(ALERT_RULE_NAME).should('have.text', 'Ransomware Prevention Alert');
});
});
it('should show ransomware alerts on alerts page', () => {
cy.log('should show ransomware alerts in alert table');

describe('Trend Chart', () => {
beforeEach(() => {
selectAlertsHistogram();
});
cy.get(ALERT_RULE_NAME).should('have.text', 'Ransomware Prevention Alert');

it('shows Ransomware Prevention Alert in the trend chart', () => {
cy.get(ALERTS_HISTOGRAM_SERIES).should('have.text', 'Ransomware Prevention Alert');
});
cy.log('should show ransomware prevention alert in the trend chart');

selectAlertsHistogram();
cy.get(ALERTS_HISTOGRAM_SERIES).should('have.text', 'Ransomware Prevention Alert');
});
});

describe('Ransomware in Timelines', function () {
before(() => {
beforeEach(() => {
christineweng marked this conversation as resolved.
Show resolved Hide resolved
deleteTimelines();
login();
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', function () {
login();
it('should render ransomware entries in timelines table', function () {
const timeline = this.timelineId;
visitTimeline(timeline);
// 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 @@ -273,7 +273,7 @@ export const selectCountTable = () => {
};

export const selectAlertsHistogram = () => {
cy.get(SELECT_HISTOGRAM).click({ force: true });
cy.get(SELECT_HISTOGRAM).click();
};

export const goToAcknowledgedAlerts = () => {
Expand Down
Loading