Skip to content

Commit

Permalink
Disable WebGL-requiring tests in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
1j01 committed Jul 1, 2024
1 parent 5fbd103 commit 5245105
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/paint.spec.ts
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
9 changes: 9 additions & 0 deletions tests/screensavers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 5245105

Please sign in to comment.