From 216c1002699c833eb93d9fa93af5075c64b7f5fc Mon Sep 17 00:00:00 2001
From: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
Date: Tue, 3 Nov 2020 21:43:49 +0100
Subject: [PATCH] Repro for #13235: Filter with remapped values [ci skip]
 (#13667)

* Add repro for #13235 [ci skip]
(Cannot filter by selecting remapped display value from dropdown list)
---
 .../scenarios/question/filter.cy.spec.js      | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/frontend/test/metabase/scenarios/question/filter.cy.spec.js b/frontend/test/metabase/scenarios/question/filter.cy.spec.js
index b2f1cc08508..1a89b2331f1 100644
--- a/frontend/test/metabase/scenarios/question/filter.cy.spec.js
+++ b/frontend/test/metabase/scenarios/question/filter.cy.spec.js
@@ -1,6 +1,7 @@
 import {
   signInAsAdmin,
   restore,
+  openOrdersTable,
   openProductsTable,
   popover,
   withSampleDataset,
@@ -159,4 +160,35 @@ describe("scenarios > question > filter", () => {
       });
     });
   });
+
+  it.skip("should filter based on remapped values (metabase#13235)", () => {
+    withSampleDataset(({ ORDERS, PRODUCTS }) => {
+      // set "Filtering on this field" = "A list of all values"
+      cy.request("PUT", `/api/field/${ORDERS.PRODUCT_ID}`, {
+        has_field_values: "list",
+      });
+      // "Display values" = "Use foreign key" as `Product.Title`
+      cy.request("POST", `/api/field/${ORDERS.PRODUCT_ID}/dimension`, {
+        name: "Product ID",
+        type: "external",
+        human_readable_field_id: PRODUCTS.TITLE,
+      });
+
+      // Add filter as remapped Product ID (Product name)
+      openOrdersTable();
+      cy.findByText("Filter").click();
+      cy.get(".List-item-title")
+        .contains("Product ID")
+        .click();
+      cy.get(".scroll-y")
+        .contains("Aerodynamic Linen Coat")
+        .click();
+      cy.findByText("Add filter").click();
+
+      cy.log("**Reported failing on v0.36.4 and v0.36.5.1**");
+      cy.get(".LoadingSpinner").should("not.exist");
+      cy.findAllByText("148.23"); // one of the subtotals for this product
+      cy.findAllByText("Fantastic Wool Shirt").should("not.exist");
+    });
+  });
 });
-- 
GitLab