diff --git a/e2e/support/helpers/e2e-dashboard-helpers.js b/e2e/support/helpers/e2e-dashboard-helpers.js index fb01e1396a1e242ebce0ec250250d349f226c337..4fc6ea244addb39d26a9d4bc0fef455e58902267 100644 --- a/e2e/support/helpers/e2e-dashboard-helpers.js +++ b/e2e/support/helpers/e2e-dashboard-helpers.js @@ -62,7 +62,7 @@ export function getDashboardCardMenu(index = 0) { } export function showDashboardCardActions(index = 0) { - getDashboardCard(index).realHover(); + getDashboardCard(index).realHover({ scrollBehavior: "bottom" }); } export function removeDashboardCard(index = 0) { diff --git a/e2e/test/scenarios/dashboard-cards/click-behavior.cy.spec.js b/e2e/test/scenarios/dashboard-cards/click-behavior.cy.spec.js index 798161a7c95de03b28e9de157703b2a156c885af..e0532ccc082dce3f0fdd96e54133425bcdd6eac8 100644 --- a/e2e/test/scenarios/dashboard-cards/click-behavior.cy.spec.js +++ b/e2e/test/scenarios/dashboard-cards/click-behavior.cy.spec.js @@ -1,9 +1,15 @@ import { addOrUpdateDashboardCard, restore, + resetTestTable, + resyncDatabase, visitDashboard, + editDashboard, + showDashboardCardActions, + sidebar, } from "e2e/support/helpers"; import { SAMPLE_DATABASE } from "e2e/support/cypress_sample_database"; +import { WRITABLE_DB_ID } from "e2e/support/cypress_data"; const { ORDERS, ORDERS_ID, PRODUCTS, PRODUCTS_ID, REVIEWS, REVIEWS_ID } = SAMPLE_DATABASE; @@ -192,6 +198,51 @@ describe("scenarios > dashboard > dashboard cards > click behavior", () => { // eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage cy.findByText("Orders"); }); + + it( + "should allow settings click behavior on boolean fields (metabase#18067)", + { tags: "@external" }, + () => { + const dialect = "mysql"; + const TEST_TABLE = "many_data_types"; + resetTestTable({ type: dialect, table: TEST_TABLE }); + restore(`${dialect}-writable`); + cy.signInAsAdmin(); + resyncDatabase({ + dbId: WRITABLE_DB_ID, + tableName: TEST_TABLE, + tableAlias: "testTable", + }); + + cy.get("@testTable").then(testTable => { + const dashboardDetails = { + name: "18067 dashboard", + }; + const questionDetails = { + name: "18067 question", + database: WRITABLE_DB_ID, + query: { "source-table": testTable.id }, + }; + cy.createQuestionAndDashboard({ + dashboardDetails, + questionDetails, + }).then(({ body: { dashboard_id } }) => { + visitDashboard(dashboard_id); + }); + }); + + editDashboard(); + + cy.log('Select "click behavior" option'); + showDashboardCardActions(); + cy.findByTestId("dashboardcard-actions-panel").icon("click").click(); + + sidebar().within(() => { + cy.findByText("Boolean").scrollIntoView().click(); + cy.contains("Click behavior for Boolean").should("be.visible"); + }); + }, + ); }); const getQuestionDetails = ({ display }) => ({ diff --git a/e2e/tsconfig.json b/e2e/tsconfig.json index 2c3b2c9ff1dc5d1359cfe5e0a86f90792450dadb..ce9332acd3e0ae4644bcf20310c7547875b14f49 100644 --- a/e2e/tsconfig.json +++ b/e2e/tsconfig.json @@ -3,7 +3,7 @@ "compilerOptions": { "outDir": "build", "baseUrl": "./", - "types": ["cypress", "@testing-library/cypress"], + "types": ["cypress", "@testing-library/cypress", "cypress-real-events"], "paths": { "*": ["../frontend/src/*"], "e2e/*": ["./*"]