CI/CD and snapshots
Run Puth alongside your application and test runner in CI. Docker or Podman includes the compatible Chrome version, which avoids downloading a browser on every run. See getting started for server installation options.
Run the tests
Start the Puth server and your application, then run your project's test command. Saving a .puth snapshot requires a context with snapshot recording enabled.
The Laravel test case enables snapshot recording and can save failures automatically. See Laravel test artifacts for CI=true configuration.
If you install Puth with npm, cache the browser download directory between jobs. Puth checks ~/.cache/puth and .cache/puppeteer relative to the server's working directory.
Preserve failed test snapshots
Snapshot files are written by the Puth server, so collect artifacts from the machine or container running it. The default location is storage/snapshots relative to the server’s working directory. In the Puth Docker image this is /puth/storage/snapshots. The Compose example mounts that directory to ./puth/snapshots on the host.
Configure your CI provider to upload the snapshot directory even when the test step fails. If you override the snapshot location, collect that directory instead.
Inspect a failure locally
- Download the
.puthsnapshot artifact from your CI run. - Start a local Puth server and open its GUI at
http://localhost:7345. - Drag and drop the snapshot file into the GUI.
- Step through the recorded commands and inspect the viewport, console output and errors.
Snapshots let you inspect the captured test run without having to reproduce the failure first.
