From 7d1e838859143853f6b681e07fcb6032323a779f Mon Sep 17 00:00:00 2001
From: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
Date: Fri, 14 Jan 2022 17:47:29 +0100
Subject: [PATCH] Fix flaking repro for 11439 (#19692)

* Fix flaking repro for 11439

* Fix linter
---
 .../e2e/helpers/e2e-misc-helpers.js           |  4 +++-
 .../scenarios/question/new.cy.spec.js         | 20 +++++++++++--------
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/frontend/test/__support__/e2e/helpers/e2e-misc-helpers.js b/frontend/test/__support__/e2e/helpers/e2e-misc-helpers.js
index 43c0eb29b2b..f142472378a 100644
--- a/frontend/test/__support__/e2e/helpers/e2e-misc-helpers.js
+++ b/frontend/test/__support__/e2e/helpers/e2e-misc-helpers.js
@@ -57,7 +57,9 @@ export function openNotebookEditor({ fromCurrentPage } = {}) {
   }
 
   cy.findByText("New").click();
-  cy.findByText("Question").click();
+  cy.findByText("Question")
+    .should("be.visible")
+    .click();
 }
 
 /**
diff --git a/frontend/test/metabase/scenarios/question/new.cy.spec.js b/frontend/test/metabase/scenarios/question/new.cy.spec.js
index 7bf0bb13a01..bc058bb08d4 100644
--- a/frontend/test/metabase/scenarios/question/new.cy.spec.js
+++ b/frontend/test/metabase/scenarios/question/new.cy.spec.js
@@ -1,7 +1,6 @@
 import {
   browse,
   enterCustomColumnDetails,
-  getBinningButtonForDimension,
   openOrdersTable,
   openReviewsTable,
   popover,
@@ -373,7 +372,10 @@ describe("scenarios > question > new", () => {
       cy.findByText("Saved Questions").click();
       cy.findByText("11439").click();
       visualize();
-      cy.findByTestId("toggle-summarize-sidebar-button").click();
+      cy.findAllByTestId("toggle-summarize-sidebar-button")
+        .contains("Summarize")
+        .click();
+
       cy.findByText("Group by")
         .parent()
         .within(() => {
@@ -381,13 +383,15 @@ describe("scenarios > question > new", () => {
           cy.log(
             "**Marked as regression of [#10441](https://github.com/metabase/metabase/issues/10441)**",
           );
-          getBinningButtonForDimension({
-            name: "Created At",
-          })
-            .should("have.text", "by month")
-            .click();
+
+          cy.findByText("Created At")
+            .closest("li")
+            .contains("by month")
+            // realHover() or mousemove don't work for whatever reason
+            // have to use this ugly hack for now
+            .click({ force: true });
         });
-      // this step is maybe redundant since it fails to even find "by month"
+      // // this step is maybe redundant since it fails to even find "by month"
       cy.findByText("Hour of Day");
     });
 
-- 
GitLab