Skip to main content
Momentic tests are YAML files in your repository that run locally and in CI. Install the CLI and run your first test against your web app.

Setup with coding agent

Paste this prompt into Claude Code, Codex, Cursor, Copilot, or another coding agent running in your project directory. It finds your API key, installs the momentic CLI with the wizard, runs a sample test, and installs the Momentic skills and, where supported, the MCP server. It then asks for your app’s URL and first user flow, writes a test, and runs it. With an existing momentic.config.yaml, it skips the wizard and sample. In Claude Code with the Momentic plugin, it uses the plugin’s skills instead.
Setup prompt
You need Node.js 22.12 or later in the 22.x line, or 24 or later, and a Momentic account (see prerequisites). To set up by hand, use the wizard or the manual setup.

Prerequisites

All setup methods need:
  • Node.js 22.12.0 or later in the 22.x series, or 24.0.0 or later (node -v)
  • A package.json in your project. Run npm init -y if you do not have one. Commit it with the lockfile, so CI and local runs use the same Momentic version.
  • A Momentic account. Sign up to create one.

Set up with the wizard

Run the wizard in your terminal:
The wizard signs you in through the browser, installs momentic, and writes momentic.config.yaml plus a sample test under web/. The sample runs against Momentic’s own demo site: a passing run proves the install works. The wizard then installs Chromium, runs the sample test, and asks which coding agents to set up. After the sample passes, write and run a test against your app. The wizard has already completed the install, authentication, configuration, and browser steps in the manual setup.

Manual setup

1

Install

The examples below use npx. With pnpm, use pnpm exec momentic; with yarn, use yarn momentic.
2

Authenticate

On a machine with a browser, sign in:
The CLI saves the credentials to ~/.momentic/auth.json and uses them when MOMENTIC_API_KEY is not set.If browser sign-in cannot open, or in CI, set MOMENTIC_API_KEY instead. Create an API key in the dashboard and export it:
Check which account and organization the CLI uses:
3

Initialize

For noninteractive setup:
This writes momentic.config.yaml to your project root. In an interactive terminal, it also offers to install the coding agent skills and the MCP server. init --yes also installs skills and instruction pointers for detected agents (defaulting to Codex) and attempts local and hosted MCP setup for detected clients. Pass --skills codex to select skill targets. Review editor-config writes and skipped setup in the output. See init options.init does not create tests. You write your first one in the editor below. For a sample test, use the wizard above instead.
4

Install browsers

Momentic runs your tests in a headless browser. Install Chromium:
5

Write and run your first test

Open the local editor:
Create a test with your app’s URL as the base URL and fill in the required Description. Choose one flow with an observable outcome. Add an action followed by an assertion that checks the resulting page.If you have no app running, use https://practicetestautomation.com/practice-test-login/. Add the action Log in with username "student" and password "Password123", then the assertion The login success page is visible.Save the test. The editor writes the .test.yaml file to your project. Run it from the editor, then run the saved file from the CLI. Replace <test-file> with its path relative to your current directory:
A passing run prints each test, the totals, and the dashboard link:
--upload-results sends the result artifacts to the dashboard. Without it, those artifacts stay on your machine. See AI data use for the data sent to Momentic while a test runs.If the run fails, inspect its failed step and screenshot in the dashboard. Check the app URL, sign-in state, and assertion before editing, then rerun the test. See Common problems for setup errors.
6

Verify

  • Check that the .test.yaml file exists in your project.
  • Open the dashboard and check Runs for the result.
  • Confirm the run passed and inspect the screenshot at the assertion step to check that it matches the expected state.
7

Connect your coding agent (optional)

Check the installed skill files and both MCP connections even if init ran. The two commands are independent: skills are local instruction files. The local MCP server is a live process that gives the agent a browser and Momentic tools.In Claude Code, use either the Momentic plugin or these CLI commands. The plugin already provides the skills and MCP servers.For the Momentic plugin, select it on the Installed tab in /plugin and choose Configure to set the API key, or run npx momentic login to save a sign-in. For CLI setup, run npx momentic login or export MOMENTIC_API_KEY in the shell that launches Claude Code. Without a key or saved sign-in, local tools return sign-in instructions.For Claude Code:
For Codex:
Both CLIs install the shared momentic-test, momentic-maintain, and momentic-spec skills. Verify momentic-test/references/products/web/guide.md exists under .claude/skills/ for Claude Code or .agents/skills/ for Codex before loading the skill. If it is missing, upgrade the CLI and rerun the skill install.Codex loads .codex/config.toml only in trusted projects. If you trust this project, add this to your Codex user config (normally ~/.codex/config.toml), replacing the path with the absolute project root:
Restart Codex in the project and run codex mcp list to verify that momentic and momentic-hosted appear.In Claude Code, approve momentic and momentic-hosted in /mcp if they show “Pending approval”.After setup, restart your agent. Call momentic_get_artifacts on the local momentic server. Separately sign in to momentic-hosted with OAuth and call momentic_search_docs. Tools from one server do not verify the other.For other agents, pass their supported --client name. Use --target codex if there is no dedicated skill target. See Building with AI for supported clients.

Browsers

Momentic runs web tests on Chromium, Google Chrome, or Chrome for Testing. Firefox and Safari are not supported. Chromium is the default. To use another browser, install it, then set the project default in momentic.config.yaml:
momentic.config.yaml
To override the browser for one run, pass --browser chromium, chrome, or chrome-for-testing:
The flag overrides the per-test and project defaults. See browsers for the differences between the three.

Next steps

Find elements

Target buttons and fields by their visible labels

Building with AI

Skills, the MCP server, and a prompt for your coding agent

CI/CD

Run Momentic on every pull request

Goal-based testing

Choose actions and assertions for a user flow
Clone momentic-ai/examples for a full working example.