authSave / authLoad state file, and
only move to a cached auth module when you need it.
1. Live login (recommended default)
Wrap your login steps in a module and call it from thebefore section of each
test. It performs the login on every run, so each test starts with newly
captured authentication state.
log-in.module.yaml
checkout.test.yaml
2. Save and restore a state file (authSave / authLoad)
The authSave and authLoad steps (the editor’s Save auth state / Load
auth state) write and read the browser’s cookies, localStorage, and
IndexedDB to a JSON file you manage yourself. This is the closest analog to
Playwright’s storageState, so it is the
natural next step if you are migrating from Playwright: log in once, save the
state, and load it instead of logging in again.
checkout.test.yaml
3. Cached auth module
When you want the speed-up without managing a file, let Momentic cache the session for you. Mark the login module as an auth module and enable caching: the first run logs in for real, and later runs (and parallel tests sharing the same cache key) restore the saved browser state server-side and skip the login steps entirely.log-in.module.yaml
before section exactly like the live-login module. Momentic
handles capture, storage, expiry, and per-key isolation. Tests sharing a cache
key can reuse the saved session while it remains valid. See
Cache authenticated sessions
for the full walkthrough and
Modules for every cache field.
Options and trade-offs
In CI
Live login works in CI with no extra setup; provide credentials as secrets (env.USERNAME, env.PASSWORD,
OTP secrets) rather than committed values. If logging in every run is too slow,
add an authSave / authLoad state file or a cached auth module; the module’s
session is stored server-side alongside the
step cache, so once one run logs in, other runs and
shards can reuse it within the TTL.
SSO, 2FA, and provisioned inboxes
For one-time codes and magic links, fetch the code in a JavaScript step and save it to the environment:Vercel deployment protection
For Vercel previews behind deployment protection, send a bypass secret in headers or query parameters. See Test Vercel protected preview environments.IP allowlist
If your test environment restricts inbound traffic by IP, allowlist Momentic’s fixed egress IP for hosted runs:34.106.239.183. On Azure-hosted deployments,
allowlist both 52.177.232.247 and 20.14.51.42.