From e913ee907f18ce9d92973cf8f89e54a4c22cc163 Mon Sep 17 00:00:00 2001
From: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
Date: Fri, 27 Aug 2021 14:42:07 +0200
Subject: [PATCH] #17490 Repro: Field Filter variable type cut off by Nav for
 SQL questions (#17605)

---
 .../reproductions/17490.cy.spec.js            | 61 +++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 frontend/test/metabase/scenarios/native-filters/reproductions/17490.cy.spec.js

diff --git a/frontend/test/metabase/scenarios/native-filters/reproductions/17490.cy.spec.js b/frontend/test/metabase/scenarios/native-filters/reproductions/17490.cy.spec.js
new file mode 100644
index 00000000000..b40afe161e5
--- /dev/null
+++ b/frontend/test/metabase/scenarios/native-filters/reproductions/17490.cy.spec.js
@@ -0,0 +1,61 @@
+import {
+  restore,
+  mockSessionProperty,
+  openNativeEditor,
+} from "__support__/e2e/cypress";
+
+import * as SQLFilter from "../helpers/e2e-sql-filter-helpers";
+
+describe.skip("issue 17490", () => {
+  beforeEach(() => {
+    mockSessionProperty("field-filter-operators-enabled?", true);
+
+    restore();
+    cy.signInAsAdmin();
+
+    populateStubbedTables();
+  });
+
+  it("nav bar shouldn't cut off the popover with the tables for field filter selection (metabase#17490)", () => {
+    cy.visit("/");
+    cy.icon("sql").click();
+
+    openNativeEditor();
+    SQLFilter.enterParameterizedQuery("{{f}}");
+
+    SQLFilter.openTypePickerFromDefaultFilterType();
+    SQLFilter.chooseType("Field Filter");
+
+    cy.wait("@tables");
+
+    /**
+     * Although `.click()` isn't neccessary for Cypress to fill out this input field,
+     * it's something that we can use to assert that the input field is covered by another element.
+     * Cypress fails to click any element that is not "actionable" (for example - when it's covered).
+     * In other words, the `.click()` part is essential for this repro to work. Don't remove it.
+     */
+    cy.findByPlaceholderText("Find...")
+      .click()
+      .type("Orders")
+      .blur();
+
+    cy.findByDisplayValue("Orders");
+  });
+});
+
+function populateStubbedTables() {
+  cy.intercept("GET", "/api/database/1/schema/PUBLIC", req => {
+    req.reply(res => {
+      const fauxTable = {
+        name: "Z",
+        display_name: "ZZZ",
+        id: 42, // id is hard coded, but it doesn't matter for this repro
+      };
+
+      const fauxTables = new Array(7).fill(fauxTable);
+      const stubbedResponseBody = res.body.concat(fauxTables);
+
+      res.body = stubbedResponseBody;
+    });
+  }).as("tables");
+}
-- 
GitLab