Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer, web workflow engine and protocol, tooling, docs and task records. Large generated evidence, user-testing archives, build snapshots and imported test assets remain untracked. Co-Authored-By: Claude Code <noreply@anthropic.com>
42 lines
3.0 KiB
TypeScript
42 lines
3.0 KiB
TypeScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { test, expect } from "@playwright/test";
|
|
import { observeNative } from "../fixtures/native-ui-workflow";
|
|
|
|
const root = path.resolve(import.meta.dirname, "../../..");
|
|
|
|
test("python exec then reset and undo", async ({ page }) => {
|
|
test.setTimeout(240_000);
|
|
await observeNative(page);
|
|
await page.goto("/");
|
|
await page.getByTestId("blend-file-input").setInputFiles(path.join(root, "blender-5.2.0/tests/files/sequence_editing/effects/fx_comp.blend"));
|
|
await expect.poll(async () => page.locator("main.blender-app").evaluate((n) => (n as HTMLElement).dataset.projectId), { timeout: 60000 }).toBe("fx_comp");
|
|
await expect(page.getByTestId("engine-status")).toContainText("SceneIR", { timeout: 60000 });
|
|
const out = await page.evaluate(async () => {
|
|
const worker = (window as any).__nativeWorkflowEngine as Worker;
|
|
const send = (command: any) => new Promise<any>((resolve, reject) => {
|
|
const requestId = `sem3-${crypto.randomUUID()}`;
|
|
const receive = (event: MessageEvent) => {
|
|
if (event.data?.requestId !== requestId || event.data?.kind !== 'result') return;
|
|
worker.removeEventListener('message', receive);
|
|
if (event.data.ok) resolve(event.data.result); else reject(Object.assign(new Error(`${event.data.error?.code}: ${event.data.error?.message}`), { detail: event.data.error }));
|
|
};
|
|
worker.addEventListener('message', receive); worker.postMessage({ requestId, command });
|
|
});
|
|
const hex = (buf: ArrayBuffer) => crypto.subtle.digest('SHA-256', buf).then((h) => Array.from(new Uint8Array(h), (b) => b.toString(16).padStart(2, '0')).join('').slice(0, 16));
|
|
const bytes = async () => ({ digest: await hex((await send({ type: 'saveBlend' })).blend as ArrayBuffer), revision: (await send({ type: 'snapshot' })).snapshot.revision });
|
|
const log: any = { base: await bytes() };
|
|
log.exec = await send({ type: 'jsonCommand', cmd: 'pythonExec', params: { source: 'import bpy\nbpy.context.scene.name = "ProbeStage"\n', filename: 'Probe.py', console: false } })
|
|
.then((r: any) => r?.json?.state ?? r?.status ?? 'ok', (e: Error) => String(e.message));
|
|
log.afterExec = await bytes().catch((e: Error) => String(e.message));
|
|
log.reset1 = await send({ type: 'jsonCommand', cmd: 'pythonReset', params: {} }).then((r: any) => r?.json ?? r ?? 'ok', (e: Error) => String(e.message));
|
|
log.afterReset1 = await bytes().catch((e: Error) => String(e.message));
|
|
log.reset2 = await send({ type: 'jsonCommand', cmd: 'pythonReset', params: {} }).then((r: any) => r?.json ?? r ?? 'ok', (e: Error) => String(e.message));
|
|
log.afterReset2 = await bytes().catch((e: Error) => String(e.message));
|
|
log.undo = await send({ type: 'jsonCommand', cmd: 'undo', params: {} }).then((r: any) => r?.json ?? r ?? 'ok', (e: Error) => String(e.message));
|
|
log.afterUndo = await bytes().catch((e: Error) => String(e.message));
|
|
return log;
|
|
});
|
|
fs.writeFileSync("/tmp/reset-semantic3.json", JSON.stringify(out, null, 2));
|
|
});
|