Playwright Setup
Get Spekra integrated with your Playwright test suite in under 5 minutes. This guide will walk you through installation, configuration, and running your first test.
Prerequisites
- Node.js 18 or later
- A Playwright test suite
- A Spekra account with an API key
Installation
Install the Spekra Playwright reporter:
npm install @spekra/playwrightConfiguration
Add the reporter to your playwright.config.ts:
import { defineConfig } from '@playwright/test';
export default defineConfig({
reporter: [
['html'],
['@spekra/playwright', {
apiKey: process.env.SPEKRA_API_KEY,
}],
],
// ... rest of your config
});
Set Your API Key
Add your API key to your environment. You can get your API key from Settings → API Keys.
export SPEKRA_API_KEY=sk_your_api_key_here
Secure your API key
Never commit your API key to source control. Use environment variables or a secrets manager in CI.
Run Your Tests
That's it! Run your tests as usual:
npx playwright test
Your test results will appear in your Spekra dashboard within seconds of the run completing.
What Gets Captured
The reporter automatically captures:
| Data | Description |
|---|---|
| Test results | Pass, fail, skip, and flaky status |
| Duration | How long each test took |
| Retries | Number of retries attempted |
| Projects | Playwright project names (e.g., chromium, firefox) |
| Tags | From annotations and @tag syntax in titles |
| Suite path | Describe block hierarchy |
| Git info | Branch, commit SHA, author |
| CI info | Job URL, workflow name |
Next Steps
- Configuration options - All available reporter options
- CI/CD integration - Set up reporting in your CI pipeline
- Understanding flaky tests - Learn how Spekra detects flaky tests