Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Consolidate binning e2e tests (#83440)

Nemanja Glumacfe8908f39798
diff --git a/e2e/test/scenarios/binning/binning-options.cy.spec.js b/e2e/test/scenarios/binning/binning-options.cy.spec.js
index 1baec0900a0..d9aa44a3ff0 100644
--- a/e2e/test/scenarios/binning/binning-options.cy.spec.js
+++ b/e2e/test/scenarios/binning/binning-options.cy.spec.js
@@ -46,6 +46,7 @@ const LONGITUDE_BUCKETS = [
* Makes sure that all binning options (bucket sizes) are rendered correctly for the regular table.
* 1. no option should be rendered multiple times
* 2. the selected option should be highlighted when the popover with all options opens
+ * 3. choosing another option re-runs the query with the new bucket size
*
* This spec covers the following issues:
* - metabase#15574
@@ -53,21 +54,28 @@ const LONGITUDE_BUCKETS = [
describe("scenarios > binning > binning options", () => {
beforeEach(() => {
- cy.intercept("POST", "/api/dataset").as("dataset");
H.restore();
cy.signInAsAdmin();
});
context("via simple question", () => {
- it("should render number binning options correctly", () => {
+ it("should render and apply number binning options", () => {
chooseInitialBinningOption({ table: ORDERS_ID, column: "Total" });
getTitle("Count by Total: Auto binned");
openBinningListForDimension("Total", "Auto binned");
getAllOptions({ options: NUMBER_BUCKETS, isSelected: "Auto bin" });
+ cy.intercept("POST", "/api/dataset").as("rerun");
+ selectOption("50 bins");
+ cy.wait("@rerun");
+
+ getTitle("Count by Total: 50 bins");
+ H.chartPathWithFillColor("#509EE3");
+ // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
+ cy.findByText("70");
});
- it("should render time series binning options correctly", () => {
+ it("should render and apply time series binning options", () => {
chooseInitialBinningOption({ table: ORDERS_ID, column: "Created At" });
getTitle("Count by Created At: Month");
@@ -77,9 +85,17 @@ describe("scenarios > binning > binning options", () => {
isSelected: "Month",
shouldExpandList: true,
});
+ cy.intercept("POST", "/api/dataset").as("rerun");
+ selectOption("Quarter");
+ cy.wait("@rerun");
+
+ getTitle("Count by Created At: Quarter");
+ H.cartesianChartCircle();
+ // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
+ cy.findByText("Q1 2026");
});
- it("should render longitude/latitude binning options correctly", () => {
+ it("should render and apply longitude/latitude binning options", () => {
chooseInitialBinningOption({ table: PEOPLE_ID, column: "Longitude" });
getTitle("Count by Longitude: Auto binned");
@@ -89,11 +105,34 @@ describe("scenarios > binning > binning options", () => {
isSelected: "Auto bin",
shouldExpandList: true,
});
+ cy.intercept("POST", "/api/dataset").as("rerun");
+ selectOption("Bin every 20 degrees");
+ cy.wait("@rerun");
+
+ getTitle("Count by Longitude: 20°");
+ H.chartPathWithFillColor("#509EE3");
+ // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
+ cy.findByText("180° W");
+ });
+
+ it("should apply a number bucket picked from an unselected column", () => {
+ H.openTable({ table: ORDERS_ID });
+ H.summarize();
+ H.changeBinningForDimension({
+ name: "Total",
+ fromBinning: "Auto bin",
+ toBinning: "50 bins",
+ });
+
+ getTitle("Count by Total: 50 bins");
+ H.chartPathWithFillColor("#509EE3");
+ // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
+ cy.findByText("70");
});
});
context("via custom question", () => {
- it("should render number binning options correctly", () => {
+ it("should render and apply number binning options", () => {
chooseInitialBinningOption({
table: ORDERS_ID,
mode: "notebook",
@@ -107,9 +146,18 @@ describe("scenarios > binning > binning options", () => {
openBinningListForDimension("Total", "Auto binned");
getAllOptions({ options: NUMBER_BUCKETS, isSelected: "Auto bin" });
+ selectOption("50 bins");
+
+ H.getNotebookStep("summarize").findByText("Total: 50 bins");
+ H.visualize();
+
+ getTitle("Count by Total: 50 bins");
+ H.chartPathWithFillColor("#509EE3");
+ // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
+ cy.findByText("70");
});
- it("should render time series binning options correctly", () => {
+ it("should render and apply time series binning options", () => {
chooseInitialBinningOption({
table: ORDERS_ID,
mode: "notebook",
@@ -127,9 +175,18 @@ describe("scenarios > binning > binning options", () => {
isSelected: "Month",
shouldExpandList: true,
});
+ selectOption("Quarter");
+
+ H.getNotebookStep("summarize").findByText("Created At: Quarter");
+ H.visualize();
+
+ getTitle("Count by Created At: Quarter");
+ H.cartesianChartCircle();
+ // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
+ cy.findByText("Q1 2026");
});
- it("should render longitude/latitude binning options correctly", () => {
+ it("should render and apply longitude/latitude binning options", () => {
chooseInitialBinningOption({
table: PEOPLE_ID,
mode: "notebook",
@@ -147,21 +204,62 @@ describe("scenarios > binning > binning options", () => {
isSelected: "Auto bin",
shouldExpandList: true,
});
+ selectOption("Bin every 20 degrees");
+
+ H.getNotebookStep("summarize").findByText("Longitude: 20°");
+ H.visualize();
+
+ getTitle("Count by Longitude: 20°");
+ H.chartPathWithFillColor("#509EE3");
+ // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
+ cy.findByText("180° W");
});
});
- context("via time series footer (metabase#11183)", () => {
- it("should render time series binning options correctly", () => {
+ context("via column popover", () => {
+ it("should work for number", () => {
+ H.openTable({ table: ORDERS_ID });
+ H.tableHeaderClick("Total");
+ H.popover().findByText("Distribution").click();
+
+ getTitle("Count by Total: Auto binned");
+
+ H.chartPathWithFillColor("#509EE3");
+ // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
+ cy.findByText("60");
+ });
+
+ it("should work for time series", () => {
H.openTable({ table: ORDERS_ID });
H.tableHeaderClick("Created At");
H.popover().findByText("Distribution").click();
+
getTitle("Count by Created At: Month");
+
+ H.cartesianChartCircle();
+ // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
+ cy.findByText("January 2026");
+
+ cy.log(
+ "time series footer highlights the current bucket (metabase#11183)",
+ );
cy.findByTestId("timeseries-bucket-button").click();
- H.popover().within(() => {
- cy.findByText("Month")
- .parent()
- .should("have.attr", "aria-selected", "true");
- });
+ H.popover()
+ .findByText("Month")
+ .parent()
+ .should("have.attr", "aria-selected", "true");
+ });
+
+ it("should work for longitude/latitude", () => {
+ H.openTable({ table: PEOPLE_ID });
+ H.tableHeaderClick("Longitude");
+ H.popover().findByText("Distribution").click();
+
+ getTitle("Count by Longitude: Auto binned");
+
+ H.chartPathWithFillColor("#509EE3");
+ // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
+ cy.findByText("170° W");
});
});
});
@@ -216,3 +314,8 @@ function getAllOptions({ options, isSelected, shouldExpandList } = {}) {
}
});
}
+
+function selectOption(option) {
+ // eslint-disable-next-line metabase/no-unsafe-element-filtering
+ H.popover().last().findByText(option).click();
+}
diff --git a/e2e/test/scenarios/binning/correctness/longitude.cy.spec.js b/e2e/test/scenarios/binning/correctness/longitude.cy.spec.js
index 87b4e9a6fdc..7e0629b0ffc 100644
--- a/e2e/test/scenarios/binning/correctness/longitude.cy.spec.js
+++ b/e2e/test/scenarios/binning/correctness/longitude.cy.spec.js
@@ -8,26 +8,43 @@ describe("scenarios > binning > correctness > longitude", () => {
beforeEach(() => {
H.restore();
cy.signInAsAdmin();
+ });
+
+ it("should return correct values for every bucket size", () => {
+ // Increase viewport to allow checking x-axis ticks values on dense data
+ cy.viewport(1440, 800);
H.openPeopleTable();
H.summarize();
+
+ cy.log("the first bucket is picked from the unselected column");
openPopoverFromDefaultBucketSize("Longitude", "Auto bin");
- });
- Object.entries(LONGITUDE_OPTIONS).forEach(
- ([bucketSize, { selected, representativeValues }]) => {
- it(`should return correct values for ${bucketSize}`, () => {
- // Increase viewport to allow checking x-axis ticks values on dense data
- cy.viewport(1440, 800);
- H.popover().within(() => {
- cy.findByText("More…").click();
- cy.findByText(bucketSize).click();
+ Object.entries(LONGITUDE_OPTIONS).forEach(
+ (
+ [bucketSize, { selected, representativeValues, isHiddenByDefault }],
+ index,
+ entries,
+ ) => {
+ cy.log(bucketSize);
+
+ if (index > 0) {
+ openSelectedBinningPopover();
+ }
+
+ // The popover opens expanded when the current bucket is a hidden one.
+ const isExpanded =
+ index > 0 && Boolean(entries[index - 1][1].isHiddenByDefault);
+
+ pickBucket({
+ bucketSize,
+ shouldExpand: Boolean(isHiddenByDefault) && !isExpanded,
+ alias: `dataset-${index}`,
});
cy.get("li[aria-selected='true']")
.should("contain", "Longitude")
.and("contain", selected);
- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
cy.findByText("Done").click();
getTitle(`Count by Longitude: ${selected}`);
@@ -35,14 +52,16 @@ describe("scenarios > binning > correctness > longitude", () => {
assertOnXYAxisLabels();
assertOnXAxisTicks(representativeValues);
- });
- },
- );
+ },
+ );
- it("Don't bin", () => {
- H.popover().within(() => {
- cy.findByText("More…").click();
- cy.findByText("Don't bin").click();
+ cy.log("Don't bin");
+ openSelectedBinningPopover();
+ // The previous bucket is a hidden one, so the popover is already expanded.
+ pickBucket({
+ bucketSize: "Don't bin",
+ shouldExpand: false,
+ alias: "dataset-unbinned",
});
cy.get("li[aria-selected='true']")
@@ -53,21 +72,42 @@ describe("scenarios > binning > correctness > longitude", () => {
cy.findByText("Done").click();
getTitle("Count by Longitude");
- cy.get("[data-testid=cell-data]")
- .should("contain", "Longitude")
- .should("contain", "Count")
- .and("contain", "166.54257260° W")
- .and("contain", "1");
+ H.assertTableData({
+ columns: ["Longitude", "Count"],
+ firstRows: [
+ ["166.54257260° W", "1"],
+ ["166.09897770° W", "1"],
+ ],
+ });
});
});
+function openSelectedBinningPopover() {
+ H.summarize();
+ H.getBinningButtonForDimension({
+ name: "Longitude",
+ isSelected: true,
+ }).click({ force: true });
+}
+
+function pickBucket({ bucketSize, shouldExpand, alias }) {
+ cy.intercept("POST", "/api/dataset").as(alias);
+ H.popover().within(() => {
+ if (shouldExpand) {
+ cy.findByText("More…").click();
+ }
+ cy.findByText(bucketSize).click();
+ });
+ cy.wait(`@${alias}`);
+}
+
function getTitle(title) {
cy.findByText(title);
}
function assertOnXYAxisLabels() {
- H.echartsContainer().get("text").contains("Count");
- H.echartsContainer().get("text").contains("Longitude");
+ H.echartsContainer().find("text").should("contain", "Count");
+ H.echartsContainer().find("text").should("contain", "Longitude");
}
function assertOnXAxisTicks(values) {
diff --git a/e2e/test/scenarios/binning/correctness/shared/constants.js b/e2e/test/scenarios/binning/correctness/shared/constants.js
index 1c44660d910..ad0a675ef13 100644
--- a/e2e/test/scenarios/binning/correctness/shared/constants.js
+++ b/e2e/test/scenarios/binning/correctness/shared/constants.js
@@ -1,79 +1,143 @@
export const TIME_OPTIONS = {
Minute: {
selected: "by minute",
- representativeValues: ["April 30, 2025, 6:56 PM", "May 10, 2025, 9:38 AM"],
+ firstRows: [
+ ["April 30, 2025, 6:56 PM", "1"],
+ ["May 4, 2025, 6:29 PM", "1"],
+ ["May 6, 2025, 12:28 AM", "1"],
+ ],
},
Hour: {
selected: "by hour",
- representativeValues: ["April 30, 2025, 6:00 PM", "May 10, 2025, 9:00 AM"],
+ firstRows: [
+ ["April 30, 2025, 6:00 PM", "1"],
+ ["May 4, 2025, 6:00 PM", "1"],
+ ["May 6, 2025, 12:00 AM", "1"],
+ ],
},
Day: {
selected: "by day",
- representativeValues: ["April 30, 2025", "May 10, 2025"],
+ firstRows: [
+ ["April 30, 2025", "1"],
+ ["May 4, 2025", "1"],
+ ["May 6, 2025", "1"],
+ ],
},
Week: {
selected: "by week",
- representativeValues: [
- "April 27, 2025 – May 3, 2025",
- "May 11, 2025 – May 17, 2025",
+ firstRows: [
+ ["April 27, 2025 – May 3, 2025", "1"],
+ ["May 4, 2025 – May 10, 2025", "4"],
+ ["May 11, 2025 – May 17, 2025", "3"],
],
},
Month: {
selected: "by month",
- representativeValues: ["April 2025", "May 2025"],
+ firstRows: [
+ ["April 2025", "1"],
+ ["May 2025", "19"],
+ ["June 2025", "37"],
+ ],
},
Quarter: {
selected: "by quarter",
- representativeValues: ["Q2 2025", "Q1 2026", "Q1 2027", "Q1 2028"],
+ firstRows: [
+ ["Q2 2025", "57"],
+ ["Q3 2025", "235"],
+ ["Q4 2025", "452"],
+ ],
},
Year: {
selected: "by year",
- representativeValues: ["2025", "2026", "2027", "2028", "2029"],
+ firstRows: [
+ ["2025", "744"],
+ ["2026", "3,610"],
+ ["2027", "5,834"],
+ ["2028", "6,578"],
+ ["2029", "1,994"],
+ ],
},
"Minute of hour": {
selected: "by minute of hour",
- representativeValues: ["0", "5", "8", "13"],
- type: "extended",
+ firstRows: [
+ ["0", "297"],
+ ["1", "313"],
+ ["2", "295"],
+ ],
isHiddenByDefault: true,
},
"Hour of day": {
selected: "by hour of day",
- representativeValues: ["12:00 AM", "3:00 AM", "12:00 PM", "8:00 PM"],
+ firstRows: [
+ ["12:00 AM", "766"],
+ ["1:00 AM", "807"],
+ ["2:00 AM", "741"],
+ ],
isHiddenByDefault: true,
},
"Day of week": {
selected: "by day of week",
- representativeValues: ["Saturday", "Tuesday", "Friday", "Sunday"],
+ firstRows: [
+ ["Sunday", "2,678"],
+ ["Monday", "2,719"],
+ ["Tuesday", "2,590"],
+ ],
isHiddenByDefault: true,
},
"Day of month": {
selected: "by day of month",
- representativeValues: ["5", "10", "15", "30"],
+ firstRows: [
+ ["1", "604"],
+ ["2", "604"],
+ ["3", "582"],
+ ],
isHiddenByDefault: true,
},
"Day of year": {
selected: "by day of year",
- representativeValues: ["1", "10", "12"],
+ firstRows: [
+ ["1", "45"],
+ ["2", "56"],
+ ["3", "58"],
+ ],
isHiddenByDefault: true,
},
"Week of year": {
selected: "by week of year",
- representativeValues: ["1st", "2nd", "3rd", "10th"],
+ firstRows: [
+ ["1st", "402"],
+ ["2nd", "405"],
+ ["3rd", "424"],
+ ],
isHiddenByDefault: true,
},
"Month of year": {
selected: "by month of year",
- representativeValues: ["January", "June", "December"],
+ firstRows: [
+ ["January", "1,826"],
+ ["February", "1,686"],
+ ["March", "1,801"],
+ ],
isHiddenByDefault: true,
},
"Quarter of year": {
selected: "by quarter of year",
- representativeValues: ["Q1", "Q2", "Q3", "Q4"],
+ firstRows: [
+ ["Q1", "5,313"],
+ ["Q2", "4,203"],
+ ["Q3", "4,402"],
+ ["Q4", "4,842"],
+ ],
isHiddenByDefault: true,
},
};
+// "Bin every 20 degrees" comes first so it is picked from the unselected column.
export const LONGITUDE_OPTIONS = {
+ "Bin every 20 degrees": {
+ selected: "20°",
+ representativeValues: ["180° W", "160° W", "100° W", "80° W", "60° W"],
+ },
"Auto bin": {
selected: "Auto binned",
representativeValues: ["170° W", "100° W", "60° W"],
@@ -90,20 +154,19 @@ export const LONGITUDE_OPTIONS = {
selected: "10°",
representativeValues: ["170° W", "100° W", "60° W"],
},
- "Bin every 20 degrees": {
- selected: "20°",
- representativeValues: ["180° W", "160° W", "100° W", "80° W", "60° W"],
- },
"Bin every 0.05 degrees": {
selected: "0.05°",
representativeValues: null,
+ isHiddenByDefault: true,
},
"Bin every 0.01 degrees": {
selected: "0.01°",
representativeValues: null,
+ isHiddenByDefault: true,
},
"Bin every 0.005 degrees": {
selected: "0.005°",
representativeValues: null,
+ isHiddenByDefault: true,
},
};
diff --git a/e2e/test/scenarios/binning/correctness/time-series.cy.spec.js b/e2e/test/scenarios/binning/correctness/time-series.cy.spec.js
index 66e6a683c6d..b715effdd99 100644
--- a/e2e/test/scenarios/binning/correctness/time-series.cy.spec.js
+++ b/e2e/test/scenarios/binning/correctness/time-series.cy.spec.js
@@ -13,35 +13,49 @@ const questionDetails = {
},
};
-/**
- * The list of issues this spec covers:
- * - metabase#11183
- * -
- */
describe("scenarios > binning > correctness > time series", () => {
beforeEach(() => {
H.restore();
cy.signInAsAdmin();
+ });
- cy.intercept("POST", "/api/dataset").as("dataset");
-
+ it("should return correct values for every bucket size", () => {
H.createQuestion(questionDetails, { visitQuestion: true });
-
H.summarize();
- openPopoverFromDefaultBucketSize("Created At", "by month");
- });
-
- Object.entries(TIME_OPTIONS).forEach(
- ([bucketSize, { selected, isHiddenByDefault, representativeValues }]) => {
- it(`should return correct values for ${bucketSize}`, () => {
+ cy.log("the first bucket is picked from the unselected column");
+ H.getBinningButtonForDimension({ name: "Created At" })
+ .should("have.text", "by month")
+ .click({ force: true });
+
+ Object.entries(TIME_OPTIONS).forEach(
+ (
+ [bucketSize, { selected, isHiddenByDefault, firstRows }],
+ index,
+ entries,
+ ) => {
+ cy.log(bucketSize);
+
+ if (index > 0) {
+ H.summarize();
+ H.getBinningButtonForDimension({
+ name: "Created At",
+ isSelected: true,
+ }).click({ force: true });
+ }
+
+ // The popover opens expanded when the current bucket is a hidden one.
+ const isExpanded =
+ index > 0 && Boolean(entries[index - 1][1].isHiddenByDefault);
+
+ cy.intercept("POST", "/api/dataset").as(`dataset-${index}`);
H.popover().within(() => {
- if (isHiddenByDefault) {
+ if (isHiddenByDefault && !isExpanded) {
cy.button("More…").click();
}
cy.findByText(bucketSize).click();
- cy.wait("@dataset");
});
+ cy.wait(`@dataset-${index}`);
H.getBinningButtonForDimension({
name: "Created At",
@@ -52,36 +66,21 @@ describe("scenarios > binning > correctness > time series", () => {
getTitle(`Count by Created At: ${bucketSize}`);
- assertOnHeaderCells(bucketSize);
- assertOnTableValues(representativeValues);
+ H.assertTableData({
+ columns: [`Created At: ${bucketSize}`, "Count"],
+ firstRows,
+ });
assertOnTimeSeriesFooter(bucketSize);
- });
- },
- );
+ },
+ );
+ });
});
-function openPopoverFromDefaultBucketSize(name, bucket) {
- H.getBinningButtonForDimension({ name })
- .should("have.text", bucket)
- .click({ force: true });
-}
-
function getTitle(title) {
cy.findByText(title);
}
-function assertOnHeaderCells(bucketSize) {
- cy.get("[data-testid=cell-data]").eq(0).contains(`Created At: ${bucketSize}`);
- cy.get("[data-testid=cell-data]").eq(1).contains("Count");
-}
-
-function assertOnTableValues(values) {
- values.map((v) => {
- cy.get("[data-testid=cell-data]").contains(v).scrollIntoView();
- });
-}
-
function assertOnTimeSeriesFooter(str) {
cy.findByTestId("timeseries-filter-button")
.invoke("text")
diff --git a/e2e/test/scenarios/binning/qb-regular-table.cy.spec.js b/e2e/test/scenarios/binning/qb-regular-table.cy.spec.js
deleted file mode 100644
index 38bcbeaeb3c..00000000000
--- a/e2e/test/scenarios/binning/qb-regular-table.cy.spec.js
+++ /dev/null
@@ -1,183 +0,0 @@
-const { H } = cy;
-import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database";
-
-const { ORDERS_ID, PEOPLE_ID } = SAMPLE_DATABASE;
-
-describe("scenarios > binning > binning options", () => {
- beforeEach(() => {
- H.restore();
- cy.signInAsAdmin();
- });
-
- context("via simple question", () => {
- it("should work for number", () => {
- chooseInitialBinningOption({
- table: ORDERS_ID,
- column: "Total",
- defaultBucket: "Auto bin",
- bucketSize: "50 bins",
- });
-
- getTitle("Count by Total: 50 bins");
-
- H.chartPathWithFillColor("#509EE3");
- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
- cy.findByText("70");
- });
-
- it("should work for time series", () => {
- chooseInitialBinningOption({
- table: ORDERS_ID,
- column: "Created At",
- defaultBucket: "by month",
- bucketSize: "Quarter",
- });
-
- getTitle("Count by Created At: Quarter");
-
- H.cartesianChartCircle();
- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
- cy.findByText("Q1 2026");
- });
-
- it("should work for longitude/latitude", () => {
- chooseInitialBinningOption({
- table: PEOPLE_ID,
- column: "Longitude",
- defaultBucket: "Auto bin",
- bucketSize: "Bin every 20 degrees",
- });
-
- getTitle("Count by Longitude: 20°");
-
- H.chartPathWithFillColor("#509EE3");
- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
- cy.findByText("180° W");
- });
- });
-
- context("via custom question", () => {
- it("should work for number", () => {
- chooseInitialBinningOption({
- table: ORDERS_ID,
- column: "Total",
- defaultBucket: "Auto bin",
- bucketSize: "50 bins",
- mode: "notebook",
- });
-
- getTitle("Count by Total: 50 bins");
-
- H.chartPathWithFillColor("#509EE3");
- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
- cy.findByText("70");
- });
-
- it("should work for time series", () => {
- chooseInitialBinningOption({
- table: ORDERS_ID,
- column: "Created At",
- defaultBucket: "by month",
- bucketSize: "Quarter",
- mode: "notebook",
- });
-
- getTitle("Count by Created At: Quarter");
-
- H.cartesianChartCircle();
- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
- cy.findByText("Q1 2026");
- });
-
- it("should work for longitude/latitude", () => {
- chooseInitialBinningOption({
- table: PEOPLE_ID,
- column: "Longitude",
- defaultBucket: "Auto bin",
- bucketSize: "Bin every 20 degrees",
- mode: "notebook",
- });
-
- getTitle("Count by Longitude: 20°");
-
- H.chartPathWithFillColor("#509EE3");
- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
- cy.findByText("180° W");
- });
- });
-
- context("via column popover", () => {
- it("should work for number", () => {
- H.openTable({ table: ORDERS_ID });
- H.tableHeaderClick("Total");
- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
- cy.findByText("Distribution").click();
-
- getTitle("Count by Total: Auto binned");
-
- H.chartPathWithFillColor("#509EE3");
- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
- cy.findByText("60");
- });
-
- it("should work for time series", () => {
- H.openTable({ table: ORDERS_ID });
- H.tableHeaderClick("Created At");
- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
- cy.findByText("Distribution").click();
-
- getTitle("Count by Created At: Month");
-
- H.cartesianChartCircle();
- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
- cy.findByText("January 2026");
- });
-
- it("should work for longitude/latitude", () => {
- H.openTable({ table: PEOPLE_ID });
- H.tableHeaderClick("Longitude");
- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
- cy.findByText("Distribution").click();
-
- getTitle("Count by Longitude: Auto binned");
-
- H.chartPathWithFillColor("#509EE3");
- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage
- cy.findByText("170° W");
- });
- });
-});
-
-function chooseInitialBinningOption({
- table,
- column,
- defaultBucket,
- bucketSize,
- mode = null,
-} = {}) {
- H.openTable({ table, mode });
- H.summarize({ mode });
-
- if (mode === "notebook") {
- cy.findByText("Count of rows").click();
- cy.findByText("Pick a column to group by").click();
-
- H.changeBinningForDimension({
- name: column,
- fromBinning: defaultBucket,
- toBinning: bucketSize,
- });
-
- H.visualize();
- } else {
- H.changeBinningForDimension({
- name: column,
- fromBinning: defaultBucket,
- toBinning: bucketSize,
- });
- }
-}
-
-function getTitle(title) {
- cy.findByText(title);
-}
diff --git a/e2e/test/scenarios/binning/reproductions/34688-34690-time-series-footer.cy.spec.js b/e2e/test/scenarios/binning/reproductions/34688-34690-time-series-footer.cy.spec.js
index 33329c9697d..3e3e93afc8f 100644
--- a/e2e/test/scenarios/binning/reproductions/34688-34690-time-series-footer.cy.spec.js
+++ b/e2e/test/scenarios/binning/reproductions/34688-34690-time-series-footer.cy.spec.js
@@ -39,37 +39,22 @@ describe("issues 34688 and 34690", () => {
cy.signInAsNormalUser();
});
- it("shows time series footer when category breakout is before temporal breakout (metabase#34688)", () => {
- H.createQuestion(
- {
- database: SAMPLE_DB_ID,
- type: "query",
- query: {
- ...BASE_QUERY,
- breakout: [CUSTOM_COLUMN_BREAKOUT, CREATED_AT_BREAKOUT],
+ it("shows time series footer with a category breakout before or after the temporal one (metabase#34688, metabase#34690)", () => {
+ [
+ [CUSTOM_COLUMN_BREAKOUT, CREATED_AT_BREAKOUT],
+ [CREATED_AT_BREAKOUT, CUSTOM_COLUMN_BREAKOUT],
+ ].forEach((breakout) => {
+ H.createQuestion(
+ {
+ database: SAMPLE_DB_ID,
+ type: "query",
+ query: { ...BASE_QUERY, breakout },
},
- },
- { visitQuestion: true },
- );
+ { visitQuestion: true },
+ );
- cy.findByTestId("timeseries-filter-button").should("exist");
- cy.findByTestId("timeseries-bucket-button").should("exist");
- });
-
- it("shows time series footer when there is a category breakout (metabase#34690)", () => {
- H.createQuestion(
- {
- database: SAMPLE_DB_ID,
- type: "query",
- query: {
- ...BASE_QUERY,
- breakout: [CREATED_AT_BREAKOUT, CUSTOM_COLUMN_BREAKOUT],
- },
- },
- { visitQuestion: true },
- );
-
- cy.findByTestId("timeseries-filter-button").should("exist");
- cy.findByTestId("timeseries-bucket-button").should("exist");
+ cy.findByTestId("timeseries-filter-button").should("exist");
+ cy.findByTestId("timeseries-bucket-button").should("exist");
+ });
});
});