The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Consolidate cartesian chart e2e tests (#83938)
Nemanja Glumace1dddaaa4bb0
diff --git a/e2e/test/scenarios/visualizations/charts/bar_chart.cy.spec.js b/e2e/test/scenarios/visualizations/charts/bar_chart.cy.spec.jsindex 7e6243e78f6..3d7cddc4fb0 100644--- a/e2e/test/scenarios/visualizations/charts/bar_chart.cy.spec.js+++ b/e2e/test/scenarios/visualizations/charts/bar_chart.cy.spec.js@@ -62,8 +62,8 @@ describe("scenarios > visualizations > bar chart", () => {}),);- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("(empty)").should("not.exist");+ H.chartPathWithFillColor("#A989C5").should("have.length", 2);+ H.echartsContainer().findByText("(empty)").should("not.exist");});it("should show an (empty) bar for null values when X axis is ordinal (metabase#12138)", () => {@@ -202,10 +202,7 @@ describe("scenarios > visualizations > bar chart", () => {},});- H.echartsContainer()- .get("text")- .should("contain", "19")- .and("contain", "20.0M");+ H.getValueLabels().should("contain", "19").and("contain", "20.0M");});describe("issue 55853", () => {@@ -293,7 +290,8 @@ describe("scenarios > visualizations > bar chart", () => {H.sidebar().findByText("Data").click();});- it("should allow you to show/hide and reorder columns", () => {+ it("should allow you to show/hide and reorder columns, and handle filtered and re-added items", () => {+ cy.log("Move Doohickey to the third position");H.getDraggableElements().eq(0).as("dragElement");H.moveDnDKitElementByAlias("@dragElement", {vertical: 100,@@ -307,7 +305,8 @@ describe("scenarios > visualizations > bar chart", () => {.should("contain.text", "Doohickey");cy.findAllByTestId("legend-item").eq(3).should("contain.text", "Widget");- H.getDraggableElements().eq(1).icon("close").click({ force: true }); // Hide Gizmo+ cy.log("Hide Gizmo");+ H.getDraggableElements().eq(1).icon("close").click({ force: true });cy.findByTestId("query-visualization-root").findByText("Gizmo")@@ -317,6 +316,7 @@ describe("scenarios > visualizations > bar chart", () => {H.chartPathWithFillColor("#F9D45C").should("be.visible");H.chartPathWithFillColor("#88BF4D").should("be.visible");+ cy.log("Add Gizmo again");H.leftSidebar().button("Add another series").click();H.popover().findByText("Gizmo").click();@@ -329,22 +329,11 @@ describe("scenarios > visualizations > bar chart", () => {H.chartPathWithFillColor("#88BF4D").should("be.visible");H.chartPathWithFillColor("#A989C5").should("be.visible");- cy.findAllByTestId("legend-item").contains("Gadget").click();- H.popover().findByText("See these Orders").click();- cy.findByTestId("qb-filters-panel")- .findByText("Product → Category is Gadget")- .should("exist");- });-- it("should gracefully handle removing filtered items, and adding new items to the end of the list", () => {- H.getDraggableElements().first().as("dragElement");- H.moveDnDKitElementByAlias("@dragElement", {- vertical: 100,- useMouseEvents: true,- });-- H.getDraggableElements().eq(1).icon("close").click({ force: true }); // Hide Gizmo+ cy.log("Hide Gizmo again");+ H.getDraggableElements().eq(1).should("have.text", "Gizmo");+ H.getDraggableElements().eq(1).icon("close").click({ force: true });+ cy.log("Filter out Gadget");H.queryBuilderHeader().button(/Filter/).click();@@ -361,6 +350,7 @@ describe("scenarios > visualizations > bar chart", () => {H.getDraggableElements().eq(0).should("have.text", "Doohickey");H.getDraggableElements().eq(1).should("have.text", "Widget");+ cy.log("Remove the filter");cy.findByTestId("qb-filters-panel").icon("close").click();H.getDraggableElements().should("have.length", 3);@@ -368,6 +358,7 @@ describe("scenarios > visualizations > bar chart", () => {H.getDraggableElements().eq(1).should("have.text", "Doohickey");H.getDraggableElements().eq(2).should("have.text", "Widget");+ cy.log("Add Gizmo to the end of the list");H.leftSidebar().button("Add another series").click();H.popover().findByText("Gizmo").click();@@ -376,6 +367,13 @@ describe("scenarios > visualizations > bar chart", () => {H.getDraggableElements().eq(1).should("have.text", "Gizmo");H.getDraggableElements().eq(2).should("have.text", "Doohickey");H.getDraggableElements().eq(3).should("have.text", "Widget");++ cy.log("Drill through a legend item");+ cy.findAllByTestId("legend-item").contains("Gadget").click();+ H.popover().findByText("See these Orders").click();+ cy.findByTestId("qb-filters-panel")+ .findByText("Product → Category is Gadget")+ .should("exist");});});@@ -431,7 +429,11 @@ describe("scenarios > visualizations > bar chart", () => {display: "bar",});- cy.get("g.axis.yr").should("not.exist");+ H.echartsContainer().within(() => {+ cy.findByText("Created At: Month").should("be.visible");+ cy.findByText("Average of Total").should("not.exist");+ cy.findByText("Min of Total").should("not.exist");+ });});it("should split the y-axis on native queries with two numeric columns", () => {@@ -609,6 +611,7 @@ describe("scenarios > visualizations > bar chart", () => {});// Ensure the gray color did not get assigned to series+ H.chartPathWithFillColor("#88BF4D").should("be.visible");H.chartPathWithFillColor(grayColor).should("not.exist");H.openVizSettingsSidebar();@@ -816,7 +819,7 @@ describe("scenarios > visualizations > bar chart", () => {.should("contain", "6").and("contain", "13").and("contain", "19");- cy.get(".axis.yr").should("not.exist");+ H.echartsContainer().findAllByText("Count").should("have.length", 1);});});@@ -866,7 +869,7 @@ describe("scenarios > visualizations > bar chart", () => {// since the first metric is scaled to be half of the second metric// the first bar should be half the size of the first bar// within a given tolerance- expect(heightMetricOne - heightMetricTwo / 2).to.be.lessThan(0.1);+ expect(heightMetricOne).to.be.closeTo(heightMetricTwo / 2, 0.5);});});@@ -890,7 +893,7 @@ describe("scenarios > visualizations > bar chart", () => {});});- it("should correctly show tool-tips when stacked bar charts contain a total value that is negative (#39012)", () => {+ it("should correctly show tool-tips when stacked bar charts contain a negative total or multiple positive and negative segments (#39012, #47596)", () => {cy.signInAsAdmin();H.createNativeQuestion(@@ -1022,11 +1025,8 @@ describe("scenarios > visualizations > bar chart", () => {],});H.echartsTriggerBlur();- });-- it("should correctly show tool-tips when stacked bar charts contain multiple positive and multiple negative segments (#47596)", () => {- cy.signInAsAdmin();+ cy.log("multiple positive and multiple negative segments (#47596)");H.createNativeQuestion({name: "47596",@@ -1135,14 +1135,11 @@ describe("scenarios > visualizations > bar chart", () => {cy.wait("@dataset");H.echartsContainer().should("be.visible");- // Get all x-axis labels- H.echartsContainer().within(() => {- // ECharts renders axis labels as text elements in SVG- // We should see labels for all 12 months- cy.get('svg text[text-anchor="middle"]')- .should("have.length.at.least", 12)- .should("be.visible");- });+ H.echartsContainer()+ .findAllByText(+ /^(January|February|March|April|May|June|July|August|September|October|November|December) \d{4}$/,+ )+ .should("have.length", 12);});it("should rotate axis labels when they do not fit horizontally instead of hiding them (metabase#68048)", () => {@@ -1279,10 +1276,6 @@ describe("scenarios > visualizations > bar chart", () => {"select -3 o, 'F2021' k, 1 v\nunion all select -2, 'V2021', 2\nunion all select -1, 'S2022', 3\nunion all select 0, 'F2022', 4","template-tags": {},},- visualization_settings: {- "table.pivot_column": "O",- "table.cell_column": "V",- },};H.createNativeQuestion(questionDetails).then(({ body: { id } }) => {diff --git a/e2e/test/scenarios/visualizations/charts/combo.cy.spec.js b/e2e/test/scenarios/visualizations/charts/combo.cy.spec.jsindex 2b35aae7a5f..78a849c4579 100644--- a/e2e/test/scenarios/visualizations/charts/combo.cy.spec.js+++ b/e2e/test/scenarios/visualizations/charts/combo.cy.spec.js@@ -84,6 +84,8 @@ describe("scenarios > visualizations > combo", () => {cy.findByText("Stack").click();});+ H.getValueLabels().should("have.length.greaterThan", 0);+// First circle of the line seriesH.cartesianChartCircleWithColor("#A989C5").eq(0).trigger("mousemove");H.assertEChartsTooltip({diff --git a/e2e/test/scenarios/visualizations/charts/line-bar-tooltips.cy.spec.js b/e2e/test/scenarios/visualizations/charts/line-bar-tooltips.cy.spec.jsindex aa18814bada..4f501bb74f5 100644--- a/e2e/test/scenarios/visualizations/charts/line-bar-tooltips.cy.spec.js+++ b/e2e/test/scenarios/visualizations/charts/line-bar-tooltips.cy.spec.js@@ -20,14 +20,14 @@ function testSumTotalChange() {tooltipSelector("#88BF4D", 0);H.echartsTooltip().within(() => {- H.tooltipHeader("2025");+ H.tooltipHeader().should("have.text", "2025");H.assertTooltipRow(seriesName, { color: "#88BF4D", value: "42,156.87" });});tooltipSelector("#88BF4D", 1);H.echartsTooltip().within(() => {- H.tooltipHeader("2026");+ H.tooltipHeader().should("have.text", "2026");H.assertTooltipRow(seriesName, {color: "#88BF4D",value: "205,256.02",@@ -99,7 +99,7 @@ function testAvgTotalChange() {tooltipSelector("#A989C5", 0);H.echartsTooltip().within(() => {- H.tooltipHeader("2025");+ H.tooltipHeader().should("have.text", "2025");H.assertTooltipRow(seriesName, {color: "#A989C5",value: "56.66",@@ -108,7 +108,7 @@ function testAvgTotalChange(tooltipSelector("#A989C5", 1);H.echartsTooltip().within(() => {- H.tooltipHeader("2025");+ H.tooltipHeader().should("have.text", "2026");H.assertTooltipRow(seriesName, {color: "#A989C5",value: "56.86",@@ -140,7 +140,7 @@ function testCumSumChange(if (testFirstTooltip) {showTooltipForCircleInSeries("#88BF4D", 0);H.echartsTooltip().within(() => {- H.tooltipHeader("2025");+ H.tooltipHeader().should("have.text", "2025");H.assertTooltipRow(seriesName, {color: "#88BF4D",value: "3,236",@@ -150,7 +150,7 @@ function testCumSumChange(showTooltipForCircleInSeries("#88BF4D", 1);H.echartsTooltip().within(() => {- H.tooltipHeader("2026");+ H.tooltipHeader().should("have.text", "2026");H.assertTooltipRow(seriesName, {color: "#88BF4D",value: "17,587",@@ -175,7 +175,7 @@ const AVG_DISCOUNT_SUM_DISCOUNT = {function testAvgDiscountChange(seriesName = "Average of Discount") {showTooltipForCircleInSeries("#509EE3", 0);H.echartsTooltip().within(() => {- H.tooltipHeader("2025");+ H.tooltipHeader().should("have.text", "2025");H.assertTooltipRow(seriesName, {color: "#509EE3",value: "5.03",@@ -184,7 +184,7 @@ function testAvgDiscountChange(seriesName = "Average of Discount") {showTooltipForCircleInSeries("#509EE3", 1);H.echartsTooltip().within(() => {- H.tooltipHeader("2026");+ H.tooltipHeader().should("have.text", "2026");H.assertTooltipRow(seriesName, {color: "#509EE3",value: "5.41",@@ -196,7 +196,7 @@ function testAvgDiscountChange(seriesName = "Average of Discount") {function testSumDiscountChange(seriesName = "Sum of Discount") {showTooltipForCircleInSeries("#98D9D9", 0);H.echartsTooltip().within(() => {- H.tooltipHeader("2025");+ H.tooltipHeader().should("have.text", "2025");H.assertTooltipRow(seriesName, {color: "#98D9D9",value: "342.09",@@ -205,7 +205,7 @@ function testSumDiscountChange(seriesName = "Sum of Discount") {showTooltipForCircleInSeries("#98D9D9", 1);H.echartsTooltip().within(() => {- H.tooltipHeader("2026");+ H.tooltipHeader().should("have.text", "2026");H.assertTooltipRow(seriesName, {color: "#98D9D9",value: "1,953.08",@@ -447,6 +447,10 @@ union all select 2, 20, 'short value'`,// Tooltip by default shows only visible series datashowTooltipForBarInSeries(COUNT_COLOR);+ H.assertEChartsTooltip({+ header: "0",+ rows: [{ name: COUNT, value: "2,308" }],+ });H.assertEChartsTooltipNotContain([SUM_OF_TOTAL, AVG_OF_QUANTITY]);// Go to the additional tooltip columns setting@@ -517,7 +521,7 @@ union all select 2, 20, 'short value'`,});});- it("should show updated column titles in tooltips after editing them via Visualization Options", () => {+ it("should show percent change, and updated column titles after editing them via Visualization Options, in tooltips", () => {const originalName = "Sum of Total";const customName = "Custom";@@ -527,6 +531,8 @@ union all select 2, 20, 'short value'`,rows: [{ name: originalName, value: "42,156.87" }],});+ testSumTotalChange();+H.editDashboard();H.showDashcardVisualizerModalSettings(0, {isVisualizerCard: false,@@ -543,10 +549,6 @@ union all select 2, 20, 'short value'`,rows: [{ name: customName, value: "42,156.87" }],});});-- it("should show percent change in tooltip for timeseries axis", () => {- testSumTotalChange();- });});describe("> single series question on dashboard with added series", () => {@@ -559,7 +561,7 @@ union all select 2, 20, 'short value'`,});});- it("should show updated column titles in tooltips after editing them via Visualization Options", () => {+ it("should show percent change, and updated column titles after editing them via Visualization Options, in tooltips", () => {const originalSeriesName = "Q1";const updatedOriginalSeriesName = "Custom Q1";const addedSeriesName = "Q2";@@ -585,6 +587,9 @@ union all select 2, 20, 'short value'`,],});+ testSumTotalChange(showTooltipForCircleInSeries, "Q1");+ testAvgTotalChange(showTooltipForCircleInSeries, "Q2");+H.editDashboard();H.showDashcardVisualizerModal(0, {isVisualizerCard: false,@@ -625,11 +630,6 @@ union all select 2, 20, 'short value'`,],});});-- it("should show percent change in tooltip for timeseries axis", () => {- testSumTotalChange(showTooltipForCircleInSeries, "Q1");- testAvgTotalChange(showTooltipForCircleInSeries, "Q2");- });});describe("> multi series question on dashboard", () => {@@ -641,7 +641,7 @@ union all select 2, 20, 'short value'`,});});- it("should show updated column titles in tooltips after editing them via Visualization Options", () => {+ it("should show percent change and updated column titles in tooltips, and hide the tooltip when the click popover is visible", () => {const originalAvgSeriesName = "Average of Total";const originalCumSumSeriesName = "Cumulative sum of Quantity";const customAvgSeriesName = "Custom 1";@@ -664,6 +664,29 @@ union all select 2, 20, 'short value'`,],});+ testAvgTotalChange();+ testCumSumChange();++ H.cartesianChartCircleWithColor("#A989C5")+ .first()+ .as("firstCircle")+ .trigger("mousemove");+ H.assertEChartsTooltip({ header: "2025" });++ cy.get("@firstCircle").click();++ // The tooltip hides when the click popover is visible+ H.popover().should("be.visible");+ cy.get("body").should(($body) => {+ const visibleTooltips = $body+ .find('[data-testid="echarts-tooltip"]')+ .toArray()+ .filter(H.isFixedPositionElementVisible);+ expect(visibleTooltips).to.have.length(0);+ });+ cy.realPress("Escape");+ cy.get(H.POPOVER_ELEMENT).should("not.exist");+H.editDashboard();H.showDashcardVisualizerModalSettings(0, {isVisualizerCard: false,@@ -694,11 +717,6 @@ union all select 2, 20, 'short value'`,],});});-- it("should show percent change in tooltip for timeseries axis", () => {- testAvgTotalChange();- testCumSumChange();- });});it("tooltips should not fully cover small dashcards", () => {@@ -737,26 +755,6 @@ union all select 2, 20, 'short value'`,});});- it("tooltips should be hidden when click popover is visible", () => {- setup({- question: AVG_OF_TOTAL_CUM_SUM_QUANTITY,- }).then((dashboardId) => {- H.visitDashboard(dashboardId);- });-- H.cartesianChartCircleWithColor("#A989C5")- .first()- .as("firstCircle")- .trigger("mousemove");-- // Ensure the tooltip is visible- H.assertEChartsTooltip({ header: "2025" });-- cy.get("@firstCircle").click();-- cy.findAllByTestId("echarts-tooltip").should("be.hidden");- });-describe("> multi series question on dashboard with added question", () => {beforeEach(() => {setup({@@ -784,7 +782,7 @@ union all select 2, 20, 'short value'`,});});- it("should show updated column titles in tooltips after editing them via Visualization Options", () => {+ it("should show percent change, and updated column titles after editing them via Visualization Options, in tooltips", () => {const originalName = "Sum of Total";const updatedName = "Custom";@@ -800,6 +798,8 @@ union all select 2, 20, 'short value'`,],});+ testSumTotalChange(showTooltipForBarInSeries);+H.editDashboard();H.showDashcardVisualizerModalSettings(0, {isVisualizerCard: false,@@ -822,10 +822,6 @@ union all select 2, 20, 'short value'`,],});});-- it("should show percent change in tooltip for timeseries axis", () => {- testSumTotalChange(showTooltipForBarInSeries);- });});describe("> bar chart question on dashboard with added series", () => {@@ -838,7 +834,7 @@ union all select 2, 20, 'short value'`,});});- it("should show updated column titles in tooltips after editing them via Visualization Options", () => {+ it("should show percent change, and updated column titles after editing them via Visualization Options, in tooltips", () => {const originalSeriesColor = "#88BF4D";const addedSeriesColor = "#A989C5";const originalSeriesName = "Q1";@@ -870,6 +866,9 @@ union all select 2, 20, 'short value'`,],});+ testSumTotalChange(showTooltipForBarInSeries, "Q1");+ testAvgTotalChange(showTooltipForBarInSeries, "Q2");+H.editDashboard();H.showDashcardVisualizerModalSettings(0, {isVisualizerCard: false,@@ -905,11 +904,6 @@ union all select 2, 20, 'short value'`,],});});-- it("should show percent change in tooltip for timeseries axis", () => {- testSumTotalChange(showTooltipForBarInSeries, "Q1");- testAvgTotalChange(showTooltipForBarInSeries, "Q2");- });});describe("> single series question grouped by month on dashboard", () => {@@ -931,7 +925,7 @@ union all select 2, 20, 'short value'`,},],});- testTooltipExcludesText("Compared to previous month");+ assertNoPercentChange("Sum of Total");showTooltipForCircleInSeries("#88BF4D", 1);H.assertEChartsTooltip({@@ -965,7 +959,7 @@ union all select 2, 20, 'short value'`,},],});- testTooltipExcludesText("Compared to previous month");+ assertNoPercentChange("Sum of Total");showTooltipForCircleInSeries("#88BF4D", 1);H.assertEChartsTooltip({header: "June 2025",@@ -977,7 +971,7 @@ union all select 2, 20, 'short value'`,},],});- testTooltipExcludesText("Compared to previous month");+ assertNoPercentChange("Sum of Total");showTooltipForCircleInSeries("#88BF4D", 2);H.assertEChartsTooltip({@@ -1003,7 +997,7 @@ union all select 2, 20, 'short value'`,},],});- testTooltipExcludesText("Compared to previous month");+ assertNoPercentChange("Sum of Total");});it("should not show if x-axis is not timeseries", () => {@@ -1024,7 +1018,7 @@ union all select 2, 20, 'short value'`,},],});- testTooltipExcludesText("Compared to previous month");+ assertNoPercentChange("Sum of Total");showTooltipForCircleInSeries("#88BF4D", 1);H.assertEChartsTooltip({@@ -1038,7 +1032,7 @@ union all select 2, 20, 'short value'`,],});- testTooltipExcludesText("Compared to previous month");+ assertNoPercentChange("Sum of Total");});});@@ -1105,7 +1099,7 @@ union all select 2, 20, 'short value'`,APRIL_CHANGES.forEach((change, index) => {showTooltipForCircleInSeries("#88BF4D", index);if (change === null) {- testTooltipExcludesText("Compared to previous");+ assertNoPercentChange("Sum of Total");return;}H.assertEChartsTooltip({@@ -1128,7 +1122,7 @@ union all select 2, 20, 'short value'`,DST_WEEK_CHANGES.forEach((change, index) => {showTooltipForCircleInSeries("#88BF4D", index);if (change === null) {- testTooltipExcludesText("Compared to previous");+ assertNoPercentChange("Sum of Total");return;}@@ -1152,7 +1146,7 @@ union all select 2, 20, 'short value'`,DST_DAY_CHANGES.forEach((change, index) => {showTooltipForCircleInSeries("#88BF4D", index);if (change === null) {- testTooltipExcludesText("Compared to previous");+ assertNoPercentChange("Sum of Total");return;}H.assertEChartsTooltip({@@ -1215,9 +1209,14 @@ function showTooltipForBarInSeries(seriesColor, index = 0) {H.chartPathWithFillColor(seriesColor).eq(index).realHover();}-function testTooltipExcludesText(text) {+// A row with a percent change has 4 cells: marker, name, value, change.+function assertNoPercentChange(seriesName) {H.echartsTooltip().within(() => {- cy.contains(text).should("not.exist");+ cy.findByText(seriesName)+ .closest("tr")+ .children("td")+ .should("have.length", 3);+ cy.findByText(/%$/).should("not.exist");});}diff --git a/e2e/test/scenarios/visualizations/charts/line_chart.cy.spec.js b/e2e/test/scenarios/visualizations/charts/line_chart.cy.spec.jsindex 9671d57811f..0210ae5be88 100644--- a/e2e/test/scenarios/visualizations/charts/line_chart.cy.spec.js+++ b/e2e/test/scenarios/visualizations/charts/line_chart.cy.spec.js@@ -31,13 +31,42 @@ describe("scenarios > visualizations > line chart", () => {cy.signInAsNormalUser();});- it("should be able to change y axis position (metabase#13487)", () => {+ it("should change formatting, y-axis position, color and line settings of a series (metabase#51952, metabase#13487, metabase#53735)", () => {H.visitQuestionAdhoc({dataset_query: testQuery,display: "line",});H.openVizSettingsSidebar();++ cy.log("x-axis column settings (metabase#51952)");+ cy.findByTestId("settings-CREATED_AT").click();+ H.popover().findByText("Abbreviate days and months").click();+ H.echartsContainer().findByText("Jan 2027");+ cy.realPress("Escape");+ cy.get("[data-element-id=mantine-popover]")+ .filter(":visible")+ .should("not.exist");++ cy.log("series formatting settings");+ H.openSeriesSettings("Count");++ H.popover().within(() => {+ cy.findByText("Formatting").click();++ cy.findByText("Add a prefix").should("exist");+ cy.findByPlaceholderText("$").type("prefix").blur();+ });++ H.echartsContainer().findByText("prefix0");+ // The popover closes on Escape only when the key event starts inside it+ H.popover().findByPlaceholderText("$").focus();+ cy.realPress("Escape");+ cy.get("[data-element-id=mantine-popover]")+ .filter(":visible")+ .should("not.exist");++ cy.log("y-axis position (metabase#13487)");H.openSeriesSettings("Count");H.echartsContainer()@@ -47,25 +76,34 @@ describe("scenarios > visualizations > line chart", () => {cy.wrap({ x, y }).as("leftAxisLabelPosition");});- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("Right").click();- H.echartsContainer()- .findByText("Count")- .then((label) => {- const { x: xRight, y: yRight } = H.getXYTransform(label);- cy.get("@leftAxisLabelPosition").then(({ x: xLeft, y: yLeft }) => {+ H.popover().findByText("Right").click();+ cy.get("@leftAxisLabelPosition").then(({ x: xLeft, y: yLeft }) => {+ H.echartsContainer()+ .findByText("Count")+ .should(($label) => {+ const { x: xRight, y: yRight } = H.getXYTransform($label);expect(yRight).to.be.eq(yLeft);expect(xRight).to.be.greaterThan(xLeft);});- });- });+ });- it("should display line settings only for line/area charts", () => {- H.visitQuestionAdhoc({- dataset_query: testQuery,- display: "line",+ cy.log("series color (metabase#53735)");+ H.popover().within(() => {+ cy.findByTestId("color-selector-button").button().click();});+ H.popover()+ .should("have.length", 2)+ .last()+ .within(() => {+ cy.findByLabelText("#EF8C8C").realClick();+ });++ cy.button("Done").click();++ H.cartesianChartCircleWithColor("#EF8C8C");++ cy.log("line settings show only for line and area charts");H.openVizSettingsSidebar();H.openSeriesSettings("Count");@@ -92,35 +130,6 @@ describe("scenarios > visualizations > line chart", () => {});});- it("should allow changing formatting settings", () => {- H.visitQuestionAdhoc({- dataset_query: testQuery,- display: "line",- });-- H.openVizSettingsSidebar();-- cy.log("x-axis column settings (metabase#51952)");- cy.findByTestId("settings-CREATED_AT").click();- H.popover().findByText("Abbreviate days and months").click();- H.echartsContainer().findByText("Jan 2027");- cy.realPress("Escape");- cy.get("[data-element-id=mantine-popover]")- .filter(":visible")- .should("not.exist");-- H.openSeriesSettings("Count");-- H.popover().within(() => {- cy.findByText("Formatting").click();-- cy.findByText("Add a prefix").should("exist");- cy.findByPlaceholderText("$").type("prefix").blur();- });-- H.echartsContainer().findByText("prefix0");- });-it("should reset series settings when switching to line chart", () => {H.visitQuestionAdhoc({dataset_query: testQuery,@@ -159,6 +168,8 @@ describe("scenarios > visualizations > line chart", () => {},});+ H.echartsContainer().findByText("100%").should("be.visible");+H.openVizTypeSidebar();cy.icon("line").click();@@ -198,7 +209,7 @@ describe("scenarios > visualizations > line chart", () => {},});- H.echartsContainer().get("text").contains("39.75%");+ H.echartsContainer().find("text").contains("39.75%");});it("should let unpin y-axis from zero", () => {@@ -287,9 +298,6 @@ describe("scenarios > visualizations > line chart", () => {assertNoPoints();- // Check that message is displayed- cy.findByRole("dialog", { name: /data points are off screen/i });-H.openVizSettingsSidebar();H.vizSettingsSidebar().findByText("Axes").click();@@ -721,7 +729,11 @@ describe("scenarios > visualizations > line chart", () => {display: "line",});- cy.get("g.axis.yr").should("not.exist");+ H.echartsContainer().within(() => {+ cy.findByText(/^Created At/).should("be.visible");+ cy.findByText("Average of Total").should("not.exist");+ cy.findByText("Min of Total").should("not.exist");+ });});it("should split the y-axis when columns are of different semantic_type", () => {@@ -749,7 +761,7 @@ describe("scenarios > visualizations > line chart", () => {});});- it("should split the y-axis when columns are of the same semantic_type but have far values", () => {+ it("should label each side of a split y-axis separately", () => {H.visitQuestionAdhoc({dataset_query: {type: "query",@@ -772,51 +784,6 @@ describe("scenarios > visualizations > line chart", () => {cy.findByText("Sum of Total").should("be.visible");cy.findByText("Min of Total").should("be.visible");});- });-- it("should not split the y-axis when the setting is disabled", () => {- H.visitQuestionAdhoc({- dataset_query: {- type: "query",- query: {- "source-table": ORDERS_ID,- aggregation: [- ["sum", ["field", ORDERS.TOTAL, null]],- ["min", ["field", ORDERS.TOTAL, null]],- ],- breakout: [- ["field", ORDERS.CREATED_AT, { "temporal-unit": "month" }],- ],- },- database: SAMPLE_DB_ID,- },- display: "line",- visualization_settings: {- "graph.y_axis.auto_split": false,- },- });-- cy.get("g.axis.yr").should("not.exist");- });-- it("should label each side of a split y-axis separately", () => {- H.visitQuestionAdhoc({- dataset_query: {- type: "query",- query: {- "source-table": ORDERS_ID,- aggregation: [- ["sum", ["field", ORDERS.TOTAL, null]],- ["min", ["field", ORDERS.TOTAL, null]],- ],- breakout: [- ["field", ORDERS.CREATED_AT, { "temporal-unit": "month" }],- ],- },- database: SAMPLE_DB_ID,- },- display: "line",- });H.openVizSettingsSidebar();H.vizSettingsSidebar().findByText("Axes").click();@@ -914,31 +881,6 @@ describe("scenarios > visualizations > line chart", () => {});});});-- it("should allow changing a series' color - #53735", () => {- H.visitQuestionAdhoc({- dataset_query: testQuery,- display: "line",- });-- H.openVizSettingsSidebar();- H.openSeriesSettings("Count");-- H.popover().within(() => {- cy.findByTestId("color-selector-button").button().click();- });-- H.popover()- .should("have.length", 2)- .last()- .within(() => {- cy.findByLabelText("#EF8C8C").realClick();- });-- cy.button("Done").click();-- H.cartesianChartCircleWithColor("#EF8C8C");- });});describe("problems with the labels when showing only one row in the results (metabase#12782, metabase#4995)", () => {@@ -963,24 +905,22 @@ describe("scenarios > visualizations > line chart", () => {cy.findByText("Category is Doohickey");});- it("should not drop the chart legend (metabase#4995)", () => {- cy.findAllByTestId("legend-item").should("contain", "Doohickey");-- cy.log("Ensure that legend is hidden when not dealing with multi series");- H.openVizSettingsSidebar();- cy.findByTestId("remove-CATEGORY").click();- H.queryBuilderMain().should("not.contain", "Doohickey");- });-- it("should display correct axis labels (metabase#12782)", () => {+ it("should keep the chart legend and axis labels (metabase#4995, metabase#12782)", () => {H.echartsContainer()- .get("text")+ .find("text").contains("Created At").should("be.visible");H.echartsContainer()- .get("text")+ .find("text").contains("Average of Price").should("be.visible");++ cy.findAllByTestId("legend-item").should("contain", "Doohickey");++ cy.log("Ensure that legend is hidden when not dealing with multi series");+ H.openVizSettingsSidebar();+ cy.findByTestId("remove-CATEGORY").click();+ H.queryBuilderMain().should("not.contain", "Doohickey");});});@@ -1332,6 +1272,12 @@ describe("scenarios > visualizations > line chart", () => {.trigger("mousemove", 180, 200).trigger("mouseup", 400, 200);+ cy.wait("@dataset");+ cy.findByTestId("qb-filters-panel").should(+ "contain",+ "Created At: Month is",+ );+H.chartPathWithFillColor("#EF8C8C").should("be.visible");H.cartesianChartCircleWithColor("#A989C5");});diff --git a/e2e/test/scenarios/visualizations/charts/rows.cy.spec.js b/e2e/test/scenarios/visualizations/charts/rows.cy.spec.jsindex 4c7d0385799..40d7b53e716 100644--- a/e2e/test/scenarios/visualizations/charts/rows.cy.spec.js+++ b/e2e/test/scenarios/visualizations/charts/rows.cy.spec.js@@ -88,17 +88,16 @@ describe("scenarios > visualizations > rows", () => {});// Verify hovering bars does not change their size (metabase#43631)- cy.findAllByRole("graphics-symbol").eq(0).as("firstBar");+ cy.findByTestId("query-visualization-root")+ .findByRole("graphics-symbol", { name: "51" })+ .as("firstBar");cy.get("@firstBar")- .invoke("width")+ .invoke("attr", "width").then((prevWidth) => {- cy.get("@firstBar")- .realHover()- .invoke("width")- .then((newWidth) => {- // eslint-disable-next-line metabase/no-unsafe-element-filtering- expect(prevWidth).eq(newWidth);- });+ expect(Number(prevWidth)).to.be.greaterThan(0);+ cy.get("@firstBar").realHover();+ H.tooltip().should("contain", "51");+ cy.get("@firstBar").should("have.attr", "width", prevWidth);});});diff --git a/e2e/test/scenarios/visualizations/charts/scatter.cy.spec.js b/e2e/test/scenarios/visualizations/charts/scatter.cy.spec.jsindex 6e180ea8b08..7b20ffd5bf1 100644--- a/e2e/test/scenarios/visualizations/charts/scatter.cy.spec.js+++ b/e2e/test/scenarios/visualizations/charts/scatter.cy.spec.js@@ -136,9 +136,9 @@ describe("scenarios > visualizations > scatter", () => {},});- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("Visualization");- cy.findAllByText("79").should("not.exist");+ H.cartesianChartCircle().should("have.length", 49);+ H.getValueLabels().should("not.exist");+ H.echartsContainer().findByText("79").should("not.exist");});it("should respect circle size in a visualization (metabase#22929)", () => {@@ -227,11 +227,11 @@ select 10 as size, 2 as x, 5 as y`,stabilizeScatterChart();H.cartesianChartCircle().first().realHover();- H.assertEChartsTooltipNotContain(columnsToRemove);H.assertEChartsTooltip({header: "15.69",rows: allTooltipRows.slice(0, 2),});+ H.assertEChartsTooltipNotContain(columnsToRemove);});it("should render scatter plot with native query data (metabase#55880)", () => {diff --git a/e2e/test/scenarios/visualizations/charts/trendline.cy.spec.js b/e2e/test/scenarios/visualizations/charts/trendline.cy.spec.jsindex ed9b7e009b8..81ae83dc25c 100644--- a/e2e/test/scenarios/visualizations/charts/trendline.cy.spec.js+++ b/e2e/test/scenarios/visualizations/charts/trendline.cy.spec.js@@ -10,44 +10,7 @@ describe("scenarios > question > trendline", () => {H.createQuestion(questionDetails, { visitQuestion: true });}- it("displays trendline when there are multiple numeric outputs (for simple question) (metabase#12781)", () => {- setup({- name: "12781",- query: {- "source-table": ORDERS_ID,- aggregation: [- ["avg", ["field", ORDERS.SUBTOTAL, null]],- ["sum", ["field", ORDERS.TOTAL, null]],- ],- breakout: [["field", ORDERS.CREATED_AT, { "temporal-unit": "year" }]],- },- display: "line",- });-- // Change settings to trendline- H.openVizSettingsSidebar();- H.leftSidebar().within(() => {- cy.findByText("Display").click();- cy.findByText("Trend line").click();- });-- // Check graph is still there- cy.get("rect");-- // Remove sum of total- H.leftSidebar().within(() => {- cy.findByText("Data").click();- // eslint-disable-next-line metabase/no-unsafe-element-filtering- cy.icon("close").last().click({ force: true });- cy.findByText("Done").click();- });-- // Graph should still exist- cy.findByPlaceholderText("Created At").should("not.exist");- cy.get("rect");- });-- it("should handle per-series trend line settings", () => {+ it("should handle per-series trend line settings (metabase#12781)", () => {setup({name: "Per-series trend line settings",query: {@@ -75,6 +38,26 @@ describe("scenarios > question > trendline", () => {cy.findByText("Show trend line for this series").click();});H.trendLine().should("have.length", 1);++ H.popover().within(() => {+ cy.findByText("Show trend line for this series").click();+ });+ H.trendLine().should("have.length", 2);+ // The popover closes on Escape only when the key event starts inside it+ H.popover()+ .findByRole("switch", { name: "Show trend line for this series" })+ .focus();+ cy.realPress("Escape");+ cy.get("[data-element-id=mantine-popover]")+ .filter(":visible")+ .should("not.exist");++ H.leftSidebar().within(() => {+ cy.findByTestId("remove-sum").click();+ cy.findByText("Done").click();+ });+ H.trendLine().should("have.length", 1);+ H.cartesianChartCircle().should("exist");});it("should display trend line for stack-100% chart (metabase#25614)", () => {diff --git a/e2e/test/scenarios/visualizations/charts/waterfall.cy.spec.js b/e2e/test/scenarios/visualizations/charts/waterfall.cy.spec.jsindex 5079176f3e3..e43106ac878 100644--- a/e2e/test/scenarios/visualizations/charts/waterfall.cy.spec.js+++ b/e2e/test/scenarios/visualizations/charts/waterfall.cy.spec.js@@ -13,13 +13,13 @@ describe("scenarios > visualizations > waterfall", () => {function verifyWaterfallRendering(xLabel = null, yLabel = null) {H.chartPathWithFillColor("#88BF4D").should("be.visible"); // A barH.chartPathWithFillColor("#303D46").should("be.visible"); // Total bar- H.echartsContainer().get("text").contains("Total");+ H.echartsContainer().find("text").contains("Total");if (xLabel) {- H.echartsContainer().get("text").contains(xLabel);+ H.echartsContainer().find("text").contains(xLabel);}if (yLabel) {- H.echartsContainer().get("text").contains(yLabel);+ H.echartsContainer().find("text").contains(yLabel);}}@@ -36,7 +36,7 @@ describe("scenarios > visualizations > waterfall", () => {verifyWaterfallRendering("PRODUCT", "PROFIT");});- it("should work with ordinal series and numeric X-axis (metabase#15550)", () => {+ it("should work with quantitative and ordinal series and numeric X-axis (metabase#15550)", () => {H.startNewNativeQuestion();H.NativeEditor.type("select 1 as X, 20 as Y union select 2 as X, -10 as Y");@@ -52,29 +52,14 @@ describe("scenarios > visualizations > waterfall", () => {H.sidebar().findAllByPlaceholderText("Select a field").last().click();H.popover().findByText("Y").click();+ verifyWaterfallRendering("X", "Y");+// eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usagecy.contains("Axes").click();H.sidebar().findAllByDisplayValue("Linear").first().click();H.popover().findByText("Ordinal").click();-- verifyWaterfallRendering("X", "Y");- });-- it("should work with quantitative series", () => {- H.startNewNativeQuestion();- H.NativeEditor.type("select 1 as X, 10 as Y union select 2 as X, -2 as Y");- cy.findByTestId("native-query-editor-container").icon("play").click();- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.contains("Visualization").click();- switchToWaterfallDisplay();-- H.sidebar().findAllByPlaceholderText("Select a field").first().click();- H.popover().findByText("X").click();-- // eslint-disable-next-line metabase/no-unsafe-element-filtering- H.sidebar().findAllByPlaceholderText("Select a field").last().click();- H.popover().findByText("Y").click();+ H.sidebar().findByDisplayValue("Ordinal").should("exist");verifyWaterfallRendering("X", "Y");});@@ -122,7 +107,8 @@ describe("scenarios > visualizations > waterfall", () => {cy.contains("Visualization").click();switchToWaterfallDisplay();- H.echartsContainer().get("text").contains("Total").should("not.exist");+ H.chartPathWithFillColor("#303D46").should("exist");+ H.echartsContainer().find("text").contains("Total").should("not.exist");});describe("multi-series (metabase#15152)", () => {@@ -143,10 +129,11 @@ describe("scenarios > visualizations > waterfall", () => {H.echartsContainer().within(() => {cy.findByText("Created At: Year").should("exist"); // x-axiscy.findByText("Count").should("exist"); // y-axis+ cy.findByText("Total").should("exist");cy.findByText("Sum of Total").should("not.exist");// x-axis labels (some)- ["2025", "2026", "2029", "Total"].forEach((label) => {+ ["2025", "2026", "2029"].forEach((label) => {cy.findByText(label).should("exist");});@@ -170,8 +157,8 @@ describe("scenarios > visualizations > waterfall", () => {});H.echartsContainer().within(() => {- cy.findByText("Sum of Total").should("exist"); // x-axis- cy.findByText("Created At: Year").should("exist"); // y-axis+ cy.findByText("Sum of Total").should("exist"); // y-axis+ cy.findByText("Created At: Year").should("exist"); // x-axiscy.findByText("Count").should("not.exist");// x-axis labels (some)@@ -191,7 +178,7 @@ describe("scenarios > visualizations > waterfall", () => {testSwitchingToWaterfall();});- it("should correctly switch into single-series mode for ad-hoc queries", () => {+ it("should correctly switch into single-series mode for saved questions", () => {H.createQuestion({ name: "Q1", query: DATASET_QUERY.query, display: "line" },{ visitQuestion: true },@@ -228,10 +215,13 @@ describe("scenarios > visualizations > waterfall", () => {H.sidebar().findAllByPlaceholderText("Select a field").last().click();H.popover().findByText("Count").click();- H.echartsContainer().should("exist"); // Chart renders after adding a metric+ H.echartsContainer().findByText("Total").should("exist");- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText(/Add another/).should("not.exist");+ H.leftSidebar().within(() => {+ cy.findByDisplayValue("Created At: Year").should("exist");+ cy.findByText("Add series breakout").should("not.exist");+ cy.findByText(/Add another/).should("not.exist");+ });});it("should work for unaggregated data (metabase#15465)", () => {@@ -352,8 +342,9 @@ describe("scenarios > visualizations > waterfall", () => {});});- it("should allow adding non-series columns to the tooltip", () => {+ it("should show the total bar tooltip, allow adding non-series columns to the tooltip, and display a goal line (metabase#48118)", () => {const INCREASE_COLOR = "#00FF00";+ const TOTAL_BAR_COLOR = "#303D46";function getFirstWaterfallSegment() {return H.echartsContainer()@@ -377,6 +368,12 @@ describe("scenarios > visualizations > waterfall", () => {},});+ H.chartPathWithFillColor(TOTAL_BAR_COLOR).realHover();+ H.assertEChartsTooltip({+ header: "Total",+ rows: [{ name: "Count", value: "18,760", color: TOTAL_BAR_COLOR }],+ });+getFirstWaterfallSegment().realHover();H.assertEChartsTooltip({header: "2025",@@ -400,49 +397,6 @@ describe("scenarios > visualizations > waterfall", () => {{ name: "Sum of Total", value: "42,156.87" },],});- });-- it("should show tooltip when hovering the total bar (metabase#48118)", () => {- H.visitQuestionAdhoc({- display: "waterfall",- dataset_query: {- type: "query",- database: SAMPLE_DB_ID,- query: {- "source-table": ORDERS_ID,- aggregation: [["count"], ["sum", ["field-id", ORDERS.TOTAL]]],- breakout: [["field", ORDERS.CREATED_AT, { "temporal-unit": "year" }]],- },- },- });-- const totalBarColor = "#303D46";-- H.chartPathWithFillColor(totalBarColor).realHover();-- H.assertEChartsTooltip({- header: "Total",- rows: [{ name: "Count", value: "18,760", color: totalBarColor }],- });- });-- it("should display goal line when configured", () => {- H.visitQuestionAdhoc({- display: "waterfall",- dataset_query: {- type: "query",- database: SAMPLE_DB_ID,- query: {- "source-table": ORDERS_ID,- aggregation: [["count"], ["sum", ["field-id", ORDERS.TOTAL]]],- breakout: [["field", ORDERS.CREATED_AT, { "temporal-unit": "year" }]],- },- },- });-- H.openVizSettingsSidebar();-- H.leftSidebar().contains("Display").click();H.leftSidebar().within(() => {cy.findByText("Goal line").click();@@ -456,9 +410,6 @@ describe("scenarios > visualizations > waterfall", () => {describe("scenarios > visualizations > waterfall settings", () => {beforeEach(() => {- H.restore();- cy.signInAsNormalUser();-H.startNewNativeQuestion();H.NativeEditor.type("select 'A' as X, -4.56 as Y");cy.findByTestId("native-query-editor-container").icon("play").click();@@ -467,43 +418,37 @@ describe("scenarios > visualizations > waterfall", () => {switchToWaterfallDisplay();});- it("should have increase, decrease, and total color options", () => {+ it("should allow toggling of the total bar and value labels, and have color options", () => {// eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usagecy.contains("Display").click();- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("Increase color").click();- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("Decrease color").click();- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("Total color").click();- });- it("should allow toggling of the total bar", () => {- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.contains("Display").click();+ H.echartsContainer().find("text").contains("Total").should("exist");cy.get('[data-field-title="Show total"]').within(() => {cy.findByRole("switch").click({ force: true });});- H.echartsContainer().get("text").contains("Total").should("not.exist");+ H.echartsContainer().find("text").contains("Total").should("not.exist");cy.get('[data-field-title="Show total"]').within(() => {cy.findByRole("switch").click({ force: true });});- H.echartsContainer().get("text").contains("Total").should("exist");- });+ H.echartsContainer().find("text").contains("Total").should("exist");- it("should allow toggling of value labels", () => {- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.contains("Display").click();-- H.echartsContainer().get("text").contains("(4.56)").should("not.exist");+ H.chartPathWithFillColor("#303D46").should("exist");+ H.echartsContainer().find("text").contains("(4.56)").should("not.exist");cy.get('[data-field-title="Show values on data points"]').findByRole("switch").click({ force: true });- H.echartsContainer().get("text").contains("(4.56)").should("be.visible");+ H.echartsContainer().find("text").contains("(4.56)").should("be.visible");++ // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage+ cy.findByText("Increase color").click();+ // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage+ cy.findByText("Decrease color").click();+ // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage+ cy.findByText("Total color").click();});});});@@ -526,5 +471,5 @@ const switchToWaterfallDisplay = () => {function getWaterfallDataLabels() {// paint-order='stroke' targets the waterfall labels only- return H.echartsContainer().get("text[paint-order='stroke']");+ return H.echartsContainer().find("text[paint-order='stroke']");}