From 919ec3f472eb6a25396088e161cc72d86a40eae6 Mon Sep 17 00:00:00 2001
From: Nemanja Glumac <31325167+nemanjaglumac@users.noreply.github.com>
Date: Mon, 20 Jul 2020 17:39:14 +0200
Subject: [PATCH] Repro for #12651 (#12919)

* Add repro for #12651

* Refactor test

- stick to CSS classes when targetting icons

* Skip the test

- skip the test until the issue is resolved
- added reference to the original issue in the test description
---
 .../scenarios/question/new.cy.spec.js         | 21 ++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/frontend/test/metabase/scenarios/question/new.cy.spec.js b/frontend/test/metabase/scenarios/question/new.cy.spec.js
index 23a8bbaf06c..7b412f6df78 100644
--- a/frontend/test/metabase/scenarios/question/new.cy.spec.js
+++ b/frontend/test/metabase/scenarios/question/new.cy.spec.js
@@ -1,4 +1,9 @@
-import { restore, signInAsAdmin, popover } from "__support__/cypress";
+import {
+  restore,
+  signInAsAdmin,
+  popover,
+  openOrdersTable,
+} from "__support__/cypress";
 
 // test various entry points into the query builder
 
@@ -25,6 +30,20 @@ describe("scenarios > question > new", () => {
       cy.contains("Orders").click();
       cy.contains("37.65");
     });
+
+    it.skip("should remove `/notebook` from URL when converting question to SQL/Native (Issue #12651)", () => {
+      cy.server();
+      cy.route("POST", "/api/dataset").as("dataset");
+      openOrdersTable();
+      cy.wait("@dataset");
+      cy.url().should("include", "question#");
+      // Isolate icons within "QueryBuilder" scope because there is also `.Icon-sql` in top navigation
+      cy.get(".QueryBuilder .Icon-notebook").click();
+      cy.url().should("include", "question/notebook#");
+      cy.get(".QueryBuilder .Icon-sql").click();
+      cy.findByText("Convert this question to SQL").click();
+      cy.url().should("include", "question#");
+    });
   });
 
   describe("ask a (custom) question", () => {
-- 
GitLab