From afbd997d8810ec42fe1d375368e3c11b8a50cdeb Mon Sep 17 00:00:00 2001 From: geido Date: Fri, 30 Sep 2022 17:05:39 +0300 Subject: [PATCH 1/8] Add tests Tier1 and Tier2 --- .../dashboard/drilltodetail.test.ts | 608 ++++++++++++++++-- 1 file changed, 552 insertions(+), 56 deletions(-) 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 d44f6a27e4a13..4d83f854f60fc 100644 --- a/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts @@ -42,10 +42,13 @@ function openModalFromMenu(chartType: string) { function openModalFromChartContext(targetMenuItem: string) { interceptSamples(); + cy.wait(500); cy.get('.ant-dropdown') .not('.ant-dropdown-hidden') + .first() .find("[role='menu'] [role='menuitem']") - .should('contain', targetMenuItem) + .contains(targetMenuItem) + .first() .click(); cy.wait('@samples'); } @@ -130,90 +133,322 @@ describe('Drill to detail modal', () => { }); }); + describe('Big number total', () => { + it('opens the modal with no filters', () => { + interceptSamples(); + + // opens the modal by clicking on the number on the chart + cy.get("[data-test-viz-type='big_number_total'] .header-line") + .scrollIntoView() + .rightclick(); + + openModalFromChartContext('Drill to detail'); + + cy.getBySel('filter-val').should('not.exist'); + }); + }); + + describe('Big number with trendline', () => { + it('opens the modal with the correct data', () => { + interceptSamples(); + + // opens the modal by clicking on the number + cy.get("[data-test-viz-type='big_number'] .header-line") + .scrollIntoView() + .rightclick(); + + openModalFromChartContext('Drill to detail'); + + cy.getBySel('filter-val').should('not.exist'); + + closeModal(); + + // opens the modal by clicking on the trendline + cy.get("[data-test-viz-type='big_number'] canvas").then($canvas => { + cy.wrap($canvas).scrollIntoView().click(1, 18).rightclick(1, 18); + + openModalFromChartContext('Drill to detail by 1965-01-01'); + + // checking the filter + cy.getBySel('filter-val').should('contain', '1965-01-01'); + }); + }); + }); + + describe('Table', () => { + it('opens the modal with the correct filters', () => { + interceptSamples(); + + cy.get("[data-test-viz-type='table']") + .scrollIntoView() + .contains('boy') + .rightclick(); + + openModalFromChartContext('Drill to detail by boy'); + + cy.getBySel('filter-val').should('contain', 'boy'); + + closeModal(); + + cy.get("[data-test-viz-type='table']") + .scrollIntoView() + .contains('girl') + .rightclick(); + + openModalFromChartContext('Drill to detail by girl'); + + cy.getBySel('filter-val').should('contain', 'girl'); + }); + }); + + describe('Pivot Table V2', () => { + it('opens the modal with the correct filters', () => { + interceptSamples(); + + cy.get("[data-test-viz-type='pivot_table_v2']") + .scrollIntoView() + .find('[role="gridcell"]') + .first() + .rightclick(); + + openModalFromChartContext('Drill to detail by boy'); + + cy.getBySel('filter-val').should('contain', 'boy'); + closeModal(); + + cy.get("[data-test-viz-type='pivot_table_v2']") + .scrollIntoView() + .find('[role="gridcell"]') + .first() + .rightclick(); + + openModalFromChartContext('Drill to detail by CA'); + + cy.getBySel('filter-val').should('contain', 'CA'); + closeModal(); + + cy.get("[data-test-viz-type='pivot_table_v2']") + .scrollIntoView() + .find('[role="gridcell"]') + .eq(3) + .rightclick(); + + openModalFromChartContext('Drill to detail by girl'); + + cy.getBySel('filter-val').should('contain', 'girl'); + closeModal(); + + cy.get("[data-test-viz-type='pivot_table_v2']") + .scrollIntoView() + .find('[role="gridcell"]') + .eq(3) + .rightclick(); + + openModalFromChartContext('Drill to detail by FL'); + + cy.getBySel('filter-val').should('contain', 'FL'); + closeModal(); + + cy.get("[data-test-viz-type='pivot_table_v2']") + .scrollIntoView() + .find('[role="gridcell"]') + .eq(3) + .rightclick(); + + openModalFromChartContext('Drill to detail by all'); + + cy.getBySel('filter-val').first().should('contain', 'girl'); + cy.getBySel('filter-val').eq(1).should('contain', 'FL'); + }); + }); + + describe('Time-Series Line Chart', () => { + it('opens the modal with the correct filters', () => { + interceptSamples(); + + cy.get("[data-test-viz-type='echarts_timeseries_line'] canvas").then( + $canvas => { + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by 1965'); + cy.getBySel('filter-val').should('contain', '1965'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by boy'); + cy.getBySel('filter-val').should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by all'); + cy.getBySel('filter-val').first().should('contain', '1965'); + cy.getBySel('filter-val').eq(1).should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas) + .scrollIntoView() + .click(70, 145) + .rightclick(70, 145); + openModalFromChartContext('Drill to detail by girl'); + cy.getBySel('filter-val').should('contain', 'girl'); + closeModal(); + + cy.wrap($canvas) + .scrollIntoView() + .click(70, 145) + .rightclick(70, 145); + openModalFromChartContext('Drill to detail by all'); + cy.getBySel('filter-val').first().should('contain', '1965'); + cy.getBySel('filter-val').eq(1).should('contain', 'girl'); + }, + ); + }); + }); + describe('Time-series Bar Chart V2', () => { it('opens the modal with the correct filters', () => { interceptSamples(); cy.get("[data-test-viz-type='echarts_timeseries_bar'] canvas").then( $canvas => { + cy.wrap($canvas).scrollIntoView().rightclick(70, 100); + + openModalFromChartContext('Drill to detail by 1965'); + cy.getBySel('filter-val').should('contain', '1965'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().rightclick(70, 100); + + openModalFromChartContext('Drill to detail by boy'); + cy.getBySel('filter-val').should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().rightclick(70, 100); + + openModalFromChartContext('Drill to detail by all'); + cy.getBySel('filter-val').first().should('contain', '1965'); + cy.getBySel('filter-val').eq(1).should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().rightclick(72, 200); + + openModalFromChartContext('Drill to detail by girl'); + cy.getBySel('filter-val').should('contain', 'girl'); + closeModal(); + cy.wrap($canvas) .scrollIntoView() - .rightclick(70, 100, { force: true }); - cy.get('.ant-dropdown') - .not('.ant-dropdown-hidden') - .find("[role='menu'] [role='menuitem']") - .should('have.length', 3) - .then($menuitems => { - expect($menuitems).to.contain('Drill to detail by 1965'); - expect($menuitems).to.contain('Drill to detail by boy'); - expect($menuitems).to.contain('Drill to detail by all'); - }) - .eq(2) - .click(); - cy.wait('@samples'); - - cy.getBySel('filter-val').then($filters => { - expect($filters).to.contain('1965'); - expect($filters).to.contain('boy'); - }); + .click(70, 145) + .rightclick(70, 145); + openModalFromChartContext('Drill to detail by all'); + cy.getBySel('filter-val').first().should('contain', '1965'); + cy.getBySel('filter-val').eq(1).should('contain', 'girl'); }, ); }); }); - describe('Pie', () => { + describe('Time-Series Area Chart', () => { it('opens the modal with the correct filters', () => { interceptSamples(); - // opens the modal by clicking on the slice of the Pie chart - cy.get("[data-test-viz-type='pie'] canvas").then($canvas => { - const canvasWidth = $canvas.width() || 0; - const canvasHeight = $canvas.height() || 0; - const canvasCenterX = canvasWidth / 3; - const canvasCenterY = canvasHeight / 2; + cy.get("[data-test-viz-type='echarts_area'] canvas").then($canvas => { + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - cy.wrap($canvas) - .scrollIntoView() - .rightclick(canvasCenterX, canvasCenterY, { force: true }); + openModalFromChartContext('Drill to detail by 1965'); + cy.getBySel('filter-val').should('contain', '1965'); + closeModal(); - openModalFromChartContext('Drill to detail by girl'); + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by boy'); + cy.getBySel('filter-val').should('contain', 'boy'); + closeModal(); - // checking the filtered and paginated data + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by all'); + cy.getBySel('filter-val').first().should('contain', '1965'); + cy.getBySel('filter-val').eq(1).should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().click(70, 145).rightclick(70, 145); + openModalFromChartContext('Drill to detail by girl'); cy.getBySel('filter-val').should('contain', 'girl'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().click(70, 145).rightclick(70, 145); + openModalFromChartContext('Drill to detail by all'); + cy.getBySel('filter-val').first().should('contain', '1965'); + cy.getBySel('filter-val').eq(1).should('contain', 'girl'); }); }); }); - describe('Big number total', () => { - it('opens the modal with no filters', () => { + describe('Time-Series Scatter Chart', () => { + it('opens the modal with the correct filters', () => { interceptSamples(); - // opens the modal by clicking on the number on the chart - cy.get("[data-test-viz-type='big_number_total'] .header-line") - .scrollIntoView() - .rightclick(); + cy.get("[data-test-viz-type='echarts_timeseries_scatter'] canvas").then( + $canvas => { + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - openModalFromChartContext('Drill to detail'); + openModalFromChartContext('Drill to detail by 1965'); + cy.getBySel('filter-val').should('contain', '1965'); + closeModal(); - cy.getBySel('filter-val').should('not.exist'); + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by boy'); + cy.getBySel('filter-val').should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by all'); + cy.getBySel('filter-val').first().should('contain', '1965'); + cy.getBySel('filter-val').eq(1).should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas) + .scrollIntoView() + .click(70, 145) + .rightclick(70, 145); + openModalFromChartContext('Drill to detail by girl'); + cy.getBySel('filter-val').should('contain', 'girl'); + closeModal(); + + cy.wrap($canvas) + .scrollIntoView() + .click(70, 145) + .rightclick(70, 145); + openModalFromChartContext('Drill to detail by all'); + cy.getBySel('filter-val').first().should('contain', '1965'); + cy.getBySel('filter-val').eq(1).should('contain', 'girl'); + }, + ); }); }); - describe('Big number with trendline', () => { - it('opens the modal with the correct data', () => { + describe('Pie', () => { + it('opens the modal with the correct filters', () => { interceptSamples(); - // opens the modal by clicking on the number - cy.get("[data-test-viz-type='big_number'] .header-line") - .scrollIntoView() - .rightclick(); + // opens the modal by clicking on the slice of the Pie chart + cy.get("[data-test-viz-type='pie'] canvas").then($canvas => { + cy.wrap($canvas).scrollIntoView().rightclick(130, 150); - openModalFromChartContext('Drill to detail'); + openModalFromChartContext('Drill to detail by girl'); + cy.getBySel('filter-val').should('contain', 'girl'); + closeModal(); - cy.getBySel('filter-val').should('not.exist'); + cy.wrap($canvas).scrollIntoView().rightclick(230, 190); - // TODO: test clicking on a trendline - // Cypress is refusing to rightclick on the dot + openModalFromChartContext('Drill to detail by boy'); + cy.getBySel('filter-val').should('contain', 'boy'); + }); }); }); }); @@ -274,21 +509,282 @@ describe('Drill to detail modal', () => { it('opens the modal with the correct 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 / 3; - const canvasCenterY = (canvasHeight * 5) / 6; + cy.wrap($canvas) + .scrollIntoView() + .click(135, 275) + .rightclick(135, 275); + + openModalFromChartContext('Drill to detail by boy'); + cy.getBySel('filter-val').should('contain', 'boy'); + closeModal(); cy.wrap($canvas) .scrollIntoView() - .rightclick(canvasCenterX, canvasCenterY, { force: true }); + .click(270, 280) + .rightclick(270, 280); + + openModalFromChartContext('Drill to detail by girl'); + cy.getBySel('filter-val').should('contain', 'girl'); + }); + }); + }); + + describe('Time-Series Generic Chart', () => { + it('opens the modal with the correct filters', () => { + interceptSamples(); + + cy.get("[data-test-viz-type='echarts_timeseries'] canvas").then( + $canvas => { + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by 1965'); + cy.getBySel('filter-val').should('contain', '1965'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by boy'); + cy.getBySel('filter-val').should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by all'); + cy.getBySel('filter-val').first().should('contain', '1965'); + cy.getBySel('filter-val').eq(1).should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas) + .scrollIntoView() + .click(70, 145) + .rightclick(70, 145); + openModalFromChartContext('Drill to detail by girl'); + cy.getBySel('filter-val').should('contain', 'girl'); + + closeModal(); + + cy.wrap($canvas) + .scrollIntoView() + .click(70, 145) + .rightclick(70, 145); + openModalFromChartContext('Drill to detail by all'); + cy.getBySel('filter-val').first().should('contain', '1965'); + cy.getBySel('filter-val').eq(1).should('contain', 'girl'); + }, + ); + }); + }); + + describe('Time-Series Smooth Chart', () => { + it('opens the modal with the correct filters', () => { + interceptSamples(); + + cy.get("[data-test-viz-type='echarts_timeseries_smooth'] canvas").then( + $canvas => { + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by 1965'); + cy.getBySel('filter-val').should('contain', '1965'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by boy'); + cy.getBySel('filter-val').should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by all'); + cy.getBySel('filter-val').first().should('contain', '1965'); + cy.getBySel('filter-val').eq(1).should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas) + .scrollIntoView() + .click(70, 145) + .rightclick(70, 145); + openModalFromChartContext('Drill to detail by girl'); + cy.getBySel('filter-val').should('contain', 'girl'); + + closeModal(); + + cy.wrap($canvas) + .scrollIntoView() + .click(70, 145) + .rightclick(70, 145); + openModalFromChartContext('Drill to detail by all'); + cy.getBySel('filter-val').first().should('contain', '1965'); + cy.getBySel('filter-val').eq(1).should('contain', 'girl'); + }, + ); + }); + }); + + describe('Time-Series Step Line Chart', () => { + it('opens the modal with the correct filters', () => { + interceptSamples(); + + cy.get("[data-test-viz-type='echarts_timeseries_step'] canvas").then( + $canvas => { + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by 1965'); + cy.getBySel('filter-val').should('contain', '1965'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by boy'); + cy.getBySel('filter-val').should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by all'); + cy.getBySel('filter-val').first().should('contain', '1965'); + cy.getBySel('filter-val').eq(1).should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas) + .scrollIntoView() + .click(70, 145) + .rightclick(70, 145); + openModalFromChartContext('Drill to detail by girl'); + cy.getBySel('filter-val').should('contain', 'girl'); + + closeModal(); + + cy.wrap($canvas) + .scrollIntoView() + .click(70, 145) + .rightclick(70, 145); + openModalFromChartContext('Drill to detail by all'); + cy.getBySel('filter-val').first().should('contain', '1965'); + cy.getBySel('filter-val').eq(1).should('contain', 'girl'); + }, + ); + }); + }); + + describe('Funnel Chart', () => { + it('opens the modal with the correct filters', () => { + interceptSamples(); + + cy.get("[data-test-viz-type='funnel'] canvas").then($canvas => { + cy.wrap($canvas).scrollIntoView().rightclick(170, 90); openModalFromChartContext('Drill to detail by boy'); + cy.getBySel('filter-val').should('contain', 'boy'); + closeModal(); - // checking the filter + cy.wrap($canvas).scrollIntoView().rightclick(190, 250); + + openModalFromChartContext('Drill to detail by girl'); + cy.getBySel('filter-val').should('contain', 'girl'); + }); + }); + }); + + describe('Gauge Chart', () => { + it('opens the modal with the correct filters', () => { + interceptSamples(); + + cy.get("[data-test-viz-type='gauge_chart'] canvas").then($canvas => { + cy.wrap($canvas).scrollIntoView().rightclick(135, 95); + + openModalFromChartContext('Drill to detail by boy'); cy.getBySel('filter-val').should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().rightclick(95, 135); + + openModalFromChartContext('Drill to detail by girl'); + cy.getBySel('filter-val').should('contain', 'girl'); + }); + }); + }); + + describe('Mixed Chart', () => { + it('opens the modal with the correct filters', () => { + interceptSamples(); + + cy.get("[data-test-viz-type='mixed_timeseries'] canvas").then( + $canvas => { + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by 1965'); + cy.getBySel('filter-val').should('contain', '1965'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by boy'); + cy.getBySel('filter-val').should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by all'); + cy.getBySel('filter-val').first().should('contain', '1965'); + cy.getBySel('filter-val').eq(1).should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas) + .scrollIntoView() + .click(70, 145) + .rightclick(70, 145); + openModalFromChartContext('Drill to detail by girl'); + cy.getBySel('filter-val').should('contain', 'girl'); + closeModal(); + + cy.wrap($canvas) + .scrollIntoView() + .click(70, 145) + .rightclick(70, 145); + openModalFromChartContext('Drill to detail by all'); + cy.getBySel('filter-val').first().should('contain', '1965'); + cy.getBySel('filter-val').eq(1).should('contain', 'girl'); + }, + ); + }); + }); + + describe('Radar Chart', () => { + it('opens the modal with the correct filters', () => { + interceptSamples(); + + cy.get("[data-test-viz-type='radar'] canvas").then($canvas => { + cy.wrap($canvas).scrollIntoView().rightclick(180, 45); + + openModalFromChartContext('Drill to detail by boy'); + cy.getBySel('filter-val').should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().rightclick(180, 85); + + openModalFromChartContext('Drill to detail by girl'); + cy.getBySel('filter-val').should('contain', 'girl'); + }); + }); + }); + + describe('Treemap V2', () => { + it('opens the modal with the correct filters', () => { + interceptSamples(); + + cy.get("[data-test-viz-type='treemap_v2'] canvas").then($canvas => { + cy.wrap($canvas).scrollIntoView().rightclick(100, 30); + + openModalFromChartContext('Drill to detail by boy'); + cy.getBySel('filter-val').should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().rightclick(150, 250); + + openModalFromChartContext('Drill to detail by girl'); + cy.getBySel('filter-val').should('contain', 'girl'); }); }); }); From 371a47f856c357b123d531e9f9887b984334587b Mon Sep 17 00:00:00 2001 From: geido Date: Mon, 3 Oct 2022 16:44:31 +0300 Subject: [PATCH 2/8] Enhance tests --- .../new-chart-2022-09-09T14-22-31.728Z.jpg | Bin 16879 -> 0 bytes .../dashboard/drilltodetail.test.ts | 344 +++--------------- .../explore/visualizations/area.test.js | 8 +- .../explore/visualizations/big_number.test.js | 6 +- .../visualizations/big_number_total.test.js | 6 +- .../explore/visualizations/box_plot.test.js | 8 +- .../explore/visualizations/bubble.test.js | 8 +- .../explore/visualizations/compare.test.js | 8 +- .../explore/visualizations/dist_bar.test.js | 21 +- .../explore/visualizations/dual_line.test.js | 8 +- .../explore/visualizations/gauge.test.js | 8 +- .../explore/visualizations/graph.test.ts | 8 +- .../explore/visualizations/histogram.test.ts | 8 +- .../explore/visualizations/line.test.ts | 6 +- .../explore/visualizations/pie.test.js | 8 +- .../visualizations/pivot_table.test.js | 6 +- .../explore/visualizations/sankey.test.js | 8 +- .../explore/visualizations/sunburst.test.js | 8 +- .../explore/visualizations/table.test.ts | 6 +- .../explore/visualizations/time_table.js | 6 +- .../explore/visualizations/treemap.test.js | 8 +- .../explore/visualizations/world_map.test.js | 8 +- .../examples/supported_charts_dashboard.py | 14 +- 23 files changed, 192 insertions(+), 327 deletions(-) delete mode 100644 superset-frontend/cypress-base/cypress/downloads/new-chart-2022-09-09T14-22-31.728Z.jpg diff --git a/superset-frontend/cypress-base/cypress/downloads/new-chart-2022-09-09T14-22-31.728Z.jpg b/superset-frontend/cypress-base/cypress/downloads/new-chart-2022-09-09T14-22-31.728Z.jpg deleted file mode 100644 index 81bcb35cff22523bdfe07eead3d58cc1ed817bbd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16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<7=Af z)`g~c+jrg>wHX*MjSC{@$38l2cRdnSd<5q6RaqENp*)b%!k{Z}pWn2~#5dCWR4u|(dYSDNSRJtT_r{m}gCtD9#Z3 zHqYJ4o55v<;@&L9Z*Pw0d+#BzCoN7`^2$<*2zg+{#kk9*&YNN|bVk!Tyl9ey=J9>)DUyBly7guxxvpuwmp3Es6@e8`OOD za7^VW?o~q+E#yo!`I0XBrin;&1@dLrRGD`NAik>=Q|=owmQr;Qf4|0LW`;araHzVr zdj96zp5VEv(c4p@nxODlyl}i>Hil@jO>yU@w$3C6jMs-?{4P^ddn=TvNT&0Cz2cd- zIB*ze9*rnf%Nuv4C@6|<3@|?}B&{T(GG$7ae1oCeq>^6--p`ATjay;@d_35hBLrLX zr&Ow!gMC+NvpnibpE@srgigSoPw+I)Q9>$;PgKrK`B1l&`QWX)Ys7N3aro0Ga!I|5 zS7I-_ChwDvWEW5|8zqHJ)Dr9m@S&($f;wm^p2HQjTRY!J3bb3s(q`z7jD@8%u4?O6 zU2fWi{XC%KXxH^z>}LF2+1Bb-`e0t*F>Z4wSO5Oa-l#mGMbUK^u(@sHt943BT@x^Q zV@;hw&n4B)TJpDx#XH@|9}BLN%Q)2;AcJ!NA<+yH{XQ7?G*~o9Wn)KPU1fWS*-RB8 z=hOJCv%#Vs_Et_%SDbE+(pD>zbY4rg`TDPkpE9b3qnJQbEx{B|S8Jb1D=M4yqvG(U zLP4QMea)&Saw4emc-|yietv76h(c3;C7Y3;>_YR(rj`#whuol^0Mi29`mD2T%CDXc zBBkcW&m~`%2`BPP)Jh7>KlH@=q|BEo;GJv=^;76{**R8?|LDny!Bh&o`o^NgU60Fs zu{E#wBT6q=7J)A=kQ1?0l;V>-CNCzL?{ksA7_Tfw`-)MTD#PRO^Ca&yy&QceAeR=i jTrqVPFl-N<`?TBuKbu#m|Av { + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by 1965'); + cy.getBySel('filter-val').should('contain', '1965'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by boy'); + cy.getBySel('filter-val').should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + + openModalFromChartContext('Drill to detail by all'); + cy.getBySel('filter-val').first().should('contain', '1965'); + cy.getBySel('filter-val').eq(1).should('contain', 'boy'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().click(70, 145).rightclick(70, 145); + openModalFromChartContext('Drill to detail by girl'); + cy.getBySel('filter-val').should('contain', 'girl'); + closeModal(); + + cy.wrap($canvas).scrollIntoView().click(70, 145).rightclick(70, 145); + openModalFromChartContext('Drill to detail by all'); + cy.getBySel('filter-val').first().should('contain', '1965'); + cy.getBySel('filter-val').eq(1).should('contain', 'girl'); + }); +} + describe('Drill to detail modal', () => { beforeEach(() => { cy.preserveLogin(); @@ -264,46 +299,7 @@ describe('Drill to detail modal', () => { describe('Time-Series Line Chart', () => { it('opens the modal with the correct filters', () => { - interceptSamples(); - - cy.get("[data-test-viz-type='echarts_timeseries_line'] canvas").then( - $canvas => { - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by 1965'); - cy.getBySel('filter-val').should('contain', '1965'); - closeModal(); - - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by boy'); - cy.getBySel('filter-val').should('contain', 'boy'); - closeModal(); - - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by all'); - cy.getBySel('filter-val').first().should('contain', '1965'); - cy.getBySel('filter-val').eq(1).should('contain', 'boy'); - closeModal(); - - cy.wrap($canvas) - .scrollIntoView() - .click(70, 145) - .rightclick(70, 145); - openModalFromChartContext('Drill to detail by girl'); - cy.getBySel('filter-val').should('contain', 'girl'); - closeModal(); - - cy.wrap($canvas) - .scrollIntoView() - .click(70, 145) - .rightclick(70, 145); - openModalFromChartContext('Drill to detail by all'); - cy.getBySel('filter-val').first().should('contain', '1965'); - cy.getBySel('filter-val').eq(1).should('contain', 'girl'); - }, - ); + testTimeChart('echarts_timeseries_line'); }); }); @@ -336,15 +332,6 @@ describe('Drill to detail modal', () => { openModalFromChartContext('Drill to detail by girl'); cy.getBySel('filter-val').should('contain', 'girl'); - closeModal(); - - cy.wrap($canvas) - .scrollIntoView() - .click(70, 145) - .rightclick(70, 145); - openModalFromChartContext('Drill to detail by all'); - cy.getBySel('filter-val').first().should('contain', '1965'); - cy.getBySel('filter-val').eq(1).should('contain', 'girl'); }, ); }); @@ -352,83 +339,13 @@ describe('Drill to detail modal', () => { describe('Time-Series Area Chart', () => { it('opens the modal with the correct filters', () => { - interceptSamples(); - - cy.get("[data-test-viz-type='echarts_area'] canvas").then($canvas => { - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by 1965'); - cy.getBySel('filter-val').should('contain', '1965'); - closeModal(); - - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by boy'); - cy.getBySel('filter-val').should('contain', 'boy'); - closeModal(); - - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by all'); - cy.getBySel('filter-val').first().should('contain', '1965'); - cy.getBySel('filter-val').eq(1).should('contain', 'boy'); - closeModal(); - - cy.wrap($canvas).scrollIntoView().click(70, 145).rightclick(70, 145); - openModalFromChartContext('Drill to detail by girl'); - cy.getBySel('filter-val').should('contain', 'girl'); - closeModal(); - - cy.wrap($canvas).scrollIntoView().click(70, 145).rightclick(70, 145); - openModalFromChartContext('Drill to detail by all'); - cy.getBySel('filter-val').first().should('contain', '1965'); - cy.getBySel('filter-val').eq(1).should('contain', 'girl'); - }); + testTimeChart('echarts_area'); }); }); describe('Time-Series Scatter Chart', () => { it('opens the modal with the correct filters', () => { - interceptSamples(); - - cy.get("[data-test-viz-type='echarts_timeseries_scatter'] canvas").then( - $canvas => { - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by 1965'); - cy.getBySel('filter-val').should('contain', '1965'); - closeModal(); - - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by boy'); - cy.getBySel('filter-val').should('contain', 'boy'); - closeModal(); - - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by all'); - cy.getBySel('filter-val').first().should('contain', '1965'); - cy.getBySel('filter-val').eq(1).should('contain', 'boy'); - closeModal(); - - cy.wrap($canvas) - .scrollIntoView() - .click(70, 145) - .rightclick(70, 145); - openModalFromChartContext('Drill to detail by girl'); - cy.getBySel('filter-val').should('contain', 'girl'); - closeModal(); - - cy.wrap($canvas) - .scrollIntoView() - .click(70, 145) - .rightclick(70, 145); - openModalFromChartContext('Drill to detail by all'); - cy.getBySel('filter-val').first().should('contain', '1965'); - cy.getBySel('filter-val').eq(1).should('contain', 'girl'); - }, - ); + testTimeChart('echarts_timeseries_scatter'); }); }); @@ -451,6 +368,24 @@ describe('Drill to detail modal', () => { }); }); }); + + describe('World Map', () => { + it('opens the modal with the correct filters', () => { + interceptSamples(); + + cy.get("[data-test-viz-type='world_map'] svg").then($canvas => { + cy.wrap($canvas).scrollIntoView().rightclick(70, 150); + openModalFromChartContext('Drill to detail by United States'); + cy.getBySel('filter-val').should('contain', 'United States'); + closeModal(); + }); + cy.get("[data-test-viz-type='world_map'] svg").then($canvas => { + cy.wrap($canvas).scrollIntoView().rightclick(200, 140); + openModalFromChartContext('Drill to detail by Slovakia'); + cy.getBySel('filter-val').should('contain', 'Slovakia'); + }); + }); + }); }); describe('Tier 2 charts', () => { @@ -532,139 +467,19 @@ describe('Drill to detail modal', () => { describe('Time-Series Generic Chart', () => { it('opens the modal with the correct filters', () => { - interceptSamples(); - - cy.get("[data-test-viz-type='echarts_timeseries'] canvas").then( - $canvas => { - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by 1965'); - cy.getBySel('filter-val').should('contain', '1965'); - closeModal(); - - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by boy'); - cy.getBySel('filter-val').should('contain', 'boy'); - closeModal(); - - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by all'); - cy.getBySel('filter-val').first().should('contain', '1965'); - cy.getBySel('filter-val').eq(1).should('contain', 'boy'); - closeModal(); - - cy.wrap($canvas) - .scrollIntoView() - .click(70, 145) - .rightclick(70, 145); - openModalFromChartContext('Drill to detail by girl'); - cy.getBySel('filter-val').should('contain', 'girl'); - - closeModal(); - - cy.wrap($canvas) - .scrollIntoView() - .click(70, 145) - .rightclick(70, 145); - openModalFromChartContext('Drill to detail by all'); - cy.getBySel('filter-val').first().should('contain', '1965'); - cy.getBySel('filter-val').eq(1).should('contain', 'girl'); - }, - ); + testTimeChart('echarts_timeseries'); }); }); describe('Time-Series Smooth Chart', () => { it('opens the modal with the correct filters', () => { - interceptSamples(); - - cy.get("[data-test-viz-type='echarts_timeseries_smooth'] canvas").then( - $canvas => { - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by 1965'); - cy.getBySel('filter-val').should('contain', '1965'); - closeModal(); - - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by boy'); - cy.getBySel('filter-val').should('contain', 'boy'); - closeModal(); - - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by all'); - cy.getBySel('filter-val').first().should('contain', '1965'); - cy.getBySel('filter-val').eq(1).should('contain', 'boy'); - closeModal(); - - cy.wrap($canvas) - .scrollIntoView() - .click(70, 145) - .rightclick(70, 145); - openModalFromChartContext('Drill to detail by girl'); - cy.getBySel('filter-val').should('contain', 'girl'); - - closeModal(); - - cy.wrap($canvas) - .scrollIntoView() - .click(70, 145) - .rightclick(70, 145); - openModalFromChartContext('Drill to detail by all'); - cy.getBySel('filter-val').first().should('contain', '1965'); - cy.getBySel('filter-val').eq(1).should('contain', 'girl'); - }, - ); + testTimeChart('echarts_timeseries_smooth'); }); }); describe('Time-Series Step Line Chart', () => { it('opens the modal with the correct filters', () => { - interceptSamples(); - - cy.get("[data-test-viz-type='echarts_timeseries_step'] canvas").then( - $canvas => { - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by 1965'); - cy.getBySel('filter-val').should('contain', '1965'); - closeModal(); - - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by boy'); - cy.getBySel('filter-val').should('contain', 'boy'); - closeModal(); - - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by all'); - cy.getBySel('filter-val').first().should('contain', '1965'); - cy.getBySel('filter-val').eq(1).should('contain', 'boy'); - closeModal(); - - cy.wrap($canvas) - .scrollIntoView() - .click(70, 145) - .rightclick(70, 145); - openModalFromChartContext('Drill to detail by girl'); - cy.getBySel('filter-val').should('contain', 'girl'); - - closeModal(); - - cy.wrap($canvas) - .scrollIntoView() - .click(70, 145) - .rightclick(70, 145); - openModalFromChartContext('Drill to detail by all'); - cy.getBySel('filter-val').first().should('contain', '1965'); - cy.getBySel('filter-val').eq(1).should('contain', 'girl'); - }, - ); + testTimeChart('echarts_timeseries_step'); }); }); @@ -708,46 +523,7 @@ describe('Drill to detail modal', () => { describe('Mixed Chart', () => { it('opens the modal with the correct filters', () => { - interceptSamples(); - - cy.get("[data-test-viz-type='mixed_timeseries'] canvas").then( - $canvas => { - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by 1965'); - cy.getBySel('filter-val').should('contain', '1965'); - closeModal(); - - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by boy'); - cy.getBySel('filter-val').should('contain', 'boy'); - closeModal(); - - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); - - openModalFromChartContext('Drill to detail by all'); - cy.getBySel('filter-val').first().should('contain', '1965'); - cy.getBySel('filter-val').eq(1).should('contain', 'boy'); - closeModal(); - - cy.wrap($canvas) - .scrollIntoView() - .click(70, 145) - .rightclick(70, 145); - openModalFromChartContext('Drill to detail by girl'); - cy.getBySel('filter-val').should('contain', 'girl'); - closeModal(); - - cy.wrap($canvas) - .scrollIntoView() - .click(70, 145) - .rightclick(70, 145); - openModalFromChartContext('Drill to detail by all'); - cy.getBySel('filter-val').first().should('contain', '1965'); - cy.getBySel('filter-val').eq(1).should('contain', 'girl'); - }, - ); + testTimeChart('mixed_timeseries'); }); }); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/area.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/area.test.js index 069b457aa748d..dd7ca3188bfbf 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/area.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/area.test.js @@ -55,8 +55,12 @@ describe('Visualization > Area', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' }); } - beforeEach(() => { + before(() => { cy.login(); + }); + + beforeEach(() => { + cy.preserveLogin(); cy.intercept('POST', '/superset/explore_json/**').as('getJson'); }); @@ -105,6 +109,8 @@ describe('Visualization > Area', () => { }); it('should allow type to search color schemes and apply the scheme', () => { + verify(AREA_FORM_DATA); + cy.get('#controlSections-tab-display').click(); cy.get('.Control[data-test="color_scheme"]').scrollIntoView(); cy.get('.Control[data-test="color_scheme"] input[type="search"]') diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/big_number.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/big_number.test.js index ede7ed47f9a79..691311059aa91 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/big_number.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/big_number.test.js @@ -49,8 +49,12 @@ describe('Visualization > Big Number with Trendline', () => { }); } - beforeEach(() => { + before(() => { cy.login(); + }); + + beforeEach(() => { + cy.preserveLogin(); interceptChart({ legacy: false }).as('chartData'); }); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/big_number_total.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/big_number_total.test.js index e2fcc5a1a1e32..9058c955d5f5d 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/big_number_total.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/big_number_total.test.js @@ -25,8 +25,12 @@ describe('Visualization > Big Number Total', () => { viz_type: 'big_number_total', }; - beforeEach(() => { + before(() => { cy.login(); + }); + + beforeEach(() => { + cy.preserveLogin(); interceptChart({ legacy: false }).as('chartData'); }); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/box_plot.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/box_plot.test.js index 46242e0114895..adbd5bcef24d4 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/box_plot.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/box_plot.test.js @@ -37,8 +37,12 @@ describe('Visualization > Box Plot', () => { cy.verifySliceSuccess({ waitAlias: '@getJson' }); } - beforeEach(() => { + before(() => { cy.login(); + }); + + beforeEach(() => { + cy.preserveLogin(); cy.intercept('POST', '/api/v1/chart/data*').as('getJson'); }); @@ -48,6 +52,8 @@ describe('Visualization > Box Plot', () => { }); it('should allow type to search color schemes', () => { + verify(BOX_PLOT_FORM_DATA); + cy.get('#controlSections-tab-display').click(); cy.get('.Control[data-test="color_scheme"]').scrollIntoView(); cy.get('.Control[data-test="color_scheme"] input[type="search"]') diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/bubble.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/bubble.test.js index e41535b549b4b..955ec1661861a 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/bubble.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/bubble.test.js @@ -51,8 +51,12 @@ describe('Visualization > Bubble', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' }); } - beforeEach(() => { + before(() => { cy.login(); + }); + + beforeEach(() => { + cy.preserveLogin(); cy.intercept('POST', '/superset/explore_json/**').as('getJson'); }); @@ -109,6 +113,8 @@ describe('Visualization > Bubble', () => { }); it('should allow type to search color schemes and apply the scheme', () => { + cy.visitChartByParams(BUBBLE_FORM_DATA); + cy.get('.Control[data-test="color_scheme"]').scrollIntoView(); cy.get('.Control[data-test="color_scheme"] input[type="search"]') .focus() diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/compare.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/compare.test.js index 71f61c1432f71..efce9db8197e8 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/compare.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/compare.test.js @@ -51,8 +51,12 @@ describe('Visualization > Compare', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' }); } - beforeEach(() => { + before(() => { cy.login(); + }); + + beforeEach(() => { + cy.preserveLogin(); cy.intercept('POST', '/superset/explore_json/**').as('getJson'); }); @@ -88,6 +92,8 @@ describe('Visualization > Compare', () => { }); it('should allow type to search color schemes and apply the scheme', () => { + verify(COMPARE_FORM_DATA); + cy.get('#controlSections-tab-display').click(); cy.get('.Control[data-test="color_scheme"]').scrollIntoView(); cy.get('.Control[data-test="color_scheme"] input[type="search"]') diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/dist_bar.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/dist_bar.test.js index 9f62003c82bd3..cff5c2705aa99 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/dist_bar.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/dist_bar.test.js @@ -20,20 +20,23 @@ import { FORM_DATA_DEFAULTS, NUM_METRIC } from './shared.helper'; describe('Visualization > Distribution bar chart', () => { const VIZ_DEFAULTS = { ...FORM_DATA_DEFAULTS, viz_type: 'dist_bar' }; + const DISTBAR_FORM_DATA = { + ...VIZ_DEFAULTS, + metrics: NUM_METRIC, + groupby: ['state'], + }; - beforeEach(() => { + before(() => { cy.login(); + }); + + beforeEach(() => { + cy.preserveLogin(); cy.intercept('POST', '/superset/explore_json/**').as('getJson'); }); it('should work with adhoc metric', () => { - const formData = { - ...VIZ_DEFAULTS, - metrics: NUM_METRIC, - groupby: ['state'], - }; - - cy.visitChartByParams(formData); + cy.visitChartByParams(DISTBAR_FORM_DATA); cy.verifySliceSuccess({ waitAlias: '@getJson', querySubstring: NUM_METRIC.label, @@ -79,6 +82,8 @@ describe('Visualization > Distribution bar chart', () => { }); it('should allow type to search color schemes and apply the scheme', () => { + cy.visitChartByParams(DISTBAR_FORM_DATA); + cy.get('#controlSections-tab-display').click(); cy.get('.Control[data-test="color_scheme"]').scrollIntoView(); cy.get('.Control[data-test="color_scheme"] input[type="search"]') diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/dual_line.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/dual_line.test.js index 1e7ed4c454c02..c39d614dd5e70 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/dual_line.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/dual_line.test.js @@ -39,8 +39,12 @@ describe('Visualization > Dual Line', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' }); } - beforeEach(() => { + before(() => { cy.login(); + }); + + beforeEach(() => { + cy.preserveLogin(); cy.intercept('POST', '/superset/explore_json/**').as('getJson'); }); @@ -68,6 +72,8 @@ describe('Visualization > Dual Line', () => { }); it('should allow type to search color schemes and apply the scheme', () => { + verify(DUAL_LINE_FORM_DATA); + cy.get('#controlSections-tab-display').click(); cy.get('.Control[data-test="color_scheme"]').scrollIntoView(); cy.get('.Control[data-test="color_scheme"] input[type="search"]') diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/gauge.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/gauge.test.js index e8a85e83d0589..ccce5981f2f45 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/gauge.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/gauge.test.js @@ -17,14 +17,13 @@ * under the License. */ -// TODO(kgabryje): fix it and un-skip -describe.skip('Visualization > Gauge', () => { +describe('Visualization > Gauge', () => { const GAUGE_FORM_DATA = { - datasource: '2__table', + datasource: '3__table', viz_type: 'gauge_chart', metric: 'count', adhoc_filters: [], - slice_id: 49, + slice_id: 54, row_limit: 10, }; @@ -64,6 +63,7 @@ describe.skip('Visualization > Gauge', () => { }); it('should allow type to search color schemes', () => { + verify(GAUGE_FORM_DATA); cy.get('#controlSections-tab-display').click(); cy.get('.Control[data-test="color_scheme"]').scrollIntoView(); cy.get('.Control[data-test="color_scheme"] input[type="search"]') diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/graph.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/graph.test.ts index 16747d722138c..8fae1cd331990 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/graph.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/graph.test.ts @@ -50,8 +50,12 @@ describe('Visualization > Graph', () => { cy.verifySliceSuccess({ waitAlias: '@getJson' }); } - beforeEach(() => { + before(() => { cy.login(); + }); + + beforeEach(() => { + cy.preserveLogin(); cy.intercept('POST', '/api/v1/chart/data*').as('getJson'); }); @@ -79,6 +83,8 @@ describe('Visualization > Graph', () => { }); it('should allow type to search color schemes', () => { + verify(GRAPH_FORM_DATA); + cy.get('#controlSections-tab-display').click(); cy.get('.Control[data-test="color_scheme"]').scrollIntoView(); cy.get('.Control[data-test="color_scheme"] input[type="search"]') diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/histogram.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/histogram.test.ts index fbd5cfadeba50..c86f74ea3f998 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/histogram.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/histogram.test.ts @@ -43,8 +43,12 @@ describe('Visualization > Histogram', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' }); } - beforeEach(() => { + before(() => { cy.login(); + }); + + beforeEach(() => { + cy.preserveLogin(); cy.intercept('POST', '/superset/explore_json/**').as('getJson'); }); @@ -86,6 +90,8 @@ describe('Visualization > Histogram', () => { }); it('should allow type to search color schemes and apply the scheme', () => { + verify(HISTOGRAM_FORM_DATA); + cy.get('#controlSections-tab-display').click(); cy.get('.Control[data-test="color_scheme"]').scrollIntoView(); cy.get('.Control[data-test="color_scheme"] input[type="search"]') diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts index 03ab7a6ed0442..f614c65de989f 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts @@ -21,8 +21,12 @@ import { FORM_DATA_DEFAULTS, NUM_METRIC, SIMPLE_FILTER } from './shared.helper'; describe('Visualization > Line', () => { const LINE_CHART_DEFAULTS = { ...FORM_DATA_DEFAULTS, viz_type: 'line' }; - beforeEach(() => { + before(() => { cy.login(); + }); + + beforeEach(() => { + cy.preserveLogin(); cy.intercept('POST', '/superset/explore_json/**').as('getJson'); }); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pie.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pie.test.js index 6c6d33e6e62b4..1fa63942a532e 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pie.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pie.test.js @@ -41,8 +41,12 @@ describe('Visualization > Pie', () => { cy.verifySliceSuccess({ waitAlias: '@getJson' }); } - beforeEach(() => { + before(() => { cy.login(); + }); + + beforeEach(() => { + cy.preserveLogin(); cy.intercept('POST', '/api/v1/chart/data*').as('getJson'); }); @@ -70,6 +74,8 @@ describe('Visualization > Pie', () => { }); it('should allow type to search color schemes', () => { + verify(PIE_FORM_DATA); + cy.get('#controlSections-tab-display').click(); cy.get('.Control[data-test="color_scheme"]').scrollIntoView(); cy.get('.Control[data-test="color_scheme"] input[type="search"]') diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pivot_table.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pivot_table.test.js index ef62beb381056..1669ceb070481 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pivot_table.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pivot_table.test.js @@ -58,8 +58,12 @@ describe('Visualization > Pivot Table', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'table' }); } - beforeEach(() => { + before(() => { cy.login(); + }); + + beforeEach(() => { + cy.preserveLogin(); cy.intercept('POST', '/superset/explore_json/**').as('getJson'); }); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/sankey.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/sankey.test.js index fccefecf320c8..97a47f0a85d5d 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/sankey.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/sankey.test.js @@ -37,8 +37,12 @@ describe('Visualization > Sankey', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' }); } - beforeEach(() => { + before(() => { cy.login(); + }); + + beforeEach(() => { + cy.preserveLogin(); cy.intercept('POST', '/superset/explore_json/**').as('getJson'); }); @@ -75,6 +79,8 @@ describe('Visualization > Sankey', () => { }); it('should allow type to search color schemes', () => { + verify(SANKEY_FORM_DATA); + cy.get('#controlSections-tab-display').click(); cy.get('.Control[data-test="color_scheme"]').scrollIntoView(); cy.get('.Control[data-test="color_scheme"] input[type="search"]') diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/sunburst.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/sunburst.test.js index 990d1d5294fa5..74f4720bc78b1 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/sunburst.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/sunburst.test.js @@ -36,8 +36,12 @@ describe('Visualization > Sunburst', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' }); } - beforeEach(() => { + before(() => { cy.login(); + }); + + beforeEach(() => { + cy.preserveLogin(); cy.intercept('POST', '/superset/explore_json/**').as('getJson'); }); @@ -82,6 +86,8 @@ describe('Visualization > Sunburst', () => { }); it('should allow type to search color schemes', () => { + verify(SUNBURST_FORM_DATA); + cy.get('#controlSections-tab-display').click(); cy.get('.Control[data-test="color_scheme"]').scrollIntoView(); cy.get('.Control[data-test="color_scheme"] input[type="search"]') diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts index f11b23d595a1d..9a383f810c10d 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts @@ -43,8 +43,12 @@ describe('Visualization > Table', () => { optionName: 'metric_6qwzgc8bh2v_zox7hil1mzs', }; - beforeEach(() => { + before(() => { cy.login(); + }); + + beforeEach(() => { + cy.preserveLogin(); interceptChart({ legacy: false }).as('chartData'); }); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/time_table.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/time_table.js index eb81d17a3ba1e..cf86c43aa26fe 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/time_table.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/time_table.js @@ -21,8 +21,12 @@ import { FORM_DATA_DEFAULTS, NUM_METRIC } from './shared.helper'; describe('Visualization > Time TableViz', () => { const VIZ_DEFAULTS = { ...FORM_DATA_DEFAULTS, viz_type: 'time_table' }; - beforeEach(() => { + before(() => { cy.login(); + }); + + beforeEach(() => { + cy.preserveLogin(); cy.intercept('POST', '/superset/explore_json/**').as('getJson'); }); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/treemap.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/treemap.test.js index efd92a3e4e1b9..5a22aae6a57b8 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/treemap.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/treemap.test.js @@ -42,8 +42,12 @@ describe('Visualization > Treemap', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' }); } - beforeEach(() => { + before(() => { cy.login(); + }); + + beforeEach(() => { + cy.preserveLogin(); cy.intercept('POST', '/superset/explore_json/**').as('getJson'); }); @@ -82,6 +86,8 @@ describe('Visualization > Treemap', () => { }); it('should allow type to search color schemes and apply the scheme', () => { + verify(TREEMAP_FORM_DATA); + cy.get('.Control[data-test="color_scheme"]').scrollIntoView(); cy.get('.Control[data-test="color_scheme"] input[type="search"]') .focus() diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/world_map.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/world_map.test.js index 8faa4e412b47c..d9297c613af94 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/world_map.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/world_map.test.js @@ -39,8 +39,12 @@ describe('Visualization > World Map', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' }); } - beforeEach(() => { + before(() => { cy.login(); + }); + + beforeEach(() => { + cy.preserveLogin(); cy.intercept('POST', '/superset/explore_json/**').as('getJson'); }); @@ -82,6 +86,8 @@ describe('Visualization > World Map', () => { }); it('should allow type to search color schemes', () => { + verify(WORLD_MAP_FORM_DATA); + cy.get('.Control[data-test="linear_color_scheme"]').scrollIntoView(); cy.get('.Control[data-test="linear_color_scheme"] input[type="search"]') .focus() diff --git a/superset/examples/supported_charts_dashboard.py b/superset/examples/supported_charts_dashboard.py index 8d0b3570eada6..aa4f404ccb0fe 100644 --- a/superset/examples/supported_charts_dashboard.py +++ b/superset/examples/supported_charts_dashboard.py @@ -171,18 +171,6 @@ def create_slices(tbl: SqlaTable) -> List[Slice]: groupby=["gender"], ), ), - # TODO: use a different dataset for world map - Slice( - **slice_props, - slice_name="World Map", - viz_type="world_map", - params=get_slice_json( - defaults, - viz_type="world_map", - metric="sum__num", - entity="gender", - ), - ), # --------------------- # TIER 2 # --------------------- @@ -673,7 +661,7 @@ def load_supported_charts_dashboard() -> None: "meta": { "chartId": 11, "height": 50, - "sliceName": "World Map", + "sliceName": "% Rural", "width": 4 }, "type": "CHART" From 79444c569b0b2b76ca6877fbbdb1125d8793db45 Mon Sep 17 00:00:00 2001 From: geido Date: Mon, 3 Oct 2022 17:53:59 +0300 Subject: [PATCH 3/8] Fix tests --- .../dashboard/drilltodetail.test.ts | 8 ++--- .../explore/visualizations/area.test.js | 14 +++----- .../explore/visualizations/big_number.test.js | 14 +++----- .../visualizations/big_number_total.test.js | 14 +++----- .../explore/visualizations/box_plot.test.js | 14 +++----- .../explore/visualizations/bubble.test.js | 36 +++---------------- .../explore/visualizations/compare.test.js | 14 +++----- .../explore/visualizations/dist_bar.test.js | 14 +++----- .../explore/visualizations/dual_line.test.js | 14 +++----- .../explore/visualizations/gauge.test.js | 11 +++--- .../explore/visualizations/graph.test.ts | 14 +++----- .../explore/visualizations/histogram.test.ts | 14 +++----- .../explore/visualizations/line.test.ts | 8 ++--- .../explore/visualizations/pie.test.js | 14 +++----- .../visualizations/pivot_table.test.js | 14 +++----- .../explore/visualizations/sankey.test.js | 14 +++----- .../explore/visualizations/sunburst.test.js | 14 +++----- .../explore/visualizations/table.test.ts | 14 +++----- .../explore/visualizations/time_table.js | 8 ++--- .../explore/visualizations/treemap.test.js | 14 +++----- .../explore/visualizations/world_map.test.js | 14 +++----- 21 files changed, 99 insertions(+), 196 deletions(-) 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 8c38a8e7b92b1..5e9f98df58ef3 100644 --- a/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts @@ -183,7 +183,7 @@ describe('Drill to detail modal', () => { }); }); - describe('Big number with trendline', () => { + describe.only('Big number with trendline', () => { it('opens the modal with the correct data', () => { interceptSamples(); @@ -200,12 +200,12 @@ describe('Drill to detail modal', () => { // opens the modal by clicking on the trendline cy.get("[data-test-viz-type='big_number'] canvas").then($canvas => { - cy.wrap($canvas).scrollIntoView().click(1, 18).rightclick(1, 18); + cy.wrap($canvas).scrollIntoView().click(40, 15).rightclick(40, 15); - openModalFromChartContext('Drill to detail by 1965-01-01'); + openModalFromChartContext('Drill to detail by 1970-01-01'); // checking the filter - cy.getBySel('filter-val').should('contain', '1965-01-01'); + cy.getBySel('filter-val').should('contain', '1970-01-01'); }); }); }); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/area.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/area.test.js index dd7ca3188bfbf..a8af76a651b23 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/area.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/area.test.js @@ -17,6 +17,11 @@ * under the License. */ describe('Visualization > Area', () => { + beforeEach(() => { + cy.preserveLogin(); + cy.intercept('POST', '/superset/explore_json/**').as('getJson'); + }); + const AREA_FORM_DATA = { datasource: '2__table', viz_type: 'area', @@ -55,15 +60,6 @@ describe('Visualization > Area', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' }); } - before(() => { - cy.login(); - }); - - beforeEach(() => { - cy.preserveLogin(); - cy.intercept('POST', '/superset/explore_json/**').as('getJson'); - }); - it('should work without groupby', () => { verify(AREA_FORM_DATA); cy.get('.nv-area').should('have.length', 1); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/big_number.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/big_number.test.js index 691311059aa91..5701ed81044ce 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/big_number.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/big_number.test.js @@ -19,6 +19,11 @@ import { interceptChart } from 'cypress/utils'; describe('Visualization > Big Number with Trendline', () => { + beforeEach(() => { + cy.preserveLogin(); + interceptChart({ legacy: false }).as('chartData'); + }); + const BIG_NUMBER_FORM_DATA = { datasource: '2__table', viz_type: 'big_number', @@ -49,15 +54,6 @@ describe('Visualization > Big Number with Trendline', () => { }); } - before(() => { - cy.login(); - }); - - beforeEach(() => { - cy.preserveLogin(); - interceptChart({ legacy: false }).as('chartData'); - }); - it('should work', () => { verify(BIG_NUMBER_FORM_DATA); cy.get('.chart-container .header-line'); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/big_number_total.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/big_number_total.test.js index 9058c955d5f5d..8ef01b7a4e679 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/big_number_total.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/big_number_total.test.js @@ -20,20 +20,16 @@ import { interceptChart } from 'cypress/utils'; import { FORM_DATA_DEFAULTS, NUM_METRIC } from './shared.helper'; describe('Visualization > Big Number Total', () => { - const BIG_NUMBER_DEFAULTS = { - ...FORM_DATA_DEFAULTS, - viz_type: 'big_number_total', - }; - - before(() => { - cy.login(); - }); - beforeEach(() => { cy.preserveLogin(); interceptChart({ legacy: false }).as('chartData'); }); + const BIG_NUMBER_DEFAULTS = { + ...FORM_DATA_DEFAULTS, + viz_type: 'big_number_total', + }; + it('Test big number chart with adhoc metric', () => { const formData = { ...BIG_NUMBER_DEFAULTS, metric: NUM_METRIC }; diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/box_plot.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/box_plot.test.js index adbd5bcef24d4..d88ef7562726a 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/box_plot.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/box_plot.test.js @@ -17,6 +17,11 @@ * under the License. */ describe('Visualization > Box Plot', () => { + beforeEach(() => { + cy.preserveLogin(); + cy.intercept('POST', '/api/v1/chart/data*').as('getJson'); + }); + const BOX_PLOT_FORM_DATA = { datasource: '2__table', viz_type: 'box_plot', @@ -37,15 +42,6 @@ describe('Visualization > Box Plot', () => { cy.verifySliceSuccess({ waitAlias: '@getJson' }); } - before(() => { - cy.login(); - }); - - beforeEach(() => { - cy.preserveLogin(); - cy.intercept('POST', '/api/v1/chart/data*').as('getJson'); - }); - it('should work', () => { verify(BOX_PLOT_FORM_DATA); cy.get('.chart-container .box_plot canvas').should('have.length', 1); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/bubble.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/bubble.test.js index 955ec1661861a..9a0e4ca2b9ef2 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/bubble.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/bubble.test.js @@ -17,6 +17,11 @@ * under the License. */ describe('Visualization > Bubble', () => { + beforeEach(() => { + cy.preserveLogin(); + cy.intercept('POST', '/superset/explore_json/**').as('getJson'); + }); + const BUBBLE_FORM_DATA = { datasource: '2__table', viz_type: 'bubble', @@ -51,37 +56,6 @@ describe('Visualization > Bubble', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' }); } - before(() => { - cy.login(); - }); - - beforeEach(() => { - cy.preserveLogin(); - cy.intercept('POST', '/superset/explore_json/**').as('getJson'); - }); - - // Number of circles are pretty unstable when there are a lot of circles - // Since main functionality is already covered in filter test below, - // skip this test until we find a solution. - it.skip('should work', () => { - cy.visitChartByParams(BUBBLE_FORM_DATA).then(() => { - cy.wait('@getJson').then(xhr => { - let expectedBubblesNumber = 0; - xhr.responseBody.data.forEach(element => { - expectedBubblesNumber += element.values.length; - }); - cy.get('[data-test="chart-container"]') - .should('be.visible', { timeout: 15000 }) - .within(() => { - cy.get('svg') - .should('exist') - .find('.nv-point-clips circle') - .should('have.length', expectedBubblesNumber); - }); - }); - }); - }); - it('should work with filter', () => { verify({ ...BUBBLE_FORM_DATA, diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/compare.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/compare.test.js index efce9db8197e8..d319944b31744 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/compare.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/compare.test.js @@ -17,6 +17,11 @@ * under the License. */ describe('Visualization > Compare', () => { + beforeEach(() => { + cy.preserveLogin(); + cy.intercept('POST', '/superset/explore_json/**').as('getJson'); + }); + const COMPARE_FORM_DATA = { datasource: '3__table', viz_type: 'compare', @@ -51,15 +56,6 @@ describe('Visualization > Compare', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' }); } - before(() => { - cy.login(); - }); - - beforeEach(() => { - cy.preserveLogin(); - cy.intercept('POST', '/superset/explore_json/**').as('getJson'); - }); - it('should work without groupby', () => { verify(COMPARE_FORM_DATA); cy.get('.chart-container .nvd3 path.nv-line').should('have.length', 1); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/dist_bar.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/dist_bar.test.js index cff5c2705aa99..0a81ab78f7aee 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/dist_bar.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/dist_bar.test.js @@ -19,6 +19,11 @@ import { FORM_DATA_DEFAULTS, NUM_METRIC } from './shared.helper'; describe('Visualization > Distribution bar chart', () => { + beforeEach(() => { + cy.preserveLogin(); + cy.intercept('POST', '/superset/explore_json/**').as('getJson'); + }); + const VIZ_DEFAULTS = { ...FORM_DATA_DEFAULTS, viz_type: 'dist_bar' }; const DISTBAR_FORM_DATA = { ...VIZ_DEFAULTS, @@ -26,15 +31,6 @@ describe('Visualization > Distribution bar chart', () => { groupby: ['state'], }; - before(() => { - cy.login(); - }); - - beforeEach(() => { - cy.preserveLogin(); - cy.intercept('POST', '/superset/explore_json/**').as('getJson'); - }); - it('should work with adhoc metric', () => { cy.visitChartByParams(DISTBAR_FORM_DATA); cy.verifySliceSuccess({ diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/dual_line.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/dual_line.test.js index c39d614dd5e70..be9b26739b146 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/dual_line.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/dual_line.test.js @@ -17,6 +17,11 @@ * under the License. */ describe('Visualization > Dual Line', () => { + beforeEach(() => { + cy.preserveLogin(); + cy.intercept('POST', '/superset/explore_json/**').as('getJson'); + }); + const DUAL_LINE_FORM_DATA = { datasource: '3__table', viz_type: 'dual_line', @@ -39,15 +44,6 @@ describe('Visualization > Dual Line', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' }); } - before(() => { - cy.login(); - }); - - beforeEach(() => { - cy.preserveLogin(); - cy.intercept('POST', '/superset/explore_json/**').as('getJson'); - }); - it('should work', () => { verify(DUAL_LINE_FORM_DATA); cy.get('.chart-container svg path.nv-line').should('have.length', 2); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/gauge.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/gauge.test.js index ccce5981f2f45..023b3aeaa4249 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/gauge.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/gauge.test.js @@ -18,6 +18,11 @@ */ describe('Visualization > Gauge', () => { + beforeEach(() => { + cy.preserveLogin(); + cy.intercept('POST', '/api/v1/chart/data*').as('getJson'); + }); + const GAUGE_FORM_DATA = { datasource: '3__table', viz_type: 'gauge_chart', @@ -32,11 +37,6 @@ describe('Visualization > Gauge', () => { cy.verifySliceSuccess({ waitAlias: '@getJson' }); } - beforeEach(() => { - cy.login(); - cy.intercept('POST', '/api/v1/chart/data*').as('getJson'); - }); - it('should work', () => { verify(GAUGE_FORM_DATA); cy.get('.chart-container .gauge_chart canvas').should('have.length', 1); @@ -64,6 +64,7 @@ describe('Visualization > Gauge', () => { it('should allow type to search color schemes', () => { verify(GAUGE_FORM_DATA); + cy.get('#controlSections-tab-display').click(); cy.get('.Control[data-test="color_scheme"]').scrollIntoView(); cy.get('.Control[data-test="color_scheme"] input[type="search"]') diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/graph.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/graph.test.ts index 8fae1cd331990..76883ca87695a 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/graph.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/graph.test.ts @@ -27,6 +27,11 @@ type adhocFilter = { }; describe('Visualization > Graph', () => { + beforeEach(() => { + cy.preserveLogin(); + cy.intercept('POST', '/api/v1/chart/data*').as('getJson'); + }); + const GRAPH_FORM_DATA = { datasource: '1__table', viz_type: 'graph_chart', @@ -50,15 +55,6 @@ describe('Visualization > Graph', () => { cy.verifySliceSuccess({ waitAlias: '@getJson' }); } - before(() => { - cy.login(); - }); - - beforeEach(() => { - cy.preserveLogin(); - cy.intercept('POST', '/api/v1/chart/data*').as('getJson'); - }); - it('should work with ad-hoc metric', () => { verify(GRAPH_FORM_DATA); cy.get('.chart-container .graph_chart canvas').should('have.length', 1); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/histogram.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/histogram.test.ts index c86f74ea3f998..5a8576df2e6f8 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/histogram.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/histogram.test.ts @@ -19,6 +19,11 @@ import { QueryFormData } from '@superset-ui/core'; describe('Visualization > Histogram', () => { + beforeEach(() => { + cy.preserveLogin(); + cy.intercept('POST', '/superset/explore_json/**').as('getJson'); + }); + const HISTOGRAM_FORM_DATA: QueryFormData = { datasource: '3__table', viz_type: 'histogram', @@ -43,15 +48,6 @@ describe('Visualization > Histogram', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' }); } - before(() => { - cy.login(); - }); - - beforeEach(() => { - cy.preserveLogin(); - cy.intercept('POST', '/superset/explore_json/**').as('getJson'); - }); - it('should work without groupby', () => { verify(HISTOGRAM_FORM_DATA); cy.get('.chart-container svg .vx-bar').should( diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts index f614c65de989f..7f55529a68ea1 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/line.test.ts @@ -19,17 +19,13 @@ import { FORM_DATA_DEFAULTS, NUM_METRIC, SIMPLE_FILTER } from './shared.helper'; describe('Visualization > Line', () => { - const LINE_CHART_DEFAULTS = { ...FORM_DATA_DEFAULTS, viz_type: 'line' }; - - before(() => { - cy.login(); - }); - beforeEach(() => { cy.preserveLogin(); cy.intercept('POST', '/superset/explore_json/**').as('getJson'); }); + const LINE_CHART_DEFAULTS = { ...FORM_DATA_DEFAULTS, viz_type: 'line' }; + it('should show validator error when no metric', () => { const formData = { ...LINE_CHART_DEFAULTS, metrics: [] }; cy.visitChartByParams(formData); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pie.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pie.test.js index 1fa63942a532e..77f502e172088 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pie.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pie.test.js @@ -17,6 +17,11 @@ * under the License. */ describe('Visualization > Pie', () => { + beforeEach(() => { + cy.preserveLogin(); + cy.intercept('POST', '/api/v1/chart/data*').as('getJson'); + }); + const PIE_FORM_DATA = { datasource: '3__table', viz_type: 'pie', @@ -41,15 +46,6 @@ describe('Visualization > Pie', () => { cy.verifySliceSuccess({ waitAlias: '@getJson' }); } - before(() => { - cy.login(); - }); - - beforeEach(() => { - cy.preserveLogin(); - cy.intercept('POST', '/api/v1/chart/data*').as('getJson'); - }); - it('should work with ad-hoc metric', () => { verify(PIE_FORM_DATA); cy.get('.chart-container .pie canvas').should('have.length', 1); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pivot_table.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pivot_table.test.js index 1669ceb070481..dbf74472acddb 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pivot_table.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/pivot_table.test.js @@ -17,6 +17,11 @@ * under the License. */ describe('Visualization > Pivot Table', () => { + beforeEach(() => { + cy.preserveLogin(); + cy.intercept('POST', '/superset/explore_json/**').as('getJson'); + }); + const PIVOT_TABLE_FORM_DATA = { datasource: '3__table', viz_type: 'pivot_table', @@ -58,15 +63,6 @@ describe('Visualization > Pivot Table', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'table' }); } - before(() => { - cy.login(); - }); - - beforeEach(() => { - cy.preserveLogin(); - cy.intercept('POST', '/superset/explore_json/**').as('getJson'); - }); - it('should work with single groupby', () => { verify(PIVOT_TABLE_FORM_DATA); cy.get('.chart-container tr:eq(0) th:eq(1)').contains('sum__num'); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/sankey.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/sankey.test.js index 97a47f0a85d5d..b0da5cd808a7b 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/sankey.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/sankey.test.js @@ -17,6 +17,11 @@ * under the License. */ describe('Visualization > Sankey', () => { + beforeEach(() => { + cy.preserveLogin(); + cy.intercept('POST', '/superset/explore_json/**').as('getJson'); + }); + const SANKEY_FORM_DATA = { datasource: '1__table', viz_type: 'sankey', @@ -37,15 +42,6 @@ describe('Visualization > Sankey', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' }); } - before(() => { - cy.login(); - }); - - beforeEach(() => { - cy.preserveLogin(); - cy.intercept('POST', '/superset/explore_json/**').as('getJson'); - }); - it('should work', () => { verify(SANKEY_FORM_DATA); cy.get('.chart-container svg g.node rect').should('have.length', 41); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/sunburst.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/sunburst.test.js index 74f4720bc78b1..a3e556d5909f8 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/sunburst.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/sunburst.test.js @@ -17,6 +17,11 @@ * under the License. */ describe('Visualization > Sunburst', () => { + beforeEach(() => { + cy.preserveLogin(); + cy.intercept('POST', '/superset/explore_json/**').as('getJson'); + }); + const SUNBURST_FORM_DATA = { datasource: '2__table', viz_type: 'sunburst', @@ -36,15 +41,6 @@ describe('Visualization > Sunburst', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' }); } - before(() => { - cy.login(); - }); - - beforeEach(() => { - cy.preserveLogin(); - cy.intercept('POST', '/superset/explore_json/**').as('getJson'); - }); - it('should work without secondary metric', () => { verify(SUNBURST_FORM_DATA); // There should be 7 visible arcs + 1 hidden diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts index 9a383f810c10d..b91df4a45f0d8 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts @@ -27,6 +27,11 @@ import { // Table describe('Visualization > Table', () => { + beforeEach(() => { + cy.preserveLogin(); + interceptChart({ legacy: false }).as('chartData'); + }); + const VIZ_DEFAULTS = { ...FORM_DATA_DEFAULTS, viz_type: 'table', @@ -43,15 +48,6 @@ describe('Visualization > Table', () => { optionName: 'metric_6qwzgc8bh2v_zox7hil1mzs', }; - before(() => { - cy.login(); - }); - - beforeEach(() => { - cy.preserveLogin(); - interceptChart({ legacy: false }).as('chartData'); - }); - it('Use default time column', () => { cy.visitChartByParams({ ...VIZ_DEFAULTS, diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/time_table.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/time_table.js index cf86c43aa26fe..ef9863a56f8b8 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/time_table.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/time_table.js @@ -19,17 +19,13 @@ import { FORM_DATA_DEFAULTS, NUM_METRIC } from './shared.helper'; describe('Visualization > Time TableViz', () => { - const VIZ_DEFAULTS = { ...FORM_DATA_DEFAULTS, viz_type: 'time_table' }; - - before(() => { - cy.login(); - }); - beforeEach(() => { cy.preserveLogin(); cy.intercept('POST', '/superset/explore_json/**').as('getJson'); }); + const VIZ_DEFAULTS = { ...FORM_DATA_DEFAULTS, viz_type: 'time_table' }; + it('Test time series table multiple metrics last year total', () => { const formData = { ...VIZ_DEFAULTS, diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/treemap.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/treemap.test.js index 5a22aae6a57b8..9b7ea9819022a 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/treemap.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/treemap.test.js @@ -17,6 +17,11 @@ * under the License. */ describe('Visualization > Treemap', () => { + beforeEach(() => { + cy.preserveLogin(); + cy.intercept('POST', '/superset/explore_json/**').as('getJson'); + }); + const TREEMAP_FORM_DATA = { datasource: '2__table', viz_type: 'treemap', @@ -42,15 +47,6 @@ describe('Visualization > Treemap', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' }); } - before(() => { - cy.login(); - }); - - beforeEach(() => { - cy.preserveLogin(); - cy.intercept('POST', '/superset/explore_json/**').as('getJson'); - }); - it('should work', () => { verify(TREEMAP_FORM_DATA); cy.get(level0).should('have.length', 1); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/world_map.test.js b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/world_map.test.js index d9297c613af94..4afb5f54ff751 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/world_map.test.js +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/world_map.test.js @@ -17,6 +17,11 @@ * under the License. */ describe('Visualization > World Map', () => { + beforeEach(() => { + cy.preserveLogin(); + cy.intercept('POST', '/superset/explore_json/**').as('getJson'); + }); + const WORLD_MAP_FORM_DATA = { datasource: '2__table', viz_type: 'world_map', @@ -39,15 +44,6 @@ describe('Visualization > World Map', () => { cy.verifySliceSuccess({ waitAlias: '@getJson', chartSelector: 'svg' }); } - before(() => { - cy.login(); - }); - - beforeEach(() => { - cy.preserveLogin(); - cy.intercept('POST', '/superset/explore_json/**').as('getJson'); - }); - it('should work with ad-hoc metric', () => { verify(WORLD_MAP_FORM_DATA); cy.get('.bubbles circle.datamaps-bubble').should('have.length', 206); From c0d7a2b04ec79f7ec1eff8167ea6ad5a83bd3471 Mon Sep 17 00:00:00 2001 From: geido Date: Tue, 4 Oct 2022 14:34:39 +0300 Subject: [PATCH 4/8] Update failing tests --- .../cypress/integration/dashboard/drilltodetail.test.ts | 8 ++++---- .../cypress/integration/dashboard/nativeFilters.test.ts | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) 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 5e9f98df58ef3..3fa472ec47077 100644 --- a/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts @@ -183,7 +183,7 @@ describe('Drill to detail modal', () => { }); }); - describe.only('Big number with trendline', () => { + describe('Big number with trendline', () => { it('opens the modal with the correct data', () => { interceptSamples(); @@ -200,12 +200,12 @@ describe('Drill to detail modal', () => { // opens the modal by clicking on the trendline cy.get("[data-test-viz-type='big_number'] canvas").then($canvas => { - cy.wrap($canvas).scrollIntoView().click(40, 15).rightclick(40, 15); + cy.wrap($canvas).scrollIntoView().click(1, 14).rightclick(1, 14); - openModalFromChartContext('Drill to detail by 1970-01-01'); + openModalFromChartContext('Drill to detail by 1965-01-01'); // checking the filter - cy.getBySel('filter-val').should('contain', '1970-01-01'); + cy.getBySel('filter-val').should('contain', '1965-01-01'); }); }); }); 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 403faf1668e25..184ac86139b48 100644 --- a/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts @@ -64,7 +64,7 @@ function visitDashboard() { cy.wait('@get'); cy.wait('@getCharts'); cy.wait('@getDatasets'); - cy.wait(500); + cy.url().should('contain', 'native_filters_key'); } function prepareDashboardFilters( @@ -454,6 +454,7 @@ describe('Native filters', () => { let filterKey: string; const removeFirstChar = (search: string) => search.split('').slice(1, search.length).join(''); + cy.location().then(loc => { const queryParams = qs.parse(removeFirstChar(loc.search)); filterKey = queryParams.native_filters_key as string; From 060c25798576d81241420df62ef5bff5e0dc58e2 Mon Sep 17 00:00:00 2001 From: geido Date: Tue, 4 Oct 2022 14:58:52 +0300 Subject: [PATCH 5/8] Remove flaky test --- .../integration/dashboard/drilltodetail.test.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) 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 3fa472ec47077..6b665a9ea1fb2 100644 --- a/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts @@ -196,17 +196,9 @@ describe('Drill to detail modal', () => { cy.getBySel('filter-val').should('not.exist'); - closeModal(); - - // opens the modal by clicking on the trendline - cy.get("[data-test-viz-type='big_number'] canvas").then($canvas => { - cy.wrap($canvas).scrollIntoView().click(1, 14).rightclick(1, 14); - - openModalFromChartContext('Drill to detail by 1965-01-01'); + // TODO(geido): opens the modal by clicking on the trendline + // proved to be flaky, requires deeper investigation - // checking the filter - cy.getBySel('filter-val').should('contain', '1965-01-01'); - }); }); }); From 55711429227a33350bea1406b5b57ba134af4ab2 Mon Sep 17 00:00:00 2001 From: geido Date: Tue, 4 Oct 2022 15:11:14 +0300 Subject: [PATCH 6/8] Lint --- .../cypress/integration/dashboard/drilltodetail.test.ts | 1 - 1 file changed, 1 deletion(-) 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 6b665a9ea1fb2..9dd9f9eb26779 100644 --- a/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts @@ -198,7 +198,6 @@ describe('Drill to detail modal', () => { // TODO(geido): opens the modal by clicking on the trendline // proved to be flaky, requires deeper investigation - }); }); From 03886f9386cf373e5b3c75e38b81be3eef0552da Mon Sep 17 00:00:00 2001 From: geido Date: Tue, 4 Oct 2022 17:04:52 +0300 Subject: [PATCH 7/8] Enhance test --- .../integration/dashboard/drilltodetail.test.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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 9dd9f9eb26779..cbd29001afea2 100644 --- a/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts @@ -196,8 +196,17 @@ describe('Drill to detail modal', () => { cy.getBySel('filter-val').should('not.exist'); - // TODO(geido): opens the modal by clicking on the trendline - // proved to be flaky, requires deeper investigation + closeModal(); + + // opens the modal by clicking on the trendline + cy.get("[data-test-viz-type='big_number'] canvas").then($canvas => { + cy.wrap($canvas).scrollIntoView().click(1, 14).rightclick(1, 14); + + openModalFromChartContext('Drill to detail by 1965'); + + // checking the filter + cy.getBySel('filter-val').should('contain', '1965'); + }); }); }); From bb484d09626db16999193d75195afbd9f4bd448c Mon Sep 17 00:00:00 2001 From: geido Date: Wed, 5 Oct 2022 12:36:27 +0300 Subject: [PATCH 8/8] Use mousemove --- .../dashboard/drilltodetail.test.ts | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) 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 cbd29001afea2..edce9053fd762 100644 --- a/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/dashboard/drilltodetail.test.ts @@ -69,31 +69,46 @@ function testTimeChart(vizType: string) { interceptSamples(); cy.get(`[data-test-viz-type='${vizType}'] canvas`).then($canvas => { - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + cy.wrap($canvas) + .scrollIntoView() + .trigger('mousemove', 70, 93) + .rightclick(70, 93); openModalFromChartContext('Drill to detail by 1965'); cy.getBySel('filter-val').should('contain', '1965'); closeModal(); - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + cy.wrap($canvas) + .scrollIntoView() + .trigger('mousemove', 70, 93) + .rightclick(70, 93); openModalFromChartContext('Drill to detail by boy'); cy.getBySel('filter-val').should('contain', 'boy'); closeModal(); - cy.wrap($canvas).scrollIntoView().click(70, 93).rightclick(70, 93); + cy.wrap($canvas) + .scrollIntoView() + .trigger('mousemove', 70, 93) + .rightclick(70, 93); openModalFromChartContext('Drill to detail by all'); cy.getBySel('filter-val').first().should('contain', '1965'); cy.getBySel('filter-val').eq(1).should('contain', 'boy'); closeModal(); - cy.wrap($canvas).scrollIntoView().click(70, 145).rightclick(70, 145); + cy.wrap($canvas) + .scrollIntoView() + .trigger('mousemove', 70, 145) + .rightclick(70, 145); openModalFromChartContext('Drill to detail by girl'); cy.getBySel('filter-val').should('contain', 'girl'); closeModal(); - cy.wrap($canvas).scrollIntoView().click(70, 145).rightclick(70, 145); + cy.wrap($canvas) + .scrollIntoView() + .trigger('mousemove', 70, 145) + .rightclick(70, 145); openModalFromChartContext('Drill to detail by all'); cy.getBySel('filter-val').first().should('contain', '1965'); cy.getBySel('filter-val').eq(1).should('contain', 'girl'); @@ -200,7 +215,10 @@ describe('Drill to detail modal', () => { // opens the modal by clicking on the trendline cy.get("[data-test-viz-type='big_number'] canvas").then($canvas => { - cy.wrap($canvas).scrollIntoView().click(1, 14).rightclick(1, 14); + cy.wrap($canvas) + .scrollIntoView() + .trigger('mousemove', 1, 14) + .rightclick(1, 14); openModalFromChartContext('Drill to detail by 1965'); @@ -447,7 +465,7 @@ describe('Drill to detail modal', () => { cy.get("[data-test-viz-type='box_plot'] canvas").then($canvas => { cy.wrap($canvas) .scrollIntoView() - .click(135, 275) + .trigger('mousemove', 135, 275) .rightclick(135, 275); openModalFromChartContext('Drill to detail by boy'); @@ -456,7 +474,7 @@ describe('Drill to detail modal', () => { cy.wrap($canvas) .scrollIntoView() - .click(270, 280) + .trigger('mousemove', 270, 280) .rightclick(270, 280); openModalFromChartContext('Drill to detail by girl');