From 7aa32fdca24800472485fdefc4bb274abead36d6 Mon Sep 17 00:00:00 2001 From: Roman Abdulmanov <roman@metabase.com> Date: Wed, 28 Jun 2023 21:35:03 +0400 Subject: [PATCH] Fix for the flaky X-Ray test (#31849) --- .../scenarios/dashboard/x-rays.cy.spec.js | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/e2e/test/scenarios/dashboard/x-rays.cy.spec.js b/e2e/test/scenarios/dashboard/x-rays.cy.spec.js index 3d08cfb46cc..b85d7caad06 100644 --- a/e2e/test/scenarios/dashboard/x-rays.cy.spec.js +++ b/e2e/test/scenarios/dashboard/x-rays.cy.spec.js @@ -5,6 +5,7 @@ import { summarize, visualize, startNewQuestion, + main, } from "e2e/support/helpers"; import { SAMPLE_DB_ID } from "e2e/support/cypress_data"; @@ -19,7 +20,7 @@ describe("scenarios > x-rays", () => { cy.signInAsAdmin(); }); - const XRAY_DATASETS = 11; // enough to load most questions + const XRAY_DATASETS = 5; // enough to load most questions it("should not display x-rays if the feature is disabled in admin settings (metabase#26571)", () => { cy.request("PUT", "api/setting/enable-xrays", { value: false }); @@ -92,10 +93,7 @@ describe("scenarios > x-rays", () => { }); ["X-ray", "Compare to the rest"].forEach(action => { - // Temporarily skipping this due to degraded performance causing the test to fail, blocking all merges to master. - // We're actively investigating whether Github's runners or our code is responsible. See discussion at: - // https://metaboat.slack.com/archives/C5XHN8GLW/p1685964332028149 - it.skip(`"${action.toUpperCase()}" should work on a nested question made from base native question (metabase#15655)`, () => { + it(`"${action.toUpperCase()}" should work on a nested question made from base native question (metabase#15655)`, () => { cy.intercept("GET", "/api/automagic-dashboards/**").as("xray"); cy.createNativeQuestion({ @@ -122,17 +120,19 @@ describe("scenarios > x-rays", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText(action).click(); + for (let c = 0; c < XRAY_DATASETS; ++c) { + cy.wait("@postDataset"); + } + cy.wait("@xray").then(xhr => { - for (let c = 0; c < XRAY_DATASETS; ++c) { - cy.wait("@postDataset"); - } expect(xhr.response.body.cause).not.to.exist; expect(xhr.response.statusCode).not.to.eq(500); }); - cy.findByTextEnsureVisible("A look at the number of 15655"); + main().within(() => { + cy.findByText("A look at the number of 15655").should("exist"); + }); - cy.findByRole("heading", { name: /^A look at the number of/ }); cy.get(".DashCard"); }); -- GitLab