Cypress · Browser testing end to end

How do headless Cypress runs work?

Easyheadlesscypress runciUpdated Oct 2026
Quiz this track

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.

bash
npx cypress run
npx cypress run --browser chrome
npx cypress run --spec "cypress/e2e/checkout.cy.ts"
npx cypress run --config video=true
The browser, spec selection and per-run config can be set from the command line.

What 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.

Do not confuse headless with parallel. A single cypress run executes one machine's worth of specs. Parallel execution requires a service or a splitting strategy.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1What exit code does a failed headless run produce?
  2. 2How do you run only one spec file?
  3. 3Is a headless browser a different browser engine?
  4. 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.