Cypress - Dashboards
Cypress - Cypress Cloud
Section titled “Cypress - Cypress Cloud”Cypress Cloud (formerly known as Cypress Dashboard) is a service that provides valuable insights and features for your Cypress tests, especially when running them in CI/CD environments. It allows you to record test runs, view detailed analytics, and collaborate more effectively.
Key Features of Cypress Cloud
Section titled “Key Features of Cypress Cloud”Cypress Cloud offers several powerful features:
- Test Recording: Stores artifacts from your test runs, including command logs, screenshots of failures, and video recordings of entire test sessions.
- Analytics and Insights: Provides data on test suite health, such as pass/fail rates, duration, and flaky test detection.
- Parallelization: Allows you to run tests in parallel across multiple machines, significantly reducing CI run times.
- Load Balancing: Intelligently distributes spec files across available parallel machines to optimize run duration.
- GitHub Integration: Integrates with GitHub for status checks on pull requests and easy access to test results.
- Flaky Test Management: Helps identify and manage tests that intermittently pass or fail.
- Organization Management: Manage projects, users, and permissions within your team or organization.
Setting Up Cypress Cloud
Section titled “Setting Up Cypress Cloud”To connect your project to Cypress Cloud, follow these general steps:
-
Open Cypress: Launch the Cypress Test Runner using
npx cypress open. -
Navigate to Runs Tab: In the Test Runner, there’s typically a ‘Runs’ or ‘Cloud’ tab. Click on it.
-
Connect to Cloud: You’ll find an option like ‘Connect to Cypress Cloud’ or ‘Set up project to record’. Click this to begin the setup process.
-
Log In/Sign Up: You’ll be prompted to log in to your Cypress Cloud account or create a new one. This usually involves authenticating via GitHub, Google, or email.
After a successful login, the interface will guide you through setting up your project in Cypress Cloud.
- Configure Project: You’ll need to give your project a name, choose an organization (if applicable), and decide on its visibility (public or private).
Once the project is set up in Cypress Cloud, you will be provided with:
- A unique
projectId: This ID identifies your project in Cypress Cloud. - A record key: This secret key authenticates your test runs when sending data to Cypress Cloud.
The projectId should be automatically added to your cypress.config.js (or cypress.config.ts) file. If not, you’ll need to add it manually, for example: e2e: { projectId: 'your-project-id', setupNodeEvents(...) }.
To record your first run, execute Cypress with the --record flag and your record key:
npx cypress run --record --key YOUR_RECORD_KEYReplace YOUR_RECORD_KEY with the actual key provided by Cypress Cloud. It’s best practice to set the record key as an environment variable (e.g., CYPRESS_RECORD_KEY) in your CI environment rather than hardcoding it.
After the command finishes, the terminal output will include a link to the recorded run in Cypress Cloud.
In Cypress Cloud, you can then view detailed information about the run, including overall statistics (passed, failed, skipped tests), individual spec results, screenshots for failures, and video recordings. The ‘Specs’ tab will list each test file and its outcome, allowing you to drill down into specific failures and examine the command log, error messages, and visual artifacts.
Real-world Application: Setting up Cypress Cloud for your CI/CD pipeline provides invaluable visibility into test failures, helping developers quickly diagnose and fix issues. Parallelization can drastically reduce feedback loops for large test suites.
For more details, refer to the official Cypress Cloud documentation: [https://on.cypress.io/cloud]