Momentic tests and modules are YAML files. The on-disk format favors readable, human-editable shapes: single-key command aliases, natural-language targets, and no volatile IDs.Documentation Index
Fetch the complete documentation index at: https://momentic.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
This is the current web format. Mobile tests still use the previous verbose
shape; existing mobile tests keep working without changes.
File shapes
A test is YAML with afileType, a readable kebab-case id, an optional url,
and a list of steps:
checkout.test.yaml
fileType: momentic/module/v2 and a
human-readable name. Both tests and modules use the same id key for their
stable identifier.
log-in.module.yaml
{ name, default?, enum? }. default is a value
object ({ string } or { javascript }) used when an invocation does not
supply an input for the parameter. The legacy form — an array of bare parameter
names paired with defaultParameters / parameterEnums — is still accepted
for backward compatibility.
Before and after sections
Alongsidesteps, a test can declare optional before and after sections.
They are sibling top-level keys with the same step shape as steps. In the
editor these are the Setup (before) and Teardown (after) sections.
checkout.test.yaml
beforeruns first, thensteps, thenafter.- If a
beforestep fails, the main steps are skipped and the test is marked as a setup failure. afterruns after the main steps regardless of whether they passed, which makes it the right place for teardown (resetting state, deleting test data).
before for prerequisites the main steps assume - most commonly
authentication.
Step shapes
Every step is one of:-
A bare command alias for commands that take no options:
- refresh,- goBack,- goForward,- paste,- offline,- online,- authSave,- blur. -
A simplified single-key scalar:
- click: Submit. The string is the natural-language description of the target. -
A detailed single-key object when the command needs more than a description:
-
An AI action:
- act: <goal>, or a detailed form withgoalandversion. -
A module invocation:
- module: <relative path or id>, or a detailed form withpathandinputs. -
A conditional with one
ifkey. The condition is a single inline command alongsidethen:
retries, skipped, comment, and saveAs
can be set on any step. saveAs stores the step’s result on env.<NAME> for
later steps to read.
Targets
Target-bearing commands accept either a natural-language description, a CSS selector, or absolute coordinates. The description key varies by command:| Command | Description key |
|---|---|
click, doubleClick, rightClick, hover, focus, blur | on |
visualDiff, mouseDrag | on / from |
assert, assertVisually | that |
type | into |
select | from |
scrollUp, scrollDown, scrollLeft, scrollRight | in |
dragAndDrop | from, to |
fileUpload | path |
navigate, newTab | url |
checkElement... aliases | element |
css. Coordinate targeting uses coords for numeric pairs,
or split x / y when either coordinate needs templating:
Command aliases
Common command aliases:| Category | Aliases |
|---|---|
| Interact | click, doubleClick, rightClick, type, select, hover, focus, blur |
| Drag | dragAndDrop, mouseDrag |
| Scroll | scrollUp, scrollDown, scrollLeft, scrollRight |
| Keyboard | press, keyDown, keyUp, copy, paste |
| Navigation | navigate, newTab, switchTab, closeTab, goBack, goForward, refresh |
| Waits | wait, waitForUrl, waitForUrlNotToMatch |
| AI | act, assert, assertVisually, extract |
| Page assertions | checkPageContains, checkPageDoesNotContain |
| Element checks | checkElement<...> family. See Element checks below. |
| Network | header, mock, removeRouteMock, request, graphqlRequest, registerRequestListener, awaitListener, recordRequests, getRecordedRequests |
| Storage | cookie, localStorage |
| Files / auth | fileUpload, javascript, authLoad, authSave |
| Misc | dialog, captcha, offline, online, visualDiff |
doubleClick: Submit is shorthand for click: { on: Submit, times: 2 }, and
rightClick: Submit is shorthand for click: { on: Submit, rightClick: true }.
AI actions and assertions
assert fails the test by default. extract fails the step when the extracted
payload does not conform to the schema, and stores the result on env.<saveAs>
when saveAs is set.
See Agentic testing,
Writing assertions, and
Variables for usage patterns.
Element checks
checkElement<...> aliases are deterministic assertions against a single
element. They take an element natural-language target (or css / coords /
x+y) and, where relevant, a name and value.
- Subjects:
Element(existence-style:Exists,Visible,Enabled,Editable,Focused),ElementContent,ElementAttribute,ElementName,ElementStyle(content-style:Contains,Equals,StartsWith). - Each positive condition has a paired negation, e.g.
DoesNotExist,NotVisible,DoesNotContain,DoesNotEqual,DoesNotStartWith.
Modules
Module invocations reference a module file with a path relative to the file that contains the invocation:inputs is one of:
- A shorthand string - evaluated as a JavaScript expression. Use this to
reference env vars (
env.PARAM) or call helpers. It is not mustache templating. { string: ... }- a literal string.{ javascript: ... }- the script’s return value is bound to the parameter. Equivalent to the shorthand but supports multi-line scripts.
File references
Relative file references resolve from the YAML file containing the step, not from the project root and not from the test file when the step is inside a module.Variables and templating
Any string field can include{{ expression }} templating, evaluated at runtime
against the test’s env map. Use saveAs on any step to write its result to
env.<NAME> for later steps. See Variables for
setting and reading values across steps.