diff --git a/frontend/test/metabase/scenarios/question/nulls.cy.spec.js b/frontend/test/metabase/scenarios/question/nulls.cy.spec.js index fcc83edc9e6da1bf661fb3f39d1358c3382ffe8a..e8afb3bd89583793937886b5319f0d590b0a6f8f 100644 --- a/frontend/test/metabase/scenarios/question/nulls.cy.spec.js +++ b/frontend/test/metabase/scenarios/question/nulls.cy.spec.js @@ -7,8 +7,10 @@ import { } from "__support__/cypress"; describe("scenarios > question > null", () => { - before(restore); - beforeEach(signInAsAdmin); + beforeEach(() => { + restore(); + signInAsAdmin(); + }); it("should display rows whose value is `null` (metabase#13571)", () => { withSampleDataset(({ ORDERS }) => { @@ -127,6 +129,77 @@ describe("scenarios > question > null", () => { }); }); + it("dashboard should handle cards with null values (metabase#13801)", () => { + cy.log("**-- Create Question 1 --**"); + + cy.request("POST", "/api/card", { + name: "13801_Q1", + dataset_query: { + database: 1, + native: { query: "SELECT null", "template-tags": {} }, + type: "native", + }, + display: "scalar", + visualization_settings: {}, + }).then(({ body: { id: Q1_ID } }) => { + cy.log("**-- Create Question 2 --**"); + + cy.request("POST", "/api/card", { + name: "13801_Q2", + dataset_query: { + database: 1, + native: { query: "SELECT 0", "template-tags": {} }, + type: "native", + }, + display: "scalar", + visualization_settings: {}, + }).then(({ body: { id: Q2_ID } }) => { + cy.log("**-- Create Dashboard --**"); + + cy.request("POST", "/api/dashboard", { + name: "13801D", + }).then(({ body: { id: DASHBOARD_ID } }) => { + cy.log( + `**-- Add both previously created questions to the dashboard--**`, + ); + + [Q1_ID, Q2_ID].forEach((questionId, index) => { + cy.request("POST", `/api/dashboard/${DASHBOARD_ID}/cards`, { + cardId: questionId, + }).then(({ body: { id: DASHCARD_ID } }) => { + const CARD_SIZE_X = 6; + + cy.request("PUT", `/api/dashboard/${DASHBOARD_ID}/cards`, { + cards: [ + { + id: DASHCARD_ID, + card_id: questionId, + row: 0, + col: index === 0 ? 0 : CARD_SIZE_X, // making sure the second card doesn't overlap the first one + sizeX: CARD_SIZE_X, + sizeY: 4, + parameter_mappings: [], + }, + ], + }); + }); + }); + cy.server(); + cy.route("POST", "/api/card/*/query").as("cardQuery"); + + cy.visit(`/dashboard/${DASHBOARD_ID}`); + // wait for the second cardQuery to finish + cy.wait("@cardQuery.2"); + + cy.log("P0 regression in v0.37.1!"); + cy.get(".LoadingSpinner").should("not.exist"); + cy.findByText("13801_Q1"); + cy.findByText("13801_Q2"); + }); + }); + }); + }); + describe("aggregations with null values", () => { beforeEach(() => { cy.server();