diff --git a/e2e/test/scenarios/dashboard/dashboard-reproductions.cy.spec.js b/e2e/test/scenarios/dashboard/dashboard-reproductions.cy.spec.js index 1945dc9009738a05c60916aa1ef802d29df4800d..df0a1abdffcfbcb85262c8c3f2b8560de6b3879d 100644 --- a/e2e/test/scenarios/dashboard/dashboard-reproductions.cy.spec.js +++ b/e2e/test/scenarios/dashboard/dashboard-reproductions.cy.spec.js @@ -12,6 +12,7 @@ import { appBar, assertDatasetReqIsSandboxed, assertQueryBuilderRowCount, + assertTabSelected, cartesianChartCircle, closeDashboardInfoSidebar, closeDashboardSettingsSidebar, @@ -737,7 +738,7 @@ describe("issue 31274", () => { size_x: 2, size_y: 2, row: (length - index - 1) * 2, - text: `Text card ${index + 1}`, + text: `Text ${index + 1}`, }); }); }; @@ -746,47 +747,39 @@ describe("issue 31274", () => { return cy.findAllByTestId("dashboardcard-actions-panel").filter(":visible"); } - function secondTextCard() { - return cy.findAllByTestId("editing-dashboard-text-preview").eq(1).parent(); - } - beforeEach(() => { restore(); cy.signInAsAdmin(); }); - // cypress automatically scrolls to the element, but we don't need it in this test - it( - "should not clip dashcard actions (metabase#31274)", - { tags: "@flaky" }, - () => { - cy.createDashboard().then(({ body: dashboard }) => { - const dashcards = createTextCards(3); - cy.request("PUT", `/api/dashboard/${dashboard.id}`, { - dashcards, - }); - - visitDashboard(dashboard.id); - editDashboard(dashboard.id); + it("should not clip dashcard actions (metabase#31274)", () => { + cy.createDashboard().then(({ body: dashboard }) => { + const dashcards = createTextCards(3); + cy.request("PUT", `/api/dashboard/${dashboard.id}`, { + dashcards, + }); - secondTextCard().realHover(); + visitDashboard(dashboard.id); + editDashboard(dashboard.id); - visibleActionsPanel().should("have.length", 1); + assertTabSelected("Tab 1"); - cy.log( - "Make sure cypress can click the element, which means it is not covered by another", - ); + getDashboardCard(1).realHover({ + scrollBehavior: false, // prevents flaky tests + }); - visibleActionsPanel().within(() => { - cy.icon("close").click({ - position: "top", - }); - }); + cy.log( + "Make sure cypress can click the element, which means it is not covered by another", + ); - cy.findAllByTestId("dashcard").should("have.length", 2); + visibleActionsPanel().should("have.length", 1).icon("close").click({ + position: "top", + scrollBehavior: false, // prevents flaky tests }); - }, - ); + + cy.findAllByTestId("dashcard").should("have.length", 2); + }); + }); it("renders cross icon on the link card without clipping", () => { cy.createDashboard().then(({ body: dashboard }) => { diff --git a/e2e/test/scenarios/dashboard/dashboard.cy.spec.js b/e2e/test/scenarios/dashboard/dashboard.cy.spec.js index 9898608afb34fa3010f5f30916de817d4e2e4334..2519c72bc224a97d37b49eb999e45fb8da93d4ad 100644 --- a/e2e/test/scenarios/dashboard/dashboard.cy.spec.js +++ b/e2e/test/scenarios/dashboard/dashboard.cy.spec.js @@ -650,8 +650,8 @@ describe("scenarios > dashboard", () => { visitDashboard(dashboard_id); }); - getDashboardCards().eq(0).contains("top"); - getDashboardCards().eq(1).contains("bottom"); + getDashboardCard(0).contains("top"); + getDashboardCard(1).contains("bottom"); }, ); }); @@ -1212,7 +1212,7 @@ describeWithSnowplow("scenarios > dashboard", () => { addIFrameWhileEditing("https://example.com"); cy.findByTestId("dashboardcard-actions-panel").should("not.exist"); cy.button("Done").click(); - getDashboardCards().eq(0).realHover(); + getDashboardCard(0).realHover(); cy.findByTestId("dashboardcard-actions-panel").should("be.visible"); validateIFrame("https://example.com"); saveDashboard();