From 515faa4507117f272da410591cb5913728188e43 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Fri, 24 Nov 2023 10:51:29 -0800 Subject: [PATCH] Refactored alerting test, and added wait logic to reduce flakiness. (#953) (#957) Signed-off-by: AWSHurneyt (cherry picked from commit 5db8065e5918e382706587aa925a30144d1d7505) Co-authored-by: AWSHurneyt --- .../monitors_dashboard_spec.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cypress/integration/plugins/alerting-dashboards-plugin/monitors_dashboard_spec.js b/cypress/integration/plugins/alerting-dashboards-plugin/monitors_dashboard_spec.js index ba8898ee6..7a42a6481 100644 --- a/cypress/integration/plugins/alerting-dashboards-plugin/monitors_dashboard_spec.js +++ b/cypress/integration/plugins/alerting-dashboards-plugin/monitors_dashboard_spec.js @@ -38,7 +38,7 @@ const clusterHealthMonitor = { severity: '1', condition: { script: { - source: 'ctx.results[0].status != "green"', + source: 'ctx.results[0].status != "blue"', lang: 'painless', }, }, @@ -107,8 +107,13 @@ describe('Monitors dashboard page', () => { }); it('Displays expected number of alerts', () => { + // Wait for table to finish loading + cy.get('tbody > tr').should(($tr) => + expect($tr).to.have.length.greaterThan(1) + ); + // Ensure the 'Monitor name' column is sorted in ascending order by sorting another column first - cy.contains('Last updated by').click({ force: true }); + cy.contains('Last notification time').click({ force: true }); cy.contains('Monitor name').click({ force: true }); testMonitors.forEach((entry) => {