Skip to content

Commit

Permalink
fixes alerts test
Browse files Browse the repository at this point in the history
  • Loading branch information
MadameSheema committed Dec 2, 2020
1 parent 4cb4fa9 commit 0d09335
Showing 1 changed file with 15 additions and 21 deletions.
36 changes: 15 additions & 21 deletions x-pack/plugins/security_solution/cypress/integration/alerts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* you may not use this file except in compliance with the Elastic License.
*/
import {
NUMBER_OF_ALERTS,
ALERTS,
ALERTS_COUNT,
SELECTED_ALERTS,
SHOWING_ALERTS,
ALERTS,
TAKE_ACTION_POPOVER_BTN,
} from '../screens/alerts';

Expand Down Expand Up @@ -45,7 +45,7 @@ describe('Alerts', () => {
waitForAlertsPanelToBeLoaded();
waitForAlertsToBeLoaded();

cy.get(NUMBER_OF_ALERTS)
cy.get(ALERTS_COUNT)
.invoke('text')
.then((numberOfAlerts) => {
cy.get(SHOWING_ALERTS).should('have.text', `Showing ${numberOfAlerts} alerts`);
Expand All @@ -64,10 +64,7 @@ describe('Alerts', () => {
waitForAlerts();

const expectedNumberOfAlertsAfterClosing = +numberOfAlerts - numberOfAlertsToBeClosed;
cy.get(NUMBER_OF_ALERTS).should(
'have.text',
expectedNumberOfAlertsAfterClosing.toString()
);
cy.get(ALERTS_COUNT).should('have.text', expectedNumberOfAlertsAfterClosing.toString());

cy.get(SHOWING_ALERTS).should(
'have.text',
Expand All @@ -77,7 +74,7 @@ describe('Alerts', () => {
goToClosedAlerts();
waitForAlerts();

cy.get(NUMBER_OF_ALERTS).should('have.text', numberOfAlertsToBeClosed.toString());
cy.get(ALERTS_COUNT).should('have.text', numberOfAlertsToBeClosed.toString());
cy.get(SHOWING_ALERTS).should(
'have.text',
`Showing ${numberOfAlertsToBeClosed.toString()} alerts`
Expand All @@ -98,7 +95,7 @@ describe('Alerts', () => {
waitForAlerts();

const expectedNumberOfClosedAlertsAfterOpened = 2;
cy.get(NUMBER_OF_ALERTS).should(
cy.get(ALERTS_COUNT).should(
'have.text',
expectedNumberOfClosedAlertsAfterOpened.toString()
);
Expand Down Expand Up @@ -128,7 +125,7 @@ describe('Alerts', () => {
it('Closes one alert when more than one opened alerts are selected', () => {
waitForAlertsToBeLoaded();

cy.get(NUMBER_OF_ALERTS)
cy.get(ALERTS_COUNT)
.invoke('text')
.then((numberOfAlerts) => {
const numberOfAlertsToBeClosed = 1;
Expand All @@ -144,7 +141,7 @@ describe('Alerts', () => {
waitForAlerts();

const expectedNumberOfAlerts = +numberOfAlerts - numberOfAlertsToBeClosed;
cy.get(NUMBER_OF_ALERTS).should('have.text', expectedNumberOfAlerts.toString());
cy.get(ALERTS_COUNT).should('have.text', expectedNumberOfAlerts.toString());
cy.get(SHOWING_ALERTS).should(
'have.text',
`Showing ${expectedNumberOfAlerts.toString()} alerts`
Expand All @@ -153,7 +150,7 @@ describe('Alerts', () => {
goToClosedAlerts();
waitForAlerts();

cy.get(NUMBER_OF_ALERTS).should('have.text', numberOfAlertsToBeClosed.toString());
cy.get(ALERTS_COUNT).should('have.text', numberOfAlertsToBeClosed.toString());
cy.get(SHOWING_ALERTS).should(
'have.text',
`Showing ${numberOfAlertsToBeClosed.toString()} alert`
Expand All @@ -178,7 +175,7 @@ describe('Alerts', () => {
goToClosedAlerts();
waitForAlertsToBeLoaded();

cy.get(NUMBER_OF_ALERTS)
cy.get(ALERTS_COUNT)
.invoke('text')
.then((numberOfAlerts) => {
const numberOfAlertsToBeOpened = 1;
Expand All @@ -195,7 +192,7 @@ describe('Alerts', () => {
waitForAlerts();

const expectedNumberOfAlerts = +numberOfAlerts - numberOfAlertsToBeOpened;
cy.get(NUMBER_OF_ALERTS).should('have.text', expectedNumberOfAlerts.toString());
cy.get(ALERTS_COUNT).should('have.text', expectedNumberOfAlerts.toString());
cy.get(SHOWING_ALERTS).should(
'have.text',
`Showing ${expectedNumberOfAlerts.toString()} alerts`
Expand All @@ -204,7 +201,7 @@ describe('Alerts', () => {
goToOpenedAlerts();
waitForAlerts();

cy.get(NUMBER_OF_ALERTS).should('have.text', numberOfAlertsToBeOpened.toString());
cy.get(ALERTS_COUNT).should('have.text', numberOfAlertsToBeOpened.toString());
cy.get(SHOWING_ALERTS).should(
'have.text',
`Showing ${numberOfAlertsToBeOpened.toString()} alert`
Expand All @@ -228,7 +225,7 @@ describe('Alerts', () => {
waitForAlerts();
waitForAlertsToBeLoaded();

cy.get(NUMBER_OF_ALERTS)
cy.get(ALERTS_COUNT)
.invoke('text')
.then((numberOfAlerts) => {
const numberOfAlertsToBeMarkedInProgress = 1;
Expand All @@ -244,7 +241,7 @@ describe('Alerts', () => {
waitForAlertsToBeLoaded();

const expectedNumberOfAlerts = +numberOfAlerts - numberOfAlertsToBeMarkedInProgress;
cy.get(NUMBER_OF_ALERTS).should('have.text', expectedNumberOfAlerts.toString());
cy.get(ALERTS_COUNT).should('have.text', expectedNumberOfAlerts.toString());
cy.get(SHOWING_ALERTS).should(
'have.text',
`Showing ${expectedNumberOfAlerts.toString()} alerts`
Expand All @@ -253,10 +250,7 @@ describe('Alerts', () => {
goToInProgressAlerts();
waitForAlerts();

cy.get(NUMBER_OF_ALERTS).should(
'have.text',
numberOfAlertsToBeMarkedInProgress.toString()
);
cy.get(ALERTS_COUNT).should('have.text', numberOfAlertsToBeMarkedInProgress.toString());
cy.get(SHOWING_ALERTS).should(
'have.text',
`Showing ${numberOfAlertsToBeMarkedInProgress.toString()} alert`
Expand Down

0 comments on commit 0d09335

Please sign in to comment.