Cypress CI/CD Pipeline Configuration
Intermediatev1.0.0
Set up Cypress in CI/CD with GitHub Actions — parallel test execution, video recording, screenshot capture, and spec balancing for optimal build times.
Content
Overview
Running Cypress in CI ensures every PR is validated with E2E tests. A properly configured pipeline starts the application, runs tests in parallel, captures artifacts on failure, and keeps build times under 10 minutes.
How It Works
Step 1: GitHub Actions Workflow
Step 2: Cypress Configuration for CI
Step 3: Optimize with Spec Balancing
Best Practices
- -Use
wait-onto ensure the app is ready before tests start - -Enable
retries: 2in CI to handle infrastructure flakiness - -Upload screenshots on
failure()and videos onalways()conditions - -Use 3-4 parallel containers for suites with 50+ specs
- -Cache
node_modulesand Cypress binary between runs - -Set
video: falselocally,video: truein CI to save disk space
Common Mistakes
- -Not waiting for the application to start (
wait-onis essential) - -Running all tests sequentially (parallel cuts time by 60-75%)
- -Not uploading artifacts — makes CI failures impossible to debug
- -Setting timeout too low for CI environments (network is slower than local)
FAQ
Discussion
Loading comments...