You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by su...@apache.org on 2021/05/04 16:28:02 UTC
[superset] 01/01: chore(dashboard): add navigation e2e test
This is an automated email from the ASF dual-hosted git repository.
suddjian pushed a commit to branch aaron--e2e-dashboard-tests
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 29915dfa2758ec82075f6b0e814d4c63f9a94b08
Author: David Aaron Suddjian <aa...@gmail.com>
AuthorDate: Mon May 3 19:05:16 2021 -0700
chore(dashboard): add navigation e2e test
---
.../integration/dashboard/dashboard.helper.ts | 9 ++++
.../integration/dashboard/navigation.test.ts | 48 ++++++++++++++++++++++
.../dashboard/components/gridComponents/Chart.jsx | 2 +-
3 files changed, 58 insertions(+), 1 deletion(-)
diff --git a/superset-frontend/cypress-base/cypress/integration/dashboard/dashboard.helper.ts b/superset-frontend/cypress-base/cypress/integration/dashboard/dashboard.helper.ts
index 123c777..d2b71c6 100644
--- a/superset-frontend/cypress-base/cypress/integration/dashboard/dashboard.helper.ts
+++ b/superset-frontend/cypress-base/cypress/integration/dashboard/dashboard.helper.ts
@@ -37,6 +37,15 @@ export const WORLD_HEALTH_CHARTS = [
{ name: 'Box plot', viz: 'box_plot' },
] as const;
+export const VIDEO_GAME_SALES_CHARTS = [
+ { name: 'Global Sales per Console', viz: 'area' },
+ { name: 'Top 10 Games (by Global Sales)', viz: 'table' },
+ { name: 'Publishers of Top 25 Games', viz: 'pie' },
+ { name: 'Top 10 Consoles, by # of Hit Games', viz: 'treemap' },
+ { name: 'Popular Genres Across Platforms', viz: 'heatmap' },
+ { name: 'Top 10 Games: Proportion of Sales in Markets', viz: 'dist_bar' },
+];
+
/** Used to specify charts expected by the test suite */
export interface ChartSpec {
name: string;
diff --git a/superset-frontend/cypress-base/cypress/integration/dashboard/navigation.test.ts b/superset-frontend/cypress-base/cypress/integration/dashboard/navigation.test.ts
new file mode 100644
index 0000000..9b65adc
--- /dev/null
+++ b/superset-frontend/cypress-base/cypress/integration/dashboard/navigation.test.ts
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import {
+ WORLD_HEALTH_CHARTS,
+ WORLD_HEALTH_DASHBOARD,
+ VIDEO_GAME_SALES_CHARTS,
+ waitForChartLoad,
+} from './dashboard.helper';
+
+describe('Dashboard SPA navigation', () => {
+ before(() => {
+ cy.login();
+ });
+
+ it('navigates to a dashboard, then to the list page, then another dashboard', () => {
+ cy.visit(WORLD_HEALTH_DASHBOARD);
+ cy.contains('[data-test="dashboard-header"]', "World Bank's Data");
+ WORLD_HEALTH_CHARTS.forEach(waitForChartLoad);
+ // go to the dashboard list
+ cy.contains('.navbar a', 'Dashboards').click();
+ cy.get('[data-test="search-input"]')
+ .click()
+ .type(`Video Game Sales{enter}`);
+ // loading search results can unmount the targeted element,
+ // screwing up the click, so switch to card view
+ cy.get('[data-test="card-view"]').click();
+ // go to video games dashboard
+ cy.contains('a', 'Video Game Sales').click();
+ cy.contains('[data-test="dashboard-header"]', 'Video Game Sales');
+ VIDEO_GAME_SALES_CHARTS.forEach(waitForChartLoad);
+ });
+});
diff --git a/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx b/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx
index bc1f78f..6d6f336 100644
--- a/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx
+++ b/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx
@@ -297,7 +297,7 @@ export default class Chart extends React.Component {
data-test="chart-grid-component"
data-test-chart-id={id}
data-test-viz-type={slice.viz_type}
- data-test-chart-name={slice.slice_name}
+ data-test-chart-name={sliceName}
>
<SliceHeader
innerRef={this.setHeaderRef}