From 5b1735eec0d24c20a7d3a9b5f7d52503c95ee322 Mon Sep 17 00:00:00 2001
From: Paul Rosenzweig <paulrosenzweig@users.noreply.github.com>
Date: Wed, 18 Dec 2019 16:37:25 -0500
Subject: [PATCH] ignore applicatino errors in cypress (#11551)

---
 frontend/test/__support__/cypress.js                 |  2 ++
 frontend/test/cypress.json                           |  2 +-
 .../test/metabase/dashboard/dashboard.cy.spec.js     |  1 -
 .../components/NativeQueryEditor.cy.spec.js          | 12 +-----------
 4 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/frontend/test/__support__/cypress.js b/frontend/test/__support__/cypress.js
index e13f621338d..fb9992a39aa 100644
--- a/frontend/test/__support__/cypress.js
+++ b/frontend/test/__support__/cypress.js
@@ -9,3 +9,5 @@ export function signInAsNormalUser() {
 }
 
 export const plainDbHost = Cypress.env("PLAIN_DB_HOST");
+
+Cypress.on("uncaught:exception", (err, runnable) => false);
diff --git a/frontend/test/cypress.json b/frontend/test/cypress.json
index 102200676d4..08d537427b2 100644
--- a/frontend/test/cypress.json
+++ b/frontend/test/cypress.json
@@ -2,5 +2,5 @@
 	"testFiles": "**/*.cy.spec.js",
 	"pluginsFile": "frontend/test/cypress-plugins.js",
 	"integrationFolder": "frontend/test",
-	"supportFile": false
+	"supportFile": "frontend/test/__support__/cypress.js"
 }
diff --git a/frontend/test/metabase/dashboard/dashboard.cy.spec.js b/frontend/test/metabase/dashboard/dashboard.cy.spec.js
index c3ae236f4bd..b77fe5b490a 100644
--- a/frontend/test/metabase/dashboard/dashboard.cy.spec.js
+++ b/frontend/test/metabase/dashboard/dashboard.cy.spec.js
@@ -1,7 +1,6 @@
 import { signInAsAdmin } from "__support__/cypress";
 
 describe("dashboard", () => {
-  Cypress.on("uncaught:exception", (err, runnable) => false);
   beforeEach(signInAsAdmin);
 
   it("should have the correct embed snippet", () => {
diff --git a/frontend/test/metabase/query_builder/components/NativeQueryEditor.cy.spec.js b/frontend/test/metabase/query_builder/components/NativeQueryEditor.cy.spec.js
index 7a3ba943096..ac957f88ab1 100644
--- a/frontend/test/metabase/query_builder/components/NativeQueryEditor.cy.spec.js
+++ b/frontend/test/metabase/query_builder/components/NativeQueryEditor.cy.spec.js
@@ -1,16 +1,6 @@
 import { signInAsNormalUser } from "__support__/cypress";
 describe("NativeQueryEditor", () => {
-  beforeEach(() => {
-    signInAsNormalUser();
-    cy.on("uncaught:exception", (err, runnable) => {
-      // ignore the error if it's a "script error"
-      if (err.message.match(/^Script error./)) {
-        return false;
-      }
-      // otherwise, let Cypress fail as usual
-      return true;
-    });
-  });
+  beforeEach(signInAsNormalUser);
 
   it("lets you create and run a SQL question", () => {
     cy.visit("/question/new");
-- 
GitLab