29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
|
|
test("preloads completed WASM and loads the debug module independently", async ({ page }) => {
|
|
await page.goto("/");
|
|
const result = await page.evaluate(async () => {
|
|
const { WebEngineClient } = await import("/src/engine-client/WebEngineClient.ts");
|
|
const client = new WebEngineClient({ timeoutMs: 60_000 });
|
|
try {
|
|
await client.init();
|
|
const before = await client.snapshot();
|
|
const pending = before.status;
|
|
const loaded = await client.loadDebugWasmModule("debug-incremental");
|
|
return {
|
|
pending,
|
|
loaded,
|
|
debug: loaded.find((module) => module.id === "debug-incremental"),
|
|
completed: loaded.filter((module) => module.lifecycle === "complete"),
|
|
};
|
|
}
|
|
finally { await client.shutdown(); }
|
|
});
|
|
expect(result.pending.ready).toBe(true);
|
|
expect(result.completed.length).toBeGreaterThan(0);
|
|
expect(result.completed.every((module) => module.status === "loaded")).toBe(true);
|
|
expect(result.debug?.status).toBe("loaded");
|
|
expect(result.debug?.lifecycle).toBe("debug");
|
|
expect(result.debug?.byteLength).toBeGreaterThan(0);
|
|
});
|