Update e2e tests to use new viewport creation helpers

This commit is contained in:
2026-04-03 00:24:55 +02:00
parent 1fe0da2bb9
commit 46984c8998
2 changed files with 8 additions and 8 deletions

View File

@@ -2,7 +2,7 @@ import path from "node:path";
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { getEditorStoreSnapshot, setViewportPlacementPreview } from "./viewport-test-helpers"; import { clickViewport, getEditorStoreSnapshot, setViewportCreationPreview } from "./viewport-test-helpers";
const fixturePath = path.resolve(process.cwd(), "fixtures/assets/tiny-triangle-draco.glb"); const fixturePath = path.resolve(process.cwd(), "fixtures/assets/tiny-triangle-draco.glb");
@@ -41,14 +41,14 @@ test("imports a draco-compressed glb asset, places an instance, and survives rel
throw new Error("Imported model asset was not found in the document snapshot."); throw new Error("Imported model asset was not found in the document snapshot.");
} }
await setViewportPlacementPreview( await setViewportCreationPreview(
page, page,
"topLeft", "topLeft",
{ kind: "model-instance", assetId: importedModelAsset.id }, { kind: "model-instance", assetId: importedModelAsset.id },
{ x: 84, y: 0, z: -88 } { x: 84, y: 0, z: -88 }
); );
await expect(page.getByTestId("viewport-snap-preview-topLeft")).toBeVisible(); await expect(page.getByTestId("viewport-snap-preview-topLeft")).toBeVisible();
await page.getByTestId("viewport-fallback-place-topLeft").dispatchEvent("click"); await clickViewport(page, "topLeft");
await expect(page.getByTestId("outliner-model-instance-list").getByRole("button")).toHaveCount(2); await expect(page.getByTestId("outliner-model-instance-list").getByRole("button")).toHaveCount(2);
const snapshot = await getEditorStoreSnapshot(page); const snapshot = await getEditorStoreSnapshot(page);
const selectedModelInstanceId = snapshot.selection.kind === "modelInstances" ? snapshot.selection.ids?.[0] ?? null : null; const selectedModelInstanceId = snapshot.selection.kind === "modelInstances" ? snapshot.selection.ids?.[0] ?? null : null;

View File

@@ -2,7 +2,7 @@ import path from "node:path";
import { expect, test } from "@playwright/test"; import { expect, test } from "@playwright/test";
import { setViewportPlacementPreview } from "./viewport-test-helpers"; import { clickViewport, setViewportCreationPreview } from "./viewport-test-helpers";
const panoramaFixturePath = path.resolve(process.cwd(), "fixtures/assets/skybox-panorama.svg"); const panoramaFixturePath = path.resolve(process.cwd(), "fixtures/assets/skybox-panorama.svg");
@@ -39,9 +39,9 @@ test("local lights and background images persist through editor and runner flows
await page.getByTestId("outliner-add-button").click(); await page.getByTestId("outliner-add-button").click();
await page.getByTestId("add-menu-lights").click(); await page.getByTestId("add-menu-lights").click();
await page.getByTestId("add-menu-point-light").click(); await page.getByTestId("add-menu-point-light").click();
await setViewportPlacementPreview(page, "topLeft", { kind: "entity", entityKind: "pointLight", audioAssetId: null }, { x: 12, y: 3, z: -4 }); await setViewportCreationPreview(page, "topLeft", { kind: "entity", entityKind: "pointLight", audioAssetId: null }, { x: 12, y: 3, z: -4 });
await expect(page.getByTestId("viewport-snap-preview-topLeft")).toBeVisible(); await expect(page.getByTestId("viewport-snap-preview-topLeft")).toBeVisible();
await page.getByTestId("viewport-fallback-place-topLeft").dispatchEvent("click"); await clickViewport(page, "topLeft");
await expect(page.getByTestId("point-light-distance")).toHaveValue("8"); await expect(page.getByTestId("point-light-distance")).toHaveValue("8");
await page.getByTestId("point-light-distance").fill("12"); await page.getByTestId("point-light-distance").fill("12");
await page.getByTestId("point-light-distance").press("Tab"); await page.getByTestId("point-light-distance").press("Tab");
@@ -49,9 +49,9 @@ test("local lights and background images persist through editor and runner flows
await page.getByTestId("outliner-add-button").click(); await page.getByTestId("outliner-add-button").click();
await page.getByTestId("add-menu-lights").click(); await page.getByTestId("add-menu-lights").click();
await page.getByTestId("add-menu-spot-light").click(); await page.getByTestId("add-menu-spot-light").click();
await setViewportPlacementPreview(page, "topLeft", { kind: "entity", entityKind: "spotLight", audioAssetId: null }, { x: -10, y: 4, z: 6 }); await setViewportCreationPreview(page, "topLeft", { kind: "entity", entityKind: "spotLight", audioAssetId: null }, { x: -10, y: 4, z: 6 });
await expect(page.getByTestId("viewport-snap-preview-topLeft")).toBeVisible(); await expect(page.getByTestId("viewport-snap-preview-topLeft")).toBeVisible();
await page.getByTestId("viewport-fallback-place-topLeft").dispatchEvent("click"); await clickViewport(page, "topLeft");
await expect(page.getByTestId("spot-light-angle")).toHaveValue("35"); await expect(page.getByTestId("spot-light-angle")).toHaveValue("35");
await page.getByTestId("spot-light-angle").fill("48"); await page.getByTestId("spot-light-angle").fill("48");
await page.getByTestId("spot-light-angle").press("Tab"); await page.getByTestId("spot-light-angle").press("Tab");