Files
workinf_Blender_Wasm/web/tests/e2e/b3-seq-open-result-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

39 lines
1.9 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 open result error report", async ({ page }) => {
test.setTimeout(180_000);
await page.goto("/");
await page.waitForTimeout(10000);
for (const worker of page.workers()) {
await worker.evaluate(() => {
const scope = self as unknown as { __openResults: unknown[] };
if (scope.__openResults) return;
scope.__openResults = [];
const original = self.addEventListener.bind(self);
self.addEventListener = ((type: string, listener: EventListenerOrEventListenerObject, options?: unknown) => {
if (type !== "message") return original(type, listener, options as AddEventListenerOptions);
return original(type, ((event: Event) => {
const data = (event as MessageEvent).data;
if (data && (data.kind === "result" || data.type === "result")) {
scope.__openResults.push({ ok: data.ok, error: data.error ? { code: data.error.code, message: String(data.error.message).slice(0, 600) } : null, status: data.result?.status });
if (scope.__openResults.length > 40) scope.__openResults.shift();
}
return typeof listener === "function" ? listener(event) : listener.handleEvent(event);
}) as EventListener, options);
}) as typeof self.addEventListener;
});
}
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 results: unknown[] = [];
for (const worker of page.workers()) {
const collected = await worker.evaluate(() => (self as unknown as { __openResults?: unknown[] }).__openResults ?? []);
results.push(collected);
}
fs.writeFileSync("/tmp/seq-open-result.json", JSON.stringify(results, null, 2));
});