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

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

commit 106c917f7bbf4897622f527e80c1f8085179c15b
Author: geido <[email protected]>
AuthorDate: Mon Sep 5 16:12:05 2022 +0300

    Clean up
---
 .../{controls.test.ts => _skip.controls.test.ts}   |   6 +-
 .../{filter.test.ts => _skip.filter.test.ts}       |   4 +-
 .../{key_value.test.ts => _skip.key_value.test.ts} |   2 +-
 ...url_params.test.ts => _skip.url_params.test.ts} |   4 +-
 .../integration/dashboard/dashboard.helper.ts      |   9 +-
 .../integration/dashboard/drilltodetail.test.ts    | 185 +++++++++++----------
 .../{editsave.test.ts => editmode.test.ts}         |   0
 .../cypress/integration/dashboard/utils.ts         |   8 +
 .../cypress-base/cypress/utils/urls.ts             |   3 +-
 .../src/components/Chart/DrillDetailModal.tsx      |   2 +-
 .../components/SliceHeaderControls/index.tsx       |   1 +
 11 files changed, 122 insertions(+), 102 deletions(-)

diff --git 
a/superset-frontend/cypress-base/cypress/integration/dashboard/controls.test.ts 
b/superset-frontend/cypress-base/cypress/integration/dashboard/_skip.controls.test.ts
similarity index 95%
rename from 
superset-frontend/cypress-base/cypress/integration/dashboard/controls.test.ts
rename to 
superset-frontend/cypress-base/cypress/integration/dashboard/_skip.controls.test.ts
index 3c772fdca9..1fa60c7f69 100644
--- 
a/superset-frontend/cypress-base/cypress/integration/dashboard/controls.test.ts
+++ 
b/superset-frontend/cypress-base/cypress/integration/dashboard/_skip.controls.test.ts
@@ -25,14 +25,14 @@ import { WORLD_HEALTH_CHARTS } from './utils';
 import { WORLD_HEALTH_DASHBOARD } from 'cypress/utils/urls';
 import { isLegacyResponse } from '../../utils/vizPlugins';
 
-describe('Dashboard top-level controls', () => {
+describe.skip('Dashboard top-level controls', () => {
   beforeEach(() => {
     cy.login();
     cy.visit(WORLD_HEALTH_DASHBOARD);
   });
 
   // flaky test
-  xit('should allow chart level refresh', () => {
+  it('should allow chart level refresh', () => {
     const mapSpec = WORLD_HEALTH_CHARTS.find(
       ({ viz }) => viz === 'world_map',
     ) as ChartSpec;
@@ -58,7 +58,7 @@ describe('Dashboard top-level controls', () => {
     });
   });
 
-  xit('should allow dashboard level force refresh', () => {
+  it('should allow dashboard level force refresh', () => {
     // when charts are not start loading, for example, under a secondary tab,
     // should allow force refresh
     WORLD_HEALTH_CHARTS.forEach(waitForChartLoad);
diff --git 
a/superset-frontend/cypress-base/cypress/integration/dashboard/filter.test.ts 
b/superset-frontend/cypress-base/cypress/integration/dashboard/_skip.filter.test.ts
similarity index 97%
rename from 
superset-frontend/cypress-base/cypress/integration/dashboard/filter.test.ts
rename to 
superset-frontend/cypress-base/cypress/integration/dashboard/_skip.filter.test.ts
index 389c181cba..25ed5a02a7 100644
--- 
a/superset-frontend/cypress-base/cypress/integration/dashboard/filter.test.ts
+++ 
b/superset-frontend/cypress-base/cypress/integration/dashboard/_skip.filter.test.ts
@@ -24,13 +24,13 @@ import {
 import {WORLD_HEALTH_CHARTS } from './utils';
 import { WORLD_HEALTH_DASHBOARD } from 'cypress/utils/urls';
 
-describe('Dashboard filter', () => {
+describe.skip('Dashboard filter', () => {
   before(() => {
     cy.login();
     cy.visit(WORLD_HEALTH_DASHBOARD);
   });
 
-  xit('should apply filter', () => {
+  it('should apply filter', () => {
     WORLD_HEALTH_CHARTS.forEach(waitForChartLoad);
     getChartAliasesBySpec(
       WORLD_HEALTH_CHARTS.filter(({ viz }) => viz !== 'filter_box'),
diff --git 
a/superset-frontend/cypress-base/cypress/integration/dashboard/key_value.test.ts
 
b/superset-frontend/cypress-base/cypress/integration/dashboard/_skip.key_value.test.ts
similarity index 97%
rename from 
superset-frontend/cypress-base/cypress/integration/dashboard/key_value.test.ts
rename to 
superset-frontend/cypress-base/cypress/integration/dashboard/_skip.key_value.test.ts
index 42ac6cf7c7..3b2b9ea2d4 100644
--- 
a/superset-frontend/cypress-base/cypress/integration/dashboard/key_value.test.ts
+++ 
b/superset-frontend/cypress-base/cypress/integration/dashboard/_skip.key_value.test.ts
@@ -27,7 +27,7 @@ interface QueryString {
   native_filters_key: string;
 }
 
-xdescribe('nativefilter url param key', () => {
+describe.skip('nativefilter url param key', () => {
   // const urlParams = { param1: '123', param2: 'abc' };
   before(() => {
     cy.login();
diff --git 
a/superset-frontend/cypress-base/cypress/integration/dashboard/url_params.test.ts
 
b/superset-frontend/cypress-base/cypress/integration/dashboard/_skip.url_params.test.ts
similarity index 94%
rename from 
superset-frontend/cypress-base/cypress/integration/dashboard/url_params.test.ts
rename to 
superset-frontend/cypress-base/cypress/integration/dashboard/_skip.url_params.test.ts
index c5b4c6655f..b0fdff057a 100644
--- 
a/superset-frontend/cypress-base/cypress/integration/dashboard/url_params.test.ts
+++ 
b/superset-frontend/cypress-base/cypress/integration/dashboard/_skip.url_params.test.ts
@@ -24,7 +24,7 @@ import {
 import { WORLD_HEALTH_CHARTS } from './utils';
 import { WORLD_HEALTH_DASHBOARD } from 'cypress/utils/urls';
 
-describe('Dashboard form data', () => {
+describe.skip('Dashboard form data', () => {
   const urlParams = { param1: '123', param2: 'abc' };
   before(() => {
     cy.login();
@@ -32,7 +32,7 @@ describe('Dashboard form data', () => {
     cy.visit(WORLD_HEALTH_DASHBOARD, { qs: urlParams });
   });
 
-  xit('should apply url params to slice requests', () => {
+  it('should apply url params to slice requests', () => {
     cy.intercept('/api/v1/chart/data?*', request => {
       // TODO: export url params to chart data API
       request.body.queries.forEach((query: { url_params: JsonObject }) => {
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 9868eb5b5e..e4395ee4cf 100644
--- 
a/superset-frontend/cypress-base/cypress/integration/dashboard/dashboard.helper.ts
+++ 
b/superset-frontend/cypress-base/cypress/integration/dashboard/dashboard.helper.ts
@@ -21,7 +21,6 @@ import { dashboardView } from 'cypress/support/directories';
 export const USA_BIRTH_NAMES_DASHBOARD = '/superset/dashboard/births/';
 export const testDashboard = '/superset/dashboard/538/';
 export const TABBED_DASHBOARD = '/superset/dashboard/tabbed_dash/';
-export const ECHARTS_DASHBOARD = '/superset/dashboard/echarts_dash/';
 
 export const testItems = {
   dashboard: 'Cypress test Dashboard',
@@ -59,13 +58,7 @@ export const testItems = {
 export const CHECK_DASHBOARD_FAVORITE_ENDPOINT =
   '/superset/favstar/Dashboard/*/count';
 
-export const ECHARTS_CHARTS = [
-  { name: 'Number of Girls', viz: 'big_number_total' },
-  { name: 'Participants', viz: 'big_number' },
-  { name: 'Box plot', viz: 'box_plot' },
-  { name: 'Genders', viz: 'pie' },
-  { name: 'Energy Force Layout', viz: 'graph_chart' },
-] as const;
+
 
 export function resize(selector: string) {
   return {
diff --git 
a/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts
 
b/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts
index b3dc40bc35..d57add1531 100644
--- 
a/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts
+++ 
b/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts
@@ -18,9 +18,11 @@
  */
 import {
   waitForChartLoad,
+} from 'cypress/utils';
+import {
   ECHARTS_CHARTS,
-  ECHARTS_DASHBOARD,
-} from './dashboard.helper';
+} from './utils';
+import {ECHARTS_DASHBOARD} from 'cypress/utils/urls';
 
 function interceptSamples() {
   cy.intercept(`/datasource/samples*`).as('samples');
@@ -52,110 +54,125 @@ function openModalFromChartContext(targetMenuItem: 
string) {
   cy.wait('@samples');
 }
 
+function closeModal() {
+  cy.get('body').then($body => {
+    if ($body.find('[data-test="close-drilltodetail-modal"]').length) {
+      cy.getBySel('close-drilltodetail-modal').click({ force: true });
+    }
+  });
+}
+
 describe('Drill to detail modal', () => {
-  beforeEach(() => {
-    cy.login();
+  before(() => {
     cy.visit(ECHARTS_DASHBOARD);
     ECHARTS_CHARTS.forEach(waitForChartLoad);
   });
 
-  it('opens the modal from the context menu', () => {
-    openModalFromMenu('big_number_total');
-
-    cy.get("[role='dialog'] .draggable-trigger").should(
-      'contain',
-      'Drill to detail: Number of Girls',
-    );
-  });
-
-  it('refreshes the data', () => {
-    openModalFromMenu('big_number_total');
-    // move to the last page
-    cy.get(".pagination-container [role='navigation'] [role='button']")
-      .eq(7)
-      .click();
-    cy.wait('@samples');
-    // reload
-    cy.get("[aria-label='reload']").click();
-    cy.wait('@samples');
-    // make sure it started back from first page
-    cy.get(".pagination-container [role='navigation'] li.active").should(
-      'contain',
-      '1',
-    );
-  });
-
-  it('paginates', () => {
-    openModalFromMenu('big_number_total');
-    // checking the data
-    cy.get("[data-test='row-count-label']").should('contain', '36.4k rows');
-    cy.get("[role='rowgroup'] [role='row']")
-      .should('have.length', 50)
-      .then($rows => {
-        expect($rows).to.contain('Amy');
-      });
-    // checking the paginated data
-    cy.get(".pagination-container [role='navigation'] [role='button']")
-      .should('have.length', 9)
-      .then($pages => {
-        expect($pages).to.contain('1');
-        expect($pages).to.contain('729');
-      });
-    cy.get(".pagination-container [role='navigation'] [role='button']")
-      .eq(7)
-      .click();
-    cy.wait('@samples');
-    cy.get("[role='rowgroup'] [role='row']")
-      .should('have.length', 46)
-      .then($rows => {
-        expect($rows).to.contain('Victoria');
-      });
+  beforeEach(() => {
+    cy.preserveLogin();
+    closeModal();
   });
 
-  it('clears filters', () => {
-    interceptSamples();
-
-    // opens the modal by clicking on the box on the chart
-    cy.get("[data-test-viz-type='box_plot'] canvas").then($canvas => {
-      const canvasWidth = $canvas.width() || 0;
-      const canvasHeight = $canvas.height() || 0;
-      const canvasCenterX = canvasWidth / 6;
-      const canvasCenterY = canvasHeight / 6;
+  describe('Modal actions', () => {
+    it('opens the modal from the context menu', () => {
+      openModalFromMenu('big_number_total');
 
-      cy.wrap($canvas)
-        .scrollIntoView()
-        .rightclick(canvasCenterX, canvasCenterY, { force: true });
-
-      openModalFromChartContext('Drill to detail by East Asia & Pacific');
-
-      // checking the filter
-      cy.get("[data-test='filter-val']").should(
+      cy.get("[role='dialog'] .draggable-trigger").should(
         'contain',
-        'East Asia & Pacific',
+        'Drill to detail: Number of Girls',
       );
-      cy.get("[data-test='row-count-label']").should('contain', '1.98k rows');
-      cy.get(".pagination-container [role='navigation'] [role='button']")
-        .should('have.length', 9)
-        .then($pages => {
-          expect($pages).to.contain('1');
-          expect($pages).to.contain('40');
-        });
+    });
 
-      // close the filter and test that data was reloaded
-      cy.get("[data-test='filter-col']").find("[aria-label='close']").click();
+    it('refreshes the data', () => {
+      openModalFromMenu('big_number_total');
+      // move to the last page
+      cy.get(".pagination-container [role='navigation'] [role='button']")
+        .eq(7)
+        .click();
+      cy.wait('@samples');
+      // reload
+      cy.get("[aria-label='reload']").click();
       cy.wait('@samples');
-      cy.get("[data-test='row-count-label']").should('contain', '11.8k rows');
+      // make sure it started back from first page
       cy.get(".pagination-container [role='navigation'] li.active").should(
         'contain',
         '1',
       );
+    });
+
+    it('paginates', () => {
+      openModalFromMenu('big_number_total');
+      // checking the data
+      cy.get("[data-test='row-count-label']").should('contain', '36.4k rows');
+      cy.get("[role='rowgroup'] [role='row']")
+        .should('have.length', 50)
+        .then($rows => {
+          expect($rows).to.contain('Amy');
+        });
+      // checking the paginated data
       cy.get(".pagination-container [role='navigation'] [role='button']")
         .should('have.length', 9)
         .then($pages => {
           expect($pages).to.contain('1');
-          expect($pages).to.contain('236');
+          expect($pages).to.contain('729');
+        });
+      cy.get(".pagination-container [role='navigation'] [role='button']")
+        .eq(7)
+        .click();
+      cy.wait('@samples');
+      cy.get("[role='rowgroup'] [role='row']")
+        .should('have.length', 46)
+        .then($rows => {
+          expect($rows).to.contain('Victoria');
         });
     });
+
+    it('clears filters', () => {
+      interceptSamples();
+
+      // opens the modal by clicking on the box on the chart
+      cy.get("[data-test-viz-type='box_plot'] canvas").then($canvas => {
+        const canvasWidth = $canvas.width() || 0;
+        const canvasHeight = $canvas.height() || 0;
+        const canvasCenterX = canvasWidth / 6;
+        const canvasCenterY = canvasHeight / 6;
+
+        cy.wrap($canvas)
+          .scrollIntoView()
+          .rightclick(canvasCenterX, canvasCenterY, { force: true });
+
+        openModalFromChartContext('Drill to detail by East Asia & Pacific');
+
+        // checking the filter
+        cy.get("[data-test='filter-val']").should(
+          'contain',
+          'East Asia & Pacific',
+        );
+        cy.get("[data-test='row-count-label']").should('contain', '1.98k 
rows');
+        cy.get(".pagination-container [role='navigation'] [role='button']")
+          .should('have.length', 9)
+          .then($pages => {
+            expect($pages).to.contain('1');
+            expect($pages).to.contain('40');
+          });
+
+        // close the filter and test that data was reloaded
+        
cy.get("[data-test='filter-col']").find("[aria-label='close']").click();
+        cy.wait('@samples');
+        cy.get("[data-test='row-count-label']").should('contain', '11.8k 
rows');
+        cy.get(".pagination-container [role='navigation'] li.active").should(
+          'contain',
+          '1',
+        );
+        cy.get(".pagination-container [role='navigation'] [role='button']")
+          .should('have.length', 9)
+          .then($pages => {
+            expect($pages).to.contain('1');
+            expect($pages).to.contain('236');
+          });
+      });
+    });
+
   });
 
   describe('Time-series Bar Chart V2', () => {
diff --git 
a/superset-frontend/cypress-base/cypress/integration/dashboard/editsave.test.ts 
b/superset-frontend/cypress-base/cypress/integration/dashboard/editmode.test.ts
similarity index 100%
rename from 
superset-frontend/cypress-base/cypress/integration/dashboard/editsave.test.ts
rename to 
superset-frontend/cypress-base/cypress/integration/dashboard/editmode.test.ts
diff --git 
a/superset-frontend/cypress-base/cypress/integration/dashboard/utils.ts 
b/superset-frontend/cypress-base/cypress/integration/dashboard/utils.ts
index 072a190314..6e562f5a7e 100644
--- a/superset-frontend/cypress-base/cypress/integration/dashboard/utils.ts
+++ b/superset-frontend/cypress-base/cypress/integration/dashboard/utils.ts
@@ -30,6 +30,14 @@
     { name: 'Box plot', viz: 'box_plot' },
   ] as const;
 
+  export const ECHARTS_CHARTS = [
+    { name: 'Number of Girls', viz: 'big_number_total' },
+    { name: 'Participants', viz: 'big_number' },
+    { name: 'Box plot', viz: 'box_plot' },
+    { name: 'Genders', viz: 'pie' },
+    { name: 'Energy Force Layout', viz: 'graph_chart' },
+  ] as const;
+
 export function interceptGet() {
 cy.intercept('/api/v1/dashboard/*').as('get');
 }
diff --git a/superset-frontend/cypress-base/cypress/utils/urls.ts 
b/superset-frontend/cypress-base/cypress/utils/urls.ts
index 40eb51a170..beed748e44 100644
--- a/superset-frontend/cypress-base/cypress/utils/urls.ts
+++ b/superset-frontend/cypress-base/cypress/utils/urls.ts
@@ -20,4 +20,5 @@
 export const DASHBOARD_LIST = '/dashboard/list/';
 export const CHART_LIST = '/chart/list/';
 export const WORLD_HEALTH_DASHBOARD = '/superset/dashboard/world_health/';
-export const SAMPLE_DASHBOARD_1 = '/superset/dashboard/1-sample-dashboard/';
\ No newline at end of file
+export const SAMPLE_DASHBOARD_1 = '/superset/dashboard/1-sample-dashboard/';
+export const ECHARTS_DASHBOARD = '/superset/dashboard/echarts_dash/';
\ No newline at end of file
diff --git a/superset-frontend/src/components/Chart/DrillDetailModal.tsx 
b/superset-frontend/src/components/Chart/DrillDetailModal.tsx
index 128359741b..365fe3abc2 100644
--- a/superset-frontend/src/components/Chart/DrillDetailModal.tsx
+++ b/superset-frontend/src/components/Chart/DrillDetailModal.tsx
@@ -91,7 +91,7 @@ const DrillDetailModal: React.FC<{
           >
             {t('Edit chart')}
           </Button>
-          <Button buttonStyle="primary" buttonSize="small" 
onClick={closeModal}>
+          <Button data-test="close-drilltodetail-modal" buttonStyle="primary" 
buttonSize="small" onClick={closeModal}>
             {t('Close')}
           </Button>
         </>
diff --git 
a/superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx 
b/superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx
index ee99767b31..057421a9fb 100644
--- a/superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx
+++ b/superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx
@@ -205,6 +205,7 @@ const DashboardChartModalTrigger = ({
                 {t('Edit chart')}
               </Button>
               <Button
+                data-test="close-drilltodetail-modal"
                 buttonStyle="primary"
                 buttonSize="small"
                 onClick={closeModal}

Reply via email to