@supatest/webdriverio-reporter
v0.0.4
Published
Supatest WebdriverIO reporter - stream test results to Supatest dashboard
Downloads
222
Maintainers
Readme
@supatest/webdriverio-reporter
Supatest reporter for WebdriverIO - stream test results to the Supatest dashboard in real-time.
Installation
npm install @supatest/webdriverio-reporter --save-dev
# or
yarn add @supatest/webdriverio-reporter --dev
# or
pnpm add @supatest/webdriverio-reporter --save-devRequirements
- Node.js >= 18.0.0
- WebdriverIO >= 8.0.0
Usage
Add the reporter to your wdio.conf.js or wdio.conf.ts:
// wdio.conf.js
export const config = {
// ... other config
reporters: [
'spec',
['@supatest/webdriverio-reporter', {
projectId: process.env.SUPATEST_PROJECT_ID,
apiKey: process.env.SUPATEST_API_KEY,
}]
],
};TypeScript
// wdio.conf.ts
import type { Options } from '@wdio/types';
export const config: Options.Testrunner = {
// ... other config
reporters: [
'spec',
['@supatest/webdriverio-reporter', {
projectId: process.env.SUPATEST_PROJECT_ID,
apiKey: process.env.SUPATEST_API_KEY,
}]
],
};Environment Variables
| Variable | Description |
|----------|-------------|
| SUPATEST_API_KEY | Required. Your Supatest API key |
| SUPATEST_PROJECT_ID | Required. Your project identifier for organizing test runs |
| SUPATEST_API_URL | Optional. Custom API endpoint |
| SUPATEST_DRY_RUN | Optional. Set to true to enable dry-run mode |
Configuration Options
All options can be passed in the reporter config or set via environment variables.
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| projectId | string | - | Required. Your Supatest project ID |
| apiKey | string | - | Required. Your Supatest API key |
| apiUrl | string | https://code-api.supatest.ai | API endpoint URL |
| uploadAssets | boolean | true | Whether to upload screenshots and other attachments |
| maxConcurrentUploads | number | 5 | Maximum concurrent attachment uploads |
| retryAttempts | number | 3 | Number of retry attempts for failed API calls |
| timeoutMs | number | 30000 | Timeout for API calls in milliseconds |
| dryRun | boolean | false | Log payloads instead of sending to API |
Stable Test IDs
For consistent test tracking across runs, you can assign stable IDs to tests:
describe('Login', () => {
it('@id:TC-001 should login with valid credentials', async () => {
// Test implementation
});
it('@id:TC-002 should show error for invalid password', async () => {
// Test implementation
});
});If no explicit ID is provided, the reporter generates a stable hash based on the spec file path, suite hierarchy, and test title.
CI/CD Integration
The reporter automatically detects and captures CI/CD context from:
- GitHub Actions
- GitLab CI
- Jenkins
- CircleCI
- Travis CI
- Buildkite
- Azure Pipelines
Git information (branch, commit, author) is automatically extracted from both CI environment variables and local git repository.
Features
- Real-time test result streaming
- Browser/capability information capture
- Screenshot and attachment uploads
- Git and CI/CD metadata collection
- Retry tracking and flaky test detection
- Non-blocking uploads (won't slow down your tests)
- Graceful error handling
Example
// wdio.conf.js
export const config = {
runner: 'local',
specs: ['./test/specs/**/*.js'],
capabilities: [{
browserName: 'chrome'
}],
framework: 'mocha',
reporters: [
'spec',
['@supatest/webdriverio-reporter', {
projectId: 'proj_abc123',
apiKey: 'sk_test_xyz789',
}]
],
mochaOpts: {
ui: 'bdd',
timeout: 60000
}
};License
ISC
Development
Running Tests
Unit Tests:
pnpm test # Run tests in watch mode
pnpm test:run # Run tests once
pnpm test:coverage # Run tests with coverageIntegration Tests:
pnpm test:integration # Build reporter and run full E2E test suiteThis will:
- Build the reporter package (
pnpm build) - Run the WebDriverIO test suite in
reporter-test-suites/webdriverio-saucedemo/ - Verify data flows to your local API (requires API running on
http://localhost:9090)
Quick Development Loop:
# Terminal 1: Start local API
cd api && pnpm dev
# Terminal 2: Build reporter, run integration tests
cd webdriverio-reporter
pnpm test:integrationTest Suite Configuration
The integration test suite uses .env configuration:
# reporter-test-suites/webdriverio-saucedemo/.env
SUPATEST_API_URL=http://localhost:9090
SUPATEST_API_KEY=sk_test_...
SUPATEST_PROJECT_ID=proj_local_swaglabs
SUPATEST_DRY_RUN=falseVerifying Integration Tests
After running pnpm test:integration, you should see:
[supatest] Run <run-id> started (X spec files)[supatest] Waiting for N pending uploads...[supatest] Run <run-id> completed
Check your local API dashboard at http://localhost:3000 to see the test results.
