You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by di...@apache.org on 2022/10/11 14:33:35 UTC

[superset] branch chore/e2e-d2d created (now a2c981fe4c)

This is an automated email from the ASF dual-hosted git repository.

diegopucci pushed a change to branch chore/e2e-d2d
in repository https://gitbox.apache.org/repos/asf/superset.git


      at a2c981fe4c Initial test structure Explore

This branch includes the following new commits:

     new a2c981fe4c Initial test structure Explore

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[superset] 01/01: Initial test structure Explore

Posted by di...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

diegopucci pushed a commit to branch chore/e2e-d2d
in repository https://gitbox.apache.org/repos/asf/superset.git

commit a2c981fe4c8690f84ce8b800692da1c5a44bb3a1
Author: geido <di...@gmail.com>
AuthorDate: Tue Oct 11 17:33:13 2022 +0300

    Initial test structure Explore
---
 .../cypress-base/cypress/fixtures/charts.json      |  5 +++--
 .../cypress/integration/explore/chart.test.js      | 26 ++++++++++++++++++++++
 .../cypress-base/cypress/support/index.ts          |  2 +-
 .../src/components/MetadataBar/MetadataBar.tsx     |  2 +-
 4 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/superset-frontend/cypress-base/cypress/fixtures/charts.json b/superset-frontend/cypress-base/cypress/fixtures/charts.json
index 6b342ee9a5..600e081024 100644
--- a/superset-frontend/cypress-base/cypress/fixtures/charts.json
+++ b/superset-frontend/cypress-base/cypress/fixtures/charts.json
@@ -32,7 +32,8 @@
     "owners": [1],
     "viz_type": "line",
     "cache_timeout": 1000,
-    "datasource_id": 1,
-    "datasource_type": "table"
+    "datasource_id": 2,
+    "datasource_type": "table",
+    "params": "{\"viz_type\":\"line\",\"metrics\":[\"count\"]}"
   }
 ]
diff --git a/superset-frontend/cypress-base/cypress/integration/explore/chart.test.js b/superset-frontend/cypress-base/cypress/integration/explore/chart.test.js
index ca37bf9690..ac3f3ddcb0 100644
--- a/superset-frontend/cypress-base/cypress/integration/explore/chart.test.js
+++ b/superset-frontend/cypress-base/cypress/integration/explore/chart.test.js
@@ -17,6 +17,32 @@
  * under the License.
  */
 import { FORM_DATA_DEFAULTS, NUM_METRIC } from './visualizations/shared.helper';
+import { CHART_LIST } from 'cypress/utils/urls';
+import {interceptFiltering} from './utils';
+
+function visitSampleChart(id) {
+  cy.getBySel('table-row').first().contains(`${id} - Sample chart`).click();
+  cy.intercept('POST', '/superset/explore_json/**').as('getJson');
+}
+
+describe('Cross-referenced dashboards', () => {
+  beforeEach(() => {
+    interceptFiltering();
+
+    cy.preserveLogin();
+    cy.visit(CHART_LIST);
+    cy.wait("@filtering");
+  });
+
+  before(() => {
+    cy.createSampleCharts();
+  });
+
+  it('Shows the "Added to {x} dashboard(s)', () => {
+    visitSampleChart(4);
+    cy.getBySel("metadata-bar").contains("Not added to any dashboard");
+  });
+});
 
 describe('No Results', () => {
   beforeEach(() => {
diff --git a/superset-frontend/cypress-base/cypress/support/index.ts b/superset-frontend/cypress-base/cypress/support/index.ts
index 80a51fc409..6dd009f76a 100644
--- a/superset-frontend/cypress-base/cypress/support/index.ts
+++ b/superset-frontend/cypress-base/cypress/support/index.ts
@@ -269,7 +269,7 @@ Cypress.Commands.add('createSampleCharts', (indexes?: number[]) =>
           method: 'POST',
           url: `/api/v1/chart/`,
           body: CHART_FIXTURES[i],
-          failOnStatusCode: false,
+          failOnStatusCode: true,
           headers: {
             Cookie: `csrf_access_token=${window.localStorage.getItem(
               'access_token',
diff --git a/superset-frontend/src/components/MetadataBar/MetadataBar.tsx b/superset-frontend/src/components/MetadataBar/MetadataBar.tsx
index 57733b7160..3756722523 100644
--- a/superset-frontend/src/components/MetadataBar/MetadataBar.tsx
+++ b/superset-frontend/src/components/MetadataBar/MetadataBar.tsx
@@ -203,7 +203,7 @@ const MetadataBar = ({ items }: MetadataBarProps) => {
   const { ref } = useResizeDetector({ onResize });
 
   return (
-    <Bar ref={ref} count={count}>
+    <Bar ref={ref} count={count} data-test="metadata-bar">
       {sortedItems.map((item, index) => (
         <Item
           barWidth={width}