Add face material authoring test and update box brush test

This commit is contained in:
2026-03-31 02:39:34 +02:00
parent cbf7e16dd4
commit 7b4d3ce244
3 changed files with 41 additions and 5 deletions

View File

@@ -36,7 +36,7 @@ test("user can create a box brush and keep it through a draft reload", async ({
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 in the viewport or outliner to select it.")).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([]);

View File

@@ -0,0 +1,38 @@
import { expect, test } from "@playwright/test";
test("user can assign a face material through the UI 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 page.getByTestId("face-button-posZ").click();
await page.getByTestId("material-button-starter-amber-grid").click();
await expect(page.getByTestId("selected-face-material-name")).toContainText("Amber Grid");
await page.getByRole("button", { name: "Save Draft" }).click();
await page.reload();
await page.getByRole("button", { name: /Box Brush 1/ }).click();
await page.getByTestId("face-button-posZ").click();
await expect(page.getByTestId("selected-face-material-name")).toContainText("Amber Grid");
expect(pageErrors).toEqual([]);
expect(consoleErrors).toEqual([]);
});

View File

@@ -70,9 +70,7 @@ describe("box face UV projection", () => {
}
);
expect(transformedUv).toEqual({
x: expect.closeTo(1.5),
y: expect.closeTo(1.75)
});
expect(transformedUv.x).toBeCloseTo(1.5);
expect(transformedUv.y).toBeCloseTo(1.75);
});
});