From 9d41ad9f6213bf61d6081a7543d44110c50e4f2e Mon Sep 17 00:00:00 2001 From: Amardeepsingh Siglani Date: Tue, 26 Mar 2024 16:48:25 -0700 Subject: [PATCH] wait for monitor search to finish in the beginning Signed-off-by: Amardeepsingh Siglani --- .../acknowledge_alerts_modal_spec.js | 6 ++++++ 1 file changed, 6 insertions(+) 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 744014c49..a325e9248 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 @@ -41,9 +41,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: ALERTING_PLUGIN_TIMEOUT }); cy.contains(QUERY_MONITOR, { timeout: ALERTING_PLUGIN_TIMEOUT });