From a59bd05c4fc9d0c94c8ebf8f24bfae67c821ba12 Mon Sep 17 00:00:00 2001 From: Xaviju Date: Wed, 25 Mar 2026 09:51:32 +0100 Subject: [PATCH] :bug: Update visual regression tests (#8730) --- .gitignore | 1 + frontend/playwright/ui/pages/DashboardPage.js | 1 + .../ui/visual-specs/visual-dashboard.spec.js | 13 ++++++++++--- .../ui/visual-specs/visual-viewer.spec.js | 2 +- .../playwright/ui/visual-specs/workspace.spec.js | 4 +++- frontend/src/app/main/ui/dashboard/grid.cljs | 1 + 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 15e8533e3f..100be94717 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,7 @@ /frontend/.storybook/preview-body.html /frontend/.storybook/preview-head.html /frontend/playwright-report/ +/frontend/playwright/ui/visual-specs/ /frontend/text-editor/src/wasm/ /frontend/dist/ /frontend/npm-debug.log diff --git a/frontend/playwright/ui/pages/DashboardPage.js b/frontend/playwright/ui/pages/DashboardPage.js index f7e4df2582..4dee04f18e 100644 --- a/frontend/playwright/ui/pages/DashboardPage.js +++ b/frontend/playwright/ui/pages/DashboardPage.js @@ -147,6 +147,7 @@ export class DashboardPage extends BaseWebSocketPage { "get-projects?team-id=*", "dashboard/get-projects-full.json", ); + await this.mockRPC( "get-project-files?project-id=*", "dashboard/get-project-files.json", diff --git a/frontend/playwright/ui/visual-specs/visual-dashboard.spec.js b/frontend/playwright/ui/visual-specs/visual-dashboard.spec.js index 5e3f1a5eff..9a61a8ae97 100644 --- a/frontend/playwright/ui/visual-specs/visual-dashboard.spec.js +++ b/frontend/playwright/ui/visual-specs/visual-dashboard.spec.js @@ -9,6 +9,7 @@ test("User goes to an empty dashboard", async ({ page }) => { const dashboardPage = new DashboardPage(page); await dashboardPage.goToDashboard(); + await expect(dashboardPage.page).toHaveURL(/dashboard/); await expect(dashboardPage.mainHeading).toBeVisible(); await expect(dashboardPage.page).toHaveScreenshot(); @@ -122,9 +123,7 @@ test("User goes to a full search page", async ({ page }) => { await dashboardPage.searchInput.fill("3"); await expect(dashboardPage.mainHeading).toHaveText("Search results"); - await expect( - dashboardPage.page.getByRole("button", { name: "New File 3" }), - ).toBeVisible(); + await expect(page.getByRole("button", { name: "New File 3" })).toBeVisible(); await expect(dashboardPage.page).toHaveScreenshot(); }); @@ -202,6 +201,10 @@ test("User opens teams selector with more than one team", async ({ page }) => { test("User goes to second team", async ({ page }) => { const dashboardPage = new DashboardPage(page); await dashboardPage.setupDashboardFull(); + await dashboardPage.mockRPC( + `get-projects?team-id=${DashboardPage.secondTeamId}`, + "dashboard/get-projects-second-team.json", + ); await dashboardPage.goToDashboard(); await dashboardPage.teamDropdown.click(); @@ -216,6 +219,10 @@ test("User goes to second team", async ({ page }) => { test("User opens team management dropdown", async ({ page }) => { const dashboardPage = new DashboardPage(page); await dashboardPage.setupDashboardFull(); + await dashboardPage.mockRPC( + `get-projects?team-id=${DashboardPage.secondTeamId}`, + "dashboard/get-projects-second-team.json", + ); await dashboardPage.goToSecondTeamDashboard(); await expect(page.getByText("Team Up")).toBeVisible(); diff --git a/frontend/playwright/ui/visual-specs/visual-viewer.spec.js b/frontend/playwright/ui/visual-specs/visual-viewer.spec.js index 977eb57fcb..8361c263fb 100644 --- a/frontend/playwright/ui/visual-specs/visual-viewer.spec.js +++ b/frontend/playwright/ui/visual-specs/visual-viewer.spec.js @@ -103,7 +103,7 @@ test("User goes to the Viewer Inspect code", async ({ page }) => { await expect( viewerPage.page.getByRole("button", { - name: "Toggle panel Size & Position", + name: "Toggle panel Size and position", }), ).toBeVisible(); diff --git a/frontend/playwright/ui/visual-specs/workspace.spec.js b/frontend/playwright/ui/visual-specs/workspace.spec.js index c1cc4ecbcc..df766736a0 100644 --- a/frontend/playwright/ui/visual-specs/workspace.spec.js +++ b/frontend/playwright/ui/visual-specs/workspace.spec.js @@ -158,7 +158,9 @@ test.describe("Palette", () => { .getByRole("button", { name: "Color Palette" }) .click(); await expect( - workspace.palette.getByRole("button", { name: "#7798ff" }), + workspace.palette.getByText( + "There are no color styles in your library yet", + ), ).toBeVisible(); }); }); diff --git a/frontend/src/app/main/ui/dashboard/grid.cljs b/frontend/src/app/main/ui/dashboard/grid.cljs index a24490af59..345a8a6075 100644 --- a/frontend/src/app/main/ui/dashboard/grid.cljs +++ b/frontend/src/app/main/ui/dashboard/grid.cljs @@ -413,6 +413,7 @@ :ref node-ref :role "button" :title (:name file) + :aria-label (:name file) :draggable (dm/str can-edit) :on-click on-select :on-key-down on-key-down