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 dashboard filters e2e tests (final sweep) (#83789)
Nemanja Glumac174c93b8441e
diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filter-data-permissions.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filter-data-permissions.cy.spec.jsindex 1903206f9b5..0254a522201 100644--- a/e2e/test/scenarios/dashboard-filters/dashboard-filter-data-permissions.cy.spec.js+++ b/e2e/test/scenarios/dashboard-filters/dashboard-filter-data-permissions.cy.spec.js@@ -2,7 +2,6 @@ const { H } = cy;import { ORDERS_DASHBOARD_ID } from "e2e/support/cypress_sample_instance_data";function filterDashboard() {- H.visitDashboard(ORDERS_DASHBOARD_ID);H.filterWidget().click();cy.findByPlaceholderText("Search the list").type("Main Street");@@ -38,16 +37,14 @@ describe("support > permissions (metabase#8472)", () => {"Address",);- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.contains("Done").click();- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.contains("Save").click();+ H.saveDashboard();});it("should let admin and nodata users use the filter, and hide filter mapping from nodata users in edit mode", () => {filterDashboard();cy.signIn("nodata");+ H.visitDashboard(ORDERS_DASHBOARD_ID);filterDashboard();H.editDashboard();diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filter-defaults.cy.spec.ts b/e2e/test/scenarios/dashboard-filters/dashboard-filter-defaults.cy.spec.tsindex 78b217ab24f..26b9f39a247 100644--- a/e2e/test/scenarios/dashboard-filters/dashboard-filter-defaults.cy.spec.ts+++ b/e2e/test/scenarios/dashboard-filters/dashboard-filter-defaults.cy.spec.ts@@ -124,6 +124,16 @@ describe("scenarios > dashboard > filters > reset", () => {H.filterWidget().contains("Baz").should("be.visible");H.filterWidget().contains("Foo").should("be.visible");++ cy.log("Keep a long value inside the filter box (metabase#59306)");+ H.clearFilterWidget(0);+ H.filterWidget({ name: "Filter One" }).click();+ H.popover().within(() => {+ cy.findByPlaceholderText("Enter some text")+ .type("asdf".repeat(20))+ .invoke("outerWidth")+ .should("be.lt", 400);+ });});});diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-auto-apply.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-auto-apply.cy.spec.jsindex a743cfe08c8..f8a0cf0864b 100644--- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-auto-apply.cy.spec.js+++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-auto-apply.cy.spec.js@@ -25,12 +25,6 @@ const QUESTION_DETAILS = {query: { "source-table": PRODUCTS_ID },};-function createDashboardDetails({ parameters }) {- return {- parameters,- };-}-const filterToggleLabel = "Auto-apply filters";describe(@@ -48,7 +42,12 @@ describe(});describe("modifying only dashboard", () => {- it("should handle toggling auto applying filters on and off", () => {+ it("should handle toggling auto applying filters on and off and send snowplow events only when disabling them", () => {+ H.resetSnowplow();+ cy.signInAsAdmin();+ H.enableTracking();+ cy.signInAsNormalUser();+createDashboard();openDashboard();cy.wait("@cardQuery");@@ -73,6 +72,9 @@ describe(cy.wait("@updateDashboard");cy.findByLabelText(filterToggleLabel).should("not.be.checked");});+ H.expectUnstructuredSnowplowEvent({+ event: "auto_apply_filters_disabled",+ });H.closeDashboardSettingsSidebar();H.filterWidget().findByText("Gadget").should("be.visible");H.assertTableRowsCount(53);@@ -108,6 +110,10 @@ describe(cy.wait("@updateDashboard");cy.findByLabelText(filterToggleLabel).should("be.checked");});+ cy.log("enabling auto-apply filters should not send an event");+ H.expectUnstructuredSnowplowEvent({+ event: "auto_apply_filters_disabled",+ });H.closeDashboardSettingsSidebar();H.filterWidget().findByText("Widget").should("be.visible");@@ -136,52 +142,16 @@ describe(cy.get("@cardQuery.all").should("have.length", 5);cy.get("@updateDashboardSpy").should("have.callCount", 3);- });- });-- it("should not save unapplied filter state and allow resetting it", () => {- createDashboard({ dashboardDetails: { auto_apply_filters: false } });- openDashboard();-- H.filterWidget().findByText(FILTER.name).click();- H.popover().within(() => {- cy.findByText("Gadget").click();- cy.button("Add filter").click();- });-- H.applyFilterButton().should("be.visible");- H.applyFilterToast().findByText("1 filter changed");-- cy.log("verify filter value is not saved");-- H.visitDashboard("@dashboardId");- H.filterWidget()- .should("contain", FILTER.name)- .and("not.contain", "Gadget");-- cy.log("verify unapplied filter value can be reset");-- H.filterWidget().findByText(FILTER.name).click();- H.popover().within(() => {- cy.findByLabelText("Gadget").click();- cy.findByLabelText("Gadget").should("be.checked");- cy.button("Add filter").click();- });-- H.applyFilterButton().should("be.visible");- H.applyFilterToast().findByText("1 filter changed");-- H.cancelFilterButton().click();- H.applyFilterToast().should("not.exist");-- H.filterWidget().findByText(FILTER.name).click();- H.popover().within(() => {- cy.findByLabelText("Gadget").should("not.be.checked");+ H.expectUnstructuredSnowplowEvent(+ { event: "auto_apply_filters_disabled" },+ 2,+ );+ H.expectNoBadSnowplowEvents();});});describe("modifying dashboard and dashboard cards", () => {- it("should preserve draft parameter values when editing is cancelled but not when the dashboard is saved", () => {+ it("should not save draft parameter values, allow resetting them, and keep them when editing is cancelled but not when the dashboard is saved", () => {createDashboard({ dashboardDetails: { auto_apply_filters: false } });openDashboard();@@ -191,6 +161,7 @@ describe(cy.button("Add filter").click();});H.applyFilterButton().should("be.visible");+ H.applyFilterToast().findByText("1 filter changed");cy.log("cancel editing");H.editDashboard();@@ -198,6 +169,34 @@ describe(H.filterWidget().findByText("Gadget").should("be.visible");H.applyFilterButton().should("be.visible");+ cy.log("verify filter value is not saved");+ H.visitDashboard("@dashboardId");+ H.filterWidget()+ .should("contain", FILTER.name)+ .and("not.contain", "Gadget");++ cy.log("verify unapplied filter value can be reset");+ H.filterWidget().findByText(FILTER.name).click();+ H.popover().within(() => {+ cy.findByLabelText("Gadget").click();+ cy.findByLabelText("Gadget").should("be.checked");+ cy.button("Add filter").click();+ });++ H.applyFilterButton().should("be.visible");+ H.applyFilterToast().findByText("1 filter changed");++ H.cancelFilterButton().click();+ H.applyFilterToast().should("not.exist");++ H.filterWidget().findByText(FILTER.name).click();+ H.popover().within(() => {+ cy.findByLabelText("Gadget").should("not.be.checked");+ cy.findByLabelText("Gadget").click();+ cy.button("Add filter").click();+ });+ H.applyFilterButton().should("be.visible");+cy.log("edit and save the dashboard");H.editDashboard();@@ -291,73 +290,7 @@ describe(});describe("embeddings", () => {- beforeEach(() => {- cy.signInAsAdmin();- });-- describe("public embeds", () => {- it("should apply filters after clicking the apply button when auto-apply filters is turned off", () => {- createDashboard({ dashboardDetails: { auto_apply_filters: false } });- cy.get("@dashboardId").then((dashboardId) => {- H.visitPublicDashboard(dashboardId);- });-- H.applyFilterToast().should("not.exist");- H.filterWidget().findByText("Category").click();- H.popover().within(() => {- cy.findByText("Widget").click();- cy.button("Add filter").click();- });- H.getDashboardCard().within(() => {- H.assertTableRowsCount(200);- });- H.applyFilterButton().should("be.visible").click();- H.getDashboardCard().within(() => {- H.assertTableRowsCount(54);- });- });- });-- describe("signed embeds", () => {- it("should apply filters after clicking the apply button when auto-apply filters is turned off", () => {- createDashboard({- dashboardDetails: {- auto_apply_filters: false,- enable_embedding: true,- embedding_params: {- [FILTER.slug]: "enabled",- },- },- });- cy.get("@dashboardId").then((dashboardId) => {- const embeddingPayload = {- resource: { dashboard: dashboardId },- params: {},- };- H.visitEmbeddedPage(embeddingPayload);- });-- H.applyFilterToast().should("not.exist");- H.filterWidget().findByText("Category").click();- H.popover().within(() => {- cy.findByText("Widget").click();- cy.button("Add filter").click();- });- H.getDashboardCard().within(() => {- H.assertTableRowsCount(200);- });- H.applyFilterButton().should("be.visible").click();- H.getDashboardCard().within(() => {- H.assertTableRowsCount(54);- });- });- });-describe("full-app embeddings", () => {- beforeEach(() => {- cy.signInAsNormalUser();- });-it("should apply filters after clicking the apply button when auto-apply filters is turned off", () => {createDashboard({dashboardDetails: {@@ -377,7 +310,6 @@ describe(// Ensure that we're viewing the dashboard in full-app embedding mode, since `logo` is a full-app embedding parameter.cy.findByTestId("main-logo").should("not.exist");- H.applyFilterToast().should("not.exist");H.filterWidget().findByText("Category").click();H.popover().within(() => {cy.findByText("Widget").click();@@ -387,6 +319,7 @@ describe(H.assertTableRowsCount(200);});H.applyFilterButton().should("be.visible").click();+ H.applyFilterToast().should("not.exist");H.getDashboardCard().within(() => {H.assertTableRowsCount(54);});@@ -396,44 +329,6 @@ describe(},);-describe("scenarios > dashboards > filters > auto apply", () => {- beforeEach(() => {- H.restore();- H.resetSnowplow();- cy.signInAsAdmin();- H.enableTracking();- cy.intercept("PUT", "/api/dashboard/*").as("updateDashboard");- });-- afterEach(() => {- H.expectNoBadSnowplowEvents();- });-- it("should send snowplow events only when disabling auto-apply filters", () => {- createDashboard();- openDashboard();- cy.wait("@cardQuery");-- H.openDashboardSettingsSidebar();- H.sidesheet().within(() => {- cy.findByLabelText(filterToggleLabel).click();- cy.wait("@updateDashboard");- cy.findByLabelText(filterToggleLabel).should("not.be.checked");- H.expectUnstructuredSnowplowEvent({- event: "auto_apply_filters_disabled",- });-- cy.log("enabling auto-apply filters should not send an event");- cy.findByLabelText(filterToggleLabel).click();- cy.wait("@updateDashboard");- cy.findByLabelText(filterToggleLabel).should("be.checked");- H.expectUnstructuredSnowplowEvent({- event: "auto_apply_filters_disabled",- });- });- });-});-const createDashboard = ({dashboardDetails: dashboardOpts = {},parameter = FILTER,@@ -442,7 +337,7 @@ const createDashboard = ({H.createQuestionAndDashboard({questionDetails: QUESTION_DETAILS,dashboardDetails: {- ...createDashboardDetails({ parameters }),+ parameters,...dashboardOpts,},}).then(({ body: card }) => {@@ -461,12 +356,12 @@ const getParameterMapping = ({ card_id }, parameters) => ({}),});-const openDashboard = (params = {}) => {+const openDashboard = () => {cy.intercept("POST", "/api/dashboard/*/dashcard/*/card/*/query").as("cardQuery",);- H.visitDashboard("@dashboardId", { params });+ H.visitDashboard("@dashboardId");};const visitFullAppEmbeddingUrl = ({ url, qs }) => {diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-auto-wiring.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-auto-wiring.cy.spec.jsindex cf2a3be7fd8..d4e7c7ad681 100644--- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-auto-wiring.cy.spec.js+++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-auto-wiring.cy.spec.js@@ -32,7 +32,7 @@ describe("dashboard filters auto-wiring", () => {});describe("parameter mapping", () => {- it("should wire parameters to cards with matching fields", () => {+ it("should undo auto-wiring, not wire cards that already have a parameter, and wire cards with matching fields", () => {createDashboardWithCards({ cards }).then((dashboardId) => {H.visitDashboard(dashboardId);});@@ -47,6 +47,46 @@ describe("dashboard filters auto-wiring", () => {cy.findByText("User.Name").should("exist");});+ H.undoToast()+ .should(+ "contain",+ "Auto-connect this filter to all questions containing “User.Name”?",+ )+ .findByRole("button", { name: "Auto-connect" })+ .click();++ H.getDashboardCard(0).findByText("User.Name").should("exist");+ H.getDashboardCard(1).findByText("User.Name").should("exist");++ cy.log("verify undo functionality");+ H.undoToast().findByRole("button", { name: "Undo" }).click();++ H.getDashboardCard(0).findByText("User.Name").should("exist");+ H.getDashboardCard(1).findByText("Select…").should("exist");++ H.selectDashboardFilter(H.getDashboardCard(1), "Address");++ H.getDashboardCard(0).within(() => {+ cy.findByText("User.Name").should("exist");+ });++ H.getDashboardCard(1).within(() => {+ cy.findByText("User.Address").should("exist");+ });++ H.undoToast().should("not.exist");++ cy.log("verify auto-wiring from a state without mappings");++ removeFilterFromDashCard(1);+ removeFilterFromDashCard(0);++ H.selectDashboardFilter(H.getDashboardCard(0), "Name");++ H.getDashboardCard(0).within(() => {+ cy.findByText("User.Name").should("exist");+ });+H.getDashboardCard(1).findByText("Select…").should("exist");H.getDashboardCard(1).findByText("User.Name").should("not.exist");@@ -105,51 +145,6 @@ describe("dashboard filters auto-wiring", () => {H.getDashboardCard(1).findByText("User.Name").should("exist");});- it("should undo auto-wiring and not wire parameters to cards that already have a parameter, despite matching fields", () => {- createDashboardWithCards({ cards }).then((dashboardId) => {- H.visitDashboard(dashboardId);- });-- H.editDashboard();-- H.setFilter("Text or Category", "Is");-- H.selectDashboardFilter(H.getDashboardCard(0), "Name");-- H.getDashboardCard(0).within(() => {- cy.findByText("User.Name").should("exist");- });-- H.undoToast()- .should(- "contain",- "Auto-connect this filter to all questions containing “User.Name”?",- )- .findByRole("button", { name: "Auto-connect" })- .click();-- H.getDashboardCard(0).findByText("User.Name").should("exist");- H.getDashboardCard(1).findByText("User.Name").should("exist");-- cy.log("verify undo functionality");- H.undoToast().findByRole("button", { name: "Undo" }).click();-- H.getDashboardCard(0).findByText("User.Name").should("exist");- H.getDashboardCard(1).findByText("Select…").should("exist");-- H.selectDashboardFilter(H.getDashboardCard(1), "Address");-- H.getDashboardCard(0).within(() => {- cy.findByText("User.Name").should("exist");- });-- H.getDashboardCard(1).within(() => {- cy.findByText("User.Address").should("exist");- });-- H.undoToast().should("not.exist");- });-it("should not suggest to wire parameters to cards that don't have a matching field", () => {H.createQuestion({name: "Products Table",@@ -407,7 +402,6 @@ describe("dashboard filters auto-wiring", () => {},],});- cy.wrap(id).as("productsQuestionId");});H.createQuestion({@@ -538,7 +532,7 @@ describe("dashboard filters auto-wiring", () => {});describe("dismiss toasts", () => {- it("should dismiss auto-wire toasts on filter removal", () => {+ it("should dismiss auto-wire toasts on filter removal and on card removal", () => {createDashboardWithCards({ cards }).then((dashboardId) => {H.visitDashboard(dashboardId);});@@ -559,14 +553,9 @@ describe("dashboard filters auto-wiring", () => {removeFilterFromDashboard();H.undoToast().should("not.exist");- });- it("should dismiss auto-wire toasts on card removal", () => {- createDashboardWithCards({ cards }).then((dashboardId) => {- H.visitDashboard(dashboardId);- });+ cy.log("verify toasts are dismissed on card removal");- H.editDashboard();H.setFilter("Text or Category", "Is");H.selectDashboardFilter(H.getDashboardCard(0), "Name");@@ -579,7 +568,7 @@ describe("dashboard filters auto-wiring", () => {.contains("Auto-connect “Orders Model” to “Text”?").should("be.visible");- H.removeDashboardCard(2);+ H.removeDashboardCard(3);H.undoToastList().should("have.length", 1)diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-boolean.cy.spec.ts b/e2e/test/scenarios/dashboard-filters/dashboard-filters-boolean.cy.spec.tsindex c600fc3d0c2..3da0cc48991 100644--- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-boolean.cy.spec.ts+++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-boolean.cy.spec.ts@@ -27,7 +27,7 @@ describe("scenarios > dashboard > filters > boolean", () => {cy.signInAsAdmin();});- it("should allow to map a boolean parameter to a boolean column of an MBQL query, update it with a click behavior, and drill-thru", () => {+ it("should allow to map a boolean parameter to a boolean column of an MBQL query, update it with a click behavior, drill-thru, and use a 'Go to a custom destination - Saved question' click behavior", () => {createQuestionAndDashboard().then(({ dashboardId }) =>H.visitDashboard(dashboardId),);@@ -68,19 +68,18 @@ describe("scenarios > dashboard > filters > boolean", () => {H.queryBuilderFiltersPanel().findByText(`${COLUMN_NAME} is true`).should("be.visible");- });- it("should allow to use a 'Go to a custom destination - Saved question' click behavior", () => {- createQuestionAndDashboard().then(({ dashboardId }) =>- H.visitDashboard(dashboardId),- );+ cy.go("back");+ H.filterWidget().findByText("True").should("be.visible");+ H.filterWidget().icon("close").click();+ H.getDashboardCard().findByText("200 rows").should("be.visible");- cy.log("set up click behavior");+ cy.log("'Go to a custom destination - Saved question' click behavior");H.editDashboard();H.showDashboardCardActions();cy.findByLabelText("Click behavior").click();H.sidebar().within(() => {- cy.findByText(COLUMN_NAME).click();+ cy.findByText(`${COLUMN_NAME} updates 1 filter`).click();cy.findByText("Go to a custom destination").click();cy.findByText("Saved question").click();});@@ -92,7 +91,6 @@ describe("scenarios > dashboard > filters > boolean", () => {H.selectDropdown().findByText(COLUMN_NAME).click();H.saveDashboard();- cy.log("assert click behavior");H.getDashboardCard().findAllByText("true").first().click();H.queryBuilderFiltersPanel().findByText(`${COLUMN_NAME} is true`)@@ -244,9 +242,11 @@ describe("scenarios > dashboard > filters > boolean", () => {function createQuestionAndDashboard({questionName = QUESTION_NAME,dashboardName = DASHBOARD_NAME,+ parameters,}: {questionName?: string;dashboardName?: string;+ parameters?: DashboardDetails["parameters"];} = {}) {const questionDetails: StructuredQuestionDetails = {name: questionName,@@ -263,6 +263,7 @@ function createQuestionAndDashboard({};const dashboardDetails: DashboardDetails = {name: dashboardName,+ parameters,};return H.createQuestionAndDashboard({questionDetails,@@ -358,14 +359,33 @@ function createAndMapParameter({function setupDashboardClickBehavior() {cy.log("setup target dashboard");+ const parameter = {+ id: "f8ec7c71",+ name: PARAMETER_NAME,+ slug: "boolean_parameter",+ type: "boolean/=",+ sectionId: "boolean",+ };createQuestionAndDashboard({dashboardName: DASHBOARD_NAME,questionName: QUESTION_NAME,- }).then(({ dashboardId }) => {- H.visitDashboard(dashboardId);- H.editDashboard();- createAndMapParameter();- H.saveDashboard();+ parameters: [parameter],+ }).then(({ dashboardId, questionId }) => {+ H.updateDashboardCards({+ dashboard_id: dashboardId,+ cards: [+ {+ card_id: questionId,+ parameter_mappings: [+ {+ parameter_id: parameter.id,+ card_id: questionId,+ target: ["dimension", ["expression", COLUMN_NAME]],+ },+ ],+ },+ ],+ });});cy.log(diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-date.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-date.cy.spec.jsindex dd5683ef67e..a3c56289c3f 100644--- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-date.cy.spec.js+++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-date.cy.spec.js@@ -3,10 +3,41 @@ import {ORDERS_DASHBOARD_DASHCARD_ID,ORDERS_DASHBOARD_ID,} from "e2e/support/cypress_sample_instance_data";+import { dayjs } from "metabase/dayjs";import * as DateFilter from "../native/helpers/e2e-date-filter-helpers";-import { DASHBOARD_DATE_FILTERS } from "./shared/dashboard-filters-date";+const DASHBOARD_DATE_FILTERS = {+ "Month and Year": {+ value: {+ month: "Nov",+ year: "2025",+ },+ representativeResult: "85.88",+ },+ "Quarter and Year": {+ value: {+ quarter: "Q2",+ year: "2025",+ },+ representativeResult: "44.43",+ },+ "Single Date": {+ value: "05/23/2025",+ representativeResult: "49.54",+ },+ "Date Range": {+ value: {+ startDate: "05/25/2025",+ endDate: "06/01/2025",+ },+ representativeResult: "75.41",+ },+ "All Options": {+ value: "06/01/2025",+ representativeResult: "53.6",+ },+};describe("scenarios > dashboard > filters > date", () => {beforeEach(() => {@@ -15,6 +46,7 @@ describe("scenarios > dashboard > filters > date", () => {});it("should work when set through the filter widget", () => {+ cy.signInAsNormalUser();visitOrdersDashboardInEditMode();// Add and connect every single available date filter type@@ -50,6 +82,56 @@ describe("scenarios > dashboard > filters > date", () => {cy.wait(`@dashcardQuery${ORDERS_DASHBOARD_DASHCARD_ID}`);},);++ const allOptionsWidget = () => H.filterWidget().eq(4);++ cy.log("Round the relative date range preview (metabase#22482)");+ allOptionsWidget().click();+ H.popover().within(() => {+ cy.findByText("Relative date range…").click();+ cy.findByLabelText("Interval").clear().type(15);+ cy.findByRole("textbox", { name: "Unit" }).click();+ });+ H.selectDropdown().findByText("months").click();++ const expectedRange = getFormattedRange(+ dayjs().startOf("month").add(-15, "month"),+ dayjs().add(-1, "month").endOf("month"),+ );+ H.popover().findByText(expectedRange).should("be.visible");+ cy.realPress("Escape");+ H.popover({ skipVisibilityCheck: true }).should("not.exist");++ cy.log("Remove the last excluded hour (metabase#27579)");+ allOptionsWidget().click();+ H.popover().within(() => {+ cy.findByText("Exclude…").click();+ cy.findByText("Hours of the day…").click();+ cy.findByText("Select all").click();+ cy.findByLabelText("12 AM").should("be.checked");++ cy.findByText("Select all").click();+ cy.findByLabelText("12 AM").should("not.be.checked");+ });+ cy.realPress("Escape");+ H.popover({ skipVisibilityCheck: true }).should("not.exist");++ cy.log(+ "Block an exclude filter with all options selected (metabase#24235)",+ );+ allOptionsWidget().click();+ H.popover().within(() => {+ cy.findByText("Exclude…").click();+ cy.findByText("Days of the week…").click();+ cy.findByText("Select all").click();+ cy.findByText("Add filter").click();+ });++ allOptionsWidget().click();+ H.popover().within(() => {+ cy.findByText("Select all").click();+ cy.button("Update filter").should("be.disabled");+ });});it("should support being required", () => {@@ -58,6 +140,17 @@ describe("scenarios > dashboard > filters > date", () => {cy.log("show sub-day resolutions in relative date filter (metabase#6660)");H.setFilter("Date picker", "All Options");H.dashboardParameterSidebar().findByText("No default").click();++ cy.log("re-position the default value popover on resize (metabase#52918)");+ H.popover().within(() => {+ cy.findByText("Fixed date range…").click();+ cy.findByText("Between").should("be.visible");+ });+ H.popover().should(([element]) => {+ expect(element.offsetWidth).to.gte(element.scrollWidth);+ });+ H.popover().button("Back").click();+H.popover().within(() => {cy.findByText("Relative date range…").click();cy.findByText("Next").click();@@ -146,6 +239,10 @@ describe("scenarios > dashboard > filters > date", () => {});});+function getFormattedRange(start, end) {+ return `${start.format("MMM D, YYYY")} – ${end.format("MMM D, YYYY")}`;+}+function visitOrdersDashboardInEditMode() {H.visitDashboard(ORDERS_DASHBOARD_ID);H.editDashboard();diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-id.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-id.cy.spec.jsindex c50fcee91d1..58678cf9b85 100644--- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-id.cy.spec.js+++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-id.cy.spec.js@@ -53,7 +53,7 @@ describe("scenarios > dashboard > filters > ID", () => {);});- it("should work for the primary key, the foreign key and the implicit join when set through the filter widget", () => {+ it("should work for the primary key, the foreign key and the implicit join when set through the filter widget or as the default filter", () => {ID_FILTERS.forEach((filter) => addIdFilter(filter));H.saveDashboard();@@ -77,9 +77,16 @@ describe("scenarios > dashboard > filters > ID", () => {cy.wait("@dashboardData");},);- });- it("should work for the primary key, the foreign key and the implicit join when set as the default filter", () => {+ cy.log("recreate the filters with default values");+ H.editDashboard();+ ID_FILTERS.forEach(({ name }) => {+ cy.findByTestId("edit-dashboard-parameters-widget-container")+ .findByText(name)+ .click();+ H.sidebar().findByRole("button", { name: "Remove" }).click();+ });+ID_FILTERS.forEach((filter) => {addIdFilter(filter);cy.findByText("Default value").next().click();diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-location.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-location.cy.spec.jsindex fadf6275657..bc6b52ec225 100644--- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-location.cy.spec.js+++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-location.cy.spec.js@@ -46,7 +46,7 @@ describe("scenarios > dashboard > filters > location", () => {cy.findByTestId("dashcard").should("contain", "39.72");Object.entries(DASHBOARD_LOCATION_FILTERS).forEach(- ([filter, { value, representativeResult }], index) => {+ ([filter, { value, representativeResult, negativeAssertion }], index) => {// eslint-disable-next-line metabase/no-unsafe-element-filteringH.filterWidget().eq(index).click();// The "Is" value matches its default, so the widget offers "Set to default"@@ -59,6 +59,9 @@ describe("scenarios > dashboard > filters > location", () => {cy.findByTestId("dashcard").should("contain", representativeResult).and("not.contain", "39.72");+ if (negativeAssertion) {+ cy.findByTestId("dashcard").should("not.contain", negativeAssertion);+ }H.clearFilterWidget(index);cy.wait(`@dashcardQuery${ORDERS_DASHBOARD_DASHCARD_ID}`);diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-management.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-management.cy.spec.jsindex fb6c0d6f420..1fcf14eb433 100644--- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-management.cy.spec.js+++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-management.cy.spec.js@@ -110,15 +110,17 @@ describe("scenarios > dashboard > filters > management", () => {});describe("change parameter type", () => {- it("should reset existing filter mappings and default value, and preselect the default operator for every type", () => {- createDashboardWithFilterAndQuestionMapped();+ it("should reset existing filter mappings and default value, restore the saved operator and mappings for the saved type, and preselect the default operator for every type", () => {+ createDashboardWithFilterAndQuestionMapped({+ type: "string/does-not-contain",+ });selectFilter("Text");H.getDashboardCard().should("contain", "People.Name");- cy.log("verify Text default value: Is");- H.sidebar().findByDisplayValue("Is").should("exist");+ cy.log("verify the saved Text operator: Does not contain");+ H.sidebar().findByDisplayValue("Does not contain").should("exist");cy.log("change filter type");@@ -140,6 +142,20 @@ describe("scenarios > dashboard > filters > management", () => {H.getDashboardCard().should("not.contain", "People.Name");+ changeFilterType("Text or Category");++ cy.log("verify the saved parameter value is restored");+ H.sidebar().within(() => {+ cy.findByDisplayValue("Does not contain").should("exist");+ cy.findByDisplayValue("Text or Category").should("exist");+ cy.findByDisplayValue("Text").should("exist");+ });++ cy.log("verify that mapping is restored");+ H.getDashboardCard().should("contain", "People.Name");++ changeFilterType("Number");+changeFilterType("ID");cy.log("verify ID default value: Numeric ID");@@ -159,75 +175,6 @@ describe("scenarios > dashboard > filters > management", () => {H.filterWidget().should("not.exist");});-- it("should restore the saved parameter value and mappings when user switches back to the saved filter type", () => {- const textFilter = createMockParameter({- name: "Text Text",- slug: "string",- id: "5aefc726",- type: "string/does-not-contain",- sectionId: "string",- });-- const peopleQuestionDetails = {- query: { "source-table": PEOPLE_ID, limit: 5 },- };-- H.createDashboardWithQuestions({- dashboardDetails: {- parameters: [textFilter],- },- questions: [peopleQuestionDetails],- }).then(({ dashboard, questions: cards }) => {- const [peopleCard] = cards;-- H.updateDashboardCards({- dashboard_id: dashboard.id,- cards: [- {- card_id: peopleCard.id,- parameter_mappings: [- {- parameter_id: textFilter.id,- card_id: peopleCard.id,- target: ["dimension", ["field", PEOPLE.NAME, null]],- },- ],- },- ],- });-- H.visitDashboard(dashboard.id);- });-- H.editDashboard();-- selectFilter("Text Text");-- H.sidebar().findByDisplayValue("Does not contain").should("exist");-- H.getDashboardCard().should("contain", "People.Name");-- changeFilterType("Number");-- // default value for a number type- H.sidebar().findByDisplayValue("Equal to").should("exist");-- cy.log("verify that mapping is cleared");- H.getDashboardCard().should("not.contain", "People.Name");-- changeFilterType("Text or Category");-- cy.log("verify the saved parameter value is restored");- H.sidebar().within(() => {- cy.findByDisplayValue("Does not contain").should("exist");- cy.findByDisplayValue("Text or Category").should("exist");- cy.findByDisplayValue("Text Text").should("exist");- });-- cy.log("verify that mapping is restored");- H.getDashboardCard().should("contain", "People.Name");- });});describe("change parameter operator", () => {@@ -255,12 +202,14 @@ describe("scenarios > dashboard > filters > management", () => {});});-function createDashboardWithFilterAndQuestionMapped() {+function createDashboardWithFilterAndQuestionMapped({+ type = "string/=",+} = {}) {const textFilter = createMockParameter({name: "Text",slug: "string",id: "5aefc726",- type: "string/=",+ type,sectionId: "string",default: "value to check default",});diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-number.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-number.cy.spec.jsindex 67a96b460e7..2290781f07a 100644--- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-number.cy.spec.js+++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-number.cy.spec.js@@ -27,7 +27,63 @@ describe("scenarios > dashboard > filters > number", () => {);});- it("should work when set through the filter widget", () => {+ it("should support being required, and work when set through the filter widget", () => {+ H.setFilter("Number", "Equal to", "Equal to");+ H.selectDashboardFilter(cy.findByTestId("dashcard"), "Tax");++ // Can't save without a default value+ H.toggleRequiredParameter();+ H.dashboardSaveButton().should("be.disabled");+ H.dashboardSaveButton().realHover();+ cy.findByRole("tooltip").should(+ "contain.text",+ 'The "Equal to" parameter requires a default value but none was provided.',+ );++ // Can't close sidebar without a default value+ H.dashboardParametersDoneButton().should("be.disabled");+ H.dashboardParametersDoneButton().realHover();+ cy.findByRole("tooltip").should(+ "contain.text",+ "The parameter requires a default value but none was provided.",+ );++ H.sidebar().findByText("Default value").next().click();+ addWidgetNumberFilter("2.07", { buttonLabel: "Update filter" });++ H.saveDashboard();+ cy.wait("@dashboardData");+ assertDefaultTaxApplied();++ // Updates the filter value+ H.setFilterWidgetValue("5.27", "Enter a number");+ cy.wait("@dashboardData");+ H.ensureDashboardCardHasText("95.77");++ // Resets the value back by clicking widget icon+ H.resetFilterWidgetToDefault();+ H.filterWidget().findByText("2.07");+ cy.wait("@dashboardData");+ assertDefaultTaxApplied();++ // Removing value resets back to default+ H.setFilterWidgetValue("5.27", "Enter a number");+ cy.wait("@dashboardData");+ H.ensureDashboardCardHasText("95.77");+ H.setFilterWidgetValue(null, "Enter a number", {+ buttonLabel: "Set to default",+ });+ cy.wait("@dashboardData");+ H.filterWidget().findByText("2.07");+ assertDefaultTaxApplied();++ cy.log("remove the required filter");+ H.editDashboard();+ cy.findByTestId("edit-dashboard-parameters-widget-container")+ .findByText("Equal to")+ .click();+ H.sidebar().findByRole("button", { name: "Remove" }).click();+DASHBOARD_NUMBER_FILTERS.forEach(({ operator, single }) => {cy.log(`Make sure we can connect ${operator} filter`);H.setFilter("Number", operator);@@ -45,15 +101,20 @@ describe("scenarios > dashboard > filters > number", () => {H.setFilter("Number", "Between");H.selectDashboardFilter(H.getDashboardCard(), "Total");+ // Removing the required filter can re-run the card, and no wait takes that request.+ // A new alias makes the waits below start at the save.+ cy.intercept("POST", "api/dashboard/*/dashcard/*/card/*/query").as(+ "savedDashboardData",+ );H.saveDashboard();- cy.wait("@dashboardData");+ cy.wait("@savedDashboardData");DASHBOARD_NUMBER_FILTERS.forEach(({ operator, value, representativeResult, negativeAssertion }, index) => {// eslint-disable-next-line metabase/no-unsafe-element-filteringH.filterWidget().eq(index).click();addWidgetNumberFilter(value);- cy.wait("@dashboardData");+ cy.wait("@savedDashboardData");cy.log(`Make sure ${operator} filter returns correct result`);cy.findByTestId("dashcard")@@ -61,7 +122,7 @@ describe("scenarios > dashboard > filters > number", () => {.and("not.contain", negativeAssertion);H.clearFilterWidget(index);- cy.wait("@dashboardData");+ cy.wait("@savedDashboardData");},);@@ -104,57 +165,6 @@ describe("scenarios > dashboard > filters > number", () => {});H.getDashboardCard().within(() => H.assertTableRowsCount(166));});-- it("should support being required", () => {- H.setFilter("Number", "Equal to", "Equal to");- H.selectDashboardFilter(cy.findByTestId("dashcard"), "Tax");-- // Can't save without a default value- H.toggleRequiredParameter();- H.dashboardSaveButton().should("be.disabled");- H.dashboardSaveButton().realHover();- cy.findByRole("tooltip").should(- "contain.text",- 'The "Equal to" parameter requires a default value but none was provided.',- );-- // Can't close sidebar without a default value- H.dashboardParametersDoneButton().should("be.disabled");- H.dashboardParametersDoneButton().realHover();- cy.findByRole("tooltip").should(- "contain.text",- "The parameter requires a default value but none was provided.",- );-- H.sidebar().findByText("Default value").next().click();- addWidgetNumberFilter("2.07", { buttonLabel: "Update filter" });-- H.saveDashboard();- cy.wait("@dashboardData");- assertDefaultTaxApplied();-- // Updates the filter value- H.setFilterWidgetValue("5.27", "Enter a number");- cy.wait("@dashboardData");- H.ensureDashboardCardHasText("95.77");-- // Resets the value back by clicking widget icon- H.resetFilterWidgetToDefault();- H.filterWidget().findByText("2.07");- cy.wait("@dashboardData");- assertDefaultTaxApplied();-- // Removing value resets back to default- H.setFilterWidgetValue("5.27", "Enter a number");- cy.wait("@dashboardData");- H.ensureDashboardCardHasText("95.77");- H.setFilterWidgetValue(null, "Enter a number", {- buttonLabel: "Set to default",- });- cy.wait("@dashboardData");- H.filterWidget().findByText("2.07");- assertDefaultTaxApplied();- });});function assertDefaultTaxApplied() {diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-reproductions-1.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-reproductions-1.cy.spec.jsindex e3f6f36328f..5a51e492a8a 100644--- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-reproductions-1.cy.spec.js+++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-reproductions-1.cy.spec.js@@ -8,7 +8,6 @@ import {ORDERS_DASHBOARD_ID,ORDERS_QUESTION_ID,} from "e2e/support/cypress_sample_instance_data";-import { dayjs } from "metabase/dayjs";import {createMockDashboardCard,createMockParameter,@@ -116,8 +115,9 @@ describe("issues 8030 and 32444", () => {});describe("issue 12720, issue 47172", () => {- function clickThrough(title) {+ function clickThrough(title, { beforeClick } = {}) {H.visitDashboard(ORDERS_DASHBOARD_ID);+ beforeClick?.();cy.findAllByTestId("dashcard-container").contains(title).click();cy.location("pathname").should("match", /^\/question/);@@ -206,35 +206,26 @@ describe("issue 12720, issue 47172", () => {it("should show QB question on a dashboard with filter connected to card without data-permission (metabase#12720)", () => {cy.signIn("readonly");- clickThrough("12720_SQL");- clickThrough("Orders");- });-- it("should apply the specific (before|after) filter on a native question with field filter (metabase#47172)", () => {- H.visitDashboard(ORDERS_DASHBOARD_ID);-- H.getDashboardCard(1).within(() => {- cy.findByTestId("table-root").should("be.visible");- cy.findByText("There was a problem displaying this chart.").should(- "not.exist",- );+ cy.intercept("POST", "/api/card/*/query").as("cardQuery");- cy.log("Drill down to the question");- cy.intercept("POST", "/api/card/*/query").as("cardQuery");- cy.findByText(questionDetails.name).click();+ clickThrough("12720_SQL", {+ beforeClick: () => {+ cy.log(+ "Run a native field filter with an open date range (metabase#47172)",+ );+ H.getDashboardCard(1).within(() => {+ cy.findByTestId("table-root").should("be.visible");+ cy.findByText("There was a problem displaying this chart.").should(+ "not.exist",+ );+ });+ },});-- cy.location("search").should("eq", `?filter=${dashboardFilter.default}`);cy.wait("@cardQuery");+ cy.location("search").should("eq", `?filter=${dashboardFilter.default}`);H.tableInteractive().should("be.visible").and("contain", "97.44");- cy.findByTestId("question-row-count").should(- "not.have.text",- "Showing 0 rows",- );- cy.findByTestId("question-row-count").should(- "have.text",- "Showing 1,980 rows",- );++ clickThrough("Orders");});});@@ -310,8 +301,7 @@ describe("issue 12985 > dashboard filter dropdown/search", () => {cy.button("Add filter").click();cy.location("search").should("eq", "?category=Gadget");- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("Ergonomic Silk Coat");+ H.getDashboardCard().within(() => H.assertTableRowsCount(53));});});@@ -405,7 +395,10 @@ describe("issues 15119 and 16112", () => {H.popover().contains("adam").click();cy.button("Add filter").click();- cy.findByTestId("dashcard-container").should("contain", "adam");+ H.getDashboardCard().within(() => {+ H.assertTableRowsCount(1);+ cy.findAllByTestId("cell-data").should("contain", "adam");+ });cy.location("search").should("eq", "?rating=&reviewer=adam");// eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage@@ -414,8 +407,12 @@ describe("issues 15119 and 16112", () => {H.popover().contains("5").click();cy.button("Add filter").click();- cy.findByTestId("dashcard-container").should("contain", "adam");- cy.findByTestId("dashcard-container").should("contain", "5");+ H.getDashboardCard().within(() => {+ H.assertTableRowsCount(1);+ cy.findAllByTestId("cell-data")+ .should("contain", "adam")+ .and("contain", "5");+ });cy.location("search").should("eq", "?rating=5&reviewer=adam");});});@@ -857,47 +854,6 @@ describe("issue 21528", () => {});});-describe("issue 22482", () => {- function getFormattedRange(start, end) {- return `${start.format("MMM D, YYYY")} – ${end.format("MMM D, YYYY")}`;- }-- beforeEach(() => {- H.restore();- cy.signInAsAdmin();-- H.visitDashboard(ORDERS_DASHBOARD_ID);-- H.editDashboard();- H.setFilter("Date picker", "All Options");-- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("Select…").click();- H.popover().contains("Created At").eq(0).click();-- H.saveDashboard();-- H.filterWidget().click();- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("Relative date range…").click();- });-- it("should round relative date range (metabase#22482)", () => {- cy.findByLabelText("Interval").clear().type(15);- cy.findByRole("textbox", { name: "Unit" }).click();- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("months").click();-- const expectedRange = getFormattedRange(- dayjs().startOf("month").add(-15, "month"),- dayjs().add(-1, "month").endOf("month"),- );-- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText(expectedRange);- });-});-describe("issue 22788", () => {const ccName = "Custom Category";const ccDisplayName = "Products.Custom Category";@@ -1006,77 +962,6 @@ describe("issue 22788", () => {});});-describe("issue 24235", () => {- const questionDetails = {- query: { "source-table": PRODUCTS_ID, limit: 5 },- };-- const parameter = {- id: "727b06c1",- name: "Date Filter",- sectionId: "date",- slug: "date_filter",- type: "date/all-options",- };-- const parameterTarget = [- "dimension",- ["field", PRODUCTS.CREATED_AT, { "temporal-unit": "month" }],- ];-- const dashboardDetails = { parameters: [parameter] };-- const mapParameterToDashboardCard = ({ id, card_id, dashboard_id }) => {- cy.request("PUT", `/api/dashboard/${dashboard_id}`, {- dashcards: [- {- id,- card_id,- row: 0,- col: 0,- size_x: 24,- size_y: 10,- parameter_mappings: [- {- card_id,- parameter_id: parameter.id,- target: parameterTarget,- },- ],- },- ],- });- };-- beforeEach(() => {- H.restore();- cy.signInAsAdmin();- });-- it("should not allow to add a filter when all exclude options are selected (metabase#24235)", () => {- H.createQuestionAndDashboard({ questionDetails, dashboardDetails }).then(- ({ body: { id, card_id, dashboard_id } }) => {- mapParameterToDashboardCard({ id, card_id, dashboard_id });- H.visitDashboard(dashboard_id);- },- );-- H.filterWidget().contains(parameter.name).click();- H.popover().within(() => {- cy.findByText("Exclude…").click();- cy.findByText("Days of the week…").click();- cy.findByText("Select all").click();- cy.findByText("Add filter").click();- });-- H.filterWidget().click();- H.popover().within(() => {- cy.findByText("Select all").click();- cy.button("Update filter").should("be.disabled");- });- });-});-describe("issues 15279 and 24500", () => {const listFilter = {name: "List",@@ -1295,93 +1180,6 @@ describe("issue 25322", () => {});});-describe("issue 25248", () => {- const question1Details = {- name: "Q1",- display: "line",- query: {- "source-table": ORDERS_ID,- aggregation: [["count"]],- breakout: [["field", ORDERS.CREATED_AT, { "temporal-unit": "month" }]],- },- visualization_settings: {- "graph.metrics": ["count"],- "graph.dimensions": ["CREATED_AT"],- },- };-- const question2Details = {- name: "Q2",- display: "line",- query: {- "source-table": ORDERS_ID,- aggregation: [["count"], ["avg", ["field", ORDERS.TOTAL, null]]],- breakout: [["field", ORDERS.CREATED_AT, { "temporal-unit": "month" }]],- },- visualization_settings: {- "graph.metrics": ["avg"],- "graph.dimensions": ["CREATED_AT"],- },- };-- const parameterDetails = {- name: "Date Filter",- slug: "date_filter",- id: "888188ad",- type: "date/all-options",- sectionId: "date",- };-- const dashboardDetails = {- name: "25248",- parameters: [parameterDetails],- };-- const createDashboard = () => {- H.createQuestionAndDashboard({- questionDetails: question1Details,- dashboardDetails,- }).then(({ body: { id, card_id, dashboard_id } }) => {- H.createQuestion(question2Details).then(({ body: { id: card_2_id } }) => {- cy.request("PUT", `/api/dashboard/${dashboard_id}`, {- dashcards: [- {- id,- card_id,- series: [{ id: card_2_id }],- row: 0,- col: 0,- size_x: 16,- size_y: 8,- },- ],- });- });- H.visitDashboard(dashboard_id);- });- };-- beforeEach(() => {- H.restore();- cy.signInAsAdmin();- });-- it("should allow mapping parameters to combined cards individually (metabase#25248)", () => {- createDashboard();- H.editDashboard();-- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText(parameterDetails.name).click();- cy.findAllByText("Select…").first().click();- H.popover().findAllByText("Created At").first().click();-- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("Orders.Created At").should("be.visible");- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("Select…").should("be.visible");- });-});-describe("issue 25374", () => {const questionDetails = {name: "25374",@@ -1424,7 +1222,7 @@ describe("issue 25374", () => {beforeEach(() => {cy.intercept("POST", "/api/card/*/query").as("cardQuery");- cy.intercept("POST", "/api/dashboard/*/dashcard/*/card//*/query").as(+ cy.intercept("POST", "/api/dashboard/*/dashcard/*/card/*/query").as("dashcardQuery",);@@ -1472,8 +1270,8 @@ describe("issue 25374", () => {});});- it("should pass comma-separated values down to the connected question (metabase#25374-1)", () => {- // Drill-through and go to the question+ it("should pass comma-separated values down to the question and retain them on refresh and when reverting to default (metabase#25374-1, metabase#25374-2, metabase#25374-3, metabase#25374-4)", () => {+ cy.log("Drill-through and go to the question (metabase#25374-1)");H.getDashboardCard(0).findByText(questionDetails.name).click();cy.wait("@cardQuery");@@ -1481,9 +1279,13 @@ describe("issue 25374", () => {H.tableInteractiveBody().findByText("3");cy.location("search").should("eq", "?num=1%2C2%2C3");- });- it("should retain comma-separated values on refresh and when reverting to default (metabase#25374-2, metabase#25374-3, metabase#25374-4)", () => {+ H.queryBuilderHeader()+ .findByLabelText(`Back to ${dashboardDetails.name}`)+ .click();+ cy.location("search").should("eq", "?equal_to=1%2C2%2C3");+ cy.findByDisplayValue("1,2,3").should("be.visible");+cy.reload();// Make sure filter widget still has all the values@@ -1888,6 +1690,7 @@ describe("issues 29347, 29346", () => {const createDashboard = ({dashboardDetails = editableDashboardDetails,+ alias = "dashboardId",} = {}) => {H.createQuestionAndDashboard({ questionDetails, dashboardDetails }).then(({ body: { id, card_id, dashboard_id } }) => {@@ -1911,7 +1714,7 @@ describe("issues 29347, 29346", () => {],});- cy.wrap(dashboard_id).as("dashboardId");+ cy.wrap(dashboard_id).as(alias);},);};@@ -1928,7 +1731,7 @@ describe("issues 29347, 29346", () => {};const verifyRemappedValues = (fieldValue) => {- verifyRemappedFilterValues(filterValue);+ verifyRemappedFilterValues(fieldValue);verifyRemappedCardValues(fieldValue);};@@ -1950,121 +1753,109 @@ describe("issues 29347, 29346", () => {addFieldRemapping(ORDERS.QUANTITY);});- describe("regular dashboards", () => {- beforeEach(() => {- cy.intercept("GET", "/api/dashboard/*").as("dashboard");- cy.intercept("POST", "/api/dashboard/**/card/*/query").as("cardQuery");- });-- it("should be able to filter on remapped values in the UI and in the url (metabase#29347, metabase#29346)", () => {- createDashboard();- H.visitDashboard("@dashboardId");- cy.wait("@dashboard");- cy.wait("@cardQuery");-- filterOnRemappedValues(filterValue);- cy.wait("@cardQuery");+ it("should be able to filter on remapped values in the UI, in the url and in the token (metabase#29347, metabase#29346)", () => {+ cy.intercept("GET", "/api/dashboard/*").as("dashboard");+ cy.intercept("POST", "/api/dashboard/**/card/*/query").as("cardQuery");+ cy.intercept("GET", "/api/public/dashboard/*").as("publicDashboard");+ cy.intercept("GET", "/api/public/dashboard/**/card/*").as(+ "publicCardQuery",+ );+ cy.intercept("GET", "/api/embed/dashboard/*").as("embedDashboard");+ cy.intercept("GET", "/api/embed/dashboard/**/card/*").as("embedCardQuery");- verifyRemappedValues(filterValue);+ createDashboard();+ createDashboard({+ dashboardDetails: lockedDashboardDetails,+ alias: "lockedDashboardId",+ });- // Clear the last used value so the url value is the only source- H.clearFilterWidget();- cy.wait("@cardQuery");+ cy.log("Regular dashboard");+ H.visitDashboard("@dashboardId");+ cy.wait("@dashboard");+ cy.wait("@cardQuery");- H.visitDashboard("@dashboardId", {- params: { [filterDetails.slug]: filterValue },- });+ filterOnRemappedValues(filterValue);+ cy.wait("@cardQuery");- cy.wait("@dashboard");- cy.wait("@cardQuery");+ verifyRemappedValues(filterValue);- verifyRemappedValues(filterValue);- });- });+ // Clear the last used value so the url value is the only source+ H.clearFilterWidget();+ cy.wait("@cardQuery");- describe("embedded dashboards", () => {- beforeEach(() => {- cy.intercept("GET", "/api/embed/dashboard/*").as("dashboard");- cy.intercept("GET", "/api/embed/dashboard/**/card/*").as("cardQuery");+ H.visitDashboard("@dashboardId", {+ params: { [filterDetails.slug]: filterValue },});- it("should be able to filter on remapped values in the UI and in the url (metabase#29347, metabase#29346)", () => {- createDashboard();- cy.get("@dashboardId").then((dashboardId) =>- H.visitEmbeddedPage({- resource: { dashboard: dashboardId },- params: {},- }),- );- cy.wait("@dashboard");- cy.wait("@cardQuery");+ cy.wait("@dashboard");+ cy.wait("@cardQuery");- filterOnRemappedValues(filterValue);- cy.wait("@cardQuery");+ verifyRemappedValues(filterValue);- verifyRemappedValues(filterValue);+ cy.log("Public dashboard");+ cy.get("@dashboardId").then((dashboardId) =>+ H.visitPublicDashboard(dashboardId),+ );+ cy.wait("@publicDashboard");+ cy.wait("@publicCardQuery");- cy.get("@dashboardId").then((dashboardId) => {- H.visitEmbeddedPage(- {- resource: { dashboard: dashboardId },- params: {},- },- {- setFilters: { [filterDetails.slug]: filterValue },- },- );- });- cy.wait("@dashboard");- cy.wait("@cardQuery");+ filterOnRemappedValues(filterValue);+ cy.wait("@publicCardQuery");- verifyRemappedValues(filterValue);- });+ verifyRemappedValues(filterValue);- it("should be able to filter on remapped values in the token (metabase#29347, metabase#29346)", () => {- createDashboard({ dashboardDetails: lockedDashboardDetails });- cy.get("@dashboardId").then((dashboardId) => {- H.visitEmbeddedPage({- resource: { dashboard: dashboardId },- params: {- [filterDetails.slug]: filterValue,- },- });- });- cy.wait("@dashboard");- cy.wait("@cardQuery");-- verifyRemappedCardValues(filterValue);- });- });+ cy.location("pathname").then((pathname) =>+ cy.visit(`${pathname}?${filterDetails.slug}=${filterValue}`),+ );+ cy.wait("@publicDashboard");+ cy.wait("@publicCardQuery");- describe("public dashboards", () => {- beforeEach(() => {- cy.intercept("GET", "/api/public/dashboard/*").as("dashboard");- cy.intercept("GET", "/api/public/dashboard/**/card/*").as("cardQuery");- });+ verifyRemappedValues(filterValue);- it("should be able to filter on remapped values in the UI and in the url (metabase#29347, metabase#29346)", () => {- createDashboard();- cy.get("@dashboardId").then((dashboardId) =>- H.visitPublicDashboard(dashboardId),- );- cy.wait("@dashboard");- cy.wait("@cardQuery");+ cy.log("Embedded dashboard with an editable parameter");+ cy.get("@dashboardId").then((dashboardId) =>+ H.visitEmbeddedPage({+ resource: { dashboard: dashboardId },+ params: {},+ }),+ );+ cy.wait("@embedDashboard");+ cy.wait("@embedCardQuery");- filterOnRemappedValues(filterValue);- cy.wait("@cardQuery");+ filterOnRemappedValues(filterValue);+ cy.wait("@embedCardQuery");- verifyRemappedValues(filterValue);+ verifyRemappedValues(filterValue);- cy.location("pathname").then((pathname) =>- cy.visit(`${pathname}?${filterDetails.slug}=${filterValue}`),+ cy.get("@dashboardId").then((dashboardId) => {+ H.visitEmbeddedPage(+ {+ resource: { dashboard: dashboardId },+ params: {},+ },+ {+ setFilters: { [filterDetails.slug]: filterValue },+ },);- cy.wait("@dashboard");- cy.wait("@cardQuery");+ });+ cy.wait("@embedDashboard");+ cy.wait("@embedCardQuery");++ verifyRemappedValues(filterValue);- verifyRemappedValues(filterValue);+ cy.log("Embedded dashboard with a locked parameter in the token");+ cy.get("@lockedDashboardId").then((dashboardId) => {+ H.visitEmbeddedPage({+ resource: { dashboard: dashboardId },+ params: {+ [filterDetails.slug]: filterValue,+ },+ });});+ cy.wait("@embedDashboard");+ cy.wait("@embedCardQuery");++ verifyRemappedCardValues(filterValue);});});@@ -2248,11 +2039,11 @@ describe("issue 43154", () => {cy.signInAsNormalUser();});- it("should be able to see field values with a model-based question (metabase#43154)", () => {+ it("should be able to see field values with a model-based question with and without aggregation (metabase#43154)", () => {+ cy.log("Question without aggregation");verifyNestedFilter(questionDetails);- });- it("should be able to see field values with a model-based question with aggregation (metabase#43154)", () => {+ cy.log("Question with aggregation");verifyNestedFilter(questionWithAggregationDetails, () =>H.getDashboardCard().findByText("18,760").should("be.visible"),);diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-reproductions-2.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-reproductions-2.cy.spec.jsindex 0f9555e9f57..61ff9cfe895 100644--- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-reproductions-2.cy.spec.js+++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-reproductions-2.cy.spec.js@@ -22,31 +22,6 @@ const {PEOPLE_ID,} = SAMPLE_DATABASE;-describe("issue 27579", () => {- beforeEach(() => {- H.restore();- cy.signInAsNormalUser();- });-- it("should be able to remove the last exclude hour option (metabase#27579)", () => {- H.visitDashboard(ORDERS_DASHBOARD_ID);- H.editDashboard();- H.setFilter("Date picker", "All Options");- H.selectDashboardFilter(H.getDashboardCard(), "Created At");- H.saveDashboard();- H.filterWidget().click();- H.popover().within(() => {- cy.findByText("Exclude…").click();- cy.findByText("Hours of the day…").click();- cy.findByText("Select all").click();- cy.findByLabelText("12 AM").should("be.checked");-- cy.findByText("Select all").click();- cy.findByLabelText("12 AM").should("not.be.checked");- });- });-});-describe("issue 32804", () => {const question1Details = {name: "Q1",@@ -447,6 +422,7 @@ describe("issue 44790", () => {},});H.getDashboardCard().should("contain", "[email protected]");+ H.getDashboardCard().within(() => H.assertTableRowsCount(5));cy.log("wrong value for number filter should be ignored");H.visitDashboard("@dashboardId", {@@ -456,6 +432,7 @@ describe("issue 44790", () => {},});H.getDashboardCard().should("contain", "[email protected]");+ H.getDashboardCard().within(() => H.assertTableRowsCount(1));});});@@ -843,7 +820,7 @@ describe("issue 32573", () => {});});-describe("issue 45670", { tags: ["@external"] }, () => {+describe("issues 45670 and 14595", { tags: ["@external"] }, () => {const dialect = "postgres";const tableName = "many_data_types";@@ -898,6 +875,103 @@ describe("issue 45670", { tags: ["@external"] }, () => {};}+ function createDashboard() {+ return H.getTableId({ name: tableName }).then((tableId) => {+ return H.createDashboardWithQuestions({+ dashboardDetails: {+ parameters: [+ createMockParameter({+ id: "p1",+ slug: "p1",+ name: "p1",+ type: "string/=",+ sectionId: "string",+ }),+ createMockParameter({+ id: "p2",+ slug: "p2",+ name: "p2",+ type: "string/=",+ sectionId: "string",+ }),+ createMockParameter({+ id: "p3",+ slug: "p3",+ name: "p3",+ type: "string/=",+ sectionId: "string",+ }),+ ],+ },+ questions: [+ {+ name: "Orders",+ query: { "source-table": ORDERS_ID },+ },+ {+ name: "Products",+ query: { "source-table": PRODUCTS_ID },+ },+ {+ name: "Many data types",+ database: WRITABLE_DB_ID,+ query: { "source-table": tableId },+ },+ ],+ }).then(({ dashboard }) => {+ return dashboard.id;+ });+ });+ }++ function mapParameters() {+ cy.findByTestId("fixed-width-filters").findByText("p1").click();+ H.selectDashboardFilter(H.getDashboardCard(0), "Source");+ cy.findByTestId("fixed-width-filters").findByText("p2").click();+ H.selectDashboardFilter(H.getDashboardCard(1), "Category");+ cy.findByTestId("fixed-width-filters").findByText("p3").click();+ H.selectDashboardFilter(H.getDashboardCard(2), "String");+ }++ function assertLinkedFilterSettings({+ parameterName,+ compatibleParameterNames,+ incompatibleParameterNames,+ }) {+ cy.findByTestId("fixed-width-filters").findByText(parameterName).click();+ H.sidebar().within(() => {+ cy.findByText("Linked filters").click();+ compatibleParameterNames.forEach((compatibleParameterName) => {+ cy.findByTestId("compatible-parameters")+ .findByText(compatibleParameterName)+ .should("be.visible");+ });+ incompatibleParameterNames.forEach((incompatibleParameterName) => {+ cy.findByTestId("incompatible-parameters")+ .findByText(incompatibleParameterName)+ .should("be.visible");+ });+ });+ }++ function assertParameterSettings() {+ assertLinkedFilterSettings({+ parameterName: "p1",+ compatibleParameterNames: ["p2"],+ incompatibleParameterNames: ["p3"],+ });+ assertLinkedFilterSettings({+ parameterName: "p2",+ compatibleParameterNames: ["p1"],+ incompatibleParameterNames: ["p3"],+ });+ assertLinkedFilterSettings({+ parameterName: "p3",+ compatibleParameterNames: [],+ incompatibleParameterNames: ["p1", "p2"],+ });+ }+beforeEach(() => {H.restore(`${dialect}-writable`);H.resetTestTable({ type: dialect, table: tableName });@@ -905,7 +979,10 @@ describe("issue 45670", { tags: ["@external"] }, () => {H.resyncDatabase({ dbId: WRITABLE_DB_ID, tableName });});- it("should be able to pass query string parameters for boolean parameters in dashboards (metabase#45670)", () => {+ it("should pass query string parameters for boolean parameters and hide parameters that cannot be linked (metabase#45670, metabase#14595)", () => {+ cy.log(+ "Pass query string parameters for boolean parameters in dashboards (metabase#45670)",+ );getField().then((field) => {H.createNativeQuestion(getQuestionDetails(field.id)).then(({ body: card }) => {@@ -934,6 +1011,14 @@ describe("issue 45670", { tags: ["@external"] }, () => {cy.findByText("true").should("be.visible");cy.findByText("false").should("not.exist");});++ cy.log(+ "Don't show parameters that cannot be linked in parameter settings (metabase#14595)",+ );+ createDashboard().then((dashboardId) => H.visitDashboard(dashboardId));+ H.editDashboard();+ mapParameters();+ assertParameterSettings();});});@@ -1150,28 +1235,6 @@ describe("issue 52627", () => {});});-describe("issue 52918", () => {- beforeEach(() => {- H.restore();- cy.signInAsAdmin();- });-- it("should re-position the parameter dropdown when its size changes (metabase#52918)", () => {- H.visitDashboard(ORDERS_DASHBOARD_ID);- H.editDashboard();- H.setFilter("Date picker", "All Options");- H.sidebar().findByLabelText("No default").click();- H.popover().within(() => {- cy.findByText("Fixed date range…").click();- cy.findByText("Between").should("be.visible");- });- cy.log("check that there is no overflow in the popover");- H.popover().should(([element]) => {- expect(element.offsetWidth).to.gte(element.scrollWidth);- });- });-});-describe("issue 54236", () => {beforeEach(() => {H.restore();@@ -1365,122 +1428,6 @@ describe("issue 55678", () => {});});-describe("issue 14595", { tags: ["@external"] }, () => {- const dialect = "postgres";- const tableName = "many_data_types";-- function createDashboard() {- return H.getTableId({ name: tableName }).then((tableId) => {- return H.createDashboardWithQuestions({- dashboardDetails: {- parameters: [- createMockParameter({- id: "p1",- slug: "p1",- name: "p1",- type: "string/=",- sectionId: "string",- }),- createMockParameter({- id: "p2",- slug: "p2",- name: "p2",- type: "string/=",- sectionId: "string",- }),- createMockParameter({- id: "p3",- slug: "p3",- name: "p3",- type: "string/=",- sectionId: "string",- }),- ],- },- questions: [- {- name: "Orders",- query: { "source-table": ORDERS_ID },- },- {- name: "Products",- query: { "source-table": PRODUCTS_ID },- },- {- name: "Many data types",- database: WRITABLE_DB_ID,- query: { "source-table": tableId },- },- ],- }).then(({ dashboard }) => {- return dashboard.id;- });- });- }-- function mapParameters() {- cy.findByTestId("fixed-width-filters").findByText("p1").click();- H.selectDashboardFilter(H.getDashboardCard(0), "Source");- cy.findByTestId("fixed-width-filters").findByText("p2").click();- H.selectDashboardFilter(H.getDashboardCard(1), "Category");- cy.findByTestId("fixed-width-filters").findByText("p3").click();- H.selectDashboardFilter(H.getDashboardCard(2), "String");- }-- function assertLinkedFilterSettings({- parameterName,- compatibleParameterNames,- incompatibleParameterNames,- }) {- cy.findByTestId("fixed-width-filters").findByText(parameterName).click();- H.sidebar().within(() => {- cy.findByText("Linked filters").click();- compatibleParameterNames.forEach((compatibleParameterName) => {- cy.findByTestId("compatible-parameters")- .findByText(compatibleParameterName)- .should("be.visible");- });- incompatibleParameterNames.forEach((incompatibleParameterName) => {- cy.findByTestId("incompatible-parameters")- .findByText(incompatibleParameterName)- .should("be.visible");- });- });- }-- function assertParameterSettings() {- assertLinkedFilterSettings({- parameterName: "p1",- compatibleParameterNames: ["p2"],- incompatibleParameterNames: ["p3"],- });- assertLinkedFilterSettings({- parameterName: "p2",- compatibleParameterNames: ["p1"],- incompatibleParameterNames: ["p3"],- });- assertLinkedFilterSettings({- parameterName: "p3",- compatibleParameterNames: [],- incompatibleParameterNames: ["p1", "p2"],- });- }-- beforeEach(() => {- H.restore(`${dialect}-writable`);- H.resetTestTable({ type: dialect, table: tableName });- cy.signInAsAdmin();- H.resyncDatabase({ dbId: WRITABLE_DB_ID, tableName });- });-- it("should not see parameters that cannot be linked to the current parameter in parameter settings (metabase#14595)", () => {- createDashboard().then((dashboardId) => H.visitDashboard(dashboardId));- H.editDashboard();- mapParameters();- assertParameterSettings();- });-});-describe("issue 44090", () => {const parameterDetails = {name: "p1",@@ -1570,57 +1517,6 @@ describe("issue 44090", () => {});});-describe("issue 59306", () => {- beforeEach(() => {- H.restore();- cy.signInAsAdmin();-- const parameter = createMockParameter({- id: "p1",- slug: "p1",- type: "string/=",- sectionId: "string",- default: undefined,- values_query_type: "none",- });-- H.createDashboardWithQuestions({- dashboardDetails: {- parameters: [parameter],- },- questions: [{ name: "q1", query: { "source-table": PRODUCTS_ID } }],- }).then(({ dashboard, questions: [card] }) => {- H.updateDashboardCards({- dashboard_id: dashboard.id,- cards: [- {- card_id: card.id,- parameter_mappings: [- {- card_id: card.id,- parameter_id: parameter.id,- target: ["dimension", ["field", PRODUCTS.CATEGORY, null]],- },- ],- },- ],- }).then(() => {- H.visitDashboard(dashboard.id);- });- });- });-- it("should not overflow the filter box (metabase#59306)", () => {- H.filterWidget().click();- H.popover().within(() => {- cy.findByPlaceholderText("Enter some text")- .type("asdf".repeat(20))- .invoke("outerWidth")- .should("be.lt", 400);- });- });-});-describe("issues 60987 and 46767", () => {beforeEach(() => {H.restore();diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-reset-clear.cy.spec.ts b/e2e/test/scenarios/dashboard-filters/dashboard-filters-reset-clear.cy.spec.tsindex 0d479f014a8..fd14d778488 100644--- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-reset-clear.cy.spec.ts+++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-reset-clear.cy.spec.ts@@ -528,6 +528,7 @@ describe("scenarios > dashboard > filters > reset & clear", () => {]);checkDashboardParameters({+ defaultValue: ["1", "2"],defaultValueFormatted: "2 selections",otherValue: ["3", "4"],otherValueFormatted: "2 selections",@@ -537,6 +538,9 @@ describe("scenarios > dashboard > filters > reset & clear", () => {updateValue: (label, [firstValue, secondValue]) => {updateRangeFilter(label, firstValue, secondValue);},+ assertValue: (label, [firstValue, secondValue]) => {+ assertRangeFilterValue(label, firstValue, secondValue);+ },});});@@ -802,6 +806,7 @@ function checkStatusIcon(}function checkDashboardParameters<T = string>({+ defaultValue,defaultValueFormatted,otherValue,otherValueFormatted,@@ -809,7 +814,9 @@ function checkDashboardParameters<T = string>({updateValue = setValue,setDefaultValue = setValue,updateDefaultValue = updateValue,+ assertValue,}: {+ defaultValue?: T;defaultValueFormatted: string;otherValue: T;otherValueFormatted: string;@@ -817,14 +824,25 @@ function checkDashboardParameters<T = string>({updateValue?: (label: string, value: T) => void;setDefaultValue?: (label: string, value: T) => void;updateDefaultValue?: (label: string, value: T) => void;+ /**+ * Use when the formatted value does not tell the default and the other value apart.+ */+ assertValue?: (label: string, value: T) => void;}) {+ const checkValue = (label: string, formatted: string, value?: T) => {+ filter(label).should("contain.text", formatted);+ if (assertValue && value !== undefined) {+ assertValue(label, value);+ }+ };+cy.log("no default value, non-required, no current value");checkStatusIcon(NO_DEFAULT_NON_REQUIRED, "chevron");checkResetAllFiltersHidden();cy.log("no default value, non-required, has current value");setValue(NO_DEFAULT_NON_REQUIRED, otherValue);- filter(NO_DEFAULT_NON_REQUIRED).should("contain.text", otherValueFormatted);+ checkValue(NO_DEFAULT_NON_REQUIRED, otherValueFormatted, otherValue);checkStatusIcon(NO_DEFAULT_NON_REQUIRED, "clear");checkResetAllFiltersShown();@@ -854,7 +872,7 @@ function checkDashboardParameters<T = string>({cy.log("has default value, non-required, current value same as default");checkStatusIcon(DEFAULT_NON_REQUIRED, "clear");- filter(DEFAULT_NON_REQUIRED).should("contain.text", defaultValueFormatted);+ checkValue(DEFAULT_NON_REQUIRED, defaultValueFormatted, defaultValue);checkResetAllFiltersHidden();@@ -867,7 +885,7 @@ function checkDashboardParameters<T = string>({cy.findByLabelText("Move, trash, and more…").click();H.popover().findByText("Reset all filters").click();checkStatusIcon(DEFAULT_NON_REQUIRED, "clear");- filter(DEFAULT_NON_REQUIRED).should("contain.text", defaultValueFormatted);+ checkValue(DEFAULT_NON_REQUIRED, defaultValueFormatted, defaultValue);// revert so that we can try resetting with status button as wellclearButton(DEFAULT_NON_REQUIRED).click();@@ -879,7 +897,7 @@ function checkDashboardParameters<T = string>({// reset with status buttonresetButton(DEFAULT_NON_REQUIRED).click();- filter(DEFAULT_NON_REQUIRED).should("contain.text", defaultValueFormatted);+ checkValue(DEFAULT_NON_REQUIRED, defaultValueFormatted, defaultValue);checkStatusIcon(DEFAULT_NON_REQUIRED, "clear");checkResetAllFiltersHidden();@@ -889,14 +907,14 @@ function checkDashboardParameters<T = string>({);updateValue(DEFAULT_NON_REQUIRED, otherValue);- filter(DEFAULT_NON_REQUIRED).should("contain.text", otherValueFormatted);+ checkValue(DEFAULT_NON_REQUIRED, otherValueFormatted, otherValue);checkStatusIcon(DEFAULT_NON_REQUIRED, "reset");checkResetAllFiltersShown();// reset all filterscy.findByLabelText("Move, trash, and more…").click();H.popover().findByText("Reset all filters").click();- filter(DEFAULT_NON_REQUIRED).should("contain.text", defaultValueFormatted);+ checkValue(DEFAULT_NON_REQUIRED, defaultValueFormatted, defaultValue);checkStatusIcon(DEFAULT_NON_REQUIRED, "clear");checkResetAllFiltersHidden();@@ -906,26 +924,26 @@ function checkDashboardParameters<T = string>({// reset with status buttonresetButton(DEFAULT_NON_REQUIRED).click();- filter(DEFAULT_NON_REQUIRED).should("contain.text", defaultValueFormatted);+ checkValue(DEFAULT_NON_REQUIRED, defaultValueFormatted, defaultValue);checkStatusIcon(DEFAULT_NON_REQUIRED, "clear");checkResetAllFiltersHidden();cy.log("has default value, required, value same as default");- filter(DEFAULT_REQUIRED).should("contain.text", defaultValueFormatted);+ checkValue(DEFAULT_REQUIRED, defaultValueFormatted, defaultValue);checkStatusIcon(DEFAULT_REQUIRED, "none");checkResetAllFiltersHidden();cy.log("has default value, required, current value different than default");updateValue(DEFAULT_REQUIRED, otherValue);- filter(DEFAULT_REQUIRED).should("contain.text", otherValueFormatted);+ checkValue(DEFAULT_REQUIRED, otherValueFormatted, otherValue);checkStatusIcon(DEFAULT_REQUIRED, "reset");checkResetAllFiltersShown();// reset all filterscy.findByLabelText("Move, trash, and more…").click();H.popover().findByText("Reset all filters").click();- filter(DEFAULT_REQUIRED).should("contain.text", defaultValueFormatted);+ checkValue(DEFAULT_REQUIRED, defaultValueFormatted, defaultValue);checkStatusIcon(DEFAULT_REQUIRED, "none");checkResetAllFiltersHidden();@@ -934,7 +952,7 @@ function checkDashboardParameters<T = string>({// reset with status buttonresetButton(DEFAULT_REQUIRED).click();- filter(DEFAULT_REQUIRED).should("contain.text", defaultValueFormatted);+ checkValue(DEFAULT_REQUIRED, defaultValueFormatted, defaultValue);checkStatusIcon(DEFAULT_REQUIRED, "none");checkResetAllFiltersHidden();@@ -1226,6 +1244,19 @@ function addRangeFilter(H.popover().button("Add filter").click();}+function assertRangeFilterValue(+ label: string,+ firstValue: string,+ secondValue: string,+) {+ filter(label).click();+ H.popover().findAllByRole("textbox").first().should("have.value", firstValue);+ // eslint-disable-next-line metabase/no-unsafe-element-filtering+ H.popover().findAllByRole("textbox").last().should("have.value", secondValue);+ cy.realPress("Escape");+ cy.findByTestId("parameter-value-dropdown").should("not.exist");+}+function updateRangeFilter(label: string,firstValue: string,diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-source.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-source.cy.spec.jsindex 4850817efd3..337d345991e 100644--- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-source.cy.spec.js+++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-source.cy.spec.js@@ -29,14 +29,30 @@ const targetQuestion = {},};+const stringLabelSource = {+ name: "String label source",+ native: {+ query:+ "SELECT DISTINCT CATEGORY, CONCAT(CATEGORY, ' Label') AS LABEL " ++ "FROM PRODUCTS WHERE CATEGORY != 'Doohickey'",+ },+};++const numberLabelSource = {+ name: "Number label source",+ native: {+ query: "SELECT ID, TITLE FROM PRODUCTS ORDER BY ID ASC LIMIT 5",+ },+};+describe("scenarios > dashboard > filters", { tags: "@slow" }, () => {beforeEach(() => {H.restore();cy.signInAsAdmin();});- describe("question source", () => {- it("should be able to use structured and native question sources", () => {+ describe("question, static list and field sources", () => {+ it("should be able to use structured, native and labeled question sources, static list sources and field search", () => {H.createQuestion(structuredSourceQuestion, {wrapId: true,idAlias: "structuredSourceQuestionId",@@ -45,6 +61,8 @@ describe("scenarios > dashboard > filters", { tags: "@slow" }, () => {wrapId: true,idAlias: "nativeSourceQuestionId",});+ H.createNativeQuestion(stringLabelSource);+ H.createNativeQuestion(numberLabelSource);H.createQuestionAndDashboard({questionDetails: targetQuestion,}).then(({ body: { dashboard_id } }) => {@@ -66,61 +84,6 @@ describe("scenarios > dashboard > filters", { tags: "@slow" }, () => {mapFilterToQuestion();H.setFilterQuestionSource({ question: "SQL source", field: "CATEGORY" });- H.saveDashboard();-- cy.log("structured question source with string/contains parameter");- H.getDashboardCard().findByText("200").should("be.visible");- H.filterWidget({ name: "GUI Contains" }).click();- H.popover().findByText("Gizmo").click();- H.popover().button("Add filter").click();- H.getDashboardCard().findByText("51").should("be.visible");-- cy.log("structured question source with string/= parameter");- filterDashboard({ name: "GUI Is" });-- cy.log("native question source");- filterDashboard({ name: "SQL Is" });-- cy.get("@structuredSourceQuestionId").then(H.visitQuestion);- archiveQuestion(- "It will also be removed from the 2 filters that use it to populate values.",- );-- cy.get("@nativeSourceQuestionId").then(H.visitQuestion);- archiveQuestion(- "It will also be removed from the filter that uses it to populate values.",- );- });- });-- describe("question source with custom labels", () => {- const stringLabelSource = {- name: "String label source",- native: {- query:- "SELECT DISTINCT CATEGORY, CONCAT(CATEGORY, ' Label') AS LABEL " +- "FROM PRODUCTS WHERE CATEGORY != 'Doohickey'",- },- };-- const numberLabelSource = {- name: "Number label source",- native: {- query: "SELECT ID, TITLE FROM PRODUCTS ORDER BY ID ASC LIMIT 5",- },- };-- it("should remap string, number and id values to string labels", () => {- H.createNativeQuestion(stringLabelSource);- H.createNativeQuestion(numberLabelSource);- H.createQuestionAndDashboard({- questionDetails: targetQuestion,- }).then(({ body: { dashboard_id } }) => {- H.visitDashboard(dashboard_id);- });-- H.editDashboard();-H.setFilter("Text or Category", "Is", "String label");mapFilterToQuestion();H.setFilterQuestionSource({@@ -145,8 +108,38 @@ describe("scenarios > dashboard > filters", { tags: "@slow" }, () => {labelField: "TITLE",});+ H.setFilter("Text or Category", "Is", "List dropdown");+ mapFilterToQuestion();+ H.setFilterListSource({+ values: [["Gadget"], ["Gizmo", "Gizmo Label"], "Widget"],+ });++ H.setFilter("Text or Category", "Is", "List search");+ mapFilterToQuestion();+ H.sidebar().findByText("Search box").click();+ H.setFilterListSource({+ values: [["Gadget"], ["Gizmo", "Gizmo Label"], "Widget"],+ });++ H.setFilter("Text or Category", "Is", "Field search");+ mapFilterToQuestion();+ H.setSearchBoxFilterType();+H.saveDashboard();+ cy.log("structured question source with string/contains parameter");+ H.getDashboardCard().findByText("200").should("be.visible");+ H.filterWidget({ name: "GUI Contains" }).click();+ H.popover().findByText("Gizmo").click();+ H.popover().button("Add filter").click();+ H.getDashboardCard().findByText("51").should("be.visible");++ cy.log("structured question source with string/= parameter");+ filterDashboard({ name: "GUI Is" });++ cy.log("native question source");+ filterDashboard({ name: "SQL Is" });+cy.log("string/string: the dropdown shows the labels instead of the raw values",);@@ -201,37 +194,6 @@ describe("scenarios > dashboard > filters", { tags: "@slow" }, () => {H.filterWidget({ name: "ID label" }).findByText("Rustic Paper Wallet").should("be.visible");- });- });-- describe("static list and field sources", () => {- it("should be able to use static list sources and a search box with fields configured for list", () => {- H.createQuestionAndDashboard({- questionDetails: targetQuestion,- }).then(({ body: { dashboard_id } }) => {- H.visitDashboard(dashboard_id);- });-- H.editDashboard();-- H.setFilter("Text or Category", "Is", "List dropdown");- mapFilterToQuestion();- H.setFilterListSource({- values: [["Gadget"], ["Gizmo", "Gizmo Label"], "Widget"],- });-- H.setFilter("Text or Category", "Is", "List search");- mapFilterToQuestion();- H.sidebar().findByText("Search box").click();- H.setFilterListSource({- values: [["Gadget"], ["Gizmo", "Gizmo Label"], "Widget"],- });-- H.setFilter("Text or Category", "Is", "Field search");- mapFilterToQuestion();- H.setSearchBoxFilterType();-- H.saveDashboard();cy.log("static list source (dropdown)");filterDashboard({ name: "List dropdown", isLabeled: true });@@ -244,6 +206,17 @@ describe("scenarios > dashboard > filters", { tags: "@slow" }, () => {cy.log("field source (search box)");filterDashboard({ name: "Field search", isField: true });++ cy.log("archive question sources");+ cy.get("@structuredSourceQuestionId").then(H.visitQuestion);+ archiveQuestion(+ "It will also be removed from the 2 filters that use it to populate values.",+ );++ cy.get("@nativeSourceQuestionId").then(H.visitQuestion);+ archiveQuestion(+ "It will also be removed from the filter that uses it to populate values.",+ );});});});diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-sql-management.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-sql-management.cy.spec.jsdeleted file mode 100644index d6d41547334..00000000000--- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-sql-management.cy.spec.js+++ /dev/null@@ -1,78 +0,0 @@-const { H } = cy;--describe("scenarios > dashboard > filters > SQL > management", () => {- beforeEach(() => {- H.restore();- cy.signInAsAdmin();- });-- describe("number filter", () => {- const questionDetails = {- name: "SQL question with Number variable",- native: {- "template-tags": {- tax: {- type: "number",- name: "tax",- id: "0a60ecb5-69b8-49e8-b494-ad67ad7d1050",- "display-name": "Tax GTE",- "widget-type": null,- default: null,- },- },- query: "select * from orders where tax >= {{tax}};",- },- };-- beforeEach(() => {- H.createNativeQuestionAndDashboard({ questionDetails }).then(- ({ body: { dashboard_id } }) => {- H.visitDashboard(dashboard_id);- },- );- H.editDashboard();- });-- it("should reset mappings when current operator is '=' and new operator is not '='", () => {- H.setFilter("Number", "Equal to");-- H.getDashboardCard().findByRole("button").click();- H.popover().findByText("Tax GTE").click();-- H.saveDashboard();-- H.filterWidget().type("10{enter}");-- H.getDashboardCard().should("contain", "1,062");-- H.editDashboard();-- cy.findByTestId("edit-dashboard-parameters-widget-container")- .contains("Number")- .click();-- H.sidebar().findByText("Filter operator").next().click();- H.popover().findByText("Between").click();-- H.getDashboardCard()- .should(- "contain",- "A number variable in this card can only be connected to a number filter with Equal to operator.",- )- .and("not.contain", "Column to filter on");-- H.sidebar().findByText("Filter operator").next().click();- H.popover().findByText("Equal to").click();-- H.getDashboardCard()- .should("contain", "Column to filter on")- .findByRole("button")- .should("contain", "Select…")- .and("not.contain", "Tax GTE");-- H.saveDashboard();-- H.filterWidget().should("not.exist");- });- });-});diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-sql-number.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-sql-number.cy.spec.jsindex 0e726991276..dbdceb9644e 100644--- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-sql-number.cy.spec.js+++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-sql-number.cy.spec.js@@ -31,13 +31,6 @@ describe("scenarios > dashboard > filters > SQL > number", () => {type: "number/=",sectionId: "number",},- {- name: "Price",- slug: "price",- id: "88b1a9dd",- type: "number/=",- sectionId: "number",- },];const parameterMapping = filterDetails.map((filter) => ({@@ -82,8 +75,14 @@ describe("scenarios > dashboard > filters > SQL > number", () => {});});- it("should keep filter value on blur (metabase#31975)", () => {- cy.findByPlaceholderText("Price").type("95").blur();+ it("should keep filter value on blur (metabase#31975), and reset mappings when the operator changes from '=' to another operator", () => {+ H.editDashboard();+ H.setFilter("Number", "Equal to");+ H.getDashboardCard().findByRole("button").click();+ H.popover().findByText("Price").click();+ H.saveDashboard();++ cy.findByPlaceholderText("Number").type("95").blur();cy.findByPlaceholderText("Rating").type("3.8").blur();cy.findByTestId("table-body")@@ -97,5 +96,36 @@ describe("scenarios > dashboard > filters > SQL > number", () => {.and("contain", "95.93")// second line rating.and("contain", "4.4");++ cy.log("reset mappings when the operator changes from '=' to Between");+ H.editDashboard();++ cy.findByTestId("edit-dashboard-parameters-widget-container")+ .contains("Number")+ .click();++ H.sidebar().findByText("Filter operator").next().click();+ H.popover().findByText("Between").click();++ H.getDashboardCard()+ .should(+ "contain",+ "A number variable in this card can only be connected to a number filter with Equal to operator.",+ )+ .and("not.contain", "Column to filter on");++ H.sidebar().findByText("Filter operator").next().click();+ H.popover().findByText("Equal to").click();++ H.getDashboardCard()+ .should("contain", "Column to filter on")+ .findByRole("button")+ .should("contain", "Select…")+ .and("not.contain", "Price");++ H.saveDashboard();++ H.filterWidget({ name: "Rating" }).should("be.visible");+ H.filterWidget({ name: "Number" }).should("not.exist");});});diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-text-category.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-text-category.cy.spec.jsindex bfb783a67de..372d208fb99 100644--- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-text-category.cy.spec.js+++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-text-category.cy.spec.js@@ -144,7 +144,7 @@ describe("scenarios > dashboard > filters > text/category", () => {H.filterWidget().contains("Arnold Adams");});- it("should support being required", () => {+ it("should support being required, use the list value picker for single- and multi-value category filters (metabase#49323), and reset when all values are unselected (metabase#25533)", () => {H.setFilter("Text or Category", "Is");H.selectDashboardFilter(cy.findByTestId("dashcard"), "Source");@@ -195,9 +195,9 @@ describe("scenarios > dashboard > filters > text/category", () => {cy.get(H.POPOVER_ELEMENT).should("not.exist");H.filterWidget().findByText("Organic").should("be.visible");assertOrganicOnly();- });- it("should use the list value picker for single- and multi-value category filters (metabase#49323) and reset when all values are unselected (metabase#25533)", () => {+ cy.log("add the Title and Source filters");+ H.editDashboard();H.setFilter("Text or Category", "Is", "Single title");H.selectDashboardFilter(cy.findByTestId("dashcard"), "Title");H.sidebar().findByText("A single value").click();@@ -245,7 +245,7 @@ describe("scenarios > dashboard > filters > text/category", () => {listTestId: "list-field",widgetText: "2 selections",},- ].forEach(({ name, listTestId, widgetText }, index) => {+ ].forEach(({ name, listTestId, widgetText }) => {cy.log(name);H.filterWidget({ name }).click();H.popover().within(() => {@@ -256,8 +256,7 @@ describe("scenarios > dashboard > filters > text/category", () => {cy.findByText("Aerodynamic Bronze Hat").should("be.visible").click();cy.button("Add filter").click();});- // eslint-disable-next-line metabase/no-unsafe-element-filtering- H.filterWidget().eq(index).findByText(widgetText).should("be.visible");+ H.filterWidget({ name }).findByText(widgetText).should("be.visible");});});});diff --git a/e2e/test/scenarios/dashboard-filters/dashboard-filters-with-question-revert.cy.spec.js b/e2e/test/scenarios/dashboard-filters/dashboard-filters-with-question-revert.cy.spec.jsindex c24d6e841dc..55bf82f6459 100644--- a/e2e/test/scenarios/dashboard-filters/dashboard-filters-with-question-revert.cy.spec.js+++ b/e2e/test/scenarios/dashboard-filters/dashboard-filters-with-question-revert.cy.spec.js@@ -194,6 +194,7 @@ describe("issue 35954", () => {// Set the filter through the URLcy.visit(`/public/dashboard/${uuid}?number=3`);});+ H.filterWidget().should("contain", "3");assertFilterIsDisconnected();});diff --git a/e2e/test/scenarios/dashboard-filters/parameters.cy.spec.js b/e2e/test/scenarios/dashboard-filters/parameters.cy.spec.jsindex bfd86b3a06a..6909f54ee39 100644--- a/e2e/test/scenarios/dashboard-filters/parameters.cy.spec.js+++ b/e2e/test/scenarios/dashboard-filters/parameters.cy.spec.js@@ -82,6 +82,17 @@ describe("scenarios > dashboard > parameters", () => {parameters: [startsWith, endsWith],};+ cy.intercept(+ "GET",+ "/api/dashboard/*/params/*/values",+ cy.spy().as("paramValues"),+ );+ cy.intercept(+ "GET",+ "/api/dashboard/*/params/*/search/*",+ cy.spy().as("paramSearch"),+ );+H.createQuestionAndDashboard({ questionDetails, dashboardDetails }).then(({ body: { id, card_id, dashboard_id } }) => {cy.request("PUT", `/api/dashboard/${dashboard_id}`, {@@ -139,14 +150,6 @@ describe("scenarios > dashboard > parameters", () => {// eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usagecy.findByText(startsWith.name).click();cy.findByPlaceholderText("Enter some text").type("G");- // Make sure the dropdown list with values is not populated,- // because it makes no sense for non-exact parameter string operators.- // See: https://github.com/metabase/metabase/pull/15477- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("Gizmo").should("not.exist");- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("Gadget").should("not.exist");-cy.button("Add filter").click();expectSearchParams({ [endsWith.slug]: "", [startsWith.slug]: "G" });@@ -154,21 +157,23 @@ describe("scenarios > dashboard > parameters", () => {H.tableInteractiveBody().findByText("52.72").should("be.visible");H.tableInteractiveBody().findByText("37.65").should("not.exist");+ // Non-exact string operators do not load or search the field values.+ // See: https://github.com/metabase/metabase/pull/15477+ cy.get("@paramValues").should("not.have.been.called");+ cy.get("@paramSearch").should("not.have.been.called");+// eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usagecy.findByText(endsWith.name).click();cy.findByPlaceholderText("Enter some text").type("zmo");- // Make sure the dropdown list with values is not populated,- // because it makes no sense for non-exact parameter string operators.- // See: https://github.com/metabase/metabase/pull/15477- // eslint-disable-next-line metabase/no-unscoped-text-selectors -- deprecated usage- cy.findByText("Gizmo").should("not.exist");-cy.button("Add filter").click();expectSearchParams({ [endsWith.slug]: "zmo", [startsWith.slug]: "G" });H.tableInteractiveBody().findByText("110.93").should("be.visible");H.tableInteractiveBody().findByText("52.72").should("not.exist");+ cy.get("@paramValues").should("not.have.been.called");+ cy.get("@paramSearch").should("not.have.been.called");+// Remove filter (metabase#17933)cy.icon("pencil").click();H.filterWidget({ isEditing: true, name: startsWith.name }).click();@@ -467,9 +472,10 @@ describe("scenarios > dashboard > parameters", () => {describe("when parameters are (dis)connected to dashcards", () => {beforeEach(() => {- createDashboardWithCards({ cards }).then((dashboardId) =>- H.visitDashboard(dashboardId),- );+ H.createDashboard().then(({ body: { id } }) => {+ H.updateDashboardCards({ dashboard_id: id, cards });+ H.visitDashboard(id);+ });const { interceptor } = H.spyRequestFinished("dashcardRequestSpy");@@ -780,6 +786,22 @@ describe("scenarios > dashboard > parameters", () => {H.editDashboard();});+ cy.log("Undo the heading dashcard removal (VIZ-1236)");+ H.removeDashboardCard(0);+ H.getDashboardCard().findByText("test question").should("exist");++ H.undo();++ H.getDashboardCard(0).within(() => {+ H.filterWidget({ isEditing: true }).contains("Category").click();+ });+ H.getDashboardCard(1)+ .findByTestId("parameter-mapper-container")+ .findByText(/Category/)+ .should("exist");+ H.dashboardParameterSidebar().button("Done").click();++ cy.log("Edit the restored filter");H.getDashboardCard(0).within(() => {H.filterWidget({ isEditing: true }).contains("Category").click();});@@ -820,6 +842,29 @@ describe("scenarios > dashboard > parameters", () => {cy.location().should(({ search }) => {expect(search).to.eq("?count=4000");});++ cy.log("Removing the heading dashcard removes its filters");+ cy.intercept("PUT", "/api/dashboard/*").as("updateDashboard");+ H.editDashboard();+ H.removeDashboardCard(0);+ H.getDashboardCard().findByText("test question").should("exist");+ H.undo();+ H.getDashboardCard(0)+ .findByTestId("editing-parameter-widget")+ .should("contain", "Count");+ H.removeDashboardCard(0);+ H.saveDashboard();++ cy.wait("@updateDashboard").then((xhr) => {+ const { body: dashboard } = xhr.request;+ expect(dashboard.parameters).to.have.length(0);+ expect(dashboard.dashcards).to.have.length(1);+ expect(dashboard.dashcards[0].card_id).to.not.equal(null);+ dashboard.dashcards.forEach((dashcard) => {+ expect(dashcard.inline_parameters).to.have.length(0);+ expect(dashcard.parameter_mappings).to.have.length(0);+ });+ });});it("should remove filters correctly", () => {@@ -954,6 +999,10 @@ describe("scenarios > dashboard > parameters", () => {H.getDashboardCard(0).within(() => {H.filterWidget({ isEditing: true }).contains("Category").click();});+ H.getDashboardCard(2)+ .findByTestId("parameter-mapper-container")+ .findByText("Select…")+ .should("be.visible");H.getDashboardCard(2).findByTestId("parameter-mapper-container").findByText(/Category/)@@ -963,6 +1012,14 @@ describe("scenarios > dashboard > parameters", () => {// Verify filter isn't auto-wired after mapping it to a cardH.disconnectDashboardFilter(H.getDashboardCard(1), "Category");H.selectDashboardFilter(H.getDashboardCard(1), "Category");+ H.getDashboardCard(1)+ .findByTestId("parameter-mapper-container")+ .findByText(/Category/)+ .should("exist");+ H.getDashboardCard(2)+ .findByTestId("parameter-mapper-container")+ .findByText("Select…")+ .should("be.visible");H.getDashboardCard(2).findByTestId("parameter-mapper-container").findByText(/Category/)@@ -1074,10 +1131,18 @@ describe("scenarios > dashboard > parameters", () => {});it("should duplicate filters when duplicating a dashboard", () => {+ const cardCategoryParameter = createMockParameter({+ id: "c4a7e5d2",+ name: "Card Category",+ type: "string/=",+ slug: "category_2",+ sectionId: "string",+ });+H.createQuestionAndDashboard({questionDetails: ordersCountByCategory,dashboardDetails: {- parameters: [categoryParameter],+ parameters: [categoryParameter, cardCategoryParameter],},}).then(({ body: dashcard }) => {H.updateDashboardCards({@@ -1093,6 +1158,7 @@ describe("scenarios > dashboard > parameters", () => {row: 1,size_x: 12,size_y: 6,+ inline_parameters: [cardCategoryParameter.id],parameter_mappings: [{parameter_id: categoryParameter.id,@@ -1103,6 +1169,15 @@ describe("scenarios > dashboard > parameters", () => {{ "stage-number": 0 },],},+ {+ parameter_id: cardCategoryParameter.id,+ card_id: dashcard.card_id,+ target: [+ "dimension",+ categoryFieldRef,+ { "stage-number": 0 },+ ],+ },],},],@@ -1118,12 +1193,15 @@ describe("scenarios > dashboard > parameters", () => {.should("exist");H.getDashboardCard(1).within(() => {- cy.findByText("Doohickey").should("be.visible");- cy.findByText("Gizmo").should("be.visible");- cy.findByText("Gadget").should("be.visible");- cy.findByText("Widget").should("be.visible");+ H.echartsContainer().within(() => {+ cy.findByText("Doohickey").should("be.visible");+ cy.findByText("Gizmo").should("be.visible");+ cy.findByText("Gadget").should("be.visible");+ cy.findByText("Widget").should("be.visible");+ });});+ cy.log("Heading filter");H.getDashboardCard(0).within(() => {H.filterWidget().contains("Category").click();});@@ -1133,85 +1211,44 @@ describe("scenarios > dashboard > parameters", () => {});H.getDashboardCard(1).within(() => {- cy.findByText("Gadget").should("be.visible");- cy.findByText("Doohickey").should("not.exist");- cy.findByText("Gizmo").should("not.exist");- cy.findByText("Widget").should("not.exist");+ H.echartsContainer().within(() => {+ cy.findByText("Gadget").should("be.visible");+ cy.findByText("Doohickey").should("not.exist");+ cy.findByText("Gizmo").should("not.exist");+ cy.findByText("Widget").should("not.exist");+ });});- cy.location().should(({ search }) => {- expect(search).to.eq("?category=Gadget");- });- });+ expectSearchParams({ category: "Gadget", category_2: "" });- it("should correctly undo dashcard removal and remove filters with the dashcard (VIZ-1236)", () => {- cy.intercept("PUT", "/api/dashboard/*").as("updateDashboard");+ cy.log("Question dashcard filter");+ H.getDashboardCard(0).within(() => H.clearFilterWidget());- H.createQuestionAndDashboard({- questionDetails: ordersCountByCategory,- dashboardDetails: {- parameters: [categoryParameter],- },- }).then(({ body: dashcard }) => {- H.updateDashboardCards({- dashboard_id: dashcard.dashboard_id,- cards: [- createMockHeadingDashboardCard({- inline_parameters: [categoryParameter.id],- size_x: 24,- size_y: 1,- }),- {- id: dashcard.id,- row: 1,- size_x: 12,- size_y: 6,- parameter_mappings: [- {- parameter_id: categoryParameter.id,- card_id: dashcard.card_id,- target: [- "dimension",- categoryFieldRef,- { "stage-number": 0 },- ],- },- ],- },- ],+ H.getDashboardCard(1).within(() => {+ H.echartsContainer().within(() => {+ cy.findByText("Doohickey").should("be.visible");+ cy.findByText("Gizmo").should("be.visible");+ cy.findByText("Gadget").should("be.visible");+ cy.findByText("Widget").should("be.visible");});- H.visitDashboard(dashcard.dashboard_id);- H.editDashboard();- });- H.removeDashboardCard(0);- H.getDashboardCard().findByText("test question").should("exist");-- H.undo();-- H.getDashboardCard(0).within(() => {- H.filterWidget({ isEditing: true }).contains("Category").click();+ H.filterWidget().contains("Card Category").click();+ });+ H.popover().within(() => {+ cy.findByText("Gadget").click();+ cy.button("Add filter").click();});- H.getDashboardCard(1)- .findByTestId("parameter-mapper-container")- .findByText(/Category/)- .should("exist");- H.dashboardParameterSidebar().button("Done").click();-- cy.log("Removing the heading dashcard removes its filters");- H.removeDashboardCard(0);- H.saveDashboard();- cy.wait("@updateDashboard").then((xhr) => {- const { body: dashboard } = xhr.request;- expect(dashboard.parameters).to.have.length(0);- expect(dashboard.dashcards).to.have.length(1);- expect(dashboard.dashcards[0].card_id).to.not.equal(null);- dashboard.dashcards.forEach((dashcard) => {- expect(dashcard.inline_parameters).to.have.length(0);- expect(dashcard.parameter_mappings).to.have.length(0);+ H.getDashboardCard(1).within(() => {+ H.echartsContainer().within(() => {+ cy.findByText("Gadget").should("be.visible");+ cy.findByText("Doohickey").should("not.exist");+ cy.findByText("Gizmo").should("not.exist");+ cy.findByText("Widget").should("not.exist");});});++ expectSearchParams({ category: "", category_2: "Gadget" });});it("should not display a parameter widget if there are no linked with it cards after a text card variable is removed (UXW-751)", () => {@@ -1434,14 +1471,38 @@ describe("scenarios > dashboard > parameters", () => {});describe("embedded dashboards", () => {- it("should work correctly when parameter is enabled", () => {+ it("should work correctly with enabled, disabled and locked parameters", () => {+ const disabledCategoryParameter = createMockParameter({+ ...categoryParameter,+ id: "d15ab1ed",+ name: "Category Disabled",+ slug: "category_disabled",+ });+ const lockedCategoryParameter = createMockParameter({+ ...categoryParameter,+ id: "10c4ed00",+ name: "Category Locked",+ slug: "category_locked",+ });+ const categoryTarget = [+ "dimension",+ categoryFieldRef,+ { "stage-number": 0 },+ ];+H.createQuestionAndDashboard({questionDetails: ordersCountByCategory,dashboardDetails: {- parameters: [categoryParameter],+ parameters: [+ categoryParameter,+ disabledCategoryParameter,+ lockedCategoryParameter,+ ],enable_embedding: true,embedding_params: {[categoryParameter.slug]: "enabled",+ [disabledCategoryParameter.slug]: "disabled",+ [lockedCategoryParameter.slug]: "locked",},},}).then(({ body: dashcard }) => {@@ -1451,6 +1512,8 @@ describe("scenarios > dashboard > parameters", () => {dashboard_id: dashboardId,cards: [createMockHeadingDashboardCard({+ id: -1,+ row: 0,inline_parameters: [categoryParameter.id],size_x: 24,size_y: 1,@@ -1464,88 +1527,37 @@ describe("scenarios > dashboard > parameters", () => {{parameter_id: categoryParameter.id,card_id: dashcard.card_id,- target: [- "dimension",- categoryFieldRef,- { "stage-number": 0 },- ],+ target: categoryTarget,+ },+ {+ parameter_id: disabledCategoryParameter.id,+ card_id: dashcard.card_id,+ target: categoryTarget,},],},- ],- });-- H.visitEmbeddedPage({- resource: { dashboard: dashboardId },- params: {},- });- });-- H.getDashboardCard(1).within(() => {- cy.findByText("Doohickey").should("be.visible");- cy.findByText("Gizmo").should("be.visible");- cy.findByText("Gadget").should("be.visible");- cy.findByText("Widget").should("be.visible");- });-- H.getDashboardCard(0).within(() => {- H.filterWidget().contains("Category").click();- });- H.popover().within(() => {- cy.findByText("Gadget").click();- cy.button("Add filter").click();- });-- H.getDashboardCard(1).within(() => {- cy.findByText("Gadget").should("be.visible");- cy.findByText("Doohickey").should("not.exist");- cy.findByText("Gizmo").should("not.exist");- cy.findByText("Widget").should("not.exist");- });-- cy.location().should(({ search }) => {- expect(search).to.eq("?category=Gadget");- });-- // Verify filter doesn't show up in the dashboard header- H.dashboardParametersContainer().should("not.exist");- });-- it("should work correctly when parameter is disabled", () => {- H.createQuestionAndDashboard({- questionDetails: ordersCountByCategory,- dashboardDetails: {- parameters: [categoryParameter],- enable_embedding: true,- embedding_params: {- [categoryParameter.slug]: "disabled",- },- },- }).then(({ body: dashcard }) => {- const dashboardId = dashcard.dashboard_id;-- H.updateDashboardCards({- dashboard_id: dashboardId,- cards: [createMockHeadingDashboardCard({- inline_parameters: [categoryParameter.id],+ id: -2,+ row: 7,+ text: "Hidden filters",+ inline_parameters: [+ disabledCategoryParameter.id,+ lockedCategoryParameter.id,+ ],size_x: 24,size_y: 1,}),{- id: dashcard.id,- row: 1,+ id: -3,+ card_id: dashcard.card_id,+ row: 8,size_x: 12,size_y: 6,parameter_mappings: [{- parameter_id: categoryParameter.id,+ parameter_id: lockedCategoryParameter.id,card_id: dashcard.card_id,- target: [- "dimension",- categoryFieldRef,- { "stage-number": 0 },- ],+ target: categoryTarget,},],},@@ -1554,83 +1566,57 @@ describe("scenarios > dashboard > parameters", () => {H.visitEmbeddedPage({resource: { dashboard: dashboardId },- params: {},+ params: {+ [lockedCategoryParameter.slug]: ["Gadget", "Widget"],+ },});});- H.getDashboardCard(0).within(() => {- cy.findByText("Heading Text").should("exist");- cy.findByText("Category").should("not.exist");+ cy.log("Disabled and locked parameters are hidden");+ H.getDashboardCard(2).within(() => {+ cy.findByText("Hidden filters").should("exist");+ cy.findByText("Category Disabled").should("not.exist");+ cy.findByText("Category Locked").should("not.exist");});+ cy.log("A disabled parameter does not filter");H.getDashboardCard(1).within(() => {cy.findByText("Doohickey").should("be.visible");cy.findByText("Gizmo").should("be.visible");cy.findByText("Gadget").should("be.visible");cy.findByText("Widget").should("be.visible");});- });-- it("should work correctly when parameter is locked", () => {- H.createQuestionAndDashboard({- questionDetails: ordersCountByCategory,- dashboardDetails: {- parameters: [categoryParameter],- enable_embedding: true,- embedding_params: {- [categoryParameter.slug]: "locked",- },- },- }).then(({ body: dashcard }) => {- const dashboardId = dashcard.dashboard_id;- H.updateDashboardCards({- dashboard_id: dashboardId,- cards: [- createMockHeadingDashboardCard({- inline_parameters: [categoryParameter.id],- size_x: 24,- size_y: 1,- }),- {- id: dashcard.id,- row: 1,- size_x: 12,- size_y: 6,- parameter_mappings: [- {- parameter_id: categoryParameter.id,- card_id: dashcard.card_id,- target: [- "dimension",- categoryFieldRef,- { "stage-number": 0 },- ],- },- ],- },- ],- });-- H.visitEmbeddedPage({- resource: { dashboard: dashboardId },- params: {- [categoryParameter.slug]: ["Gadget", "Widget"],- },- });+ cy.log("A locked parameter filters by its token value");+ H.getDashboardCard(3).within(() => {+ cy.findByText("Gadget").should("be.visible");+ cy.findByText("Widget").should("be.visible");+ cy.findByText("Doohickey").should("not.exist");+ cy.findByText("Gizmo").should("not.exist");});+ cy.log("An enabled parameter filters");H.getDashboardCard(0).within(() => {- cy.findByText("Heading Text").should("exist");- cy.findByText("Category").should("not.exist");+ H.filterWidget().contains("Category").click();+ });+ H.popover().within(() => {+ cy.findByText("Gadget").click();+ cy.button("Add filter").click();});H.getDashboardCard(1).within(() => {cy.findByText("Gadget").should("be.visible");- cy.findByText("Widget").should("be.visible");cy.findByText("Doohickey").should("not.exist");cy.findByText("Gizmo").should("not.exist");+ cy.findByText("Widget").should("not.exist");+ });++ cy.location().should(({ search }) => {+ expect(search).to.eq("?category=Gadget");});++ // Verify filter doesn't show up in the dashboard header+ H.dashboardParametersContainer().should("not.exist");});});});@@ -2074,6 +2060,29 @@ describe("scenarios > dashboard > parameters", () => {.findByText(/Category/).should("not.exist");H.undoToast().should("not.exist");+ H.dashboardParameterSidebar().button("Done").click();++ cy.log("Inline filters can't connect to cards on another tab");+ H.createNewTab();+ H.goToTab("Tab 2");+ H.openQuestionsSidebar();+ H.sidebar().findByText("Orders, Count").click();++ H.goToTab("Tab 1");+ H.getDashboardCard(0).within(() => {+ H.filterWidget({ isEditing: true }).contains("Category").click();+ });+ H.goToTab("Tab 2");+ H.getDashboardCard(0)+ .findByText("The selected filter is on another tab.")+ .should("be.visible");+ H.goToTab("Tab 1");++ cy.log("Disconnect the filter from its card through the sidebar");+ H.sidebar().findByText("Disconnect from card").click();+ H.getDashboardCard(1)+ .findByText("This filter can only connect to its own card.")+ .should("be.visible");});it("should duplicate filters and mappings when duplicating a dashcard", () => {@@ -2227,117 +2236,6 @@ describe("scenarios > dashboard > parameters", () => {count: "5000",});});-- it("should duplicate filters when duplicating a dashboard", () => {- H.createQuestionAndDashboard({- questionDetails: ordersCountByCategory,- dashboardDetails: {- parameters: [categoryParameter],- },- }).then(({ body: dashcard }) => {- H.updateDashboardCards({- dashboard_id: dashcard.dashboard_id,- cards: [- {- id: dashcard.id,- inline_parameters: [categoryParameter.id],- parameter_mappings: [- {- parameter_id: categoryParameter.id,- card_id: dashcard.card_id,- target: [- "dimension",- categoryFieldRef,- { "stage-number": 0 },- ],- },- ],- },- ],- });-- H.visitDashboard(dashcard.dashboard_id);- });-- H.openDashboardMenu("Duplicate");- H.modal().button("Duplicate").click();- H.dashboardHeader()- .findByText("Test Dashboard - Duplicate")- .should("exist");-- H.getDashboardCard(0).within(() => {- cy.findByText("Doohickey").should("be.visible");- cy.findByText("Gizmo").should("be.visible");- cy.findByText("Gadget").should("be.visible");- cy.findByText("Widget").should("be.visible");-- H.filterWidget().contains("Category").click();- });- H.popover().within(() => {- cy.findByText("Gadget").click();- cy.button("Add filter").click();- });-- H.getDashboardCard(0).within(() => {- H.echartsContainer().within(() => {- cy.findByText("Gadget").should("be.visible");- cy.findByText("Doohickey").should("not.exist");- cy.findByText("Gizmo").should("not.exist");- cy.findByText("Widget").should("not.exist");- });- });-- cy.location().should(({ search }) => {- expect(search).to.eq("?category=Gadget");- });- });-- it("should allow connecting inline parameters only to their own card, not to cards on another tab", () => {- H.createQuestionAndDashboard({- questionDetails: ordersCountByCategory,- }).then(({ body: dashcard }) => {- H.visitDashboard(dashcard.dashboard_id);- H.editDashboard();-- // Add a second card- H.openQuestionsSidebar();- H.sidebar().findByText("Orders, Count").click();- H.getDashboardCard(1).findByText("Count").should("exist");-- // Add a second tab- H.createNewTab();- H.goToTab("Tab 2");-- // Add a question to the second tab- H.sidebar().findByText("Orders, Count").click();-- H.goToTab("Tab 1");-- // Add a filter to the first card- H.setDashCardFilter(0, "Text or Category", null, "Category");- H.selectDashboardFilter(H.getDashboardCard(0), "Category");-- // Ensure the filter can't be connected to the second card on the same tab- H.getDashboardCard(1)- .findByText("This filter can only connect to its own card.")- .should("be.visible");-- // Ensure the filter can't be connected to the card on the other tab- H.goToTab("Tab 2");- H.getDashboardCard(0)- .findByText("The selected filter is on another tab.")- .should("be.visible");- H.goToTab("Tab 1");-- // Disconnect the filter from the first card- H.sidebar().findByText("Disconnect from card").click();-- // Ensure it still can't be connected to the second card- H.getDashboardCard(1)- .findByText("This filter can only connect to its own card.")- .should("be.visible");- });- });});describe("moving filters", () => {@@ -2398,6 +2296,11 @@ describe("scenarios > dashboard > parameters", () => {cy.log("Undo moving the card filter to the header");H.moveDashboardFilter("Top of page");+ H.editingDashboardParametersContainer().within(() => {+ H.filterWidget({ isEditing: true })+ .contains("Category")+ .should("exist");+ });H.undo();H.getDashboardCard(0).within(() => {H.filterWidget({ isEditing: true })@@ -2416,6 +2319,9 @@ describe("scenarios > dashboard > parameters", () => {});H.moveDashboardFilter("test question");H.dashboardParameterSidebar().button("Done").click();+ H.getDashboardCard(0).within(() => {+ H.filterWidget({ isEditing: true }).contains("Count").should("exist");+ });H.undo();H.getDashboardCard(0).within(() => {H.filterWidget({ isEditing: true })@@ -2705,17 +2611,3 @@ function isFilterSelected(filter, bool) {`${bool === false ? "not." : ""}be.checked`,);}--function createDashboardWithCards({- dashboardName = "my dash",- cards = [],-} = {}) {- return H.createDashboard({ name: dashboardName }).then(({ body: { id } }) => {- H.updateDashboardCards({- dashboard_id: id,- cards,- });-- cy.wrap(id).as("dashboardId");- });-}diff --git a/e2e/test/scenarios/dashboard-filters/shared/dashboard-filters-date.js b/e2e/test/scenarios/dashboard-filters/shared/dashboard-filters-date.jsdeleted file mode 100644index b4f5e8e4519..00000000000--- a/e2e/test/scenarios/dashboard-filters/shared/dashboard-filters-date.js+++ /dev/null@@ -1,31 +0,0 @@-export const DASHBOARD_DATE_FILTERS = {- "Month and Year": {- value: {- month: "Nov",- year: "2025",- },- representativeResult: "85.88",- },- "Quarter and Year": {- value: {- quarter: "Q2",- year: "2025",- },- representativeResult: "44.43",- },- "Single Date": {- value: "05/23/2025",- representativeResult: "49.54",- },- "Date Range": {- value: {- startDate: "05/25/2025",- endDate: "06/01/2025",- },- representativeResult: "75.41",- },- "All Options": {- value: "06/01/2025",- representativeResult: "53.6",- },-};diff --git a/e2e/test/scenarios/dashboard-filters/shared/dashboard-filters-location.js b/e2e/test/scenarios/dashboard-filters/shared/dashboard-filters-location.jsindex 2e97b56ce78..59f2c25e78d 100644--- a/e2e/test/scenarios/dashboard-filters/shared/dashboard-filters-location.js+++ b/e2e/test/scenarios/dashboard-filters/shared/dashboard-filters-location.js@@ -8,16 +8,18 @@ export const DASHBOARD_LOCATION_FILTERS = {representativeResult: "148.23",},Contains: {- value: "Abb",+ value: "bbev",representativeResult: "1510",},"Does not contain": {- value: "Wood",- representativeResult: "148.23",+ value: "d",+ representativeResult: "47.68",+ negativeAssertion: "148.23",},"Starts with": {- value: "Abb",- representativeResult: "1510",+ value: "Lake",+ representativeResult: "122.37",+ negativeAssertion: "67.83",},"Ends with": {value: "y",diff --git a/e2e/test/scenarios/dashboard-filters/temporal-unit-parameters.cy.spec.js b/e2e/test/scenarios/dashboard-filters/temporal-unit-parameters.cy.spec.jsindex 7597fd28d83..54676d44376 100644--- a/e2e/test/scenarios/dashboard-filters/temporal-unit-parameters.cy.spec.js+++ b/e2e/test/scenarios/dashboard-filters/temporal-unit-parameters.cy.spec.js@@ -161,6 +161,7 @@ const nativeUnitQuestionDetails = {query:"SELECT 'month' AS UNIT " +"UNION ALL SELECT 'year' AS UNIT " ++ "UNION ALL SELECT 'quarter' AS UNIT " +"UNION ALL SELECT 'invalid' AS UNIT",},};@@ -573,12 +574,13 @@ describe("scenarios > dashboard > temporal unit parameters", () => {cy.log("verify that invalid temporal units are ignored");H.getDashboardCard(1).findByText("invalid").click();- H.filterWidget()- .findByText(/invalid/i)- .should("not.exist");H.getDashboardCard().within(() => {H.tableHeaderColumn("Created At: Month");});+ H.filterWidget().within(() => {+ cy.findByText(parameterDetails.name).should("be.visible");+ cy.findByText(/invalid/i).should("not.exist");+ });cy.log("verify that recovering from an invalid temporal unit works");H.getDashboardCard(1).findByText("year").click();@@ -588,23 +590,24 @@ describe("scenarios > dashboard > temporal unit parameters", () => {});});- it("should pass a temporal unit 'custom destination -> dashboard' click behavior", () => {+ it("should pass a temporal unit with 'custom destination -> dashboard' and 'custom destination -> url' click behaviors", () => {createDashboardWithMappedQuestion({dashboardDetails: {name: "Target dashboard",},- });+ }).then((dashboard) => cy.wrap(dashboard.id).as("targetDashboardId"));H.createDashboardWithQuestions({dashboardDetails: {name: "Source dashboard",},- questions: [nativeUnitQuestionDetails],+ questions: [nativeUnitQuestionDetails, nativeUnitQuestionDetails],+ cards: [{}, { col: 11 }],}).then(({ dashboard }) => cy.wrap(dashboard.id).as("sourceDashboardId"));H.visitDashboard("@sourceDashboardId");- cy.log("setup click behavior");+ cy.log("setup dashboard click behavior on the first card");H.editDashboard();- H.getDashboardCard()+ H.getDashboardCard(0).findByLabelText("Click behavior").click({ force: true });H.sidebar().within(() => {@@ -615,41 +618,10 @@ describe("scenarios > dashboard > temporal unit parameters", () => {H.modal().findByText("Target dashboard").click();H.sidebar().findByText(parameterDetails.name).click();H.popover().findByText("UNIT").click();- H.saveDashboard();-- cy.log("verify that invalid temporal units are ignored");- H.getDashboardCard().findByText("invalid").click();- H.dashboardHeader().findByText("Target dashboard").should("be.visible");- H.filterWidget()- .findByText(/invalid/i)- .should("not.exist");- H.getDashboardCard().findByText("Created At: Month").should("be.visible");-- cy.log("verify click behavior with a valid temporal unit");- H.visitDashboard("@sourceDashboardId");- H.getDashboardCard().findByText("year").click();- H.dashboardHeader().findByText("Target dashboard").should("be.visible");- H.filterWidget().findByText("Year").should("be.visible");- H.getDashboardCard().findByText("Created At: Year").should("be.visible");- });+ H.sidebar().button("Done").click();- it("should pass a temporal unit with 'custom destination -> url' click behavior", () => {- createDashboardWithMappedQuestion({- dashboardDetails: {- name: "Target dashboard",- },- }).then((dashboard) => cy.wrap(dashboard.id).as("targetDashboardId"));- H.createDashboardWithQuestions({- dashboardDetails: {- name: "Source dashboard",- },- questions: [nativeUnitQuestionDetails],- }).then(({ dashboard }) => cy.wrap(dashboard.id).as("sourceDashboardId"));- H.visitDashboard("@sourceDashboardId");-- cy.log("setup click behavior");- H.editDashboard();- H.getDashboardCard()+ cy.log("setup url click behavior on the second card");+ H.getDashboardCard(1).findByLabelText("Click behavior").click({ force: true });H.sidebar().within(() => {@@ -673,15 +645,40 @@ describe("scenarios > dashboard > temporal unit parameters", () => {});H.saveDashboard();- cy.log("verify click behavior with a temporal valid unit");- H.getDashboardCard().findByText("year").click();+ cy.log(+ "dashboard destination: verify that invalid temporal units are ignored",+ );+ H.getDashboardCard(0).findByText("invalid").click();+ H.dashboardHeader().findByText("Target dashboard").should("be.visible");+ H.filterWidget()+ .findByText(/invalid/i)+ .should("not.exist");+ H.getDashboardCard().findByText("Created At: Month").should("be.visible");++ cy.log(+ "dashboard destination: verify click behavior with a valid temporal unit",+ );+ H.visitDashboard("@sourceDashboardId");+ H.getDashboardCard(0).findByText("year").click();H.dashboardHeader().findByText("Target dashboard").should("be.visible");H.filterWidget().findByText("Year").should("be.visible");H.getDashboardCard().findByText("Created At: Year").should("be.visible");- cy.log("verify that invalid temporal units are ignored");+ // the target parameter keeps "Year" as the last used value, so this step needs a different unit+ cy.log(+ "url destination: verify click behavior with a valid temporal unit",+ );H.visitDashboard("@sourceDashboardId");- H.getDashboardCard().findByText("invalid").click();+ H.getDashboardCard(1).findByText("quarter").click();+ H.dashboardHeader().findByText("Target dashboard").should("be.visible");+ H.filterWidget().findByText("Quarter").should("be.visible");+ H.getDashboardCard()+ .findByText("Created At: Quarter")+ .should("be.visible");++ cy.log("url destination: verify that invalid temporal units are ignored");+ H.visitDashboard("@sourceDashboardId");+ H.getDashboardCard(1).findByText("invalid").click();H.dashboardHeader().findByText("Target dashboard").should("be.visible");H.filterWidget().findByText(/invalid/i)@@ -963,8 +960,17 @@ describe("scenarios > dashboard > temporal unit parameters", () => {});describe("query string parameters", () => {- it("should parse valid and ignore invalid temporal unit values from the url", () => {- createDashboardWithMappedQuestion().then((dashboard) => {+ it("should ignore invalid temporal unit values from the url and accept valid ones outside of the allowlist", () => {+ createDashboardWithMappedQuestion({+ dashboardDetails: {+ parameters: [+ {+ ...parameterDetails,+ temporal_units: ["month", "quarter"],+ },+ ],+ },+ }).then((dashboard) => {cy.wrap(dashboard.id).as("dashboardId");H.visitDashboard(dashboard.id, { params: { unit_of_time: "invalid" } });});@@ -978,22 +984,6 @@ describe("scenarios > dashboard > temporal unit parameters", () => {cy.get("@dashboardId").then((dashboardId) =>H.visitDashboard(dashboardId, { params: { unit_of_time: "year" } }),);- H.getDashboardCard().findByText("Created At: Year").should("be.visible");- });-- it("should accept temporal units outside of the allowlist if they are otherwise valid values from the url", () => {- createDashboardWithMappedQuestion({- dashboardDetails: {- parameters: [- {- ...parameterDetails,- temporal_units: ["month", "quarter"],- },- ],- },- }).then((dashboard) => {- H.visitDashboard(dashboard.id, { params: { unit_of_time: "year" } });- });H.filterWidget().findByText("Year").should("be.visible");H.getDashboardCard().findByText("Created At: Year").should("be.visible");});diff --git a/e2e/test/scenarios/embedding/embedding-linked-filters.cy.spec.js b/e2e/test/scenarios/embedding/embedding-linked-filters.cy.spec.jsindex 4f754a56ebd..1f9ede19018 100644--- a/e2e/test/scenarios/embedding/embedding-linked-filters.cy.spec.js+++ b/e2e/test/scenarios/embedding/embedding-linked-filters.cy.spec.js@@ -131,6 +131,8 @@ describe("scenarios > embedding > dashboard > linked filters (metabase#13639, meH.popover().findByText("AK").click();H.popover().button("Add filter").click();+ H.chartPathWithFillColor("#509EE3").should("have.length", 49);+H.applyFilterButton().click();H.applyFilterToast().should("not.exist");