Enhance error handling in e2e tests for entity placement and model import
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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([]);
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user