Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk6 min

Cypress CLI and Test Runner: How to Use Them

Use Cypress open mode for interactive test authoring and debugging, then run specs reliably with the CLI in local development or CI.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use npx cypress open to author and debug tests in Cypress’s interactive app; use npx cypress run to run tests to completion, usually headlessly, including in CI. They are complementary workflows: develop and inspect tests with open, then use run for repeatable execution.

Install Cypress and open the Test Runner

Install Cypress as a development dependency with the package manager already used by your project. From the project root, run the matching command:

  • npm install cypress --save-dev
  • yarn add cypress --dev
  • pnpm add --save-dev cypress
  • bun add --dev cypress

Then launch the interactive app:

npx cypress open

Use yarn cypress open, pnpm exec cypress open, or bunx cypress open with those package managers. On first launch, Cypress’s Launchpad guides you through choosing a testing type, creating the configuration and folder structure, and selecting a browser. In open mode, the Test Runner runs specs, displays test activity in the Command Log, and reruns tests when you save changes, so you can inspect the application and step through test behavior. Cypress describes it as the place to run and debug specs in open mode (official open-mode guide).

Make the binary available

The npm package and Cypress application binary are separate parts of setup. Binary installation normally runs as a package-installation postinstall step. If lifecycle scripts are disabled, the binary download was skipped, or your CI cache strategy installs it separately, run the install command for your package manager, such as npx cypress install. See the advanced installation guide for binary installation and cache controls.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose open or run for the job

Workflow Command Best for Browser display
Interactive npx cypress open Authoring, debugging, and inspecting test behavior Opens the Cypress app and selected browser
Automated npx cypress run Repeatable local runs and CI Headless by default; add --headed to show the browser

The CLI’s command reference covers run options. Open mode is the interactive workflow, not a substitute for repeatable CI execution; run is the completion-oriented command, not the interactive debugging interface.

Run tests from the CLI

Run all specs matched by the project configuration with:

npx cypress run

Choose a testing type, browser, or spec as needed:

# Run end-to-end tests in the default browser, headlessly
npx cypress run --e2e

# Run component tests and show the browser
npx cypress run --component --headed

# Run one spec
npx cypress run --spec "cypress/e2e/login.cy.js"

# Run matching specs using a glob
npx cypress run --spec "cypress/e2e/**/*.cy.js"

# Select a detected browser
npx cypress run --browser chrome

Use the testing type actually configured in your project. Cypress only runs a spec if its path also matches the configured specPattern; a valid file path excluded by that pattern will not be found. Browser availability and compatibility can change, so consult Cypress’s current browser guidance when a specific browser matters. The CLI can select detected browsers and accepts a browser path where needed.

Useful run options

  • --headed displays the browser during cypress run; without it, the run is headless by default.
  • --spec limits execution to a file or glob that must match specPattern.
  • --browser selects a detected browser or a browser executable path.
  • --e2e and --component select the testing type.
  • --config-file selects a different project configuration file; --config overrides configuration values for this invocation.
  • --reporter selects a Mocha reporter, and --reporter-options configures it, for example for JUnit output.
  • --env supplies test environment values. Do not pass sensitive values where they may appear in shell history or CI logs.
  • --record, --group, --tag, and --parallel support recording and organizing runs with Cypress Cloud. Parallelization distributes recorded specs across multiple machines.

Set up project scripts and configuration

Scripts give teammates consistent commands without requiring them to remember flags. For example, add scripts to package.json:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
{
  "scripts": {
    "cy:open": "cypress open",
    "cy:run": "cypress run"
  }
}

Then run npm run cy:open or npm run cy:run. Avoid naming a script simply cypress: Yarn can resolve that script instead of the Cypress binary. Equivalent script execution varies by package manager.

Keep shared settings in the Cypress project configuration file. For a one-off change, use --config; use --config-file when the job needs a different configuration file. CYPRESS_-prefixed environment variables can override configuration for a particular environment. CLI configuration overrides values in the project file. The configuration reference describes configuration values and precedence.

For CI-specific values such as a base URL, reporter, or viewport, provide environment-specific configuration rather than modifying shared settings at runtime. Store record keys and other secrets in your CI provider’s secret manager: command-line secrets can appear in logs. See Cypress’s CI guide.

Run Cypress reliably in CI

A CI job typically installs Cypress, starts the application, waits until it is ready, and then runs cypress run. The readiness wait matters: launching the test command immediately after starting a background server creates a race in which Cypress may start before the application can respond.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Install project dependencies and ensure the Cypress binary is available, including a separate cypress install step if your install or cache setup skipped it.
  2. Start the application using the CI workflow’s supported server command.
  3. Wait for the application URL to respond with a readiness-waiting tool. In the official GitHub Action, use its documented start and wait-on options.
  4. Run the configured tests with cypress run, adding the browser, reporter, or other options your job requires.

For a basic local CI-style sequence, the key is the wait between server startup and the test command; use your CI provider’s syntax and a readiness tool rather than assuming the background process is ready. The official CI overview explains the supported patterns.

Containers: headless and interactive are different

Headless cypress run can work in a container when the image contains Cypress’s required Linux prerequisites; official Cypress Docker images include them. Interactive cypress open needs a graphical display, which a container does not provide by default. If you need open mode in a container, arrange a display environment rather than treating it like a headless run. Refer to the advanced installation guide for container and system requirements.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common failures

  • The Cypress binary is missing. The package may be present while its application binary was not downloaded. Run the package-manager form of cypress install, and check whether lifecycle scripts were blocked or the cache strategy expects a separate install step.
  • No spec files were found. Check the spelling and quoting of the --spec path, then confirm the file matches the configured specPattern.
  • The browser option fails. Confirm the browser is installed and detectable, or provide its executable path. Check Cypress’s current browser support guidance for version-sensitive compatibility.
  • Tests fail because the application is unavailable. Ensure the server process starts successfully and that CI waits for its URL to respond before running Cypress.
  • cypress open cannot start in a container. Open mode requires a graphical display; use a display-capable environment or use headless cypress run where interactive inspection is not needed.
  • A config value appears to be ignored. Check whether an invocation-time --config setting or a CYPRESS_-prefixed environment variable overrides the project configuration.
  • A secret appears in logs. Remove it from command-line arguments and use the CI provider’s secret-management mechanism instead.

Or skip the browser setup

For capturing a webpage screenshot rather than running Cypress tests, ScreenshotNeo is a one-request screenshot API and MCP server. Its API accepts a URL and returns an image or PDF. Here is a complete cURL example; see the ScreenshotNeo documentation for API options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing status. Its MCP server includes tools for AI agents to take screenshots, get page information, and capture PDFs. The free plan includes 1,000 shots per month with no card required; paid plans start at $5 for 3,000 shots.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.