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>
43 lines
2.7 KiB
TypeScript
43 lines
2.7 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, "../../..");
|
|
const fixtures: Array<[string, string, string]> = [
|
|
["fx_comp", "sequence_editing/effects/fx_comp.blend", "unpacked-missing-image"],
|
|
["corrupt_packed_image", "render/corrupt_packed_image.blend", "packed-image"],
|
|
["basic_scene", "scenes/basic_scene.blend", "no-external-image"],
|
|
];
|
|
|
|
test("undo after python exec across fixtures", async ({ page }) => {
|
|
test.setTimeout(300_000);
|
|
await observeNative(page);
|
|
const results: Record<string, unknown> = {};
|
|
for (const [projectId, rel, label] of fixtures) {
|
|
await page.goto("/");
|
|
await page.getByTestId("blend-file-input").setInputFiles(path.join(root, "blender-5.2.0/tests/files", rel));
|
|
await expect.poll(async () => page.locator("main.blender-app").evaluate((n) => (n as HTMLElement).dataset.projectId), { timeout: 60000 }).toBe(projectId);
|
|
await expect(page.getByTestId("engine-status")).toContainText("SceneIR", { timeout: 60000 });
|
|
results[label] = await page.evaluate(async () => {
|
|
const worker = (window as any).__nativeWorkflowEngine as Worker;
|
|
const send = (command: any) => new Promise<any>((resolve, reject) => {
|
|
const requestId = `sem4-${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 log: any = {};
|
|
log.exec = await send({ type: 'jsonCommand', cmd: 'pythonExec', params: { source: 'import bpy\nbpy.context.scene.name = bpy.context.scene.name\n', filename: 'Probe.py', console: false } }).then((r: any) => r?.json?.state ?? 'ok', (e: Error) => String(e.message));
|
|
log.pdf = await send({ type: 'applyCommand', payload: { type: 'deleteObject', objectId: 'object:Camera' } }).then((r: any) => r?.status ?? 'ok', (e: Error) => String(e.message));
|
|
log.undo = await send({ type: 'applyCommand', payload: { type: 'undo' } }).then((r: any) => r?.status ?? 'ok', (e: Error) => String(e.message));
|
|
log.redo = await send({ type: 'applyCommand', payload: { type: 'redo' } }).then((r: any) => r?.status ?? 'ok', (e: Error) => String(e.message));
|
|
return log;
|
|
});
|
|
}
|
|
fs.writeFileSync("/tmp/reset-semantic4.json", JSON.stringify(results, null, 2));
|
|
});
|