async/await is
supported. Return values are passed to downstream steps and must be
JSON-serializable.
Execution contexts
Browser steps don’t have access to the Node sandbox globals.
Timeout
JavaScript steps default to a 90-second timeout. Configure per step via the Timeout field, or in YAML (value is in seconds):email.fetchLatest or sms.fetchLatest polls for
longer than the JavaScript step’s own timeout, the step times out before the
helper returns. Set the step’s Timeout to comfortably cover the longest
nested poll.
{{ }} templating
Any string input on any step can contain {{ expression }}. Expressions
evaluate at runtime and are interpolated into the value.
Momentic utilities
The Momentic runtime provides these globals.env
env is a read-only map of the current environment’s variables. See
Variables for how variables are resolved.
setVariable(name, value)
setVariable writes a variable scoped to the current test run. Downstream steps
can read it via {{ name }} in any string input, or via env.name inside
JavaScript.
email
email sends and fetches email. See Email for inbox
setup.
sms
sms sends and fetches SMS. See SMS for number setup.
extractCookiesFromResponse(response)
extractCookiesFromResponse converts a fetch / axios response’s
Set-Cookie headers into cookie objects for a browser context. Use it to
bootstrap an authenticated session.
mock
mock is only available in mock handler steps on mocked routes. It exposes
the intercepted Request and the upstream Response.
Libraries
axios
axios is an HTTP client. See axios docs.
assert
assert provides Node’s built-in assertions. See
Node docs.
faker
faker generates realistic fake data. See
Faker docs.
moment
moment parses and formats dates. See
Moment docs.
pg
pg is a Postgres client. See node-postgres docs.
OTPAuth
OTPAuth generates time-based one-time password (TOTP) codes for two-factor
authentication (2FA) tests. See
otpauth docs.
child_process
child_process spawns subprocesses. See
Node docs.
Octokit + createAppAuth
Octokit with createAppAuth provides authenticated GitHub API access. See
Octokit docs and
auth-app docs.