Skip to content

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

test(e2e): use computed dashboard id in new question redirect assertions (#73206)

Nicolò Pretto0a976094052a
diff --git a/e2e/test/scenarios/question/new.cy.spec.js b/e2e/test/scenarios/question/new.cy.spec.js
index 08dfaec3b19..75de39a31d4 100644
--- a/e2e/test/scenarios/question/new.cy.spec.js
+++ b/e2e/test/scenarios/question/new.cy.spec.js
@@ -426,6 +426,7 @@ describe("scenarios > question > new", () => {
beforeEach(() => {
cy.intercept("POST", "/api/card").as("createQuestion");
+ cy.intercept("POST", "/api/dashboard").as("createDashboard");
H.createCollection(collectionInRoot).then(({ body: { id } }) => {
H.createDashboard({
name: "Extra Dashboard",
@@ -562,7 +563,12 @@ describe("scenarios > question > new", () => {
H.entityPickerModal()
.button(/Select/)
.click();
- cy.location("pathname").should("eq", "/dashboard/13-new-dashboard");
+ cy.wait("@createDashboard").then(({ response }) => {
+ cy.location("pathname").should(
+ "eq",
+ `/dashboard/${response.body.id}-new-dashboard`,
+ );
+ });
});
it("when selecting a collection with no child dashboards (metabase#47000)", () => {
@@ -593,7 +599,12 @@ describe("scenarios > question > new", () => {
H.entityPickerModal()
.button(/Select/)
.click();
- cy.location("pathname").should("eq", "/dashboard/13-new-dashboard");
+ cy.wait("@createDashboard").then(({ response }) => {
+ cy.location("pathname").should(
+ "eq",
+ `/dashboard/${response.body.id}-new-dashboard`,
+ );
+ });
});
it("when a dashboard is currently selected", () => {
@@ -618,7 +629,12 @@ describe("scenarios > question > new", () => {
H.entityPickerModal()
.button(/Select/)
.click();
- cy.location("pathname").should("eq", "/dashboard/13-new-dashboard");
+ cy.wait("@createDashboard").then(({ response }) => {
+ cy.location("pathname").should(
+ "eq",
+ `/dashboard/${response.body.id}-new-dashboard`,
+ );
+ });
});
});
});