Files
workinf_Blender_Wasm/web/tests/e2e/b3-seq-open-onmessage-probe.spec.ts
mes123456 f3e21c6b98
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
chore: checkpoint web Blender migration source, tools and docs
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>
2026-11-10 11:18:01 +08:00

43 lines
2.0 KiB
TypeScript

import fs from "node:fs";
import path from "node:path";
import { test } from "@playwright/test";
const root = path.resolve(import.meta.dirname, "../../..");
test("capture onmessage error replies for compressed open", async ({ page }) => {
test.setTimeout(180_000);
await page.addInitScript(() => {
const scope = window as unknown as { __replies: unknown[] };
scope.__replies = [];
const proto = Worker.prototype as unknown as { __patched?: boolean };
if (proto.__patched) return;
proto.__patched = true;
const descriptor = Object.getOwnPropertyDescriptor(Worker.prototype, "onmessage");
if (!descriptor?.set) return;
Object.defineProperty(Worker.prototype, "onmessage", {
configurable: true,
enumerable: descriptor.enumerable,
get: descriptor.get,
set(value: ((event: MessageEvent) => unknown) | null) {
if (typeof value !== "function") return descriptor.set!.call(this, value);
const wrapped = (event: MessageEvent) => {
const data = event.data as { error?: { code?: string; message?: string; detail?: string } } | undefined;
if (data?.error) {
scope.__replies.push({ code: data.error.code, message: String(data.error.message).slice(0, 400), detail: String(data.error.detail ?? "").slice(0, 500) });
if (scope.__replies.length > 60) scope.__replies.shift();
}
return value(event);
};
return descriptor.set!.call(this, wrapped);
},
});
});
await page.goto("/");
await page.waitForTimeout(12000);
await page.evaluate(() => ((window as unknown as { __replies: unknown[] }).__replies = []));
await page.getByTestId("blend-file-input").setInputFiles(path.join(root, "blender-5.2.0/tests/files/sequence_editing/sequence.blend"));
await page.waitForTimeout(35000);
const replies = await page.evaluate(() => (window as unknown as { __replies: unknown[] }).__replies);
fs.writeFileSync("/tmp/seq-open-onmessage.json", JSON.stringify(replies, null, 2));
});