Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Fix click-behavior tab-fallback e2e flake: await target dashboard load before save (#76487)

github-automation-metabasec06ca48e21b1
diff --git a/e2e/test/scenarios/dashboard-cards/click-behavior.cy.spec.js b/e2e/test/scenarios/dashboard-cards/click-behavior.cy.spec.js
index 8851b1dca36..a2c1ed392d0 100644
--- a/e2e/test/scenarios/dashboard-cards/click-behavior.cy.spec.js
+++ b/e2e/test/scenarios/dashboard-cards/click-behavior.cy.spec.js
@@ -557,10 +557,20 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => {
H.editDashboard();
H.getDashboardCard().realHover().icon("click").click();
+
+ // Wait for the click behavior sidebar to finish loading the target
+ // dashboard before saving. The `migrateDeletedTab` effect that falls the
+ // now-invalid tabId back to the first tab — which is what dirties the
+ // dashboard and triggers the save request — only runs once the target
+ // dashboard has loaded. Asserting the tab selector is absent passes
+ // trivially before that load, so we anchor on a positive signal first.
+ cy.get("aside")
+ .findByText("Pass values to this dashboard's filters (optional)")
+ .should("be.visible");
cy.get("aside")
.findByLabelText("Select a dashboard tab")
.should("not.exist");
- cy.button("Done").should("be.enabled").click();
+ cy.get("aside").button("Done").should("be.enabled").click();
H.saveDashboard({ waitMs: 250 });
clickLineChartPoint();