Skip to content

bug(e2e): Playwright runs but PixiJS canvas never attaches to #pixi-container in CI #118

@hyperpolymath

Description

@hyperpolymath

Surface

After PR #114 fixed the Playwright infrastructure (vite optimizeDeps scoping + port alignment + testDir + DCO + symmetric path filters), the workflow finally runs end-to-end on all three browser matrices. Tests execute, but 17 of 19 fail with the same root cause:

TimeoutError: locator.waitFor: Timeout 15000ms exceeded.
Call log:
  - waiting for locator('#pixi-container canvas')

  20 | async function waitForPixiCanvas(page, timeoutMs = 15000) {
  21 |   const canvas = page.locator('#pixi-container canvas');
> 22 |   await canvas.waitFor({ state: 'attached', timeout: timeoutMs });

#pixi-container exists in the served index.html (verified via the SPA shell), but no <canvas> element is ever attached inside it. PixiJS bootstrap is silently failing or not running in the CI environment.

What we know

Likely root causes (in order of probability)

  1. PixiJS init throws in headless / WebGL environment — but webkit failing too is unusual; WebGL2 / WebGL fallback may be broken
  2. Asset path mismatch in dev mode — wasm modules, sprite manifests, or audio files served with wrong content-type in vite dev (vs production build)
  3. AffineScript-TEA bootstrapvite.config.js has 'affinescript': '/src/app/tea' alias + optimizeDeps.entries: ['index.html']. If the SPA mount depends on TEA, the AOT compilation gap (per affinescript#57 status) may break dev-time boot
  4. deno task res:build in workflow does compile-only — the workflow uses dev:vite (which compiles ReScript on-demand) instead of deno task build (full production build). If the asset pipeline (AssetPack) hasn't run, sprite manifests are missing
  5. AFFINE_TEA_MIGRATION: true / USE_WASM_ROUTER: true flags in vite.config.js — if the wasm router fails to fetch its .wasm file (router.wasm), the boot pipeline aborts

Investigation recipe

  1. Download a failed run's trace.zip artifact and inspect npx playwright show-trace
  2. Check the browser console screenshot in test-results/*/test-failed-1.png
  3. Run deno task dev:vite locally, point a browser at http://localhost:1984, observe DevTools console
  4. If canvas works locally but not in CI: bisect by enabling/disabling AFFINE_TEA_MIGRATION flag
  5. If canvas doesn't work locally either: bisect on commits since 2026-05-02 (when Playwright started failing per Playwright E2E: vite alias + idaptik-ums sub-build fundamental fix #113)

Cross-references

Severity

P2 — Playwright never gave a useful signal anyway (it's been red since 2026-05-02), so this isn't a regression. But it's worth resolving so the workflow becomes the load-bearing E2E gate it was meant to be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions