Skip to content

Commit

Permalink
fixed alert tests
Browse files Browse the repository at this point in the history
Signed-off-by: Riya Saxena <riysaxen@amazon.com>
  • Loading branch information
riysaxen-amzn committed Jun 26, 2024
1 parent b72da46 commit e4e5d9c
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions cypress/integration/3_alerts.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ describe('Alerts', () => {
// Refresh the table
cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click({ force: true });

cy.wait(10000);

// Confirm there are alerts created
cy.get('tbody > tr').filter(`:contains(${alertName})`).should('have.length', docCount);
});
Expand Down Expand Up @@ -141,6 +143,8 @@ describe('Alerts', () => {
cy.get('[aria-label="View details"]').click({ force: true });
});

cy.wait(10000);

cy.get('[data-test-subj="alert-details-flyout"]').within(() => {
// Wait for findings table to finish loading
cy.wait(3000);
Expand Down Expand Up @@ -274,6 +278,8 @@ describe('Alerts', () => {
// Press the "Acknowledge" button
cy.get('[data-test-subj="acknowledge-button"]').click({ force: true });

cy.wait(10000)

// Wait for acknowledge API to finish executing
cy.contains('Acknowledged');

Expand Down Expand Up @@ -309,26 +315,29 @@ describe('Alerts', () => {
cy.contains('Active').click({ force: true });
});

cy.wait(10000);
cy.get('tbody > tr').filter(`:contains(${alertName})`).should('have.length', 3);

cy.get('tbody > tr')
// Click the "Acknowledge" icon button in the first row
.first()
.within(() => {
cy.get('[aria-label="Acknowledge"]').click({ force: true });
});

cy.get('tbody > tr').filter(`:contains(${alertName})`).should('have.length', 3);
cy.wait(10000);
cy.get('tbody > tr').filter(`:contains(${alertName})`).should('have.length', 2);

// Filter the table to show only "Acknowledged" alerts
cy.get('[data-text="Status"]');
cy.get('[data-text="Status"]').click({ force: true });
cy.get('[class="euiFilterSelect__items"]').within(() => {
cy.contains('Active').click({ force: true });
cy.contains('Acknowledged').click({ force: true });
});

// Confirm there are now 3 "Acknowledged" alerts
cy.get('tbody > tr').filter(`:contains(${alertName})`).should('have.length', 3);
cy.wait(10000);
// Confirm there are now 2 "Acknowledged" alerts
cy.get('tbody > tr').filter(`:contains(${alertName})`).should('have.length', 2);
});

it('can be acknowledged via flyout button', () => {
Expand All @@ -352,6 +361,8 @@ describe('Alerts', () => {
// Click the "Acknowledge" button on the flyout
cy.get('[data-test-subj="alert-details-flyout-acknowledge-button"]').click({ force: true });

cy.wait(5000);

// Confirm the alert is now "Acknowledged"
cy.get('[data-test-subj="text-details-group-content-alert-status"]').contains('Active');

Expand Down

0 comments on commit e4e5d9c

Please sign in to comment.