Advance M8-M11 parity workflows
This commit is contained in:
57
web/tests/e2e/geometry-node-main-reader.spec.ts
Normal file
57
web/tests/e2e/geometry-node-main-reader.spec.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
const geometryNodesBlend = path.resolve(
|
||||
import.meta.dirname,
|
||||
"../../../tests/files/web/modifier_geometry_nodes_scene.blend",
|
||||
);
|
||||
|
||||
test("M10-01 production Worker preserves Main Geometry Node topology across save and reopen", async ({ page }) => {
|
||||
test.setTimeout(120_000);
|
||||
await page.goto("/");
|
||||
const blendBytes = fs.readFileSync(geometryNodesBlend);
|
||||
const result = await page.evaluate(async ({ blendBytes }) => {
|
||||
const { WebEngineClient } = await import("/src/engine-client/WebEngineClient.ts");
|
||||
const source = blendBytes.buffer.slice(
|
||||
blendBytes.byteOffset,
|
||||
blendBytes.byteOffset + blendBytes.byteLength,
|
||||
) as ArrayBuffer;
|
||||
const first = new WebEngineClient({ timeoutMs: 60_000 });
|
||||
await first.init();
|
||||
const opened = await first.openBlend(source);
|
||||
const initial = opened.snapshot.geometryNodeGraphs ?? [];
|
||||
const saved = await first.saveBlend();
|
||||
first.terminate();
|
||||
|
||||
const second = new WebEngineClient({ timeoutMs: 60_000 });
|
||||
await second.init();
|
||||
const reopened = await second.openBlend(saved);
|
||||
const restored = reopened.snapshot.geometryNodeGraphs ?? [];
|
||||
second.terminate();
|
||||
return {
|
||||
graphNames: initial.map((graph) => graph.name),
|
||||
nodeCount: initial.reduce((count, graph) => count + graph.nodes.length, 0),
|
||||
linkCount: initial.reduce((count, graph) => count + graph.links.length, 0),
|
||||
defaultCount: initial.reduce((count, graph) => count + graph.nodes.reduce(
|
||||
(nodeCount, node) => nodeCount + node.sockets.filter((socket) => socket.defaultValue !== undefined).length,
|
||||
0,
|
||||
), 0),
|
||||
unsupportedPreserved: initial.some((graph) => graph.nodes.some((node) => node.type === "GeometryNodeSimulationOutput")),
|
||||
stable: JSON.stringify(initial) === JSON.stringify(restored),
|
||||
hashes: initial.map((graph) => graph.graphHash),
|
||||
};
|
||||
}, { blendBytes: new Uint8Array(blendBytes) });
|
||||
|
||||
expect(result).toEqual({
|
||||
graphNames: ["WebGeometryNodes", "WebGeometryNodesSetPosition", "WebGeometryNodesSimulation"],
|
||||
nodeCount: 10,
|
||||
linkCount: 7,
|
||||
defaultCount: 9,
|
||||
unsupportedPreserved: true,
|
||||
stable: true,
|
||||
hashes: result.hashes,
|
||||
});
|
||||
expect(result.hashes).toHaveLength(3);
|
||||
expect(result.hashes.every((hash) => /^[0-9a-f]{64}$/.test(hash ?? ""))).toBe(true);
|
||||
});
|
||||
Reference in New Issue
Block a user