Skip to main content
Use your coding agent to set up Momentic for a web app and run your first test. You can also use the wizard or follow the manual setup below.

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.

Setup with coding agent

Open Claude Code, Cursor, Codex, Copilot, or another coding agent in your project directory and paste the prompt below. It uses the wizard’s noninteractive API-key setup, then writes your first test.

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

Sign in with your browser:
The CLI saves the credentials to ~/.momentic/auth.json and uses them when MOMENTIC_API_KEY is not set.In CI, or in a shell without a browser, use an API key instead. Create one in the dashboard and export it:
Check which account and organization the CLI uses:
3

Initialize

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 accepts the defaults without prompts, so it works in agent shells and CI.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. 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)

Skip this step if init already did it. The two commands are independent: skills are local instruction files. The MCP server is a live process that gives the agent a browser and Momentic tools.
Both commands detect the coding agents on your machine and ask which ones to configure. Pass --yes to skip the prompt. See Building with AI for what each command does.

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.