CLI Workflow
Cappa provides a focused CLI with commands that mirror the visual regression lifecycle. Each command
operates on the screenshots defined in your cappa.config.ts
file.
cappa capture
Section titled “cappa capture”Runs Playwright to render every configured scenario and writes the resulting images to the
configured outputDir
. Captures can be executed locally or inside a CI environment. Use flags such
as --log-level
to adjust verbosity when diagnosing flaky tests.
cappa review
Section titled “cappa review”Launches an interface for comparing the latest screenshots against the approved baseline. The review step highlights diffs so you can decide whether the change is expected. Pair it with your preferred branching strategy to share reviews with teammates.
cappa approve
Section titled “cappa approve”Promotes the currently reviewed screenshots to the baseline. This command is typically run after a manual review or as a final step in an automated pipeline when the diffs are accepted.
cappa status
Section titled “cappa status”Summarizes the state of your screenshot directory, showing how many files are pending approval and whether any captures are missing. This is useful for scripting custom checks or reporting in CI.
Tip: combine the commands with npm scripts to make common workflows easy to discover for the rest of your team.