Files
workinf_Blender_Wasm/web/tests/e2e/nanovdb-sparse-performance.spec.ts
mes123456 0fe8d2bb56
Some checks are pending
M6 deployable RC / quick (push) Waiting to run
M6 deployable RC / chromium (push) Blocked by required conditions
M6 deployable RC / release (push) Blocked by required conditions
Advance M8-M11 parity workflows
2026-08-17 04:37:07 -04:00

54 lines
2.3 KiB
TypeScript

import { expect, test } from "@playwright/test";
test("M8-17 streams a 64 MiB sparse bundle with bounded paging and cancellation", async ({ page }) => {
test.setTimeout(60_000);
await page.goto("/");
const result = await page.evaluate(() => new Promise<any>((resolve, reject) => {
const worker = new Worker("/src/workers/nanovdb-sparse-performance-test.worker.ts", { type: "module" });
worker.onmessage = (event) => {
worker.terminate();
event.data.error ? reject(new Error(event.data.error)) : resolve(event.data);
};
worker.onerror = (event) => {
worker.terminate();
reject(new Error(event.message));
};
worker.postMessage({});
}));
console.log("nanovdb-sparse-performance", JSON.stringify({
bundleBytes: result.bundleBytes,
requestedPageIds: result.requestedPageIds,
loadedPageCount: result.loadedPageCount,
transferredBytes: result.transferredBytes,
peakRangeBytes: result.peakRangeBytes,
firstPageMs: result.firstPageMs,
successElapsedMs: result.successElapsedMs,
cancel: result.cancel,
}));
const mib = 1024 * 1024;
expect(result.bundleBytes).toBe(64 * mib);
expect(result.chunkBytes).toBe(4 * mib);
expect(result.pageBytes).toBe(256 * 1024);
expect(result.requestedPageIds).toEqual([0, 16, 128, 192]);
expect(result.loadedPageCount).toBe(result.requestedPageIds.length);
expect(result.transferredBytes).toBe(4 * result.chunkBytes);
expect(result.rangeCalls).toBe(result.requestedPageIds.length);
expect(result.peakRangeBytes).toBe(result.chunkBytes);
expect(result.firstPageMs).toBeLessThan(10_000);
expect(result.successElapsedMs).toBeLessThan(30_000);
expect(result.successCoordinatorStats).toEqual({ pendingPages: 0, subscribers: 0, pageIds: [] });
expect(result.cancel.status).toBe("CANCELLED");
expect(result.cancel.errorName).toBe("AbortError");
expect(result.cancel.consumerCalls).toBe(0);
expect(result.cancel.rangeCalls).toBe(1);
expect(result.cancel.abortedRequests).toBe(1);
expect(result.cancel.transferredBytes).toBeGreaterThan(0);
expect(result.cancel.transferredBytes).toBeLessThan(result.chunkBytes);
expect(result.cancel.peakRangeBytes).toBe(result.chunkBytes);
expect(result.cancel.cancelLatencyMs).toBeLessThan(2_000);
expect(result.cancel.coordinatorStats).toEqual({ pendingPages: 0, subscribers: 0, pageIds: [] });
});