Skip to main content
Creates a test snapshot: a .snapshot.zip with a resolved test, expanded modules, step caches, environment variables, and the relevant project config. Replay it with momentic run --from-snapshot without the original test files, modules, environment files, or cache backend. Replay still requires a Momentic API key and a momentic.config.yaml. Use the CLI version that created the snapshot: another version prints a warning and may replay it differently.
The command writes one zip per resolved test, named <testId>.snapshot.zip. Folders are expanded into the tests they contain, exactly like momentic run.

What a snapshot contains

Each zip holds two entries:
  • test.yaml: an encrypted resolved test, including metadata and the fully expanded before, main, and after steps with step caches inlined.
  • metadata.json: readable fields (momenticVersion, schemaVersion, createdAt, relativeFilePath, environment name, base URL, and the frozen project config: browser, ai, advanced, retries). Environment variable values and resolved environment data are stored in an encrypted field.
Snapshots can only be replayed by the organization that created them, to prevent accidental leakage of environment secrets.

Arguments

array
required
One or more test file paths or folders on the local machine to snapshot. Pass multiple values separated by spaces. Folders are expanded into every test they contain.

Common flags

string
Path to the Momentic configuration file. When omitted, Momentic searches the current directory and its parents for momentic.config.yaml or a workspace configuration. Use this flag to select a project when discovery finds more than one.
string
When using workspaces, load the project whose name matches the filter.
string
Directory to write the .snapshot.zip files to. Defaults to the current directory.
boolean
Skip all confirmation prompts. Enabled by default when CI is set.

Environment

string
Environment to resolve when capturing the snapshot. Overrides any environment configured on the test itself. The resolved variables are frozen into the snapshot.
string
Override the base URL resolved into the snapshot. Use it to capture a snapshot at a specific deployment.

Examples

Snapshot a single test into the current directory:
Snapshot every test in a folder, writing the zips elsewhere:
Snapshot a test resolved against a specific environment and deployment:
Then replay the produced zips. Replace the example IDs with the test IDs printed by snapshot; filenames use test IDs, not test names: