reportarch-pw-ul
v2.8.0
Published
A Playwright reporter that uploads test execution results, traces, and performance metrics to ReportArch platform with automatic configuration management.
Maintainers
Readme
ReportArch Playwright Reporter
A custom Playwright reporter that uploads test results and reports to ReportArch, extracting test execution stats, failure traces in text format, and performance metrics for API calls and page navigations.
Installation
npm install reportarch-pw-ulSetup
1. Create Configuration File
Create a reportarch.config.json file at the root of your test project:
{
"apiKey": "your-api-key-here",
"projectId": "your-project-id-here",
"organizationId": "your-organization-id-here",
"apiUrl": "http://localhost:3001/api/report",
"reportName": "Playwright Test Report"
}2. Configure Playwright
Add the reporter to your playwright.config.js:
module.exports = {
// ... other config
reporter: [
['html'], // Keep the default HTML reporter
['./node_modules/reportarch-pw-ul/playwrightReporter.js'] // Add ReportArch reporter
],
use: {
trace: 'on-first-retry', // Enable traces for better reporting
},
// ... rest of config
};Configuration Options
The reportarch.config.json file supports the following options:
| Option | Required | Description |
|--------|----------|-------------|
| apiKey | Yes | Your ReportArch API key |
| projectId | Yes | Your project ID in ReportArch |
| organizationId | Yes | Your organization ID in ReportArch |
| apiUrl | Yes | The ReportArch API endpoint URL |
| reportName | No | Custom name for your reports (default: "Playwright Test Report") |
| uploadTimeout | No | Upload timeout in milliseconds (default: 30000) |
| retryAttempts | No | Number of retry attempts for failed uploads (default: 3) |
| cleanupTempFiles | No | Whether to clean up temporary files after upload (default: true) |
How It Works
- Configuration Loading: The reporter looks for
reportarch.config.jsonin your test project root directory - Test Execution: During test runs, it collects test results, trace data, and performance metrics
- Report Generation: After tests complete, it generates a JSON report with all collected data
- Upload Process:
- Uploads the JSON report with metadata to ReportArch
- Zips the HTML report directory and uploads it as well
- Cleans up temporary files if configured to do so
Error Handling
- If
reportarch.config.jsonis missing or invalid, the reporter will continue to work but skip uploads - Upload failures are logged but don't interrupt the test process
- Missing required configuration fields are clearly reported
Getting Your Configuration Values
- API Key: Generate from ReportArch Settings page
- Project ID: Found in your ReportArch project settings
- Organization ID: Available in your ReportArch organization settings
- API URL: Use your ReportArch instance URL +
/api/report
Report Structure
The generated report includes:
- Summary: Test counts (total, passed, failed, skipped) and duration
- Details: Individual test results with traces and performance metrics
- Metadata: Project information and timestamps for ReportArch integration
Usage
Add the reporter to your Playwright configuration:
// playwright.config.js
module.exports = {
testDir: './tests',
reporter: [
['html'], // Keep default HTML reporter
['./node_modules/reportarch-pw-ul/playwrightReporter.js'] // Add ReportArch reporter
],
use: {
trace: 'on-first-retry', // Enable traces for better reporting
},
};Troubleshooting
- Ensure your
reportarch.config.jsonis valid JSON - Check that all required fields are present and not empty
- Verify your API key has the necessary permissions
- Check network connectivity to your ReportArch instance
- Review console output for detailed error messages during upload
Example Output
After running your Playwright tests, a playwright-report.json file will be generated in your project root. This file contains:
- Test execution stats (pass/fail/skipped/duration)
- Failure trace in text format
- Performance metrics for API calls and page navigations
- Metadata for ReportArch integration
{
"summary": {
"total": 10,
"passed": 8,
"failed": 2,
"skipped": 0,
"duration": 12345
},
"details": [
{
"title": "should login successfully",
"status": "passed",
"duration": 1200,
"traceText": "Trace details extracted from: trace.zip",
"performance": [
{
"type": "api",
"url": "https://api.example.com/login",
"startTime": 1620000000000,
"endTime": 1620000001200,
"duration": 1200
}
]
}
],
"metadata": {
"projectId": "your-project-id",
"organizationId": "your-org-id",
"timestamp": "2025-08-16T12:00:00.000Z",
"reportType": "playwright"
}
}License
MIT
