Skip to content

Commit

Permalink
unskips exceptions tests (#116149) (#116448)
Browse files Browse the repository at this point in the history
Co-authored-by: Gloria Hornero <[email protected]>
  • Loading branch information
kibanamachine and MadameSheema authored Oct 27, 2021
1 parent bb846d0 commit fe5d763
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { getException } from '../../objects/exception';
import { getNewRule } from '../../objects/rule';

import { ALERTS_COUNT, NUMBER_OF_ALERTS } from '../../screens/alerts';
import { ALERTS_COUNT, EMPTY_ALERT_TABLE, NUMBER_OF_ALERTS } from '../../screens/alerts';
import { RULE_STATUS } from '../../screens/create_new_rule';

import {
Expand All @@ -31,13 +31,12 @@ import {
removeException,
waitForTheRuleToBeExecuted,
} from '../../tasks/rule_details';
import { refreshPage } from '../../tasks/security_header';

import { ALERTS_URL } from '../../urls/navigation';
import { cleanKibana } from '../../tasks/common';

describe('From alert', () => {
const NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS = '1';
const NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS = '1 alert';

beforeEach(() => {
cleanKibana();
Expand All @@ -53,7 +52,6 @@ describe('From alert', () => {
activatesRule();
waitForTheRuleToBeExecuted();
waitForAlertsToPopulate();
refreshPage();

cy.get(ALERTS_COUNT).should('exist');
cy.get(NUMBER_OF_ALERTS).should('have.text', NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS);
Expand All @@ -64,36 +62,30 @@ describe('From alert', () => {
esArchiverUnload('auditbeat_for_exceptions2');
});

// TODO: Unskip the test when `https://github.com/elastic/kibana/issues/108244` it is fixed
it.skip('Creates an exception and deletes it', () => {
it('Creates an exception and deletes it', () => {
addExceptionFromFirstAlert();
addsException(getException());
esArchiverLoad('auditbeat_for_exceptions2');

cy.get(ALERTS_COUNT).should('exist');
cy.get(NUMBER_OF_ALERTS).should('have.text', '0 alerts');
cy.get(EMPTY_ALERT_TABLE).should('exist');

goToClosedAlerts();
refreshPage();

cy.get(ALERTS_COUNT).should('exist');
cy.get(NUMBER_OF_ALERTS).should('have.text', `${NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS} alerts`);
cy.get(NUMBER_OF_ALERTS).should('have.text', `${NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS}`);

goToOpenedAlerts();
waitForTheRuleToBeExecuted();
refreshPage();

cy.get(ALERTS_COUNT).should('exist');
cy.get(NUMBER_OF_ALERTS).should('have.text', '0 alerts');
cy.get(EMPTY_ALERT_TABLE).should('exist');

goToExceptionsTab();
removeException();
goToAlertsTab();
waitForTheRuleToBeExecuted();
waitForAlertsToPopulate();
refreshPage();

cy.get(ALERTS_COUNT).should('exist');
cy.get(NUMBER_OF_ALERTS).should('have.text', `${NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS} alerts`);
cy.get(NUMBER_OF_ALERTS).should('have.text', `${NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS}`);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { getException } from '../../objects/exception';
import { getNewRule } from '../../objects/rule';

import { ALERTS_COUNT, NUMBER_OF_ALERTS } from '../../screens/alerts';
import { ALERTS_COUNT, EMPTY_ALERT_TABLE, NUMBER_OF_ALERTS } from '../../screens/alerts';
import { RULE_STATUS } from '../../screens/create_new_rule';

import {
Expand Down Expand Up @@ -54,48 +54,40 @@ describe('From rule', () => {
refreshPage();

cy.get(ALERTS_COUNT).should('exist');
cy.get(NUMBER_OF_ALERTS).should('have.text', `${NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS} alerts`);
cy.get(NUMBER_OF_ALERTS).should('have.text', `${NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS} alert`);
});

afterEach(() => {
esArchiverUnload('auditbeat_for_exceptions');
esArchiverUnload('auditbeat_for_exceptions2');
});

// TODO: Unskip the test when `https://github.com/elastic/kibana/issues/108244` it is fixed
it.skip('Creates an exception and deletes it', () => {
it('Creates an exception and deletes it', () => {
goToExceptionsTab();
addsExceptionFromRuleSettings(getException());
esArchiverLoad('auditbeat_for_exceptions2');
waitForTheRuleToBeExecuted();
goToAlertsTab();
refreshPage();

cy.get(ALERTS_COUNT).should('exist');
cy.get(NUMBER_OF_ALERTS).should('have.text', '0 alerts');
cy.get(EMPTY_ALERT_TABLE).should('exist');

goToClosedAlerts();
refreshPage();

cy.get(ALERTS_COUNT).should('exist');
cy.get(NUMBER_OF_ALERTS).should('have.text', `${NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS} alerts`);
cy.get(NUMBER_OF_ALERTS).should('have.text', `${NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS} alert`);

goToOpenedAlerts();
waitForTheRuleToBeExecuted();
refreshPage();

cy.get(ALERTS_COUNT).should('exist');
cy.get(NUMBER_OF_ALERTS).should('have.text', '0 alerts');
cy.get(EMPTY_ALERT_TABLE).should('exist');

goToExceptionsTab();
removeException();
refreshPage();
goToAlertsTab();
waitForTheRuleToBeExecuted();
waitForAlertsToPopulate();
refreshPage();

cy.get(ALERTS_COUNT).should('exist');
cy.get(NUMBER_OF_ALERTS).should('have.text', `${NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS} alerts`);
cy.get(NUMBER_OF_ALERTS).should('have.text', `${NUMBER_OF_AUDITBEAT_EXCEPTIONS_ALERTS} alert`);
});
});
2 changes: 2 additions & 0 deletions x-pack/plugins/security_solution/cypress/screens/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export const CLOSE_SELECTED_ALERTS_BTN = '[data-test-subj="close-alert-status"]'

export const CLOSED_ALERTS_FILTER_BTN = '[data-test-subj="closedAlerts"]';

export const EMPTY_ALERT_TABLE = '[data-test-subj="tGridEmptyState"]';

export const EXPAND_ALERT_BTN = '[data-test-subj="expand-event"]';

export const ACKNOWLEDGED_ALERTS_FILTER_BTN = '[data-test-subj="acknowledgedAlerts"]';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/security_solution/cypress/tasks/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
} from '../screens/alerts_details';

export const addExceptionFromFirstAlert = () => {
cy.get(TIMELINE_CONTEXT_MENU_BTN).first().click();
cy.get(TIMELINE_CONTEXT_MENU_BTN).first().click({ force: true });
cy.get(ADD_EXCEPTION_BTN).click();
};

Expand Down

0 comments on commit fe5d763

Please sign in to comment.