October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

How to Run Cypress Tests with Jenkins

A practical Jenkins setup for Cypress: prepare a consistent agent, install dependencies, wait for the application, run tests, and add parallel workers when ready.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run Cypress in Jenkins by checking out your application, installing its locked dependencies, starting the app, waiting until it is ready, and then running npx cypress run. Begin with one Jenkins agent and a serial run; once that works reliably, you can add browser coverage or Cypress Cloud parallelization.

What the Jenkins pipeline needs to do

Cypress lists Jenkins as a supported continuous-integration provider. For a Node.js project, the core commands are typically npm ci to install the lockfile dependencies and npx cypress run to execute tests in headless mode. The pipeline around those commands depends on how your Jenkins installation checks out code and provisions agents, so treat the example below as a structure to adapt rather than a universal Jenkins configuration. Cypress Documentation: Continuous Integration

As an Amazon Associate I earn from qualifying purchases.

  1. Check out the application repository in the Jenkins workspace.
  2. Install dependencies from the committed lockfile.
  3. Start the application under test.
  4. Wait until a health endpoint or other readiness check succeeds.
  5. Run Cypress and retain the reports or other artifacts your team needs.

Prepare a suitable Jenkins agent

Use a consistent runtime

Cypress can run on many CI virtual machines without extra dependencies, but Linux agents may lack required system libraries or an X11 server. If Cypress cannot launch, inspect the startup error and compare the agent with Cypress’s current Linux prerequisites. Cypress documents Xvfb behavior and platform-specific packages in its CI overview and installation documentation.

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

A Cypress Docker image can make the environment more predictable. The image families have different purposes: cypress/base provides a Linux base and Cypress prerequisites; cypress/browsers adds browsers; cypress/included includes a fixed Cypress version; and cypress/factory supports customized combinations. Check current tags and platform/browser availability, then pin the tag you intend to use. Keep it consistent across agents so differences in Node, Cypress, or browser versions do not make parallel workers behave differently. Cypress notes that its images can shield builds from environment changes made by CI providers. Cypress CI overview

Cache the right directories

For repeat builds, Cypress recommends caching its global binary cache (typically ~/.cache on Linux) and the package manager’s cache, such as ~/.npm for npm. Avoid sharing node_modules between builds: restoring it across environments can leave stale or inconsistent dependencies. Cypress CI overview

Build a serial Jenkins pipeline

This illustrative Declarative Pipeline assumes Jenkins has already been configured to allocate an agent with Node.js, check out the repository, and make the required shell tools available. Replace the sample URL, health path, and start command with values for your application. Adapt checkout and agent configuration to your Jenkins setup; no single plugin configuration is universal.

pipeline {
  agent any

  stages {
    stage('Install dependencies') {
      steps {
        sh 'npm ci'
      }
    }

    stage('Start application') {
      steps {
        sh 'npm start &'
      }
    }

    stage('Wait for application') {
      steps {
        sh 'npx wait-on http://127.0.0.1:3000/health'
      }
    }

    stage('Run Cypress') {
      steps {
        sh 'npx cypress run'
      }
    }
  }
}

The example uses wait-on as a readiness-check command; make it available to the project or agent before relying on it. Use an endpoint that responds only when the application is actually ready to serve tests. Cypress warns that starting the app in the background and immediately running Cypress is race-prone; waiting for a response is preferable to inserting an arbitrary sleep. Cypress CI overview

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

Depending on your Jenkins setup, you may need to add repository checkout, credentials, agent selection, cleanup, and artifact archiving. Cypress’s documentation does not establish a required Jenkins plugin or a universal credentials-binding configuration, so use the conventions and security controls documented for your installation rather than copying an assumed setup.

Choose a browser deliberately

If the default browser is not the one you intend to test, install the browser on the agent or use an image that contains it, then select it explicitly. For example:

npx cypress run --browser chrome

Cypress documents Chrome-family browsers and Firefox; WebKit support is experimental. Browser availability and supported versions can change with Cypress releases, so verify the current support information for the Cypress version installed in the job. Cypress browser launching reference Cypress system requirements

Parallelize only after the serial run is stable

Cypress Cloud can distribute spec files among multiple Jenkins workers. Each worker must run a recorded parallel command and use the same project configuration and build identifier so Cloud can coordinate the work. A suite needs multiple spec files for useful distribution; this method assigns whole spec files rather than splitting an individual spec.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
npx cypress run --record --parallel --group "jenkins"

Cypress identifies Jenkins BUILD_NUMBER as a known CI build identifier. If you need a different shared identifier across workers, the Cloud guide gives BUILD_TAG as an example to pass with --ci-build-id:

npx cypress run --record --parallel --group "jenkins" --ci-build-id "$BUILD_TAG"

Use the same identifier for all workers that belong to the same coordinated run, and confirm the project’s recording settings. Parallelization through this workflow requires recording to Cypress Cloud; check current Cloud terms and your organization’s project settings before relying on it. The available Cypress documentation cited here does not establish current Cloud plan pricing. Cypress Cloud parallelization

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

Troubleshoot common Jenkins failures

  • Cypress starts before the application: replace an immediate run or fixed delay with a readiness check against a real health endpoint. Confirm the server process remains alive and the endpoint is reachable from the test agent. Cypress CI overview
  • Linux browser startup fails: inspect the error for missing libraries or X11/Xvfb issues; install the required dependencies or move to an appropriate, pinned Cypress image. Cypress CI overview Linux prerequisites
  • Results differ between workers: align the pinned image, Node, Cypress, and browser versions used by each worker.
  • Parallel workers do not appear in one run: confirm that recording is enabled, the parallel flag is present, and every worker shares the intended build identifier. Cypress Cloud parallelization
  • Dependency behavior is stale or inconsistent: install with the lockfile using npm ci; cache npm and Cypress binary caches rather than restoring node_modules across builds. Cypress CI overview

Performance, reliability, and cost considerations

First establish a reproducible single-agent run. Pinning the runtime environment and using appropriate caches can reduce avoidable variability and repeated downloads, but this guidance does not establish a specific speedup. Add workers only if the suite has enough spec files and the organization can use Cypress Cloud recording; more workers also require more Jenkins agent capacity. No Jenkins-specific benchmark or Cypress Cloud price is established by the sources cited here, so estimate those costs from your own agent usage and current service terms.

Or skip the browser setup

If your task is to capture a website screenshot rather than run application tests, ScreenshotNeo provides a one-request screenshot API and MCP server. It removes cookie/consent banners, newsletter popups, and chat widgets before capture; each cleanup step can be disabled. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, with the response identifying the page verdict and billing status in headers. AI agents can use its MCP tools to take screenshots, inspect page information, or capture PDFs.

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

For example, this cURL request saves a WebP screenshot of Stripe. See the ScreenshotNeo API documentation for options and authentication details.

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

The free plan includes 1,000 screenshots per month with no card required; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo free.

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. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
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.