import { expect, test } from "@playwright/test"; test("user can create a box brush and keep it through a draft reload", async ({ page }) => { const pageErrors: string[] = []; const consoleErrors: string[] = []; page.on("pageerror", (error) => { pageErrors.push(error.message); }); page.on("console", (message) => { if (message.type() === "error") { consoleErrors.push(message.text()); } }); await page.goto("/"); await page.evaluate((storageKey) => { window.localStorage.removeItem(storageKey); }, "webeditor3d.scene-document-draft"); await page.reload(); await page.getByTestId("create-box-brush").click(); await expect(page.getByRole("button", { name: /Box Brush 1/ })).toBeVisible(); await expect(page.getByText("1 brush selected (Box Brush 1)")).toBeVisible(); await page.getByTestId("brush-center-y").fill("2"); await page.getByTestId("apply-brush-position").click(); await page.getByTestId("brush-size-z").fill("4"); await page.getByTestId("apply-brush-size").click(); await expect(page.getByRole("button", { name: /center 0, 2, 0/ })).toBeVisible(); await expect(page.getByRole("button", { name: /size 2, 2, 4/ })).toBeVisible(); await page.getByRole("button", { name: "Save Draft" }).click(); await page.reload(); await expect(page.getByRole("button", { name: /Box Brush 1/ })).toBeVisible(); await expect(page.getByRole("button", { name: /center 0, 2, 0/ })).toBeVisible(); await expect(page.getByRole("button", { name: /size 2, 2, 4/ })).toBeVisible(); await expect(page.getByText("1 box brushes loaded. Click a brush face in the viewport or use the face selector to texture it.")).toBeVisible(); expect(pageErrors).toEqual([]); expect(consoleErrors).toEqual([]); });