Cypress · Browser testing end to end
How do headless Cypress runs work?
Short answer
cypress run executes specs without the interactive runner, usually in a headless browser. It is the standard CI mode and supports browser selection, spec filtering and machine-readable reporters.
A headless run is the non-interactive execution path. Cypress starts the browser, runs the selected specs, records results and exits with a status code. There is no command log UI, so screenshots, videos and reporter output become the diagnostic record.
npx cypress run
npx cypress run --browser chrome
npx cypress run --spec "cypress/e2e/checkout.cy.ts"
npx cypress run --config video=trueWhat to expect in CI
- The process exits non-zero when a test fails, which fails the CI job
- Screenshots are written on failure when screenshotOnRunFailure is enabled
- Video can be enabled for run mode at a cost in time and storage
- The default reporter prints a summary that CI logs can capture
- A headless browser still needs the app server running and baseUrl reachable
Headless does not mean a different engine. If you pass a browser flag, Cypress still uses that browser; it simply runs without the visible window. That is why a headless failure can often be reproduced in open mode with the same browser and viewport.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1What exit code does a failed headless run produce?
- 2How do you run only one spec file?
- 3Is a headless browser a different browser engine?
- 4What artifacts should CI keep from a headless run?
Say it in the interview
cypress run is the headless execution path. It runs the selected specs, exits with a status code and leaves screenshots, videos and reporter output as the record. I use it on CI with the app server running and baseUrl reachable. Headless is not a different engine, just a browser without the interactive runner, so failures are usually reproducible in open mode.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Cypress mock interview and get scored feedback on depth, clarity and confidence.