import { expect, test } from "@playwright/test"; import fs from "node:fs"; import path from "node:path"; const root = path.resolve(import.meta.dirname, "../../.."); const expected = JSON.parse(fs.readFileSync(path.join(root, "tests/golden/M10-10/shader-capability-block.json"), "utf8")); test("M10-10 returns a stable block for every unknown Shader node", async ({ page }) => { await page.goto("/"); const result = await page.evaluate(async () => { const { WebEngineClient } = await import("/src/engine-client/WebEngineClient.ts"); const client = new WebEngineClient({ timeoutMs: 30_000 }); await client.init(); const first = await client.queryRenderCapability({ kind: "ARBITRARY_SHADER", nodeTypes: ["VORONOI", "CUSTOM_OSL"] }); const second = await client.queryRenderCapability({ kind: "ARBITRARY_SHADER", nodeTypes: ["CUSTOM_OSL", "VORONOI"] }); client.terminate(); return { first: { taskId: first.taskId, capability: first.capability, status: first.status, code: first.issues[0]?.code, recoverable: first.issues[0]?.recoverable, message: first.issues[0]?.message }, second: { taskId: second.taskId, capability: second.capability, status: second.status, code: second.issues[0]?.code, recoverable: second.issues[0]?.recoverable, message: second.issues[0]?.message }, }; }); expect(result.first.taskId).toBe("PBR-012"); expect(result.first.capability).toBe(expected.capability); expect(result.first.status).toBe(expected.status); expect(result.first.code).toBe(expected.errorCode); expect(result.first.recoverable).toBe(expected.recoverable); expect(result.first.message).toContain("VORONOI"); expect(result.first.message).toContain("CUSTOM_OSL"); expect(result.second).toEqual(result.first); });