Skip to main content
Preview deploys exist so you can exercise a change before merge. This recipe waits for the provider’s deployment status, overrides the tests’ base URL at the preview, and reports back as a PR check.

The tests

tests/smoke/signup.test.yaml
Smoke tests have no hardcoded url: --url-override points them at whichever deployment fired the event.

The workflow

The job installs momentic from devDependencies, so your lockfile pins the CLI version. Add it once with npm install -D momentic.
.github/workflows/preview-smoke.yml
  • deployment_status fires for Vercel and any provider that posts a GitHub deployment. environment_url is the preview URL. For providers that do not post deployments, poll for the URL first: see the Next.js on Vercel guide for the wait-for-preview variant.
  • deployment.environment != 'Production' keeps staging and production deployments from re-running the preview suite. Match the environment names your provider posts (Vercel uses Preview and Production).
  • --url-override replaces each test’s url and each environment’s baseUrl.
  • Drop the --custom-headers pair when the preview is public. For protection-bypass details, see Vercel preview auth.

Decisions

  • Labels vs selection. --labels smoke is a fixed list; --ai-select picks tests from the diff. Use the label for a fast universal gate, selection when the suite is large, or both.
  • What belongs in smoke. A handful of end-to-end happy paths that finish in minutes. If the preview job takes longer than a reviewer waits, it is doing regression work. Move those tests to the nightly suite.
  • Failure is not rollback. A preview failure blocks a merge; it does not roll anything back. For post-deploy rollback gating, see the deploy-gate workflow in Common CI setups.