Skip to content

Commit

Permalink
extend e2e tests to cover imported rules
Browse files Browse the repository at this point in the history
  • Loading branch information
maximpn committed Nov 1, 2022
1 parent 9f7014f commit e3ede7a
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { TOASTER } from '../../screens/alerts_detection_rules';
import { RULES_ROW, RULES_TABLE, TOASTER } from '../../screens/alerts_detection_rules';
import { importRules, importRulesWithOverwriteAll } from '../../tasks/alerts_detection_rules';
import { cleanKibana, deleteAlertsAndRules, reload } from '../../tasks/common';
import { login, visitWithoutDateRange } from '../../tasks/login';
Expand All @@ -24,6 +24,9 @@ describe('Import rules', () => {
});

it('Imports a custom rule with exceptions', function () {
const expectedNumberOfRules = 1;
const expectedImportedRuleName = 'Test Custom Rule';

importRules('7_16_rules.ndjson');

cy.wait('@import').then(({ response }) => {
Expand All @@ -32,6 +35,13 @@ describe('Import rules', () => {
'have.text',
'Successfully imported 1 ruleSuccessfully imported 2 exceptions.'
);

cy.get(RULES_TABLE).then(($table) => {
const rulesRow = cy.wrap($table.find(RULES_ROW));

rulesRow.should('have.length', expectedNumberOfRules);
rulesRow.should('include.text', expectedImportedRuleName);
});
});
});

Expand Down

0 comments on commit e3ede7a

Please sign in to comment.