Cypress - Supported Browsers
Cypress - Supported Browsers and Execution
Section titled “Cypress - Supported Browsers and Execution”Cypress provides a seamless experience for running tests across multiple popular web browsers. This allows you to ensure your application works consistently for a wider audience.
Supported Browsers
Section titled “Supported Browsers”Cypress supports a range of browsers, including:
- Chrome (and Chromium-based browsers like Brave)
- Edge (Chromium-based versions)
- Electron (bundled with Cypress, default for
cypress openinitially) - Firefox (standard and Developer Edition)
- WebKit (experimental support, for Safari-like testing)
Cypress automatically detects compatible browsers installed on your system. When you open the Cypress Test Runner (npx cypress open), you can typically choose your desired browser from a dropdown menu in the top right corner of the Test Runner window.
If a specific browser version is not listed, ensure you have a compatible version of that browser installed on your machine. Cypress generally works well with the latest stable versions.
Running Tests in Specific Browsers
Section titled “Running Tests in Specific Browsers”Using the Test Runner
Section titled “Using the Test Runner”-
Open the Cypress Test Runner:
npx cypress open -
In the Test Runner UI, locate the browser selection dropdown (usually in the header).
-
Select the browser in which you want to run your tests.
-
Click on a spec file to start the tests in the chosen browser.
The Test Runner will then launch the selected browser and execute your tests within it, providing live visual feedback.
Using the Command Line (CLI)
Section titled “Using the Command Line (CLI)”For CI/CD pipelines or automated runs, you’ll use the cypress run command. By default, cypress run executes tests headlessly using the Electron browser.
To specify a different browser, use the --browser flag:
Run tests in Chrome (headless by default):
npx cypress run --browser chromeRun tests in Firefox (headless by default):
npx cypress run --browser firefoxRun tests in Edge (headless by default):
npx cypress run --browser edgeHeaded vs. Headless Execution
Section titled “Headed vs. Headless Execution”By default, cypress run executes tests headlessly (no visible browser window). This is faster and preferred for CI environments.
To run tests in headed mode from the CLI (i.e., with the browser window visible), use the --headed flag:
npx cypress run --headed// To run headed in a specific browser:npx cypress run --browser chrome --headedThe Electron browser is always available as it’s bundled with Cypress and doesn’t need to be installed separately. Other browsers like Chrome, Firefox, and Edge must be installed on the system where Cypress is running.
For the most up-to-date list of supported browsers and their versions, always refer to the official Cypress documentation: Launching Browsers.