Momentic improves test performance by caching element data. Most steps run in milliseconds by avoiding repeated AI lookups, while still maintaining accuracy.

How caching works

Caching is automatically applied to most interactive steps such as Click and Type. When these steps are executed, Momentic stores contextual information about the targeted element, including:

  • CSS selectors and HTML attributes.
  • Accessibility roles and metadata.
  • Screenshots and visual cues.
  • Element location and dimensions.

This allows Momentic to reuse known element data across test runs instead of re-identifying it every time.

Momentic will bust the existing cache if the target element changes significantly or if the templated description is different than what was cached.

Caches are only ever saved on successful test runs. Additionally, the test run must be eligible for cache saving (see below).

Cache saving eligibility

A test run is always eligible if the --save-cache flag is passed.
  • If the test is running in a CI environment, the test is eligible for cache saving. This is defined by the environment variable CI being set to true.
  • If the test is not running in a CI environment, caches are saved when running on a branch not configured as a main branch or protected branch. These branches are specified in the project configuration.

Where caching is never applied

  • Steps like AI check or AI extract which rely on dynamic evaluation.
  • Steps with variables that have continuously changing values (e.g. CLICK the {{ Date.now() }} timer).

Disabling cache

Disabling cache may drastically increase test duration and non-determinism.

You can disable caching globally by passing the --disable-cache flag when running tests:

momentic run --disable-cache

You can disable caching on a per-step basis in the step options. This is useful when the target element is dynamic and changes between test runs (e.g., “last item in list”)

How cache keys are generated

Cache keys are based on:

  • The step’s unique ID.
  • IDs of any parent modules.
  • The resolved element description.
  • Dynamic template values (e.g., {{ env.USERNAME }}).

If any of these inputs change, the cache is invalidated and regenerated.

Storage and expiration

Cache data is:

  • Securely stored on Momentic Cloud.
  • Isolated per organization and only accessible during authenticated test runs.
  • Automatically expired after 90 days of inactivity.

Failed steps and caching

Cache is only created when a step successfully executes. Failed steps do not generate or store cache entries.