Skip to content

Commit

Permalink
Update custom_query_rule e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
jpdjere committed Aug 23, 2022
1 parent 54a51ca commit a5e684d
Showing 1 changed file with 16 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
RULES_TABLE,
RULE_SWITCH,
SEVERITY,
SHOWING_RULES_TEXT,
} from '../../screens/alerts_detection_rules';
import {
ABOUT_CONTINUE_BTN,
Expand Down Expand Up @@ -218,21 +217,21 @@ describe('Custom query rules', () => {
const initialNumberOfRules = rules.length;
const expectedNumberOfRulesAfterDeletion = initialNumberOfRules - 1;

cy.get(SHOWING_RULES_TEXT).should(
'have.text',
`Showing 1-${initialNumberOfRules} of ${initialNumberOfRules} rules`
);
cy.request({ url: '/api/detection_engine/rules/_find' }).then(({ body }) => {
const numberOfRules = body.data.length;
expect(numberOfRules).to.eql(initialNumberOfRules);
});

deleteFirstRule();
waitForRulesTableToBeRefreshed();

cy.get(RULES_TABLE)
.find(RULES_ROW)
.should('have.length', expectedNumberOfRulesAfterDeletion);
cy.get(SHOWING_RULES_TEXT).should(
'have.text',
`Showing 1-${expectedNumberOfRulesAfterDeletion} of ${expectedNumberOfRulesAfterDeletion} rules`
);
cy.request({ url: '/api/detection_engine/rules/_find' }).then(({ body }) => {
const numberOfRules = body.data.length;
expect(numberOfRules).to.eql(expectedNumberOfRulesAfterDeletion);
});
cy.get(CUSTOM_RULES_BTN).should(
'have.text',
`Custom rules (${expectedNumberOfRulesAfterDeletion})`
Expand All @@ -256,10 +255,10 @@ describe('Custom query rules', () => {
cy.get(RULES_TABLE)
.find(RULES_ROW)
.should('have.length', expectedNumberOfRulesAfterDeletion);
cy.get(SHOWING_RULES_TEXT).should(
'have.text',
`Showing 1-${expectedNumberOfRulesAfterDeletion} of ${expectedNumberOfRulesAfterDeletion} rule`
);
cy.request({ url: '/api/detection_engine/rules/_find' }).then(({ body }) => {
const numberOfRules = body.data.length;
expect(numberOfRules).to.eql(expectedNumberOfRulesAfterDeletion);
});
cy.get(CUSTOM_RULES_BTN).should(
'have.text',
`Custom rules (${expectedNumberOfRulesAfterDeletion})`
Expand All @@ -284,10 +283,10 @@ describe('Custom query rules', () => {
cy.get(RULES_TABLE)
.find(RULES_ROW)
.should('have.length', expectedNumberOfRulesAfterDeletion);
cy.get(SHOWING_RULES_TEXT).should(
'have.text',
`Showing 1-${expectedNumberOfRulesAfterDeletion} of ${expectedNumberOfRulesAfterDeletion} rules`
);
cy.request({ url: '/api/detection_engine/rules/_find' }).then(({ body }) => {
const numberOfRules = body.data.length;
expect(numberOfRules).to.eql(expectedNumberOfRulesAfterDeletion);
});
cy.get(CUSTOM_RULES_BTN).should(
'have.text',
`Custom rules (${expectedNumberOfRulesAfterDeletion})`
Expand Down

0 comments on commit a5e684d

Please sign in to comment.