Back to Test Automation
2026-03-215 min read

Configure Cypress Cloud the way your team works (Test Automation)

Learn Configure Cypress Cloud the way your team works (Test Automation) step by step with clear examples and exercises.

Why This Matters

Welcome to this full guide on setting up Cypress Cloud for your team's test automation using JavaScript. By the end of this tutorial, you will have a solid understanding of how to use Cypress Cloud to improve your team's testing workflow and ensure high-quality software releases.

Why This Matters

In today's fast-paced development environment, it is essential to have efficient test automation tools that help catch bugs early and maintain the quality of your applications. Cypress Cloud offers a powerful solution for managing tests and providing insights into their reliability over time. By orchestrating runs and offering features like smart parallelization, flake management, and analytics, Cypress Cloud ensures feedback remains fast as your test suite grows.

Prerequisites

To follow along with this tutorial, you'll need:

  1. Node.js (v14.x or later) installed on your system
  2. A basic understanding of JavaScript and the Cypress testing framework
  3. Familiarity with Git and GitHub for version control

Core Concept

Cypress Cloud is a companion service to the open-source Cypress app, designed to help teams manage the quality of their tests and applications more effectively. It provides valuable insights into your test suite's reliability over time and orchestrates runs to ensure feedback remains fast as your suite grows.

Setting Up Cypress Cloud

To get started with Cypress Cloud:

  1. Sign up for a free trial at Cypress Cloud (skip this step if you already have an account).
  2. Install the Cypress Cloud CLI by running npm install -g cypress-cli.
  3. Initialize your project with Cypress using cypress init and navigate to the newly created cypress folder.
  4. Configure your test runner by adding the following lines to the cypress.json file:
{
"baseUrl": "http://your-app-url",
"viewportWidth": 1280,
"viewportHeight": 720,
"chromeWebSecurity": false,
"env": {
"cypress_base_url": "http://your-app-url"
},
"integrationFolder": "integration",
"specPattern": "**/*.spec.js"
}

Replace http://your-app-url with the URL of your application under test.

  1. Create a .cypress/plugins/index.js file and add the following code to configure Cypress Cloud:
module.exports = (on, config) => {
on('before:browser:launch', (browser = {}, launchOptions) => {
if (browser.name === 'chrome') {
launchOptions.env = { ...launchOptions.env, CYPRESS_CLOUD: true };
}
return launchOptions;
});
};
  1. Commit your changes and push them to GitHub.
  2. In the Cypress Cloud dashboard, create a new project by connecting it to your GitHub repository.

Running Tests on Cypress Cloud

To run tests on Cypress Cloud:

  1. Install the cypress-cloud-runner package using npm install cypress-cloud-runner.
  2. Update your test runner configuration in the cypress.json file to include the following:
{
"reporter": "cypress-mochawesome-reporter",
"reporterOptions": {
"reportDir": "cypress/reports/mocha",
"overwrite": false,
"html": false,
"json": true
},
"e2e": {
"setupFile": "./cypress/plugins/cloud-setup.js"
}
}
  1. Create a cypress/plugins/cloud-setup.js file and add the following code to configure Cypress Cloud for running tests:
const { login as cloudLogin } = require('@cypress/cloud');

module.exports = (on, config) => {
on('before:browser:launch', async (browser = {}, launchOptions) => {
const env = process.env;
if (env.CYPRESS_CLOUD && env.CYPRESS_PROJECT_ID) {
await cloudLogin({
projectId: env.CYPRESS_PROJECT_ID,
username: env.CYPRESS_USERNAME,
password: env.CYPRESS_PASSWORD
});
}
return launchOptions;
});
};
  1. Replace CYPRESS_PROJECT_ID, CYPRESS_USERNAME, and CYPRESS_PASSWORD with your Cypress Cloud project credentials.
  2. Add the following script to your package.json file:
"scripts": {
"test:cloud": "cypress run --record --key CYPRESS_PROJECT_KEY"
}

Replace CYPRESS_PROJECT_KEY with your Cypress Cloud project API key.

  1. Run tests on Cypress Cloud using the following command:
npm test:cloud

Worked Example

In this example, we will create a simple test for a login page and demonstrate how to configure Cypress Cloud to run it.

  1. Create an integration file named login_spec.js in the cypress/integration folder:
describe('Login', () => {
it('should log in successfully', () => {
cy.visit('/login');
cy.get('#username').type('testuser');
cy.get('#password').type('testpass');
cy.get('#submit-button').click();
cy.url().should('include', '/dashboard');
});
});
  1. Run the test locally using npm run e2e.
  2. Once the test is passing, configure Cypress Cloud as described in the previous section and run the test on Cypress Cloud using npm test:cloud.

Common Mistakes

  1. Not configuring the cypress.json file correctly: Ensure that you have added the necessary configurations for your project, including the base URL, plugins, and reporters.
  2. Incorrectly setting up Cypress Cloud credentials: Make sure to replace the placeholders in the cypress/plugins/cloud-setup.js file with your actual Cypress Cloud project credentials.
  3. Not committing and pushing changes to GitHub: Remember to commit and push your changes to GitHub before connecting your repository to Cypress Cloud.
  4. Using an incorrect API key: Double-check that you are using the correct API key for your Cypress Cloud project when running tests on Cypress Cloud.
  5. Not properly initializing the project with Cypress: Make sure to run cypress init and navigate to the newly created cypress folder before configuring Cypress Cloud.

Practice Questions

  1. How can you configure Cypress Cloud to run tests on multiple machines?
  2. What is smart parallelization, and how does it help reduce CI spend?
  3. How can you use analytics in Cypress Cloud to track test health at the project and organization level?
  4. What are some benefits of using Cypress Cloud for managing your team's tests and application quality?
  5. How can you set up status checks from GitHub, GitLab, or Bitbucket to block failing code from merging?

FAQ

  1. Do I need to use the Cypress Cloud CLI to run tests on Cypress Cloud?
  • Yes, you will need to install and configure the cypress-cloud-runner package to run your tests on Cypress Cloud.
  1. Can I use Cypress Cloud with any test runner other than Mochawesome?
  • Yes, you can use other reporters like Allure or JUnit by configuring them in the cypress.json file.
  1. How do I manage flaky tests on Cypress Cloud?
  • Cypress Cloud offers Flake Management features to help surface unreliable tests before your team starts ignoring real failures.
  1. Can I use Cypress Cloud with other test automation tools like Selenium or Playwright?
  • No, Cypress Cloud is specifically designed for the Cypress testing framework. However, you can use it in conjunction with other end-to-end testing tools for comprehensive coverage of your application.
  1. Is there a limit to the number of tests I can run on Cypress Cloud?
  • No, there are no limits on the number of tests you can run on Cypress Cloud as part of your free trial or paid subscription.
Configure Cypress Cloud the way your team works (Test Automation) | Test Automation | XQA Learn