Skip to main content
PR testing runs your Momentic tests on every pull request, so a change runs against a real browser or emulator before anyone approves it. Reach for it to catch behavior that reading the diff cannot show: a broken flow, a missing state, a regression in code the diff did not touch. Run the tests against the PR’s preview deployment and emit a JUnit report for your CI:
npx momentic run --url-override "$PREVIEW_URL" --reporter junit

When to use it

  • You review code by reading diffs and want a runtime signal next to them.
  • You want failures attributed to the change that introduced them, while the author still has context, instead of discovering them days later on main.
  • You want new code to arrive with coverage instead of relying on someone remembering to add a test.
This is most valuable once you have per-branch preview deployments. Without one, you can still run against a shared staging environment, but a failure is harder to attribute to a single PR.

Where it fits in review

  • Run the tests as a required check on the pull request branch so a failing run blocks the merge, the same way unit tests or linting do.
  • Run against the branch’s preview deployment so you exercise the code in the PR, not production. For protected previews, see Vercel preview auth.
  • A passing run is evidence the change works; a failing run is a reproduction with a trace you can open, not just a comment thread.

Cover what the PR changed

A static test suite only catches regressions in flows you already test. Use the explore agent to read the diff, find the user journeys it changed, and draft tests for the ones you do not cover yet.
# In CI, base and head default to the pull request
npx momentic ai explore
Run with --build to have it open the drafted tests as a pull request you review before they merge.

Get started

1

Add Momentic to CI

Run the tests in your CI pipeline on pull requests. Store your MOMENTIC_API_KEY as a CI secret. See GitHub Actions, GitLab CI, or custom setups.
2

Point tests at the PR's preview

Set the base URL to the branch’s preview deployment so each run tests the proposed change, not production.
3

Cover new journeys

Run momentic ai explore against the diff to find changed journeys, and add tests for the ones not yet covered.

Keep PR feedback fast and trustworthy

  • Shard large test suites across CI jobs with --shard-count and --shard-index so a PR is not blocked waiting on a serial run.
  • Decide a flake policy up front. Quarantined tests run but do not fail the PR by default; pass --skip-quarantined to skip them, or --ignore-quarantine to make every status count. See quarantine.
  • The base URL set on a test takes precedence over --url-override; leave it unset on tests you want to retarget per environment.

Explore agent

Find the journeys a diff changed and author tests for them.

GitHub Actions

Run Momentic on pull requests, with sharding and secrets.

Regression testing

Protect existing flows across every change.

Vercel preview auth

Test against protected preview deployments.