Update e2e tests to specify model instance positions and use new viewport placement helper
This commit is contained in:
@@ -61,7 +61,10 @@ test("imports a draco-compressed glb asset, places an instance, and survives rel
|
||||
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(selectedModelInstance.position).toMatchObject({
|
||||
x: 84,
|
||||
z: -88
|
||||
});
|
||||
|
||||
await page.getByRole("button", { name: "Save Draft" }).click();
|
||||
await expect(page.getByTestId("status-message")).toContainText("Local draft saved.");
|
||||
|
||||
@@ -60,7 +60,10 @@ test("imports a gltf asset with external resources and places an instance", asyn
|
||||
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(selectedModelInstance.position).toMatchObject({
|
||||
x: 88,
|
||||
z: -84
|
||||
});
|
||||
|
||||
expect(pageErrors).toEqual([]);
|
||||
expect(consoleErrors).toEqual([]);
|
||||
|
||||
@@ -62,7 +62,10 @@ test("imports a model asset, places an instance, and survives reload", async ({
|
||||
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(selectedModelInstance.position).toMatchObject({
|
||||
x: 92,
|
||||
z: -76
|
||||
});
|
||||
|
||||
await page.getByRole("button", { name: "Save Draft" }).click();
|
||||
await expect(page.getByTestId("status-message")).toContainText("Local draft saved.");
|
||||
|
||||
@@ -2,7 +2,7 @@ import path from "node:path";
|
||||
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
import { getViewportCanvas } from "./viewport-test-helpers";
|
||||
import { setViewportPlacementPreview } from "./viewport-test-helpers";
|
||||
|
||||
const panoramaFixturePath = path.resolve(process.cwd(), "fixtures/assets/skybox-panorama.svg");
|
||||
|
||||
@@ -39,10 +39,9 @@ test("local lights and background images persist through editor and runner flows
|
||||
await page.getByTestId("outliner-add-button").click();
|
||||
await page.getByTestId("add-menu-lights").click();
|
||||
await page.getByTestId("add-menu-point-light").click();
|
||||
await page.getByTestId("viewport-panel-topLeft").click({ position: { x: 16, y: 16 }, force: true });
|
||||
const viewportCanvas = getViewportCanvas(page);
|
||||
await viewportCanvas.hover({ position: { x: 172, y: 116 }, force: true });
|
||||
await viewportCanvas.click({ position: { x: 172, y: 116 }, force: true });
|
||||
await setViewportPlacementPreview(page, "topLeft", { kind: "entity", entityKind: "pointLight", audioAssetId: null }, { x: 12, y: 3, z: -4 });
|
||||
await expect(page.getByTestId("viewport-snap-preview-topLeft")).toBeVisible();
|
||||
await page.getByTestId("viewport-fallback-place-topLeft").click();
|
||||
await expect(page.getByTestId("point-light-distance")).toHaveValue("8");
|
||||
await page.getByTestId("point-light-distance").fill("12");
|
||||
await page.getByTestId("point-light-distance").press("Tab");
|
||||
@@ -50,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("add-menu-lights").click();
|
||||
await page.getByTestId("add-menu-spot-light").click();
|
||||
await page.getByTestId("viewport-panel-topLeft").click({ position: { x: 16, y: 16 }, force: true });
|
||||
await viewportCanvas.hover({ position: { x: 240, y: 132 }, force: true });
|
||||
await viewportCanvas.click({ position: { x: 240, y: 132 }, force: true });
|
||||
await setViewportPlacementPreview(page, "topLeft", { kind: "entity", entityKind: "spotLight", audioAssetId: null }, { x: -10, y: 4, z: 6 });
|
||||
await expect(page.getByTestId("viewport-snap-preview-topLeft")).toBeVisible();
|
||||
await page.getByTestId("viewport-fallback-place-topLeft").click();
|
||||
await expect(page.getByTestId("spot-light-angle")).toHaveValue("35");
|
||||
await page.getByTestId("spot-light-angle").fill("48");
|
||||
await page.getByTestId("spot-light-angle").press("Tab");
|
||||
|
||||
Reference in New Issue
Block a user