You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2023/08/03 15:18:48 UTC
[superset] branch fail-cypress-on-console-errors updated: Allowing some console errors to slip through.
This is an automated email from the ASF dual-hosted git repository.
rusackas pushed a commit to branch fail-cypress-on-console-errors
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/fail-cypress-on-console-errors by this push:
new df63d6e0b8 Allowing some console errors to slip through.
df63d6e0b8 is described below
commit df63d6e0b89396a8fc5526be0ae9ca4acec0e423
Author: Evan Rusackas <ev...@rusackas.com>
AuthorDate: Thu Aug 3 09:18:38 2023 -0600
Allowing some console errors to slip through.
---
.../cypress/e2e/dashboard/editmode.test.ts | 2 ++
.../cypress-base/cypress/support/e2e.ts | 20 ++++++++++++++++++--
.../cypress-base/cypress/support/index.d.ts | 1 +
3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/superset-frontend/cypress-base/cypress/e2e/dashboard/editmode.test.ts b/superset-frontend/cypress-base/cypress/e2e/dashboard/editmode.test.ts
index b35105a7b5..c07607cb1b 100644
--- a/superset-frontend/cypress-base/cypress/e2e/dashboard/editmode.test.ts
+++ b/superset-frontend/cypress-base/cypress/e2e/dashboard/editmode.test.ts
@@ -661,6 +661,8 @@ describe('Dashboard edit', () => {
it('should not accept an invalid color scheme', () => {
openAdvancedProperties();
clearMetadata();
+ // allow console error
+ cy.setConsoleMessages(['Error: A valid color scheme is required']);
writeMetadata('{"color_scheme":"wrongcolorscheme"}');
applyChanges();
cy.get('.ant-modal-body')
diff --git a/superset-frontend/cypress-base/cypress/support/e2e.ts b/superset-frontend/cypress-base/cypress/support/e2e.ts
index c6e766012b..11984dff94 100644
--- a/superset-frontend/cypress-base/cypress/support/e2e.ts
+++ b/superset-frontend/cypress-base/cypress/support/e2e.ts
@@ -18,11 +18,27 @@
*/
import '@cypress/code-coverage/support';
import '@applitools/eyes-cypress/commands';
-import failOnConsoleError from 'cypress-fail-on-console-error';
+import failOnConsoleError, { Config } from 'cypress-fail-on-console-error';
require('cy-verify-downloads').addCustomCommand();
-failOnConsoleError();
+// fail on console error, allow config to override individual tests
+// these exceptions are a little pile of tech debt
+const { getConfig, setConfig } = failOnConsoleError({consoleMessages: [
+ /\[webpack-dev-server\]/,
+ 'The pseudo class ":first-child" is potentially unsafe when doing server-side rendering. Try changing it to ":first-of-type".',
+ 'The pseudo class ":nth-child" is potentially unsafe when doing server-side rendering. Try changing it to ":nth-of-type".',
+ /Warning: /
+]});
+
+// Set infividual tests to allow certain console erros to NOT fail, e.g
+// cy.setConsoleMessages(['foo', /^some bar-regex.*/]);
+// This will be reset between tests.
+Cypress.Commands.addAll({
+ getConsoleMessages: () => cy.wrap(getConfig()?.consoleMessages),
+ setConsoleMessages: (consoleMessages: (string | RegExp)[]) =>
+ setConfig({ ...getConfig(), consoleMessages }),
+});
const BASE_EXPLORE_URL = '/explore/?form_data=';
let DASHBOARD_FIXTURES: Record<string, any>[] = [];
diff --git a/superset-frontend/cypress-base/cypress/support/index.d.ts b/superset-frontend/cypress-base/cypress/support/index.d.ts
index 124d72bddd..b9d2ed8578 100644
--- a/superset-frontend/cypress-base/cypress/support/index.d.ts
+++ b/superset-frontend/cypress-base/cypress/support/index.d.ts
@@ -41,6 +41,7 @@ declare namespace Cypress {
cleanDashboards(): cy;
loadChartFixtures(): cy;
loadDashboardFixtures(): cy;
+ setConsoleMessages(consoleMessages: (string | RegExp)[]): cy;
visitChartByParams(params: string | Record<string, unknown>): cy;
visitChartByName(name: string): cy;