Skip to content

Commit

Permalink
Add waitForAlerts command to ensure alert loading is complete before …
Browse files Browse the repository at this point in the history
…proceeding for alert related tests

Signed-off-by: Gavin Reynolds <[email protected]>
  • Loading branch information
gsreynolds committed Dec 6, 2023
1 parent 2c3a03a commit 174bdf3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cypress/e2e/Incidents/incidents.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
manageIncidentTableColumns,
priorityNames,
selectAlert,
waitForAlerts,
} from '../../support/util/common';

describe('Manage Open Incidents', { failFast: { enabled: true } }, () => {
Expand Down Expand Up @@ -278,6 +279,7 @@ describe('Manage Alerts', { failFast: { enabled: true } }, () => {
addColumns.map((column) => column[1]),
);
waitForIncidentTable();
waitForAlerts();
});

afterEach(() => {
Expand Down
7 changes: 7 additions & 0 deletions cypress/support/util/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,17 @@ export const waitForIncidentTable = () => {
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(3000); // Required for query debounce
cy.get('#incident-table-ctr', { timeout: 60000 }).should('be.visible');
cy.get('.selected-incidents-ctr', { timeout: 60000 }).should('not.include.text', 'Querying');
// will move on to next command even if table is not scrollable
cy.get('.incident-table-fixed-list').scrollTo('top', { ensureScrollable: false });
};

export const waitForAlerts = () => {
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(3000); // Required for query debounce
cy.get('.selected-incidents-ctr', { timeout: 60000 }).should('not.include.text', 'Fetching Alerts');
};

export const selectIncident = (incidentIdx = 0, shiftKey = false) => {
const selector = `[data-incident-row-idx="${incidentIdx}"]`;
cy.get(selector).invoke('attr', 'data-incident-id').as(`selectedIncidentId_${incidentIdx}`);
Expand Down

0 comments on commit 174bdf3

Please sign in to comment.