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>
52 lines
3.0 KiB
TypeScript
52 lines
3.0 KiB
TypeScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { test, expect } from "@playwright/test";
|
|
import { NativeUIWorkflow, observeNative } from "../fixtures/native-ui-workflow";
|
|
|
|
const root = path.resolve(import.meta.dirname, "../../..");
|
|
const effects = path.join(root, "blender-5.2.0/tests/files/sequence_editing/effects");
|
|
const mask = fs.readFileSync(path.join(effects, "mask.png"));
|
|
|
|
test("probe filepath after undo and packed status in snapshot", async ({ page }, testInfo) => {
|
|
test.setTimeout(180_000);
|
|
await observeNative(page);
|
|
await page.goto("/");
|
|
const flow = new NativeUIWorkflow(page, testInfo.outputPath("cases"));
|
|
await flow.command(() => page.getByTestId("blend-file-input").setInputFiles(path.join(effects, "fx_comp.blend")));
|
|
await expect(page.getByTestId("engine-status")).toContainText("SceneIR", { timeout: 60000 });
|
|
const out = await page.evaluate(async (maskBase64) => {
|
|
const worker = (window as any).__nativeWorkflowEngine as Worker;
|
|
const send = (command: any) => new Promise<any>((resolve, reject) => {
|
|
const requestId = `fpu-${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(new Error(`${event.data.error?.code}: ${event.data.error?.message}`));
|
|
};
|
|
worker.addEventListener('message', receive); worker.postMessage({ requestId, command });
|
|
});
|
|
const py = (source: string) => send({ type: 'jsonCommand', cmd: 'pythonExec', params: { source, filename: 'FpUndo.py', console: false } });
|
|
const log: any = {};
|
|
const pre = await py([
|
|
"import bpy, os, base64",
|
|
"open('/browser/mask.png','wb').write(base64.b64decode('" + maskBase64 + "'))",
|
|
"print('FP0', repr(bpy.data.filepath))",
|
|
"print('PACK', bpy.ops.file.pack_all())",
|
|
"print('PACKED', [(i.name, i.packed_file is not None) for i in bpy.data.images])",
|
|
].join("\n"));
|
|
log.pre = String(pre.json?.output ?? '').slice(0, 800);
|
|
const snapPacked = await send({ type: 'snapshot' });
|
|
log.snapshotImages = (snapPacked.snapshot.images ?? []).map((i: any) => ({ name: i.name, assetStatus: i.assetStatus, packed: i.packed }));
|
|
const undo = await send({ type: 'applyCommand', payload: { type: 'undo' } });
|
|
log.revisionAfterUndo = undo.snapshot.revision;
|
|
const post = await py(["import bpy", "print('FP_AFTER_UNDO', repr(bpy.data.filepath))", "print('ABS', bpy.path.abspath('//mask.png'))"].join("\n"));
|
|
log.post = String(post.json?.output ?? '').slice(0, 400);
|
|
const redo = await send({ type: 'applyCommand', payload: { type: 'redo' } });
|
|
log.revisionAfterRedo = redo.snapshot.revision;
|
|
const post2 = await py(["import bpy", "print('FP_AFTER_REDO', repr(bpy.data.filepath))"].join("\n"));
|
|
log.post2 = String(post2.json?.output ?? '').slice(0, 300);
|
|
return log;
|
|
}, mask.toString("base64"));
|
|
fs.writeFileSync("/tmp/filepath-undo.json", JSON.stringify(out, null, 2));
|
|
});
|