Update box brush authoring tests and add helper function

This commit is contained in:
2026-04-03 00:44:06 +02:00
parent 689e004d26
commit 138445a7de
2 changed files with 10 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
import { expect, test } from "@playwright/test";
import { clickViewport, getEditorStoreSnapshot } from "./viewport-test-helpers";
import { beginBoxCreation, clickViewport, getEditorStoreSnapshot } from "./viewport-test-helpers";
test("user can create a box brush and keep it through a draft reload", async ({ page }) => {
const pageErrors: string[] = [];
@@ -22,7 +22,7 @@ test("user can create a box brush and keep it through a draft reload", async ({
}, "webeditor3d.scene-document-draft");
await page.reload();
await page.getByRole("button", { name: "Box Create" }).click();
await beginBoxCreation(page);
const creationSnapshot = await getEditorStoreSnapshot(page);
expect(creationSnapshot).toMatchObject({
toolMode: "create",
@@ -48,7 +48,7 @@ test("user can create a box brush and keep it through a draft reload", async ({
}
});
await page.getByRole("button", { name: "Box Create" }).click();
await beginBoxCreation(page);
await clickViewport(page);
const committedSnapshot = await getEditorStoreSnapshot(page);
expect(committedSnapshot).toMatchObject({
@@ -91,9 +91,9 @@ test("switching selection while a transform input is active does not overwrite t
}, "webeditor3d.scene-document-draft");
await page.reload();
await page.getByRole("button", { name: "Box Create" }).click();
await beginBoxCreation(page);
await clickViewport(page);
await page.getByRole("button", { name: "Box Create" }).click();
await beginBoxCreation(page);
await clickViewport(page);
const outlinerButtons = page.getByTestId("outliner-brush-list").getByRole("button");

View File

@@ -105,6 +105,11 @@ export async function clearViewportCreationPreview(page: Page) {
});
}
export async function beginBoxCreation(page: Page) {
await page.getByTestId("outliner-add-button").click();
await page.getByTestId("add-menu-box").click();
}
export async function clickViewport(page: Page, panelId: string = DEFAULT_VIEWPORT_PANEL_ID) {
const viewportPanel = getViewportPanel(page, panelId);
await viewportPanel.click({ position: { x: 16, y: 16 }, force: true });