The Visual Regression Tests utilize headless browsers provided by the Playwright project. Browsers are highly platform-specific, and even small pixel differences can cause significant issues for image comparison algorithms. These differences can prevent reliable detection of regressions.
To avoid these issues, Visual Regression Tests run inside a containerized environment. This guarantees a consistent platform for headless browsers, ensuring reproducible results.
For PRs, a GitHub Action runs these tests in a Linux-based container. Locally, you must use --ci
mode, which launches tests in a container to produce snapshots identical to the GitHub Action environment.
This guide covers installing the required tools (docker
, colima
, or podman
) and building the Visual Regression Test image.
You can use Docker Desktop if you have a license. If you don’t, use Colima or Podman as alternatives.
- Download and install Docker Desktop.
- After installation, test Docker:
docker ps
- Install the Docker CLI using Homebrew:
brew install docker
- Install Colima:
brew install colima
- Start Colima:
colima start
- Test Docker with Colima:
It should run without errors.
docker ps
- Install Podman:
brew install podman
- Start Podman:
podman machine init podman machine start
- Test Podman:
podman ps
Docker is natively supported on Linux, but you can also use Podman for a rootless container environment.
- Follow the instructions for your Linux distribution to install Docker:
- After installation, test Docker:
docker ps
- Install Podman for your Linux distribution:
- Test Podman:
podman ps
Windows users can use Docker Desktop if they have a license or install Podman as an alternative.
- Download and install Docker Desktop.
- After installation, test Docker:
docker ps
- Install Podman via the Windows installer:
- Start the Podman machine:
podman machine init podman machine start
- Test Podman:
podman ps
After installing a container runtime, you must build the Visual Regression Test image.
-
Run the build script:
pnpm build:docker
-
The script automatically detects your runtime (
docker
orpodman
) and builds the image. After a successful build, you should see the image:docker images
Or, if using Podman:
podman images
Example output:
REPOSITORY TAG IMAGE ID CREATED SIZE visual-regression latest 40476ed4acae 3 minutes ago 2.09GB
- Docker Desktop: docker.com/products/docker-desktop
- Colima: colima.dev
- Podman: podman.io