Skip to content

How to Integrate Playwright with TestBeats ​

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

What You'll Achieve ​

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

Prerequisites ​

Before starting, ensure you have:

  • A Playwright test project
  • 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 Playwright to Generate JUnit Reports ​

Update your playwright.config.ts file to include the JUnit reporter:

typescript
import { defineConfig } from '@playwright/test';

export default defineConfig({
  // ... other configuration
  reporter: [
    ['list'], // Keep console output
    ['junit', { outputFile: 'test-results/junit.xml' }] // Add JUnit reporter
  ],
  // ... rest of configuration
});

Step 2: Run Your Tests ​

Run your Playwright tests as usual. The JUnit report will be generated automatically:

bash
npx playwright test

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 'test-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": ["test-results/junit.xml"]
    }
  ]
}

Then run:

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

Example Integration ​

For a complete working example, see the Playwright TestBeats example repository.

Next Steps ​


Need help with a different framework? Check Framework Integrations →

Released under the MIT License.