Skip to main content
One Momentic test suite does three jobs. Run a subset on each pull request, the full suite on every merge, and the critical flows around each deploy. The tests are the same. The trigger, the target URL, and the size of the run differ. Every job is one momentic run command in CI. The examples below use GitHub Actions. See GitLab CI or custom setups for other providers. Each job needs MOMENTIC_API_KEY as a secret; see GitHub Actions for how to create it. A failed run exits non-zero, so CI blocks the merge or the release. Quarantined tests are the exception and do not affect the exit code by default.

Pull request check

Run the tests against the pull request’s preview deployment, so the change runs in a real browser before review. This job starts when Vercel (or any provider that posts a GitHub deployment) marks the preview as ready. It runs only the tests that AI test selection picks from the diff:
.github/workflows/pr-tests.yml
What each part does:
  • deployment_status fires when the provider reports a deployment. The if guard runs the job only for a ready deployment, and environment_url is the preview URL.
  • fetch-depth: 0 gives --ai-select the full history to diff against origin/main. The deployment_status event carries no pull request base, so --ai-select-base sets it. On a pull_request event you can omit it. See AI test selection.
  • --url-override points every test at the preview URL. It also replaces a test’s own url.
  • The two --custom-headers values pass Vercel’s protection bypass. Skip them if the preview is public. See Vercel preview auth.
  • --reporter steps prints one line per step to the CI log. --reporter junit writes a JUnit XML file to reports/ for your CI’s test summary. See JUnit outputs.
Make the job a required status check on the branch so a failing run blocks the merge. Decide how the check treats flaky tests: quarantined tests run but do not fail the check by default. Pass --skip-quarantined to skip them, or --ignore-quarantine to count every status. See quarantine.

Add tests in the same pull request

The existing suite only catches regressions in flows it already covers. To cover what the pull request changes, ask your coding agent with the momentic-spec skill:
The agent writes .test.yaml files into your working tree, so the new tests land in the same review as the change and run in the same CI job.

Regression pass

Run the whole test suite on every merge to main and on a nightly schedule. This job shards the suite across four runners and merges the results into one run group in the dashboard:
.github/workflows/regression.yml
  • --env staging selects the staging environment from momentic.config.yaml, so the same tests run against its baseUrl and credentials. See environments.
  • Each shard writes to its own --output-dir. The upload job merges them so the dashboard shows one run group instead of four. See GitHub Actions.
Cover flows in order of the damage a regression causes, not in order of how hard they are to automate:
  • Revenue and retention paths first: sign-up, checkout, the primary action your product exists to do.
  • Flows that have regressed before.
  • Flows that exercise shared code that other features depend on.
The suite is useful only if the team trusts a failure:
  • Auto-heal repairs a test mid-run when the UI changed, so a moved or renamed element does not fail a test that still works.
  • Quarantine flaky tests instead of disabling them. They still run, so you keep the signal while you fix the test.
  • Reuse shared setup such as login with modules so one change updates every test that depends on it.
  • Read the trace and screenshots for a failure in results. Give each flow an owner, so the person who triages a failure knows the flow.
If your core flows still change every week, start with the deploy gate below and grow coverage as flows settle.

Deploy gate

Run a small set of critical flows against the new production deployment, and roll back if a flow fails. Tag the flows with a smoke label:
tests/checkout.test.yaml
Run the labeled tests after the production deploy, and roll back when the run fails:
.github/workflows/deploy.yml
  • --labels smoke runs only tests that carry the label. A path (npx momentic run tests/smoke) or --include and --exclude also work. The include and exclude globs in momentic.config.yaml control discovery, not one run.
  • --retries 1 reruns a failed test once before the job fails, so one transient network error does not trigger a rollback.
  • Run the same job before the deploy against staging with --url-override "$STAGING_URL" if you want a gate in front of the release too.
Keep the set small so it finishes in minutes and does not grow into a second regression suite:
  • Flows whose failure is an incident: login, checkout, the primary create or submit action.
  • One happy path per flow. Leave edge cases to the regression pass.
  • End-to-end paths, so one test runs against the real stack.
For a flow whose steps differ by environment or feature flag, use an AI action with a goal and a postcondition instead of a fixed list of clicks:
tests/signup.test.yaml
See agentic testing for when to use an AI action.

GitHub Actions

Authentication, sharding, and result upload in detail.

AI test selection

Pick the tests to run from a git diff.

Quarantine

Isolate unstable tests without blocking the rest of the suite.

Environments

Point the same tests at staging or production.