From 5245105214cee90ab984fc15bece6c92db15ca7d Mon Sep 17 00:00:00 2001 From: Isaiah Odhner Date: Mon, 1 Jul 2024 12:37:12 -0400 Subject: [PATCH] Disable WebGL-requiring tests in CI --- tests/paint.spec.ts | 6 ++++++ tests/screensavers.spec.ts | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/tests/paint.spec.ts b/tests/paint.spec.ts index a3645eb7..75914392 100644 --- a/tests/paint.spec.ts +++ b/tests/paint.spec.ts @@ -1,6 +1,12 @@ import { test, expect } from '@playwright/test'; test('can set wallpaper tiled (and use pencil, fill, and magnifier tools)', async ({ page }) => { + // TODO: make JS Paint work without WebGL, ideally (for tests and for users) + // [JavaScript Warning: "Failed to create WebGL context: WebGL creation failed: + // * WebglAllowWindowsNativeGl:false restricts context creation on this system. () + // * Exhausted GL driver options. (FEATURE_FAILURE_WEBGL_EXHAUSTED_DRIVERS)" {file: "http://localhost:1998/programs/jspaint/src/image-manipulation.js" line: 1407}] + test.skip(!!process.env.CI, 'needs WebGL; could maybe run headed or enable software rendering somehow?'); + await page.goto('http://localhost:1998/'); await page.getByText('Paint').dblclick(); await page.getByText('Image', { exact: true }).click(); diff --git a/tests/screensavers.spec.ts b/tests/screensavers.spec.ts index 5394530a..048c4b7f 100644 --- a/tests/screensavers.spec.ts +++ b/tests/screensavers.spec.ts @@ -33,6 +33,15 @@ test('closes when pressing a key', async ({ page }) => { }); test('has an animated canvas', async ({ page }) => { + // [JavaScript Warning: "Failed to create WebGL context: WebGL creation failed: + // * WebglAllowWindowsNativeGl:false restricts context creation on this system. () + // * Exhausted GL driver options. (FEATURE_FAILURE_WEBGL_EXHAUSTED_DRIVERS)" {file: "https://cdnjs.cloudflare.com/ajax/libs/three.js/98/three.min.js" line: 178}] + test.skip(!!process.env.CI, 'needs WebGL; could maybe run headed or enable software rendering somehow?'); + + // Not every frame may be different from the last (sometimes pipes are offscreen), + // so just check that we get enough unique frames to know it's animating. + // This assumes `toDataURL` is deterministic, otherwise it could pass with a static image. + // I tested the test by disabling animation in the screensaver and it failed correctly. const canvas = page.frameLocator('iframe').locator('#canvas-webgl'); await expect(canvas).toBeVisible(); expect(await canvas.evaluate((canvas: HTMLCanvasElement) => {