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
Fix skipped chart drill-through e2e tests (#63548)
Fraserd50561227fd9
diff --git a/e2e/test/scenarios/visualizations-tabular/drillthroughs/chart_drill.cy.spec.js b/e2e/test/scenarios/visualizations-tabular/drillthroughs/chart_drill.cy.spec.jsindex 52d5acadae3..22886aef879 100644--- a/e2e/test/scenarios/visualizations-tabular/drillthroughs/chart_drill.cy.spec.js+++ b/e2e/test/scenarios/visualizations-tabular/drillthroughs/chart_drill.cy.spec.js@@ -274,101 +274,79 @@ describe("scenarios > visualizations > drillthroughs > chart drill", () => {cy.contains("Dominique Leffler");});- it(- "should drill through a with date filter (metabase#12496)",- { tags: "@skip" },- () => {- H.createQuestion({- name: "Orders by Created At: Week",- query: {- "source-table": ORDERS_ID,- aggregation: [["count"]],- breakout: [["field", ORDERS.CREATED_AT, { "temporal-unit": "week" }]],- },- display: "line",- });+ it("should drill through a with date filter (metabase#12496)", () => {+ H.createQuestion({+ name: "Orders by Created At: Week",+ query: {+ "source-table": ORDERS_ID,+ aggregation: [["count"]],+ breakout: [["field", ORDERS.CREATED_AT, { "temporal-unit": "week" }]],+ },+ display: "line",+ });- // Load the question up- cy.visit("/collection/root");- // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage- cy.contains("Orders by Created At: Week").click({ force: true });- // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage- cy.contains("January 2025");+ cy.visit("/collection/root");+ cy.findAllByTestId("collection-entry-name")+ .contains("Orders by Created At: Week")+ .click();- // drill into a recent week- // eslint-disable-next-line no-unsafe-element-filtering- cy.get(".dot").eq(-4).click({ force: true });- // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage- cy.contains("See these Orders").click();-- // check that filter is applied and rows displayed- // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage- cy.contains("Showing 127 rows");-- cy.log("Filter should show the range between two dates");- // Now click on the filter widget to see if the proper parameters got passed in- // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage- cy.contains(/^Created At is .*–/).click(); // en-dash to detect date range- },- );-- it(- "should drill-through on filtered aggregated results (metabase#13504)",- { tags: "@skip" },- () => {- H.openOrdersTable({ mode: "notebook" });- H.summarize({ mode: "notebook" });- // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage- cy.findByText("Count of rows").click();- // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage- cy.findByText("Pick a column to group by").click();- // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage- cy.findByText("Created At").click();-- // add filter: Count > 1- // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage- cy.findByText("Filter").click();- H.popover().within(() => {- cy.findByText("Count").click();- cy.findByText("Equal to").click();- });- // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage- cy.findByText("Greater than").click();+ H.echartsContainer().contains("January 2025");+ // drill into a recent week+ H.cartesianChartCircle().should("have.length.gte", 4).eq(-4).click();++ H.popover().contains("See these Orders").click();++ // check that filter is applied and rows displayed+ H.assertQueryBuilderRowCount(127);++ cy.log("Filter should show the range between two dates");+ // Now click on the filter widget to see if the proper parameters got passed in+ cy.findByTestId("filter-pill")+ .contains(/^Created At: Week is .*–/)+ .click(); // en-dash to detect date range+ });++ it("should drill-through on filtered aggregated results (metabase#13504)", () => {+ H.openOrdersTable({ mode: "notebook" });+ H.summarize({ mode: "notebook" });+ H.popover().contains("Count of rows").click();+ cy.findByTestId("breakout-step")+ .contains("Pick a column to group by")+ .click();+ H.popover().contains("Created At").click();+ cy.findByTestId("step-summarize-0-0").within(() => {+ cy.icon("filter").click();+ });+ H.popover().within(() => {+ cy.contains("Count").click();+ cy.contains("Between").click();+ });+ H.popover()+ .should("have.length", 2)+ .last()+ .contains("Greater than")+ .click();+ H.popover().within(() => {cy.findByPlaceholderText("Enter a number").click().type("1");- // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage- cy.findByText("Add filter").click();-- H.visualize();-- // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage- cy.findByText("Visualization").click();- cy.icon("line").click();- // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage- cy.findByText("Done").click();- cy.log("Mid-point assertion");- // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage- cy.contains("Count by Created At: Month");- // at this point, filter is displaying correctly with the name- // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage- cy.contains("Count is greater than 1");-- // drill-through- cy.get(".dot")- .eq(10) // random dot- .click({ force: true });- // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage- cy.findByText("See these Orders").click();-- cy.log("Reproduced on 0.34.3, 0.35.4, 0.36.7 and 0.37.0-rc2");- // when the bug is present, filter is missing a name (showing only "is 256")- // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage- cy.contains("Count is equal to 256");- // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage- cy.findByText("There was a problem with your question").should(- "not.exist",- );- },- );+ cy.button("Add filter").click();+ });+ H.visualize();+ cy.button("Visualization").click();+ cy.icon("line").click();+ cy.button("Done").click();+ cy.log("Mid-point assertion");+ // at this point, filter is displaying correctly with the name+ cy.findByTestId("filter-pill").contains("Count is greater than 1");++ // drill-through+ H.cartesianChartCircle().should("have.length.gte", 10).eq(10).click();++ H.clickActionsPopover().contains("See these Orders").click();++ cy.log("Reproduced on 0.34.3, 0.35.4, 0.36.7 and 0.37.0-rc2");+ // when the bug is present, filter is missing a name (showing only "is 256")+ H.assertQueryBuilderRowCount(256);+ });it("should display correct value in a tooltip for unaggregated data (metabase#11907)", () => {H.createNativeQuestion(@@ -501,84 +479,80 @@ describe("scenarios > visualizations > drillthroughs > chart drill", () => {});});- it(- "should drill-through a custom question that joins a native SQL question (metabase#14495)",- { tags: "@skip" },- () => {- // Restrict "normal user" (belongs to the DATA_GROUP) from writing native queries- cy.log("Fetch permissions graph");- cy.request("GET", "/api/permissions/graph", {}).then(- ({ body: { groups, revision } }) => {- // This mutates the original `groups` object => we'll pass it next to the `PUT` request- groups[DATA_GROUP] = {- // database_id = 1 (SAMPLE_DATABASE)- 1: { schemas: "all", native: "none" },- };-- cy.log("Update/save permissions");- cy.request("PUT", "/api/permissions/graph", {- groups,- revision,- });- },- );+ it("should drill-through a custom question that joins a native SQL question (metabase#14495)", () => {+ // Restrict "normal user" (belongs to the DATA_GROUP) from writing native queries+ cy.log("Fetch permissions graph");+ cy.request("GET", "/api/permissions/graph", {}).then(+ ({ body: { groups, revision } }) => {+ // This mutates the original `groups` object => we'll pass it next to the `PUT` request+ groups[DATA_GROUP] = {+ // database_id = 1 (SAMPLE_DATABASE)+ 1: { schemas: "all", native: "none" },+ };++ cy.log("Update/save permissions");+ cy.request("PUT", "/api/permissions/graph", {+ groups,+ revision,+ });+ },+ );- H.createNativeQuestion({- name: "14495_SQL",- native: { query: "SELECT * FROM ORDERS", "template-tags": {} },- }).then(({ body: { id: SQL_ID } }) => {- const ALIAS = `Question ${SQL_ID}`;+ H.createNativeQuestion({+ name: "14495_SQL",+ native: { query: "SELECT * FROM ORDERS", "template-tags": {} },+ }).then(({ body: { id: SQL_ID } }) => {+ const ALIAS = `Question ${SQL_ID}`;- // Create a QB question and join it with the previously created native question- H.createQuestion({- name: "14495",- query: {- "source-table": PEOPLE_ID,- joins: [- {- fields: "all",- "source-table": `card__${SQL_ID}`,- condition: [- "=",- ["field", PEOPLE.ID, null],- [- "field",- "ID",- { "base-type": "type/BigInteger", "join-alias": ALIAS },- ],+ // Create a QB question and join it with the previously created native question+ H.createQuestion({+ name: "14495",+ query: {+ "source-table": PEOPLE_ID,+ joins: [+ {+ fields: "all",+ "source-table": `card__${SQL_ID}`,+ condition: [+ "=",+ ["field", PEOPLE.ID, null],+ [+ "field",+ "ID",+ { "base-type": "type/BigInteger", "join-alias": ALIAS },],- alias: ALIAS,- },- ],- aggregation: [["count"]],- breakout: [- ["field", PEOPLE.CREATED_AT, { "temporal-unit": "month" }],- ],- },- display: "bar",- }).then(({ body: { id: QUESTION_ID } }) => {- cy.intercept("POST", "/api/dataset").as("dataset");-- // Switch to the normal user who has restricted SQL access- cy.signInAsNormalUser();- H.visitQuestion(QUESTION_ID);-- // Initial visualization has rendered and we can now drill-through- cy.findByTestId("query-visualization-root")- .get(".bar")- .eq(4)- .click({ force: true });- cy.findByText("See these People").click();-- // We should see the resulting dataset of that drill-through- cy.wait("@dataset").then((xhr) => {- expect(xhr.response.body.error).not.to.exist;- });- cy.findByText("Macy Olson");+ ],+ alias: ALIAS,+ },+ ],+ aggregation: [["count"]],+ breakout: [+ ["field", PEOPLE.CREATED_AT, { "temporal-unit": "month" }],+ ],+ },+ display: "bar",+ }).then(({ body: { id: QUESTION_ID } }) => {+ cy.intercept("POST", "/api/dataset").as("dataset");++ // Switch to the normal user who has restricted SQL access+ cy.signInAsNormalUser();+ H.visitQuestion(QUESTION_ID);++ // Initial visualization has rendered and we can now drill-through+ H.chartPathWithFillColor("#509EE3")+ .should("have.length.gte", 4)+ .eq(4)+ .click();+ cy.findByText("See these People").click();++ // We should see the resulting dataset of that drill-through+ cy.wait("@dataset").then((xhr) => {+ expect(xhr.response.body.error).not.to.exist;});+ cy.findByText("Macy Olson");});- },- );+ });+ });it("count of rows from drill-down on binned results should match the number of records (metabase#15324)", () => {H.visitQuestionAdhoc({