Automated visual testing framework for PixiJS applications. Early in development and does not yet work for all PixiJS apps (see Issues).
Note: To access the replication package for our paper "Automatically Detecting Visual Bugs in HTML5 <canvas> Games":
- Collect snapshots from a PixiJS application; snapshots contain a screenshot paired with a scene graph
- Perform automatic visual comparisons between oracles (generated during the test) and the objects rendered to the <canvas>
- Supports automated test scripts written with Playwright in TypeScript
Note: To detect visual bugs, must set baseline (acceptable) error scores and then perform regression testing. This functionality will be added to the framework in a future release.
Download and install the latest version of Python from this link. After installing Python, ensure Python's package manager (Pip) is installed by running the command:
python3 -m pip install ---upgrade pip
Using the instructions found at this link, first install Node Version Manager (nvm), and then use nvm to install Node and Node Package Manager (npm).
- Download the latest release from the releases page
- Unzip the folder and place it inside your test directory
- Open the folder in your terminal and run the command
npm install -D
Note: Initial installation may take a long time due to Python dependencies
- Collect snapshots by instrumenting automated test scripts
- Run visual tests on collected snapshots with Python script
- Snapshot name needs to be known on both ends
- instrument your test code to capture snapshots, which are pairs of (screenshot, scene graph)
- sampling API requires reference to Playwright browser
Page
instance - sampling API requires call to inject into the
Page
instance before samples can be taken
Importing:
import { PixiSamplerPlaywright } from 'pixi-visual-test/sampling/PixiSamplerPlaywright'
Instantiating:
/** @param {playwright.Page} page: Playwright browser page where PixiJS app is running */
const sampler = new PixiSamplerPlaywright(page, 'test/snapshots')
Injecting:
await sampler.startExposing();
Sampling:
await sampler.takeSnapshot('<name_of_snapshot>');
Run python3 ./pixi-visual-test test/snapshots/<name_of_snapshot>
See test/
directory for a bare minimum example test script made for our toy example PixiJS game.
To run the example, enter the command npm run test
from the root directory of this repository.