diff --git a/frontend/test/__support__/e2e/helpers/e2e-dashboard-helpers.js b/frontend/test/__support__/e2e/helpers/e2e-dashboard-helpers.js index 07424c6710f88acd566e3b109b96697127205fa9..86240176ddf49a724d66505252b5deaf765a709d 100644 --- a/frontend/test/__support__/e2e/helpers/e2e-dashboard-helpers.js +++ b/frontend/test/__support__/e2e/helpers/e2e-dashboard-helpers.js @@ -16,6 +16,7 @@ export function showDashboardCardActions(index = 0) { export function editDashboard() { cy.icon("pencil").click(); + cy.findByText("You're editing this dashboard."); } export function saveDashboard() { diff --git a/frontend/test/metabase-visual/dashboard/parameters-widget.cy.spec.js b/frontend/test/metabase-visual/dashboard/parameters-widget.cy.spec.js index b3f08a08fa250a30de02632596cd630f3286c418..efa4875e2b66693abab52d15aa191f37461f2a14 100644 --- a/frontend/test/metabase-visual/dashboard/parameters-widget.cy.spec.js +++ b/frontend/test/metabase-visual/dashboard/parameters-widget.cy.spec.js @@ -1,10 +1,14 @@ -import { restore, visitDashboard } from "__support__/e2e/helpers"; +import { + restore, + visitDashboard, + editDashboard, +} from "__support__/e2e/helpers"; import { SAMPLE_DATABASE } from "__support__/e2e/cypress_sample_database"; const { PRODUCTS_ID } = SAMPLE_DATABASE; const questionDetails = { - query: { "source-table": PRODUCTS_ID }, + query: { "source-table": PRODUCTS_ID, limit: 2 }, }; const parameter = { @@ -48,7 +52,7 @@ describe(`visual tests > dashboard > parameters widget`, () => { }); }); - describe(`desktop`, () => { + describe("desktop", () => { it("is sticky in view mode", () => { cy.get("main") .scrollTo(0, 264) @@ -63,8 +67,8 @@ describe(`visual tests > dashboard > parameters widget`, () => { ); }); - it("is sticky in edit mode", () => { - cy.icon("pencil").click(); + it("is not sticky in edit mode", () => { + editDashboard(); cy.findByTestId("dashboard-parameters-and-cards") .scrollTo(0, 464) @@ -80,41 +84,44 @@ describe(`visual tests > dashboard > parameters widget`, () => { }); }); - describe(`mobile`, () => { - it("is sticky in view mode", () => { - cy.viewport(MOBILE_WIDTH, 667); - - cy.get("main") - .scrollTo(0, 264) - .then(() => { - cy.createPercySnapshot(null, { widths: [MOBILE_WIDTH] }); - }); - - cy.findByTestId("dashboard-parameters-widget-container").should( - "have.css", - "position", - "fixed", - ); - }); - - it("is sticky in edit mode", () => { - cy.viewport(MOBILE_WIDTH, 667); + describe( + "mobile", + { + viewportHeight: 667, + viewportWidth: MOBILE_WIDTH, + }, + () => { + it("is sticky in view mode", () => { + cy.get("main") + .scrollTo(0, 264) + .then(() => { + cy.createPercySnapshot(null, { widths: [MOBILE_WIDTH] }); + }); + + cy.findByTestId("dashboard-parameters-widget-container").should( + "have.css", + "position", + "fixed", + ); + }); - cy.icon("pencil").click(); + it("is not sticky in edit mode", () => { + editDashboard(); - cy.findByTestId("dashboard-parameters-and-cards") - .scrollTo(0, 464) - .then(() => { - cy.createPercySnapshot(null, { widths: [MOBILE_WIDTH] }); - }); + cy.findByTestId("dashboard-parameters-and-cards") + .scrollTo(0, 464) + .then(() => { + cy.createPercySnapshot(null, { widths: [MOBILE_WIDTH] }); + }); - cy.findByTestId("edit-dashboard-parameters-widget-container").should( - "not.have.css", - "position", - "fixed", - ); - }); - }); + cy.findByTestId("edit-dashboard-parameters-widget-container").should( + "not.have.css", + "position", + "fixed", + ); + }); + }, + ); }); describe(`${parametersLong.length} filters (non sticky on mobile)`, () => { @@ -144,7 +151,7 @@ describe(`visual tests > dashboard > parameters widget`, () => { }); }); - describe(`desktop`, () => { + describe("desktop", () => { it("is sticky in view mode", () => { cy.get("main") .scrollTo(0, 264) @@ -159,10 +166,8 @@ describe(`visual tests > dashboard > parameters widget`, () => { ); }); - it("is sticky in edit mode", () => { - cy.findByText("test question"); - - cy.icon("pencil").click(); + it("is not sticky in edit mode", () => { + editDashboard(); cy.findByTestId("dashboard-parameters-and-cards") .scrollTo(0, 464) @@ -178,40 +183,43 @@ describe(`visual tests > dashboard > parameters widget`, () => { }); }); - describe(`mobile`, () => { - it("is not sticky in view mode", () => { - cy.viewport(MOBILE_WIDTH, 667); - - cy.get("main") - .scrollTo(0, 264) - .then(() => { - cy.createPercySnapshot(null, { widths: [MOBILE_WIDTH] }); - }); - - cy.findByTestId("dashboard-parameters-widget-container").should( - "not.have.css", - "position", - "fixed", - ); - }); - - it("is not sticky in edit mode", () => { - cy.viewport(MOBILE_WIDTH, 667); + describe( + "mobile", + { + viewportHeight: 667, + viewportWidth: MOBILE_WIDTH, + }, + () => { + it("is not sticky in view mode", () => { + cy.get("main") + .scrollTo(0, 264) + .then(() => { + cy.createPercySnapshot(null, { widths: [MOBILE_WIDTH] }); + }); + + cy.findByTestId("dashboard-parameters-widget-container").should( + "not.have.css", + "position", + "fixed", + ); + }); - cy.icon("pencil").click(); + it("is not sticky in edit mode", () => { + editDashboard(); - cy.findByTestId("dashboard-parameters-and-cards") - .scrollTo(0, 464) - .then(() => { - cy.createPercySnapshot(null, { widths: [MOBILE_WIDTH] }); - }); + cy.findByTestId("dashboard-parameters-and-cards") + .scrollTo(0, 464) + .then(() => { + cy.createPercySnapshot(null, { widths: [MOBILE_WIDTH] }); + }); - cy.findByTestId("edit-dashboard-parameters-widget-container").should( - "not.have.css", - "position", - "fixed", - ); - }); - }); + cy.findByTestId("edit-dashboard-parameters-widget-container").should( + "not.have.css", + "position", + "fixed", + ); + }); + }, + ); }); });