Skip to content

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

Fix flaky dashboard bulk-move empty-state test (#78457)

github-automation-metabase2ef0e4d264b3
diff --git a/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.js b/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.js
index cb44b504d1f..90383cf953c 100644
--- a/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.js
+++ b/e2e/test/scenarios/dashboard/dashboard-questions.cy.spec.js
@@ -277,6 +277,8 @@ describe("Dashboard > Dashboard Questions", () => {
});
it("should tell users which dashboards will be affected when doing bulk question moves", () => {
+ cy.intercept("PUT", "/api/card/*").as("moveQuestion");
+
H.createQuestionAndDashboard({
questionDetails: {
name: "Sample Question",
@@ -312,11 +314,17 @@ describe("Dashboard > Dashboard Questions", () => {
cy.button("Move it").should("exist").click();
});
+ // Wait for the move to land before navigating: otherwise Test Dashboard
+ // can load while its dashcard is still present, so the empty state never
+ // renders and the assertion below times out.
+ cy.wait("@moveQuestion");
+ H.modal().should("not.exist");
+
H.collectionTable().findByText("Test Dashboard").click();
cy.findByTestId("dashboard-empty-state")
.findByText("This dashboard is empty")
- .should("exist");
+ .should("be.visible");
H.visitDashboard(S.ORDERS_DASHBOARD_ID);
H.dashboardCards().findByText("Sample Question").should("exist");