diff --git a/x-pack/plugins/security_solution/cypress/integration/exceptions/from_alert.spec.ts b/x-pack/plugins/security_solution/cypress/integration/exceptions/from_alert.spec.ts index 002aa0bbc2b1e..84ad93fa08943 100644 --- a/x-pack/plugins/security_solution/cypress/integration/exceptions/from_alert.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/exceptions/from_alert.spec.ts @@ -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 { @@ -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(); @@ -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); @@ -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}`); }); }); diff --git a/x-pack/plugins/security_solution/cypress/integration/exceptions/from_rule.spec.ts b/x-pack/plugins/security_solution/cypress/integration/exceptions/from_rule.spec.ts index c4e1d882d1853..ea6b6cf0186b4 100644 --- a/x-pack/plugins/security_solution/cypress/integration/exceptions/from_rule.spec.ts +++ b/x-pack/plugins/security_solution/cypress/integration/exceptions/from_rule.spec.ts @@ -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 { @@ -54,7 +54,7 @@ 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(() => { @@ -62,40 +62,32 @@ describe('From rule', () => { 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`); }); }); diff --git a/x-pack/plugins/security_solution/cypress/screens/alerts.ts b/x-pack/plugins/security_solution/cypress/screens/alerts.ts index 01848f4207846..a46f65acaf971 100644 --- a/x-pack/plugins/security_solution/cypress/screens/alerts.ts +++ b/x-pack/plugins/security_solution/cypress/screens/alerts.ts @@ -34,6 +34,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"]'; diff --git a/x-pack/plugins/security_solution/cypress/tasks/alerts.ts b/x-pack/plugins/security_solution/cypress/tasks/alerts.ts index 067c9957189b9..220c0fbdaa4cf 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/alerts.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/alerts.ts @@ -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(); };