Skip to content

Commit d6d25cb

Browse files
Copilotap0ught
andauthored
fix: WebGPU test predicate matches supportsWebGPU(); add .github/scripts/package.json for CJS compat
Agent-Logs-Url: https://github.com/ap0ught/matrix/sessions/33b6f514-63c2-46f5-b6ef-946ab3534b4f Co-authored-by: ap0ught <41078+ap0ught@users.noreply.github.com>
1 parent f643f57 commit d6d25cb

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

.github/scripts/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "type": "commonjs" }

tests/matrix-smoke.spec.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,21 @@ test.describe("Matrix WebGL effects smoke", () => {
3434
});
3535
});
3636

37+
/**
38+
* Mirrors the supportsWebGPU() predicate in js/main.js so tests skip precisely
39+
* when the app itself would fall back to WebGL (not just when navigator.gpu is absent).
40+
*/
41+
const browserSupportsWebGPU = () => window.GPUQueue != null && navigator.gpu != null && navigator.gpu.getPreferredCanvasFormat != null;
42+
3743
test.describe("Matrix WebGPU smoke", () => {
3844
test("effect=palette when WebGPU available", async ({ page }) => {
39-
const hasGpu = await page.evaluate(() => !!navigator.gpu);
45+
const hasGpu = await page.evaluate(browserSupportsWebGPU);
4046
test.skip(!hasGpu, "WebGPU not available in this browser");
4147
await assertMatrixBootsClean(page, `${baseQuery}&renderer=webgpu&effect=palette`);
4248
});
4349

4450
test("effect=mirror when WebGPU available", async ({ page }) => {
45-
const hasGpu = await page.evaluate(() => !!navigator.gpu);
51+
const hasGpu = await page.evaluate(browserSupportsWebGPU);
4652
test.skip(!hasGpu, "WebGPU not available in this browser");
4753
await assertMatrixBootsClean(page, `${baseQuery}&renderer=webgpu&effect=mirror`);
4854
});

0 commit comments

Comments
 (0)