Playwright Reporter
Send your Playwright test results directly to TestPig.io with our dedicated reporter.
Playwright + TestPig.io = Modern browser test reporting!
Quick Installation ⚡
npm install @testpig/playwright-reporter --save-dev
Configuration 🛠️
Step 1: Add the Reporter to Your Configuration File (Required)
First, add the TestPig.io reporter to your Playwright configuration:
import { defineConfig } from '@playwright/test';
export default defineConfig({
reporter: [
['@testpig/playwright-reporter']
],
// Other Playwright config options...
});
Step 2: Point Reporter to TestPig
Method 1: Environment Variables (Recommended 👍)
Set these environment variables for maximum flexibility:
export TESTPIG_PROJECT_ID=your-project-id
export TESTPIG_RUN_ID=your-run-id # Optional
export TESTPIG_API_KEY=your-api-key
Your Playwright config remains clean with just the reporter definition as shown above.
Method 2: Configuration File Options
Alternatively, specify credentials directly in your playwright.config.ts
:
import { defineConfig } from '@playwright/test';
export default defineConfig({
reporter: [
['@testpig/playwright-reporter', {
projectId: 'your-project-id',
runId: 'your-run-id', // Optional
apiKey: 'your-api-key'
}]
],
// Other Playwright config options...
});
Using It Is a Breeze 🌬️
Run your Playwright tests as usual:
npx playwright test
That's it! Your results will magically appear in your TestPig.io dashboard.
Awesome Features You'll Love ❤️
- Detailed Step Reporting: Every action beautifully documented
- Visual Evidence: Automatic integration of screenshots and videos
- Trace Viewer Support: Powerful debugging with trace files
- Multi-browser Coverage: Comprehensive reporting across all browsers
- Test Tagging: Organize tests with metadata for better analysis
Configuration Options At-a-Glance 📋
Option | What It Does | Required? |
---|---|---|
projectId | Links results to your TestPig.io project | ✅ Yes |
runId | Groups tests under a single run identifier | ❌ No |
apiKey | Your secure access key to TestPig.io | ✅ Yes |
includeAttachments | Include screenshots and videos (default: true) | ❌ No |
includeTraces | Include trace files (default: false) | ❌ No |
Check our Best Practices guide for advanced configuration strategies.
CI/CD Integration
For CI/CD environments, you can set the environment variables in your pipeline configuration:
# Example GitHub Actions configuration
env:
TESTPIG_PROJECT_ID: ${{ secrets.TESTPIG_PROJECT_ID }}
TESTPIG_RUN_ID: ${{ github.ref_name }}
TESTPIG_API_KEY: ${{ secrets.TESTPIG_API_KEY }}
Getting Help
If you encounter issues with the Playwright reporter:
- Check the Playwright Reporter GitHub repository for reporter-specific code issues
- Visit support.testpig.io for all bugs, feature requests, account or technical issues
Troubleshooting
If you encounter issues:
- Verify your API key is correct
- Check your project ID is valid
- Ensure your network allows outbound connections to TestPig
- Check the Playwright logs for any error messages
- Try running with
--debug
flag for more detailed output
Best Practices
- Use environment variables for sensitive information
- Set meaningful run IDs for better organization
- Consider using CI/CD environment variables for automated runs
- Regularly update the reporter package for the latest features and bug fixes
- Use the
--retries
option to handle flaky tests - Configure appropriate timeouts for your test environment