Skip to content

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

Port sankey repro no. 65317 to Jest (#73789)

Nemanja Glumacc20c3560a0a9
diff --git a/e2e/test/scenarios/dashboard/visualizer/reproductions.cy.spec.ts b/e2e/test/scenarios/dashboard/visualizer/reproductions.cy.spec.ts
index e5b00ee8e3a..32ece424c86 100644
--- a/e2e/test/scenarios/dashboard/visualizer/reproductions.cy.spec.ts
+++ b/e2e/test/scenarios/dashboard/visualizer/reproductions.cy.spec.ts
@@ -1,4 +1,3 @@
-import { SAMPLE_DB_ID } from "e2e/support/cypress_data";
import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database";
import type {
DashboardDetails,
@@ -291,51 +290,3 @@ describe("issue 65908 (UXW-2293)", () => {
});
});
});
-
-describe("issue 65317", () => {
- const SANKEY_QUERY = `
-SELECT 'A' AS source, 'B' AS target, 100 AS value
-UNION ALL
-SELECT 'B', 'C', 80
-UNION ALL
-SELECT 'C', 'D', 60
-`;
-
- beforeEach(() => {
- H.restore();
- cy.signInAsAdmin();
- });
-
- it("should not show 'Visualize another way' button for Sankey charts (metabase#65317)", () => {
- H.createDashboard({
- name: "Dashboard with Sankey",
- }).then(({ body: dashboard }) => {
- H.createNativeQuestion({
- name: "Sankey Question",
- native: {
- query: SANKEY_QUERY,
- },
- display: "sankey",
- database: SAMPLE_DB_ID,
- }).then(({ body: card }) => {
- H.addOrUpdateDashboardCard({
- card_id: card.id,
- dashboard_id: dashboard.id,
- card: {
- size_x: 12,
- size_y: 8,
- },
- });
-
- H.visitDashboard(dashboard.id);
- });
- });
-
- H.editDashboard();
-
- H.getDashboardCard(0).realHover({ scrollBehavior: "bottom" });
-
- cy.findByTestId("dashboardcard-actions-panel").should("be.visible");
- cy.findByLabelText("Visualize another way").should("not.exist");
- });
-});
diff --git a/frontend/src/metabase/dashboard/components/DashCard/Dashcard.unit.spec.tsx b/frontend/src/metabase/dashboard/components/DashCard/Dashcard.unit.spec.tsx
index 575d1f899d0..9a06d6d4435 100644
--- a/frontend/src/metabase/dashboard/components/DashCard/Dashcard.unit.spec.tsx
+++ b/frontend/src/metabase/dashboard/components/DashCard/Dashcard.unit.spec.tsx
@@ -442,6 +442,32 @@ describe("DashCard", () => {
).not.toBeInTheDocument();
});
+ it("should not show 'Visualize another way' for sankey cards (metabase#65317)", () => {
+ const dashcard = createMockDashboardCard({
+ card: createMockCard({
+ name: "My Card",
+ display: "sankey",
+ }),
+ });
+
+ setup({
+ dashboard: {
+ ...testDashboard,
+ dashcards: [dashcard],
+ },
+ dashcard,
+ isEditing: true,
+ });
+
+ // Anchor: prove sankey is routed as a non-visualizer type.
+ expect(
+ screen.getByLabelText("Show visualization options"),
+ ).toBeInTheDocument();
+ expect(
+ screen.queryByLabelText("Visualize another way"),
+ ).not.toBeInTheDocument();
+ });
+
it.each([
["heading", createMockHeadingDashboardCard()],
["text", createMockTextDashboardCard()],