diff --git a/cypress/integration/plugins/alerting-dashboards-plugin/acknowledge_alerts_modal_spec.js b/cypress/integration/plugins/alerting-dashboards-plugin/acknowledge_alerts_modal_spec.js index b39bee65b..260efaf34 100644 --- a/cypress/integration/plugins/alerting-dashboards-plugin/acknowledge_alerts_modal_spec.js +++ b/cypress/integration/plugins/alerting-dashboards-plugin/acknowledge_alerts_modal_spec.js @@ -42,9 +42,15 @@ describe('AcknowledgeAlertsModal', () => { }); beforeEach(() => { + const getMonitorsUrl = new RegExp('.*api/alerting/monitors/_search.*'); + cy.intercept(getMonitorsUrl).as('searchMonitors'); + // Reloading the page to close any modals that were not closed by other tests that had failures. cy.visit(`${BASE_PATH}/app/${ALERTING_PLUGIN_NAME}#/dashboard`); + // Wait for the monitor search call to finish before checking for the monitors below + cy.wait('@searchMonitors'); + // Confirm dashboard is displaying rows for the test monitors. cy.contains(BUCKET_MONITOR, { timeout: TWENTY_SECONDS }); cy.contains(QUERY_MONITOR, { timeout: TWENTY_SECONDS });