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 Preview deployment. Match the environment name your provider posts; environment_url is its target 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. To gate every pull request on a fixed set instead of the diff, label the flows you would roll back for, such as sign-in and checkout, with critical. Then replace --ai-select --ai-select-base origin/main with --labels critical. Keep the label under about ten tests and leave edge cases to the regression pass.

Add tests in the same pull request

Ask your coding agent to cover the changed journeys with the momentic-spec skill:
The new .test.yaml files land in the same pull request and CI job.

Review test changes in the pull request

Review the YAML and run evidence using Build with AI. The pull request check uploads results. The GitHub integration posts a status comment with a link to each run. Open the run in results to review its screenshots and trace. Keep credentials in environment variables, not literal test values. To rerun changed tests locally before approving:
See momentic list --changed and momentic lint for selection and validation details.

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.
  • Add npx momentic ai triage test-results/merged --yes --timeout-minutes 10 after the upload to classify failures on the merged run group and let auto-heal attempt repairs. By default, repairs arrive in a pull request; review and merge it before the next run.
For locator healing, failure recovery, permanent healing, and quarantine, see AI test maintenance. For coverage priorities and flow ownership, see regression coverage guidance. 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. Use test accounts and a payment integration in test mode for the checkout below. 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 flows that differ by environment or feature flag, see AI actions for variable flows.

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.