before, steps, and after arrays. They can interact with your product,
verify or extract state, choose or repeat a path, call a reusable module, or run
custom code.
Momentic supports exact, reviewable sequences and goal-driven execution in the
same test:
See File format for the top-level YAML structure.
Preset steps
A preset step performs one operation at a known point in the test. Use preset steps when the interaction or check should remain explicit. A preset step can still use AI. For example, Momentic can resolve a natural-language target, evaluate an assertion, or extract structured data with AI. The configured operation and its position in the sequence remain fixed. Other preset steps, such as navigating to a URL or waiting for a duration, are fully deterministic. Preset steps cover:- Interactions such as clicking, typing, tapping, swiping, and scrolling.
- Browser navigation, app lifecycle, device controls, and waits.
- Assertions, element checks, visual comparisons, and data extraction.
- Network requests, route mocking, browser state, and files.
- JavaScript and Appium integration for custom behavior.
- Web
- Mobile
Targets
Interactive preset steps identify the element they act on. Natural-language targets keep a step readable and let Momentic resolve the element from its text, appearance, accessibility attributes, and surrounding structure. Successful resolutions are cached for later runs. The target field depends on the operation. Common keys includeon, into,
from, and that; each preset step’s reference lists the fields it accepts.
- Web
- Mobile
Web preset steps accept natural language, CSS or XPath selectors, and
absolute coordinates.
Shorthand and detailed syntax
Use the shorthand form when a preset step only needs its primary value. Use the detailed form when it needs more options:- refresh on web or
- killApp on mobile. In the detailed form, place every option under the preset
step key. The shorthand form cannot have additional options.
Assertions and extraction
Useassert for a condition that requires AI evaluation, extract to read
structured data with AI, and checkElement<...> for a specific element state or
value.
AI actions
An AI action takes a natural-language goal instead of a fixed interaction. At runtime, the agent observes the current page or screen and executes the steps needed to reach that goal. Write the goal directly for the common case:act: when the action needs a precondition, postcondition, cache control,
or other options:
Control flow
Control-flow steps decide which nested steps run. Useif when a path depends
on current product state and while when the same work must repeat until a
condition changes or a limit is reached.
Conditionals
A conditional contains one condition and athen list. The condition can be an
inline assert, an element or screen check, or a javascript expression.
else branch. Use a separate conditional when another path is
required.
While loops
A while loop contains ado list and at least one loop control: a condition or
maxIterations. The condition is evaluated before each iteration.
env, so a value written with saveAs is
available to the next condition check. Use only maxIterations when the loop
should repeat a fixed number of times.
Module calls
A module call inserts a reusable sequence of preset steps and AI actions into a test. Reference the module relative to the file containing the call:{ string: ... } for a literal value and { javascript: ... } for a script.
See Modules for parameters, defaults, and caching.
Code integration
JavaScript and Appium are preset steps that extend Momentic when a built-in operation does not express the work. Use them for test data, APIs, databases, application state, or platform APIs. Keep user interactions in the built-in preset steps so they retain Momentic’s targeting, waiting, caching, and traces.- Web
- Mobile
Web JavaScript runs in a sandboxed Node environment by default. Set
environment: browser when the code needs window, document, or page
state.Shared syntax
Detailed preset steps and AI actions keep their options under the step key. Common options includeretries, skipped, comment, and saveAs. saveAs
writes a returned value to env.<NAME> for later steps.
Variables and templating
String fields can include{{ expression }} templates evaluated against the
test’s env map. JavaScript source reads values directly as env.NAME without
mustache syntax. See Variables for sources, scope,
and module parameters.