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
deployment_statusfires when the provider reports a deployment. Theifguard runs the job only for a ready deployment, andenvironment_urlis the preview URL.fetch-depth: 0gives--ai-selectthe full history to diff againstorigin/main. Thedeployment_statusevent carries no pull request base, so--ai-select-basesets it. On apull_requestevent you can omit it. See AI test selection.--url-overridepoints every test at the preview URL. It also replaces a test’s ownurl.- The two
--custom-headersvalues pass Vercel’s protection bypass. Skip them if the preview is public. See Vercel preview auth. --reporter stepsprints one line per step to the CI log.--reporter junitwrites a JUnit XML file toreports/for your CI’s test summary. See JUnit outputs.
--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 themomentic-spec skill:
.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 tomain 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 stagingselects thestagingenvironment frommomentic.config.yaml, so the same tests run against itsbaseUrland credentials. See environments.- Each shard writes to its own
--output-dir. Theuploadjob merges them so the dashboard shows one run group instead of four. See GitHub Actions.
- 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.
- 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.
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 asmoke label:
tests/checkout.test.yaml
.github/workflows/deploy.yml
--labels smokeruns only tests that carry the label. A path (npx momentic run tests/smoke) or--includeand--excludealso work. Theincludeandexcludeglobs inmomentic.config.yamlcontrol discovery, not one run.--retries 1reruns 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.
- 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.
tests/signup.test.yaml
Related
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.