test(web): give the scene settings clients an in-memory engine

The spec built two persistent WebEngineClient instances inside the editor
page, but the page's own editor owns the exclusive native-files Web Lock
for /browser, so whichever side won the startup race decided the run.
The clients only need an in-memory Main and save/reopen through bytes, so
they now start as ephemeral instances, the same pattern the armature
coverage spec already uses.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
mes123456
2026-12-02 19:01:17 +08:00
parent 09f23163c7
commit d3260cb0cb

View File

@@ -12,8 +12,11 @@ test("WBV2-P1129-001 covers the remaining Scene settings Main commands", async (
await page.goto("/");
const result = await page.evaluate(async (bytes) => {
const { WebEngineClient } = await import("/src/engine-client/WebEngineClient.ts");
const client = new WebEngineClient({ timeoutMs: 60_000 });
const reopenedClient = new WebEngineClient({ timeoutMs: 60_000 });
/* The page's own editor owns the exclusive native-files Web Lock, so a second
* persistent engine in the same page can never start. These clients only need
* an in-memory Main and save/reopen through bytes. */
const client = new WebEngineClient({ timeoutMs: 60_000, nativeFiles: false });
const reopenedClient = new WebEngineClient({ timeoutMs: 60_000, nativeFiles: false });
const digest = async (value: ArrayBuffer): Promise<string> => {
const hash = await crypto.subtle.digest("SHA-256", value);
return Array.from(new Uint8Array(hash), (byte) => byte.toString(16).padStart(2, "0")).join("");