From 49b3e939e99bba19db627c8929c5b47ae158b652 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 17 Dec 2024 19:49:11 +0000 Subject: [PATCH] Fix flaky cypress tests (#2293) * change time value to 24 when setting time Signed-off-by: Ritvi Bhatt * move intercepts earlier Signed-off-by: Ritvi Bhatt * wait for query to load before visualizing data Signed-off-by: Ritvi Bhatt * wait for table to load before clicking trace Signed-off-by: Ritvi Bhatt --------- Signed-off-by: Ritvi Bhatt Co-authored-by: Ritvi Bhatt Co-authored-by: Adam Tackett <105462877+TackAdam@users.noreply.github.com> (cherry picked from commit 6f67c500f286ba7cb305c9efb1334a94e14238e6) Signed-off-by: github-actions[bot] --- .cypress/integration/app_analytics_test/app_analytics.spec.js | 4 ++-- .../integration/event_analytics_test/event_analytics.spec.js | 1 + .../trace_analytics_test/trace_analytics_traces.spec.js | 1 + .cypress/utils/app_constants.js | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.cypress/integration/app_analytics_test/app_analytics.spec.js b/.cypress/integration/app_analytics_test/app_analytics.spec.js index bee7aba52..125715b02 100644 --- a/.cypress/integration/app_analytics_test/app_analytics.spec.js +++ b/.cypress/integration/app_analytics_test/app_analytics.spec.js @@ -433,13 +433,13 @@ describe('Viewing application', () => { it('Changes availability visualization', () => { + cy.intercept('PUT', `**/api/observability/application`).as('selectUpdate'); + cy.intercept('GET', `**/api/observability/operational_panels/panels/**`).as('loadingPanels') cy.get('[data-test-subj="app-analytics-configTab"]').click(); cy.get('select').select(visOneName); - cy.intercept('PUT', `**/api/observability/application`).as('selectUpdate'); cy.wait('@selectUpdate'); moveToHomePage(); - cy.intercept('GET', `**/api/observability/operational_panels/panels/**`).as('loadingPanels') cy.wait('@loadingPanels'); cy.reload(); cy.get('[data-test-subj="AvailableAvailabilityBadge"][style="background-color: rgb(84, 179, 153); color: rgb(0, 0, 0);"]').should('contain', 'Available'); diff --git a/.cypress/integration/event_analytics_test/event_analytics.spec.js b/.cypress/integration/event_analytics_test/event_analytics.spec.js index 86cea2f1a..fe07517ea 100644 --- a/.cypress/integration/event_analytics_test/event_analytics.spec.js +++ b/.cypress/integration/event_analytics_test/event_analytics.spec.js @@ -479,6 +479,7 @@ describe('Visualizing data', () => { }); it('Visualize vertical bar chart', () => { + cy.get('[data-test-subj="globalLoadingIndicator"]').should('not.exist'); cy.get('[data-test-subj="comboBoxInput"]').eq(1).click(); cy.get('[data-test-subj="comboBoxOptionsList "] span').contains(VIS_TYPE_VBAR).click(); cy.get('[data-test-subj="vizConfigSection-series"]') diff --git a/.cypress/integration/trace_analytics_test/trace_analytics_traces.spec.js b/.cypress/integration/trace_analytics_test/trace_analytics_traces.spec.js index 96229d932..a6a3e89f3 100644 --- a/.cypress/integration/trace_analytics_test/trace_analytics_traces.spec.js +++ b/.cypress/integration/trace_analytics_test/trace_analytics_traces.spec.js @@ -164,6 +164,7 @@ describe('Testing traces tree view', () => { cy.get("[data-test-subj='indexPattern-switch-link']").click(); cy.get("[data-test-subj='data_prepper-mode']").click(); setTimeFilter(); + cy.get('[data-test-subj="globalLoadingIndicator"]').should('not.exist'); cy.contains('02feb3a4f611abd81f2a53244d1278ae').click(); cy.get('h1.overview-content').contains('02feb3a4f611abd81f2a53244d1278ae').should('exist'); }); diff --git a/.cypress/utils/app_constants.js b/.cypress/utils/app_constants.js index 5064e4f16..81b11b6c1 100644 --- a/.cypress/utils/app_constants.js +++ b/.cypress/utils/app_constants.js @@ -136,6 +136,7 @@ export const moveToEditPage = () => { export const changeTimeTo24 = (timeUnit) => { cy.get('[data-test-subj="superDatePickerToggleQuickMenuButton"]').trigger('mouseover').click({ force: true }); + cy.get('[aria-label="Time value"]').type('{selectall}24'); cy.get('[aria-label="Time unit"]').select(timeUnit); cy.get('.euiButton').contains('Apply').click(); cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click();