📎 Add e2e tests for the broken copy indicator

Cover a copy whose main was deleted, a copy from a file not in use, the
tooltip, a healthy copy and a selection of two broken copies. The
fixture also holds nested broken copies inside a main and inside a
copy, for the case design still has to settle.

Relates to #12134

AI-assisted-by: claude-opus-5-5
This commit is contained in:
Eva Marco 2026-10-26 14:44:50 +01:00
parent 3bf9099fb9
commit 0481826b3d
2 changed files with 2234 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,77 @@
import { test, expect } from "@playwright/test";
import { WorkspacePage } from "../pages/WorkspacePage";
// The file has three component copies: one whose main is still on the
// page, one whose main was deleted, and one that points at a file the
// current file does not use.
const fileId = "0810e161-5477-81e1-8008-d94c91d8ab73";
const pageId = "0810e161-5477-81e1-8008-d94c91d8ab74";
const brokenIndicator = (workspacePage) =>
workspacePage.rightSidebar.getByLabel(
"Main component not found. This copy won’t receive updates.",
);
test.beforeEach(async ({ page }) => {
await WorkspacePage.init(page);
const workspacePage = new WorkspacePage(page);
await workspacePage.setupEmptyFile();
await workspacePage.mockRPC(
/get\-file\?/,
"workspace/get-file-broken-copies.json",
);
await workspacePage.goToWorkspace({ fileId, pageId });
});
test("Shows the broken indicator on a copy whose main was deleted", async ({
page,
}) => {
const workspacePage = new WorkspacePage(page);
await workspacePage.clickLeafLayer("Deleted copy");
await expect(brokenIndicator(workspacePage)).toBeVisible();
});
test("Shows the broken indicator on a copy from a file not in use", async ({
page,
}) => {
const workspacePage = new WorkspacePage(page);
await workspacePage.clickLeafLayer("Orphan copy");
await expect(brokenIndicator(workspacePage)).toBeVisible();
});
test("Shows the tooltip when hovering the broken indicator", async ({
page,
}) => {
const workspacePage = new WorkspacePage(page);
await workspacePage.clickLeafLayer("Orphan copy");
await brokenIndicator(workspacePage).hover();
await expect(page.getByRole("tooltip")).toHaveText(
"Main component not found. This copy won’t receive updates.",
);
});
test("Shows no broken indicator on a copy whose main exists", async ({
page,
}) => {
const workspacePage = new WorkspacePage(page);
await workspacePage.clickLeafLayer("Healthy copy");
await expect(
workspacePage.rightSidebar.getByTestId("component-pill-button"),
).toBeVisible();
await expect(brokenIndicator(workspacePage)).toHaveCount(0);
});
test("Shows the broken indicator when every selected copy is broken", async ({
page,
}) => {
const workspacePage = new WorkspacePage(page);
await workspacePage.clickLeafLayer("Deleted copy");
await workspacePage.clickLeafLayer("Orphan copy", { modifiers: ["Shift"] });
await expect(brokenIndicator(workspacePage)).toBeVisible();
});