From 5d0748cee9a8e953580f232701a1842682f10e9a Mon Sep 17 00:00:00 2001
From: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
Date: Wed, 25 May 2022 22:04:19 +0200
Subject: [PATCH] Expand repro for #22715 with additional scenario (#22955)

---
 ...lues-override-column-identifier.cy.spec.js | 23 ++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/frontend/test/metabase/scenarios/models/reproductions/22715-remapped-values-override-column-identifier.cy.spec.js b/frontend/test/metabase/scenarios/models/reproductions/22715-remapped-values-override-column-identifier.cy.spec.js
index dc56f9d6ef1..8ac70950866 100644
--- a/frontend/test/metabase/scenarios/models/reproductions/22715-remapped-values-override-column-identifier.cy.spec.js
+++ b/frontend/test/metabase/scenarios/models/reproductions/22715-remapped-values-override-column-identifier.cy.spec.js
@@ -5,16 +5,14 @@ import {
   filter,
 } from "__support__/e2e/cypress";
 
-describe.skip("issue 22715 ", () => {
+describe.skip("filtering based on the remapped column name should result in a correct query (metabase#22715)", () => {
   beforeEach(() => {
     cy.intercept("POST", "/api/dataset").as("dataset");
     cy.intercept("PUT", "/api/card/*").as("updateModel");
 
     restore();
     cy.signInAsAdmin();
-  });
 
-  it("fitlering based on the remapped column name should result in a correct query (metabase#22715)", () => {
     cy.createNativeQuestion({
       native: {
         query: `select 1 as "ID", current_timestamp::datetime as "ALIAS_CREATED_AT"`,
@@ -28,6 +26,10 @@ describe.skip("issue 22715 ", () => {
 
       // Let's go straight to the model metadata editor
       cy.visit(`/model/${id}/metadata`);
+      // Without this Cypress fails to remap the column because an element becomes detached from the DOM
+      cy.findByText(
+        "Use the tab key to navigate through settings and columns.",
+      );
 
       // The first column `ID` is automatically selected
       mapColumnTo({ table: "Orders", column: "ID" });
@@ -44,7 +46,22 @@ describe.skip("issue 22715 ", () => {
       cy.visit(`/model/${id}`);
       cy.wait("@dataset");
     });
+  });
+
+  it("when done through the column header action (metabase#22715-1)", () => {
+    cy.findByText("Created At").click();
+    cy.findByText("Filter by this column").click();
+    cy.findByText("Today").click();
+
+    cy.wait("@dataset");
+    cy.findByText("Today").should("not.exist");
+
+    cy.get(".cellData")
+      .should("have.length", 4)
+      .and("contain", "Created At");
+  });
 
+  it("when done through the filter trigger (metabase#22715-2)", () => {
     filter();
 
     cy.findByTestId("sidebar-right").within(() => {
-- 
GitLab