Skip to content

How to Integrate Cypress with TestBeats ​

This guide shows you how to send your Cypress test results to Slack, Microsoft Teams, or Google Chat using TestBeats.

What You'll Achieve ​

After following this guide, your Cypress tests will automatically send results to your team communication channels, complete with AI-powered failure analysis.

Prerequisites ​

Before starting, ensure you have:

  • A Cypress project with tests
  • TestBeats installed (npx testbeats@latest --version)
  • A webhook URL for your communication platform (Slack, Teams, or Chat)
  • (Optional) TestBeats API key from app.testbeats.com

Step 1: Configure Cypress to Generate JUnit Reports ​

Cypress needs to output test results in JUnit XML format for TestBeats to process.

Update your cypress.config.js:

js
// cypress.config.js
const { defineConfig } = require("cypress");

module.exports = defineConfig({
  reporter: 'junit',
  reporterOptions: {
    mochaFile: 'results/junit-[hash].xml',
  },
  // ... your other configuration
});

Step 2: Run Your Tests ​

Execute your Cypress tests as usual:

bash
npx cypress run

This will generate JUnit XML files in the results/ directory.

Step 3: Choose Your Integration Method ​

You have two options to send results to TestBeats:

Option A: Command Line (Quick Setup) ​

For quick testing or simple setups:

bash
npx testbeats@latest publish \
  --api-key '<your-api-key>' \
  --slack '<your-webhook-url>' \
  --junit 'results/junit-*.xml'

For more control and CI/CD integration, create a testbeats.config.json:

json
{
  "api_key": "<your-api-key>",
  "targets": [
    {
      "name": "slack",
      "inputs": {
        "url": "<your-webhook-url>"
      }
    }
  ],
  "results": [
    {
      "type": "junit",
      "files": ["results/junit-*.xml"]
    }
  ]
}

Then run:

bash
npx testbeats@latest publish -c testbeats.config.json

Example Integration ​

For a working example, see our Cypress TestBeats integration repository.

Next Steps ​


Need help with a different framework? Check Framework Integrations →

Released under the MIT License.