feat(web): preload completed wasm and load debug modules on demand
This commit is contained in:
28
web/tests/e2e/wasm-module-loading.spec.ts
Normal file
28
web/tests/e2e/wasm-module-loading.spec.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
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);
|
||||
});
|
||||
Reference in New Issue
Block a user