Skip to content

test(e2e): browser e2e tests for 2D and 3D games - #461

Merged
Tchips46 merged 3 commits into
mainfrom
feat/e2e-tests-on-visible-features
Nov 6, 2026
Merged

Tchips46 merged 3 commits into
mainfrom
feat/e2e-tests-on-visible-features

Conversation

@Tchips46

@Tchips46 Tchips46 commented Nov 6, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Adds Playwright e2e tests that run a 2D and a 3D game in Chromium and check what the player sees.

  • Two small client-only test games: e2e/game-2d (graphics-2d) and e2e/game-3d (graphics-3d with forceWebGL: true). Each sets window.__e2e (tick count, player position or cube rotation, 3D backend) so the tests can wait on known ticks. Movement is a fixed step per tick, so pixels do not depend on frame timing.
  • Four checks per game (e2e/graphics/*.spec.ts):
    1. Smoke: the loader fades out, the canvas is visible, there are no page or console errors, and ticks advance. For 3D, the backend is WebGL.
    2. State: holding an arrow key moves the square or turns the cube, and it stops on release.
    3. Pixel probes: colours at known spots, read from a real screenshot that is decoded in the page (no PNG library).
    4. Reference screenshot: toHaveScreenshot with a 1% tolerance plus antialiasing detection. Compared on Linux only (ignoreSnapshots elsewhere), because the reference images come from CI's Chromium.
  • CI: a new graphics job in tests.yml on ubuntu-24.04, with one worker and a 30 s screenshot timeout (SwiftShader renders WebGL on the CPU there). The report and screenshots are uploaded as the graphics-e2e artifact.
  • Loader bump to 1.6.0 (lockfile only): with loader-website 1.5.1 the loading screen stays on top of the running game. Its display: flex overrides hidden. The new tests caught this.

To update the reference screenshots after an intended visual change: run Tests from the Actions tab with update-snapshots checked on your branch, download the graphics-e2e artifact, and commit e2e/graphics/*-snapshots/.

How do you test this PR?

Two small client-only test games (graphics-2d, graphics-3d forced on
WebGL) run in Chromium through Playwright. Each is checked for: booting
without errors, input changing game state, pixels at known spots, and
a reference screenshot (compared on Linux only, 1% tolerance).

Bumps the loader to 1.6.0: with 1.5.1 the loading screen stays on top
of the running game.
@Tchips46
Tchips46 requested a review from Exeloo as a code owner November 6, 2026 14:06
@Tchips46 Tchips46 self-assigned this Nov 6, 2026
@Tchips46
Tchips46 merged commit 31ed3b8 into main Nov 6, 2026
4 checks passed
@Tchips46
Tchips46 deleted the feat/e2e-tests-on-visible-features branch November 6, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants