How to Use Cypress for Cross-Browser Testing: A Complete Guide to Multi-Browser Automation

Cypress supports cross-browser testing across Chrome, Edge, Firefox, and WebKit using a unified architecture where the CLI forwards browser targets to the Launcher, which spawns the correct executable while the Server manages proxy interception and the Driver executes tests inside the browser.

Cross-browser testing ensures your web application behaves consistently across different rendering engines. The cypress-io/cypress repository provides native support for running identical test suites in every major browser through a streamlined command-line interface and configuration system.

How Cross-Browser Testing Works in Cypress

Cypress coordinates cross-browser execution through four specialized packages that handle detection, launching, proxying, and test execution.

1. CLI Entry Point (cli/README.md)

The cypress command-line interface parses the --browser flag and forwards the target browser name to the internal packages. When you execute cypress run --browser firefox, the CLI validates the argument and initiates the server process.

2. Launcher (@packages/launcher)

The Launcher, documented in packages/launcher/README.md, contains the detection logic for installed browsers on your system. It identifies the correct executable path (e.g., google-chrome, firefox, or the WebKit binary) and spawns the process with the required flags and a clean profile. If the specified browser is not installed, the Launcher returns an error before the Server starts.

3. Server (@packages/server)

The Server, located in packages/server/README.md, launches the chosen browser and establishes a reverse proxy to intercept all network traffic. This proxy enables core Cypress features like cy.intercept, automatic waiting, and video recording. The Server maintains a WebSocket connection to the browser for real-time communication.

4. Driver (@packages/driver)

The Driver runs inside the browser context, injecting Cypress’s command queue into the Application Under Test (AUT) iframe. As implemented in packages/driver/README.md, this package reports test results back to the Server over the WebSocket bridge, ensuring that the same test code executes unchanged regardless of which browser hosts it.

Running Tests in Specific Browsers

Use the --browser flag with the cypress run command to target specific browsers. The Launcher validates the name against installed binaries and selects the appropriate engine.


# Run in Chrome or Chromium

npx cypress run --browser chrome

# Run in Microsoft Edge

npx cypress run --browser edge

# Run in Firefox

npx cypress run --browser firefox

# Run in WebKit (Safari engine)

npx cypress run --browser webkit

For interactive debugging, use cypress open to launch the Desktop application. The Browser Selector interface, implemented in packages/launchpad/README.md, displays available browsers detected by the Launcher. Clicking a different browser in the dropdown re-runs the current spec in that environment without modifying your test files.

Configuring Default Browsers in cypress.config.js

Define available browsers in your configuration file to control which options appear in the Launchpad and are valid for CLI execution. The browsers array is consumed by the Server when it enumerates available agents.

// cypress.config.js
module.exports = {
  e2e: {
    defaultCommandTimeout: 10000,
    browsers: ['chrome', 'firefox', 'edge', 'webkit'],
  },
}

When configured, Cypress restricts browser selection to only those listed, preventing accidental runs against unsupported engines in your test pipeline.

Automating Cross-Browser Testing in CI

Execute parallel cross-browser runs using matrix strategies in your CI provider. Each job invokes the same Cypress binary, but the Launcher selects the matching browser binary on the runner.


# .github/workflows/cross-browser.yml

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        browser: [chrome, firefox, edge, webkit]
    steps:
      - uses: actions/checkout@v3
      - name: Install dependencies
        run: npm ci
      - name: Run Cypress in ${{ matrix.browser }}
        run: npx cypress run --browser ${{ matrix.browser }}

This configuration triggers four separate test jobs, each targeting a different browser engine while using identical test specifications.

Component Testing Across Browsers

Component tests utilize the same Launcher and Server architecture as end-to-end tests. Specify the browser when opening the component testing runner to verify individual components render correctly across engines.

npx cypress open --component --browser chrome

The Test Runner, documented in packages/runner/README.md, bundles the Driver and loads the component inside the AUT iframe, maintaining the same proxy and communication bridge used for full application tests.

Summary

  • Cypress supports Chrome, Chromium, Edge, Firefox, and WebKit through the --browser CLI flag and interactive Launchpad UI.
  • The Launcher (packages/launcher) detects installed browsers and handles executable spawning with proper flags and profiles.
  • The Server (packages/server) routes traffic through a proxy to enable network stubbing, screenshot capture, and automatic waiting across all browsers.
  • The Driver (packages/driver) executes test code inside the browser via a WebSocket bridge, ensuring test parity across engines.
  • Configure multiple browsers in cypress.config.js or run them in parallel via CI matrix strategies to maximize coverage.

Frequently Asked Questions

Which browsers does Cypress support for cross-browser testing?

Cypress officially supports Chrome, Chromium, Microsoft Edge, Firefox, and WebKit (the Safari engine). According to the packages/launcher/README.md source code, the Launcher detects these browsers by querying system paths and registry entries, then validates them against supported engine criteria before spawning.

How do I run Cypress tests in WebKit (Safari)?

Execute npx cypress run --browser webkit from your terminal. The Launcher will locate the WebKit executable on your system (requires WebKit to be installed separately on Linux/Windows) and spawn it with the necessary debugging flags. Note that WebKit support requires Playwright to be installed as a peer dependency for the browser binary.

Can I configure Cypress to run multiple browsers automatically in CI?

Yes. Use your CI provider’s matrix or parallel job features to invoke Cypress multiple times with different --browser arguments. Each run uses the same test suite but targets a different browser binary detected by the Launcher, as shown in the GitHub Actions example above. This approach provides true cross-browser coverage without duplicating test code.

Why does my test behave differently across browsers?

When tests behave differently across browsers, the issue typically stems from browser-specific rendering engines, CSS implementation differences, or JavaScript engine variations. Because the Driver (packages/driver) runs identical test code in every browser, any failure represents a genuine cross-browser compatibility issue in your application, not a tooling discrepancy. Cypress reports the browser name in every test run output to help you isolate engine-specific failures.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →