Files
engine/e2e
luzhuang 40734f8394 fix(e2e): update blendShape e2e tests for GLTF_ROOT nesting
- animator-blendShape: use getComponentsIncludeChildren to find
  SkinnedMeshRenderer on child entity
- animator-multiSubMeshBlendShape: place Animator on actual model
  root (children[0]) so curve bindings with empty path resolve correctly
2026-04-15 17:39:02 +08:00
..
2026-04-01 12:09:30 +08:00
2026-03-23 17:55:13 +08:00

E2E Testing Guide

Prerequisites

Git LFS

We use git-lfs to manage baseline images for e2e tests. Install it if you haven't already:

git lfs install
git lfs pull

Quick Start

Run all e2e tests

npm run e2e

Debug tests interactively

npm run e2e:debug

Both commands will automatically:

  • Install required browsers (Chromium)
  • Start the test server
  • Run visual regression tests with odiff comparison

Project Structure

e2e/
├── case/              # Test case implementations
├── config.ts          # Test configuration
├── fixtures/
│   └── originImage/   # Baseline images (managed by git-lfs)
├── downloads/         # Generated screenshots
├── tests/             # Playwright test files
└── utils/             # Helper utilities

Adding New Test Cases

1. Create a test case file

Create your test implementation in e2e/case/, following existing patterns:

// e2e/case/my-new-test.ts
WebGLEngine.create({ canvas: "canvas" }).then((engine) => {
  // Your test implementation
  updateForE2E(engine);
  initScreenshot(engine, camera);
});

2. Add configuration

Add your test to e2e/config.ts:

MyCategory: {
  myNewTest: {
    category: "MyCategory",
    caseFileName: "my-new-test",
    threshold: 0.1  // 0.01 for strict tests, 0.1 for normal tests
  }
}

3. Generate baseline image

Run in debug mode to generate the initial screenshot:

npm run e2e:debug

Copy the generated image from e2e/downloads/ to e2e/fixtures/originImage/ and commit it with git-lfs.

Threshold Guidelines

  • 0.01: Strict comparison for pixel-perfect tests (e.g., FXAA, transparency)
  • 0.1: Normal comparison for most 3D rendering tests
  • Adjust based on rendering stability and requirements

Troubleshooting

Browser installation issues

Manually install browsers:

npm run e2e:install

Missing baseline images

Pull from git-lfs:

git lfs pull

Server startup issues

Manually start the test server:

npm run e2e:case

Framework Details

This project uses Playwright with odiff for visual regression testing. All tests run in Chromium for consistency.