From 318a95d2becf63ec1f8a470b399c64e0e3e9c499 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Mon, 13 Apr 2026 16:32:48 +0200 Subject: [PATCH] Update viewport test helpers to support entity creation targets --- tests/e2e/viewport-test-helpers.ts | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/e2e/viewport-test-helpers.ts b/tests/e2e/viewport-test-helpers.ts index 0cda2a6f..8c7c9936 100644 --- a/tests/e2e/viewport-test-helpers.ts +++ b/tests/e2e/viewport-test-helpers.ts @@ -2,6 +2,7 @@ import type { Page } from "@playwright/test"; import type { TransformSessionState } from "../../src/core/transform-session"; import type { SceneDocument } from "../../src/document/scene-document"; +import type { EntityKind } from "../../src/entities/entity-instances"; import type { CreationTarget, ViewportToolPreview } from "../../src/viewport-three/viewport-transient-state"; import type { ViewportPanelId } from "../../src/viewport-three/viewport-layout"; @@ -86,9 +87,26 @@ export async function replaceSceneDocument(page: Page, document: SceneDocument) export async function setViewportCreationPreview( page: Page, panelId: ViewportPanelId, - target: CreationTarget, + target: + | CreationTarget + | { + kind: "entity"; + entityKind: EntityKind; + audioAssetId?: string | null; + modelAssetId?: string | null; + }, center: { x: number; y: number; z: number } | null ) { + const normalizedTarget: CreationTarget = + target.kind === "entity" + ? { + kind: "entity", + entityKind: target.entityKind, + audioAssetId: target.audioAssetId ?? null, + modelAssetId: target.modelAssetId ?? null + } + : target; + await page.evaluate( ({ sourcePanelId, nextTarget, nextCenter }) => { const store = (window as Window & { @@ -110,7 +128,7 @@ export async function setViewportCreationPreview( }, { sourcePanelId: panelId, - nextTarget: target, + nextTarget: normalizedTarget, nextCenter: center } );