From 5863b1f40462596a5c9f8f69042fce4948abdf62 Mon Sep 17 00:00:00 2001
From: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
Date: Fri, 23 Dec 2022 11:49:47 +0100
Subject: [PATCH] Repro #27380: Doing "Zoom in" from dashboard drops fields
 from joined tables (#27390)

---
 ...-drops-joined-fields-on-zoom-in.cy.spec.js | 49 +++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 frontend/test/metabase/scenarios/joins/reproductions/27380-dashboard-drops-joined-fields-on-zoom-in.cy.spec.js

diff --git a/frontend/test/metabase/scenarios/joins/reproductions/27380-dashboard-drops-joined-fields-on-zoom-in.cy.spec.js b/frontend/test/metabase/scenarios/joins/reproductions/27380-dashboard-drops-joined-fields-on-zoom-in.cy.spec.js
new file mode 100644
index 00000000000..983ee78c6f7
--- /dev/null
+++ b/frontend/test/metabase/scenarios/joins/reproductions/27380-dashboard-drops-joined-fields-on-zoom-in.cy.spec.js
@@ -0,0 +1,49 @@
+import { restore, visitDashboard } from "__support__/e2e/helpers";
+import { SAMPLE_DATABASE } from "__support__/e2e/cypress_sample_database";
+
+const { ORDERS, ORDERS_ID, PRODUCTS } = SAMPLE_DATABASE;
+
+const questionDetails = {
+  query: {
+    "source-table": ORDERS_ID,
+    aggregation: [["count"]],
+    breakout: [
+      [
+        "field",
+        PRODUCTS.CREATED_AT,
+        { "source-field": ORDERS.PRODUCT_ID, "temporal-unit": "month" },
+      ],
+    ],
+  },
+  display: "line",
+};
+
+describe.skip("issue 27380", () => {
+  beforeEach(() => {
+    cy.intercept("POST", "/api/dataset").as("dataset");
+
+    restore();
+    cy.signInAsAdmin();
+
+    cy.createQuestionAndDashboard({ questionDetails }).then(
+      ({ body: { dashboard_id } }) => {
+        visitDashboard(dashboard_id);
+      },
+    );
+  });
+
+  it("should not drop fields from joined table on dashboard 'zoom-in' (metabase#27380)", () => {
+    // Doesn't really matter which 'circle" we click on the graph
+    cy.get("circle").last().realClick();
+    cy.findByText("Zoom in").click();
+    cy.wait("@dataset");
+
+    // Graph should still exist
+    // Let's check only the y-axis label
+    cy.get("y-axis-label").invoke("text").should("eq", "Count");
+
+    cy.icon("notebook").click();
+    cy.findByText("Pick a column to group by").should("not.exist");
+    cy.findByText(/Products? → Created At: Month/);
+  });
+});
-- 
GitLab