Enable local storage
1
Omit the screenshot key
In your Visual diff step, omit the
screenshot key so Momentic stores
the snapshot locally:2
Find the snapshots on disk
Momentic writes snapshots to
<momentic-root>/golden/visual-diff/<command-id>.jpg by default. The
command ID is the internal identifier generated from the step’s position
in the test:3
Override the directory (optional)
Set
goldenFileDir in
momentic.config.yaml:momentic.config.yaml
Update snapshots
Colocate snapshots with tests
Point thescreenshot.data field at a path relative to the Momentic root:
Mobile
On mobile,visualDiff always stores
golden files locally. The golden path is part of the step:
path resolves relative to the test or module file the step is defined in (the
same rule used by module and JavaScript file references), so a visualDiff
inside a module always resolves against the module’s location no matter which
test includes it.
Momentic creates the golden on the first run and the step passes. On later runs
Momentic compares the full-screen screenshot against the golden and the step
fails if it differs by more than threshold. Refresh goldens after an
intentional UI change with --update-golden-files. Mobile visualDiff is only
available when running tests locally with the CLI.