Skip to content

Commit

Permalink
[SIEM] Bring Cypress tests back to life (elastic#71871)
Browse files Browse the repository at this point in the history
* fixes and unskips 'Detection rules, custom'

* fixes 'Export rules' test

* unksips 'Deleting prebuilt rules' test

* unskips Alerts timeline

* unskips 'Events viewer' tests

* unskips 'toggle column in timeline' tests

* unskips 'url timeline' test

* fixes Overview test

* skips flaky test
# Conflicts:
#	x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_custom.spec.ts
#	x-pack/plugins/security_solution/cypress/integration/alerts_detection_rules_export.spec.ts
#	x-pack/plugins/security_solution/cypress/objects/rule.ts
#	x-pack/test/security_solution_cypress/es_archives/custom_rule_with_timeline/data.json.gz
#	x-pack/test/security_solution_cypress/es_archives/custom_rule_with_timeline/mappings.json
  • Loading branch information
MadameSheema committed Jul 16, 2020
1 parent 87a4add commit 09a8596
Show file tree
Hide file tree
Showing 15 changed files with 414 additions and 9,032 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
"winlogbeatMWSysmonOperational": 30,
"__typename": "OverviewHostData"
},
"status": {
"indicesExist": true,
"indexFields": [],
"__typename": "SourceStatus"
},
"__typename": "Source"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ import { loginAndWaitForPage } from '../tasks/login';

import { DETECTIONS_URL } from '../urls/navigation';

// Flaky: https://github.com/elastic/kibana/issues/70727
describe.skip('Alerts', () => {
describe('Alerts', () => {
context('Closing alerts', () => {
beforeEach(() => {
esArchiverLoad('alerts');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { newRule, totalNumberOfPrebuiltRulesInEsArchive } from '../objects/rule';
import { newRule } from '../objects/rule';

import {
CUSTOM_RULES_BTN,
Expand Down Expand Up @@ -64,13 +64,13 @@ import { loginAndWaitForPageWithoutDateRange } from '../tasks/login';

import { DETECTIONS_URL } from '../urls/navigation';

describe.skip('Detection rules, custom', () => {
describe('Detection rules, custom', () => {
before(() => {
esArchiverLoad('custom_rule_with_timeline');
esArchiverLoad('timeline');
});

after(() => {
esArchiverUnload('custom_rule_with_timeline');
esArchiverUnload('timeline');
});

it('Creates and activates a new custom rule', () => {
Expand All @@ -89,7 +89,7 @@ describe.skip('Detection rules, custom', () => {
changeToThreeHundredRowsPerPage();
waitForRulesToBeLoaded();

const expectedNumberOfRules = totalNumberOfPrebuiltRulesInEsArchive + 1;
const expectedNumberOfRules = 1;
cy.get(RULES_TABLE).then(($table) => {
cy.wrap($table.find(RULES_ROW).length).should('eql', expectedNumberOfRules);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { DETECTIONS_URL } from '../urls/navigation';

const EXPECTED_EXPORTED_RULE_FILE_PATH = 'cypress/test_files/expected_rules_export.ndjson';

describe.skip('Export rules', () => {
describe('Export rules', () => {
before(() => {
esArchiverLoad('export_rule');
cy.server();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ describe('Alerts rules, prebuilt rules', () => {
});
});

// FLAKY: https://github.com/elastic/kibana/issues/71814
describe.skip('Deleting prebuilt rules', () => {
describe('Deleting prebuilt rules', () => {
beforeEach(() => {
const expectedNumberOfRules = totalNumberOfPrebuiltRules;
const expectedElasticRulesBtnText = `Elastic rules (${expectedNumberOfRules})`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import { loginAndWaitForPage } from '../tasks/login';

import { DETECTIONS_URL } from '../urls/navigation';

// Flakky: https://github.com/elastic/kibana/issues/71220
describe.skip('Alerts timeline', () => {
describe('Alerts timeline', () => {
beforeEach(() => {
esArchiverLoad('timeline_alerts');
loginAndWaitForPage(DETECTIONS_URL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ const defaultHeadersInDefaultEcsCategory = [
{ id: 'destination.ip' },
];

// Flakky: https://github.com/elastic/kibana/issues/70757
describe.skip('Events Viewer', () => {
describe('Events Viewer', () => {
context('Fields rendering', () => {
before(() => {
loginAndWaitForPage(HOSTS_URL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { loginAndWaitForPage } from '../tasks/login';

import { OVERVIEW_URL } from '../urls/navigation';

describe.skip('Overview Page', () => {
describe('Overview Page', () => {
before(() => {
cy.stubSecurityApi('overview');
loginAndWaitForPage(OVERVIEW_URL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ import {

import { HOSTS_URL } from '../urls/navigation';

// Flaky: https://github.com/elastic/kibana/issues/71361
describe.skip('toggle column in timeline', () => {
describe('toggle column in timeline', () => {
before(() => {
loginAndWaitForPage(HOSTS_URL);
});
Expand Down
6 changes: 4 additions & 2 deletions x-pack/plugins/security_solution/cypress/objects/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export const totalNumberOfPrebuiltRules = rawRules.length;

export const totalNumberOfPrebuiltRulesInEsArchive = 127;

export const totalNumberOfPrebuiltRulesInEsArchiveCustomRule = 145;

interface Mitre {
tactic: string;
techniques: string[];
Expand Down Expand Up @@ -57,7 +59,7 @@ const mitre2: Mitre = {
};

export const newRule: CustomRule = {
customQuery: 'host.name: *',
customQuery: 'host.name:*',
name: 'New Rule Test',
description: 'The new rule description.',
severity: 'High',
Expand All @@ -67,7 +69,7 @@ export const newRule: CustomRule = {
falsePositivesExamples: ['False1', 'False2'],
mitre: [mitre1, mitre2],
note: '# test markdown',
timelineId: '352c6110-9ffb-11ea-b3d8-857d6042d9bd',
timelineId: '0162c130-78be-11ea-9718-118a926974a4',
};

export const machineLearningRule: MachineLearningRule = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
{"author":[],"actions":[],"created_at":"2020-07-03T10:44:10.567Z","updated_at":"2020-07-03T10:44:10.941Z","created_by":"elastic","description":"Export rule","enabled":true,"false_positives":[],"filters":[],"from":"now-360s","id":"ad65b1b6-be18-4e41-9d0a-89d8576053d8","immutable":false,"index":["apm-*-transaction*","auditbeat-*","endgame-*","filebeat-*","packetbeat-*","winlogbeat-*"],"interval":"5m","rule_id":"50a3776b-144d-4cff-9f1f-1173e0d5d4a4","language":"kuery","license":"","output_index":".siem-signals-default","max_signals":100,"risk_score":50,"risk_score_mapping":[],"rule_name_override":"","name":"Export rule","query":"host.name: * ","references":[],"meta":{"from":"1m","kibana_siem_app_url":"http://localhost:5620/app/security"},"severity":"low","severity_mapping":[],"updated_by":"elastic","tags":[],"to":"now","type":"query","threat":[],"throttle":"no_actions","timestamp_override":"","version":1,"exceptions_list":[]}
{"author":[],"actions":[],"created_at":"2020-07-15T10:45:15.954Z","updated_at":"2020-07-15T10:45:16.874Z","created_by":"elastic","description":"Export rule","enabled":true,"false_positives":[],"filters":[],"from":"now-360s","id":"a4772daa-a3ef-44a3-8035-6abd1bf2893a","immutable":false,"index":["apm-*-transaction*","auditbeat-*","endgame-*","filebeat-*","logs-*","packetbeat-*","winlogbeat-*"],"interval":"5m","rule_id":"1b08a0c2-8243-463e-92c2-b464a8c97cd4","language":"kuery","license":"","output_index":".siem-signals-default","max_signals":100,"risk_score":50,"risk_score_mapping":[],"name":"Export rule","query":"host.name: *","references":[],"meta":{"from":"1m","kibana_siem_app_url":"http://localhost:5620/app/security/detections"},"severity":"low","severity_mapping":[],"updated_by":"elastic","tags":[],"to":"now","type":"query","threat":[],"throttle":"no_actions","version":1,"exceptions_list":[]}
{"exported_count":1,"missing_rules":[],"missing_rules_count":0}
Binary file not shown.
Loading

0 comments on commit 09a8596

Please sign in to comment.