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/24 13:29:02 UTC

[superset] branch fix/cypress-parallelization created (now d22465d097)

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

diegopucci pushed a change to branch fix/cypress-parallelization
in repository https://gitbox.apache.org/repos/asf/superset.git


      at d22465d097 Ensure data cleanup

This branch includes the following new commits:

     new d22465d097 Ensure data cleanup

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: Ensure data cleanup

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

diegopucci pushed a commit to branch fix/cypress-parallelization
in repository https://gitbox.apache.org/repos/asf/superset.git

commit d22465d097c26a7329958fd56eb5051a7d02d8e8
Author: geido <di...@gmail.com>
AuthorDate: Mon Oct 24 16:28:44 2022 +0300

    Ensure data cleanup
---
 .../cypress/integration/chart_list/list.test.ts       |  5 +----
 .../cypress/integration/dashboard/editmode.test.ts    | 13 ++++++-------
 .../integration/dashboard/nativeFilters.test.ts       | 15 ++++++++-------
 .../cypress/integration/explore/chart.test.js         |  7 ++-----
 .../cypress-base/cypress/support/index.ts             | 19 ++++++++++++-------
 5 files changed, 29 insertions(+), 30 deletions(-)

diff --git a/superset-frontend/cypress-base/cypress/integration/chart_list/list.test.ts b/superset-frontend/cypress-base/cypress/integration/chart_list/list.test.ts
index 9891b09be7..faaf00ddf5 100644
--- a/superset-frontend/cypress-base/cypress/integration/chart_list/list.test.ts
+++ b/superset-frontend/cypress-base/cypress/integration/chart_list/list.test.ts
@@ -60,12 +60,9 @@ describe('Charts list', () => {
 
   describe('Cross-referenced dashboards', () => {
     beforeEach(() => {
-      visitChartList();
-    });
-
-    before(() => {
       cy.createSampleDashboards([0, 1, 2, 3]);
       cy.createSampleCharts([0]);
+      visitChartList();
     });
 
     it('should show the cross-referenced dashboards in the table cell', () => {
diff --git a/superset-frontend/cypress-base/cypress/integration/dashboard/editmode.test.ts b/superset-frontend/cypress-base/cypress/integration/dashboard/editmode.test.ts
index 6ed1ec4ee0..9f05f2fc29 100644
--- a/superset-frontend/cypress-base/cypress/integration/dashboard/editmode.test.ts
+++ b/superset-frontend/cypress-base/cypress/integration/dashboard/editmode.test.ts
@@ -75,6 +75,10 @@ function visitEdit(sampleDashboard = SAMPLE_DASHBOARD_1) {
   interceptCharts();
   interceptGet();
 
+  if (sampleDashboard === SAMPLE_DASHBOARD_1) {
+    cy.createSampleDashboards([0]);
+  }
+
   cy.visit(sampleDashboard);
   cy.wait('@get');
   editDashboard();
@@ -648,11 +652,11 @@ describe('Dashboard edit', () => {
 
   describe('Edit properties', () => {
     before(() => {
-      cy.createSampleDashboards([0]);
       visitEdit();
     });
 
     beforeEach(() => {
+      cy.createSampleDashboards([0]);
       openProperties();
     });
 
@@ -700,11 +704,11 @@ describe('Dashboard edit', () => {
 
   describe('Edit mode', () => {
     before(() => {
-      cy.createSampleDashboards([0]);
       visitEdit();
     });
 
     beforeEach(() => {
+      cy.createSampleDashboards([0]);
       discardChanges();
     });
 
@@ -736,10 +740,6 @@ describe('Dashboard edit', () => {
   });
 
   describe('Components', () => {
-    before(() => {
-      cy.createSampleDashboards([0]);
-    });
-
     beforeEach(() => {
       visitEdit();
     });
@@ -787,7 +787,6 @@ describe('Dashboard edit', () => {
 
   describe('Save', () => {
     beforeEach(() => {
-      cy.createSampleDashboards();
       visitEdit();
     });
 
diff --git a/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts b/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts
index 3f643cc32e..3a86900035 100644
--- a/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts
+++ b/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts
@@ -55,11 +55,15 @@ import {
 
 const SAMPLE_CHART = { name: 'Most Populated Countries', viz: 'table' };
 
-function visitDashboard() {
+function visitDashboard(createSample = true) {
   interceptCharts();
   interceptGet();
   interceptDatasets();
 
+  if (createSample) {
+    cy.createSampleDashboards([0]);
+  }
+
   cy.visit(SAMPLE_DASHBOARD_1);
   cy.wait('@get');
   cy.wait('@getCharts');
@@ -70,6 +74,7 @@ function visitDashboard() {
 function prepareDashboardFilters(
   filters: { name: string; column: string; datasetId: number }[],
 ) {
+  cy.createSampleDashboards([0]);
   cy.request({
     method: 'GET',
     url: `api/v1/dashboard/1-sample-dashboard`,
@@ -169,7 +174,7 @@ function prepareDashboardFilters(
             json_metadata: JSON.stringify(jsonMetadata),
           },
         })
-        .then(() => visitDashboard());
+        .then(() => visitDashboard(false));
     }
     return cy;
   });
@@ -379,11 +384,11 @@ describe('Native filters', () => {
 
   describe('Nativefilters basic interactions', () => {
     before(() => {
-      cy.createSampleDashboards([0]);
       visitDashboard();
     });
 
     beforeEach(() => {
+      cy.createSampleDashboards([0]);
       closeFilterModal();
     });
 
@@ -436,10 +441,6 @@ describe('Native filters', () => {
   });
 
   describe('Nativefilters initial state not required', () => {
-    beforeEach(() => {
-      cy.createSampleDashboards([0]);
-    });
-
     it("User can check 'Filter has default value'", () => {
       prepareDashboardFilters([
         { name: 'country_name', column: 'country_name', datasetId: 2 },
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 0dfc9bd46b..c89b1b22e0 100644
--- a/superset-frontend/cypress-base/cypress/integration/explore/chart.test.js
+++ b/superset-frontend/cypress-base/cypress/integration/explore/chart.test.js
@@ -91,13 +91,10 @@ describe('Cross-referenced dashboards', () => {
     interceptFiltering();
 
     cy.preserveLogin();
-    cy.visit(CHART_LIST);
-    cy.wait('@filtering');
-  });
-
-  before(() => {
     cy.createSampleDashboards(SAMPLE_DASHBOARDS_INDEXES);
     cy.createSampleCharts([0]);
+    cy.visit(CHART_LIST);
+    cy.wait('@filtering');
   });
 
   it('should show the cross-referenced dashboards', () => {
diff --git a/superset-frontend/cypress-base/cypress/support/index.ts b/superset-frontend/cypress-base/cypress/support/index.ts
index aa2b168e2d..9d9b764e56 100644
--- a/superset-frontend/cypress-base/cypress/support/index.ts
+++ b/superset-frontend/cypress-base/cypress/support/index.ts
@@ -42,11 +42,15 @@ before(() => {
   cy.login();
   cy.loadChartFixtures();
   cy.loadDashboardFixtures();
+});
+
+beforeEach(() => {
   cy.cleanDashboards();
   cy.cleanCharts();
 });
 
-Cypress.Commands.add('cleanDashboards', () =>
+Cypress.Commands.add('cleanDashboards', () => {
+  cy.login();
   cy.getDashboards().then((sampleDashboards?: Record<string, any>[]) => {
     const deletableDashboards = [];
     for (let i = 0; i < DASHBOARD_FIXTURES.length; i += 1) {
@@ -74,10 +78,11 @@ Cypress.Commands.add('cleanDashboards', () =>
         },
       }).then(resp => resp);
     }
-  }),
-);
+  });
+});
 
-Cypress.Commands.add('cleanCharts', () =>
+Cypress.Commands.add('cleanCharts', () => {
+  cy.login();
   cy.getCharts().then((sampleCharts?: Record<string, any>[]) => {
     const deletableCharts = [];
     for (let i = 0; i < CHART_FIXTURES.length; i += 1) {
@@ -89,7 +94,7 @@ Cypress.Commands.add('cleanCharts', () =>
         deletableCharts.push(isInDb.id);
       }
     }
-    if (deletableCharts) {
+    if (deletableCharts.length) {
       cy.request({
         failOnStatusCode: false,
         method: 'DELETE',
@@ -105,8 +110,8 @@ Cypress.Commands.add('cleanCharts', () =>
         },
       }).then(resp => resp);
     }
-  }),
-);
+  });
+});
 
 Cypress.Commands.add('getBySel', (selector, ...args) =>
   cy.get(`[data-test=${selector}]`, ...args),