From dfc614bdc3c8daaf21eb8a0d1259901399af7dd8 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Sun, 28 Jan 2024 13:42:49 -0800 Subject: [PATCH] chore: fix GitHub 'Unchanged files with check annotations' reports in PR (#26702) --- .github/workflows/superset-websocket.yml | 2 +- .../cypress/e2e/dashboard/drillby.test.ts | 1 + .../cypress/e2e/dashboard/editmode.test.ts | 1 + .../cypress-base/cypress/support/e2e.ts | 2 ++ .../cypress-base/cypress/utils/index.ts | 29 +++++++++++-------- .../cypress-base/cypress/utils/vizPlugins.ts | 1 + 6 files changed, 23 insertions(+), 13 deletions(-) diff --git a/.github/workflows/superset-websocket.yml b/.github/workflows/superset-websocket.yml index e62e728cfad7f..6000221c21865 100644 --- a/.github/workflows/superset-websocket.yml +++ b/.github/workflows/superset-websocket.yml @@ -23,7 +23,7 @@ jobs: run: npm ci - name: eslint working-directory: ./superset-websocket - run: npm run eslint -- . + run: npm run eslint -- . --quiet - name: typescript checks working-directory: ./superset-websocket run: npm run type diff --git a/superset-frontend/cypress-base/cypress/e2e/dashboard/drillby.test.ts b/superset-frontend/cypress-base/cypress/e2e/dashboard/drillby.test.ts index c365f66b4a463..50dd7180cf488 100644 --- a/superset-frontend/cypress-base/cypress/e2e/dashboard/drillby.test.ts +++ b/superset-frontend/cypress-base/cypress/e2e/dashboard/drillby.test.ts @@ -77,6 +77,7 @@ const drillBy = (targetDrillByColumn: string, isLegacy = false) => { const verifyExpectedFormData = ( interceptedRequest: Interception, + // eslint-disable-next-line @typescript-eslint/no-explicit-any expectedFormData: Record, ) => { const actualFormData = interceptedRequest.request.body?.form_data; 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 62bab84d1b85c..228fa1ec0a5c0 100644 --- a/superset-frontend/cypress-base/cypress/e2e/dashboard/editmode.test.ts +++ b/superset-frontend/cypress-base/cypress/e2e/dashboard/editmode.test.ts @@ -88,6 +88,7 @@ function visitEdit(sampleDashboard = SAMPLE_DASHBOARD_1) { } function resetTabbedDashboard(go = false) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any cy.getDashboard('tabbed_dash').then((r: Record) => { const jsonMetadata = r?.json_metadata || '{}'; const metadata = JSON.parse(jsonMetadata); diff --git a/superset-frontend/cypress-base/cypress/support/e2e.ts b/superset-frontend/cypress-base/cypress/support/e2e.ts index cccc7b2005737..6556d8e5eb92b 100644 --- a/superset-frontend/cypress-base/cypress/support/e2e.ts +++ b/superset-frontend/cypress-base/cypress/support/e2e.ts @@ -20,6 +20,8 @@ import '@cypress/code-coverage/support'; import '@applitools/eyes-cypress/commands'; import failOnConsoleError from 'cypress-fail-on-console-error'; +/* eslint-disable @typescript-eslint/no-explicit-any */ + require('cy-verify-downloads').addCustomCommand(); // fail on console error, allow config to override individual tests diff --git a/superset-frontend/cypress-base/cypress/utils/index.ts b/superset-frontend/cypress-base/cypress/utils/index.ts index 2f06efc22c25e..3ad7f7bb82bcd 100644 --- a/superset-frontend/cypress-base/cypress/utils/index.ts +++ b/superset-frontend/cypress-base/cypress/utils/index.ts @@ -41,12 +41,23 @@ export function clearAllInputs() { }); } -const toSlicelike = ($chart: JQuery): Slice => ({ - slice_id: parseInt($chart.attr('data-test-chart-id')!, 10), - form_data: { - viz_type: $chart.attr('data-test-viz-type')!, - }, -}); +const toSlicelike = ($chart: JQuery): Slice => { + const chartId = $chart.attr('data-test-chart-id'); + const vizType = $chart.attr('data-test-viz-type'); + + return { + slice_id: chartId ? parseInt(chartId, 10) : null, + form_data: { + viz_type: vizType || null, + }, + }; +}; + +export function getChartGridComponent({ name, viz }: ChartSpec) { + return cy + .get(`[data-test-chart-name="${name}"]`) + .should('have.attr', 'data-test-viz-type', viz); +} export function getChartAliasBySpec(chart: ChartSpec) { return getChartGridComponent(chart).then($chart => @@ -67,12 +78,6 @@ export function getChartAliasesBySpec(charts: readonly ChartSpec[]) { return cy.wrap(aliases); } -export function getChartGridComponent({ name, viz }: ChartSpec) { - return cy - .get(`[data-test-chart-name="${name}"]`) - .should('have.attr', 'data-test-viz-type', viz); -} - export function waitForChartLoad(chart: ChartSpec) { return getChartGridComponent(chart).then(gridComponent => { const chartId = gridComponent.attr('data-test-chart-id'); diff --git a/superset-frontend/cypress-base/cypress/utils/vizPlugins.ts b/superset-frontend/cypress-base/cypress/utils/vizPlugins.ts index 36a837476c396..c67da1afd5fd5 100644 --- a/superset-frontend/cypress-base/cypress/utils/vizPlugins.ts +++ b/superset-frontend/cypress-base/cypress/utils/vizPlugins.ts @@ -49,6 +49,7 @@ export function isLegacyChart(vizType: string): boolean { return !V1_PLUGINS.includes(vizType); } +// eslint-disable-next-line @typescript-eslint/no-explicit-any export function isLegacyResponse(response: any): boolean { return !response.result; }