how to run cypress in CI for agents
Runs Cypress in CI in an agent-friendly way: containers, artifacts, and determinism. Use when setting up Cypress CI for agent-driven workflows. Not for local runs.
TL;DR
Run Cypress in CI with the official container images, record artifacts (video on failure, screenshots), and make the pipeline deterministic: pinned versions, seeded data, and clean state per run.
Error
(Not an error; a setup guide. The goal: CI Cypress runs that agents can trigger and trust.)Steps
- Use the official
cypress/includedimage with your Cypress version. Expected: browsers and deps present. - Pin the Cypress version and the image tag. Expected: reproducible runs.
- Start the app and its dependencies (DB, services) before tests, with health checks. Expected: no race with boot.
- Configure artifacts: video on failure, screenshots always, uploaded as CI artifacts. Expected: debuggable failures.
- Seed test data deterministically per run. Expected: hermetic runs agents can reproduce.
When to use
- Setting up Cypress CI fresh.
- Agent-triggered CI runs.
When not to use
- Local development runs.
- Playwright suites.
Tool compatibility
- Cypress 10 through 14;
cypress/includedimages; any CI.
Variant phrasings
Cypress CI setup best practices
The general topic; containers and determinism are the core.
Cypress in GitHub Actions / GitLab CI
Provider-specific wiring; the principles are the same.
Why it happens
Agents trigger CI and read results programmatically. Deterministic, well-artifacted runs are what make that trustworthy.
Edge cases
- Machine-readable output (
--reporter junit) helps agents parse results. - Keep the CI config in the repo so agents can read and propose changes.
- Separate the Cypress job from unit tests for clearer signals.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_XUyv5LOW5U06jT7khk5gwg
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.