Enhance error handling in e2e tests for entity placement and model import

This commit is contained in:
2026-04-03 00:02:33 +02:00
parent cc44ca1971
commit aef964e958
4 changed files with 16 additions and 4 deletions

View File

@@ -37,7 +37,10 @@ test("user can place and select typed entities from the entity foundation workfl
const selectedSoundEmitter = soundEmitterSnapshot.document.entities[selectedSoundEmitterId as string];
expect(selectedSoundEmitter).toBeDefined();
if (selectedSoundEmitter === undefined) {
throw new Error("Placed sound emitter is missing from the document snapshot.");
}
expect(Math.abs(selectedSoundEmitter.position.x) > 0 || Math.abs(selectedSoundEmitter.position.z) > 0).toBe(true);
await expect(page.getByTestId("sound-emitter-ref-distance")).toHaveValue("6");
await expect(page.getByTestId("sound-emitter-max-distance")).toHaveValue("24");

View File

@@ -44,7 +44,10 @@ test("imports a draco-compressed glb asset, places an instance, and survives rel
const selectedModelInstance = snapshot.document.modelInstances[selectedModelInstanceId as string];
expect(selectedModelInstance).toBeDefined();
if (selectedModelInstance === undefined) {
throw new Error("Placed model instance is missing from the document snapshot.");
}
expect(Math.abs(selectedModelInstance.position.x) > 0 || Math.abs(selectedModelInstance.position.z) > 0).toBe(true);
await page.getByRole("button", { name: "Save Draft" }).click();

View File

@@ -48,7 +48,10 @@ test("imports a gltf asset with external resources and places an instance", asyn
const selectedModelInstance = snapshot.document.modelInstances[selectedModelInstanceId as string];
expect(selectedModelInstance).toBeDefined();
if (selectedModelInstance === undefined) {
throw new Error("Placed model instance is missing from the document snapshot.");
}
expect(Math.abs(selectedModelInstance.position.x) > 0 || Math.abs(selectedModelInstance.position.z) > 0).toBe(true);
expect(pageErrors).toEqual([]);

View File

@@ -50,7 +50,10 @@ test("imports a model asset, places an instance, and survives reload", async ({
const selectedModelInstance = snapshot.document.modelInstances[selectedModelInstanceId as string];
expect(selectedModelInstance).toBeDefined();
if (selectedModelInstance === undefined) {
throw new Error("Placed model instance is missing from the document snapshot.");
}
expect(Math.abs(selectedModelInstance.position.x) > 0 || Math.abs(selectedModelInstance.position.z) > 0).toBe(true);
await page.getByRole("button", { name: "Save Draft" }).click();