@checkly/playwright-reporter 0.1.9 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +114 -0
- package/README.md +266 -0
- package/dist/index.d.ts +47 -202
- package/dist/index.js +2012 -650
- package/package.json +17 -15
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@checkly/playwright-reporter` will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
|
+
|
|
7
|
+
## 1.1.0 (2026-01-20)
|
|
8
|
+
|
|
9
|
+
> **Note:** This minor version contains breaking changes. Due to options API configurations in 1.0.x that could lead to broken states, we decided to publish this as a minor version and unpublish previous 1.0.x releases to prevent issues. If you were using 1.0.x, please update your configuration as described below.
|
|
10
|
+
|
|
11
|
+
### Breaking Changes
|
|
12
|
+
|
|
13
|
+
- **Removed deprecated options** - The following options are no longer supported and will throw an error if used:
|
|
14
|
+
- `outputFile` - Use `outputDir` instead
|
|
15
|
+
- `testResultsDir` - Use `outputDir` instead
|
|
16
|
+
- `outputPath` - Use `outputDir` instead
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- **Simplified options API** - The reporter now has a cleaner configuration:
|
|
21
|
+
- `outputDir` - Directory for all output (JSON report and ZIP assets)
|
|
22
|
+
- `verbose` - Enable debug logging
|
|
23
|
+
- `apiKey` - Checkly API key (or use `CHECKLY_API_KEY` env var)
|
|
24
|
+
- `accountId` - Checkly account ID (or use `CHECKLY_ACCOUNT_ID` env var)
|
|
25
|
+
- `sessionName` - Custom session name (string or function)
|
|
26
|
+
- `dryRun` - Generate report without uploading
|
|
27
|
+
- Reduced package size
|
|
28
|
+
|
|
29
|
+
### Migration from 1.0.x
|
|
30
|
+
|
|
31
|
+
If you were using any deprecated options, update your configuration:
|
|
32
|
+
|
|
33
|
+
```diff
|
|
34
|
+
// playwright.config.ts
|
|
35
|
+
export default defineConfig({
|
|
36
|
+
reporter: [
|
|
37
|
+
- ['@checkly/playwright-reporter', {
|
|
38
|
+
- outputFile: 'results/report.json',
|
|
39
|
+
- testResultsDir: 'test-results',
|
|
40
|
+
- }],
|
|
41
|
+
+ ['@checkly/playwright-reporter', {
|
|
42
|
+
+ outputDir: 'results'
|
|
43
|
+
+ }],
|
|
44
|
+
],
|
|
45
|
+
})
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 1.0.4 (2026-01-20)
|
|
49
|
+
|
|
50
|
+
### Fixed
|
|
51
|
+
|
|
52
|
+
- Fixed module loading issues in certain Playwright configurations.
|
|
53
|
+
- Reduced package size.
|
|
54
|
+
|
|
55
|
+
## 1.0.3 (2026-01-20)
|
|
56
|
+
|
|
57
|
+
### Fixed
|
|
58
|
+
|
|
59
|
+
- Fixed compatibility with Playwright's TypeScript configuration loading mechanism.
|
|
60
|
+
- Reporter version now correctly displays in test session summary.
|
|
61
|
+
- `CHECKLY_ACCOUNT_ID` environment variable is now properly read for all features.
|
|
62
|
+
|
|
63
|
+
## 1.0.2 (2026-01-20)
|
|
64
|
+
|
|
65
|
+
### Added
|
|
66
|
+
|
|
67
|
+
- Anonymous telemetry to understand reporter usage patterns. Disable with `telemetry: false` option.
|
|
68
|
+
|
|
69
|
+
### Fixed
|
|
70
|
+
|
|
71
|
+
- Test session creation is now properly awaited before uploading results, fixing intermittent upload failures in CI environments.
|
|
72
|
+
- Sharded test execution now works correctly when using `playwright merge-reports` command.
|
|
73
|
+
- Default projects now preserve their empty name correctly.
|
|
74
|
+
|
|
75
|
+
### Changed
|
|
76
|
+
|
|
77
|
+
- Output types now re-export from `@playwright/test/reporter` with Checkly augmentations for `_checkly` property.
|
|
78
|
+
|
|
79
|
+
## 1.0.0 (2025-01-19)
|
|
80
|
+
|
|
81
|
+
First stable release of the rewritten Playwright reporter with extension-based architecture.
|
|
82
|
+
|
|
83
|
+
### Added
|
|
84
|
+
|
|
85
|
+
- **Extension-based architecture** - Modular design allows for composable functionality
|
|
86
|
+
- **Broad Playwright support** - Compatible with Playwright versions 1.40 through 1.57+
|
|
87
|
+
- **Drop-in JSON replacement** - Fully compatible with Playwright's native JSON reporter output format
|
|
88
|
+
- **Trace extraction** - Automatically extracts console messages and network requests from Playwright trace files
|
|
89
|
+
- **Checkly integration** - Automatic upload to Checkly Test Sessions when credentials are configured
|
|
90
|
+
- **New `createChecklyReporter()` function** - Better intellisense support in `playwright.config.ts`
|
|
91
|
+
- **Unified `outputDir` option** - Single option for all output files (JSON report, ZIP assets)
|
|
92
|
+
- **Verbose logging** - Debug mode for troubleshooting report generation
|
|
93
|
+
|
|
94
|
+
### Changed
|
|
95
|
+
|
|
96
|
+
- `outputFile` option is deprecated - use `outputDir` instead (JSON written to `{outputDir}/checkly-report.json`)
|
|
97
|
+
- `testResultsDir` option is deprecated - use `outputDir` instead
|
|
98
|
+
- `outputPath` option is deprecated - ZIP written to `{outputDir}/checkly-report.zip`
|
|
99
|
+
|
|
100
|
+
### Migration from 0.x
|
|
101
|
+
|
|
102
|
+
```diff
|
|
103
|
+
// playwright.config.ts
|
|
104
|
+
+import { createChecklyReporter } from '@checkly/playwright-reporter'
|
|
105
|
+
|
|
106
|
+
export default defineConfig({
|
|
107
|
+
reporter: [
|
|
108
|
+
- ['@checkly/playwright-reporter', { outputFile: 'results/report.json' }],
|
|
109
|
+
+ createChecklyReporter({ outputDir: 'results' }),
|
|
110
|
+
],
|
|
111
|
+
})
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The legacy 0.x reporter remains available via `npm install @checkly/playwright-reporter@legacy`.
|
package/README.md
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# @checkly/playwright-reporter
|
|
2
|
+
|
|
3
|
+
> **Technical Preview** - This reporter is currently in technical preview. Features and APIs may change.
|
|
4
|
+
|
|
5
|
+
Official Playwright reporter for Checkly. Automatically upload test results, screenshots, videos, and traces to gain visibility into your end-to-end tests.
|
|
6
|
+
|
|
7
|
+
**Fully compatible with Playwright's native JSON reporter** - use it as a drop-in replacement that adds Checkly integration.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install --save-dev @checkly/playwright-reporter
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Requirements:**
|
|
16
|
+
- Node.js >= 18.0.0
|
|
17
|
+
- Playwright >= 1.40.0
|
|
18
|
+
- A [Checkly account](https://app.checklyhq.com)
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
### 1. Get Your Credentials
|
|
23
|
+
|
|
24
|
+
1. Go to **Account Settings > General** to find your Account ID
|
|
25
|
+
2. Go to **User Settings > API Keys** to create an API key
|
|
26
|
+
|
|
27
|
+
### 2. Configure Playwright
|
|
28
|
+
|
|
29
|
+
Add the reporter to your `playwright.config.ts`:
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { defineConfig } from '@playwright/test';
|
|
33
|
+
import { createChecklyReporter } from '@checkly/playwright-reporter';
|
|
34
|
+
|
|
35
|
+
export default defineConfig({
|
|
36
|
+
reporter: [
|
|
37
|
+
['list'],
|
|
38
|
+
createChecklyReporter(),
|
|
39
|
+
],
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
> **Tip:** Using `createChecklyReporter()` provides full intellisense for configuration options. Alternatively, use the array syntax: `['@checkly/playwright-reporter', { ... }]`
|
|
44
|
+
|
|
45
|
+
### 3. Set Environment Variables
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
export CHECKLY_API_KEY=your_api_key
|
|
49
|
+
export CHECKLY_ACCOUNT_ID=your_account_id
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or pass them inline:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
CHECKLY_API_KEY=... CHECKLY_ACCOUNT_ID=... npx playwright test
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 4. Run Tests
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npx playwright test
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
You'll see a session URL in the output:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
View test results: https://app.checklyhq.com/test-sessions/abc123
|
|
68
|
+
|
|
69
|
+
[...test execution...]
|
|
70
|
+
|
|
71
|
+
✓ Check the results: https://app.checklyhq.com/test-sessions/abc123
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Configuration Options
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { createChecklyReporter } from '@checkly/playwright-reporter';
|
|
78
|
+
|
|
79
|
+
createChecklyReporter({
|
|
80
|
+
outputDir: 'test-results',
|
|
81
|
+
sessionName: 'My Test Suite',
|
|
82
|
+
dryRun: false,
|
|
83
|
+
verbose: false,
|
|
84
|
+
})
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
| Option | Type | Default | Description |
|
|
88
|
+
|--------|------|---------|-------------|
|
|
89
|
+
| `outputDir` | `string` | Playwright's `outputDir` | Directory for assets, JSON, and ZIP |
|
|
90
|
+
| `sessionName` | `string \| function` | Auto-generated | Custom session name |
|
|
91
|
+
| `dryRun` | `boolean` | `false` | Create ZIP without uploading |
|
|
92
|
+
| `verbose` | `boolean` | `false` | Enable debug logging |
|
|
93
|
+
|
|
94
|
+
**Output files** (written to `outputDir`):
|
|
95
|
+
- `checkly-report.json` - JSON test report
|
|
96
|
+
- `checkly-report.zip` - ZIP archive with report and assets
|
|
97
|
+
|
|
98
|
+
**Deprecated options** (will be removed in next major version):
|
|
99
|
+
| Option | Migration |
|
|
100
|
+
|--------|-----------|
|
|
101
|
+
| `outputFile` | JSON now at `{outputDir}/checkly-report.json` |
|
|
102
|
+
| `testResultsDir` | Use `outputDir` |
|
|
103
|
+
| `outputPath` | ZIP now at `{outputDir}/checkly-report.zip` |
|
|
104
|
+
|
|
105
|
+
## Environment Variables
|
|
106
|
+
|
|
107
|
+
| Variable | Description |
|
|
108
|
+
|----------|-------------|
|
|
109
|
+
| `CHECKLY_API_KEY` | Your Checkly API key |
|
|
110
|
+
| `CHECKLY_ACCOUNT_ID` | Your Checkly account ID |
|
|
111
|
+
| `CHECKLY_REPORTER_VERBOSE` | Set to `true` for detailed debug output |
|
|
112
|
+
|
|
113
|
+
## What Gets Uploaded
|
|
114
|
+
|
|
115
|
+
- Test results and status (passed/failed/flaky)
|
|
116
|
+
- Execution duration and timing
|
|
117
|
+
- Screenshots (on failure or explicit capture)
|
|
118
|
+
- Video recordings
|
|
119
|
+
- Playwright traces
|
|
120
|
+
- Console logs and network requests (extracted from traces)
|
|
121
|
+
|
|
122
|
+
## Flaky Test Detection
|
|
123
|
+
|
|
124
|
+
The reporter automatically detects flaky tests:
|
|
125
|
+
|
|
126
|
+
- **Flaky test**: A test that failed initially but passed after retry
|
|
127
|
+
- **Degraded status**: Set when there are flaky tests but no complete failures
|
|
128
|
+
- **Overall status**: `passed` if all tests eventually pass, `failed` otherwise
|
|
129
|
+
|
|
130
|
+
## Running Locally (No Upload)
|
|
131
|
+
|
|
132
|
+
For local development without uploading to Checkly:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Simply don't set CHECKLY_API_KEY or CHECKLY_ACCOUNT_ID
|
|
136
|
+
npx playwright test
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
What happens:
|
|
140
|
+
- Reporter creates `checkly-report.zip` locally
|
|
141
|
+
- Upload is automatically skipped
|
|
142
|
+
- Tests run normally
|
|
143
|
+
- You can inspect the ZIP file for debugging
|
|
144
|
+
|
|
145
|
+
## Dry Run Mode
|
|
146
|
+
|
|
147
|
+
Create local JSON and ZIP files without uploading:
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
createChecklyReporter({
|
|
151
|
+
dryRun: true,
|
|
152
|
+
})
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Conditional dry run (skip uploads when no credentials):
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
createChecklyReporter({
|
|
159
|
+
dryRun: !process.env.CHECKLY_API_KEY,
|
|
160
|
+
})
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## CI/CD Integration
|
|
164
|
+
|
|
165
|
+
### GitHub Actions
|
|
166
|
+
|
|
167
|
+
```yaml
|
|
168
|
+
name: Playwright Tests
|
|
169
|
+
on: [push, pull_request]
|
|
170
|
+
|
|
171
|
+
jobs:
|
|
172
|
+
test:
|
|
173
|
+
runs-on: ubuntu-latest
|
|
174
|
+
steps:
|
|
175
|
+
- uses: actions/checkout@v4
|
|
176
|
+
|
|
177
|
+
- uses: actions/setup-node@v4
|
|
178
|
+
with:
|
|
179
|
+
node-version: 20
|
|
180
|
+
|
|
181
|
+
- name: Install dependencies
|
|
182
|
+
run: npm ci
|
|
183
|
+
|
|
184
|
+
- name: Install Playwright browsers
|
|
185
|
+
run: npx playwright install --with-deps
|
|
186
|
+
|
|
187
|
+
- name: Run Playwright tests
|
|
188
|
+
env:
|
|
189
|
+
CHECKLY_API_KEY: ${{ secrets.CHECKLY_API_KEY }}
|
|
190
|
+
CHECKLY_ACCOUNT_ID: ${{ secrets.CHECKLY_ACCOUNT_ID }}
|
|
191
|
+
run: npx playwright test
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### GitLab CI
|
|
195
|
+
|
|
196
|
+
```yaml
|
|
197
|
+
test:
|
|
198
|
+
image: mcr.microsoft.com/playwright:v1.57.0-jammy
|
|
199
|
+
stage: test
|
|
200
|
+
script:
|
|
201
|
+
- npm ci
|
|
202
|
+
- npx playwright test
|
|
203
|
+
variables:
|
|
204
|
+
CHECKLY_API_KEY: $CHECKLY_API_KEY
|
|
205
|
+
CHECKLY_ACCOUNT_ID: $CHECKLY_ACCOUNT_ID
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**Setting up variables:**
|
|
209
|
+
1. Go to your GitLab project
|
|
210
|
+
2. Navigate to Settings > CI/CD > Variables
|
|
211
|
+
3. Add `CHECKLY_API_KEY` (check "Mask variable")
|
|
212
|
+
4. Add `CHECKLY_ACCOUNT_ID` (check "Mask variable")
|
|
213
|
+
|
|
214
|
+
## Multiple Reporters
|
|
215
|
+
|
|
216
|
+
Combine with other Playwright reporters:
|
|
217
|
+
|
|
218
|
+
```typescript
|
|
219
|
+
import { createChecklyReporter } from '@checkly/playwright-reporter';
|
|
220
|
+
|
|
221
|
+
export default defineConfig({
|
|
222
|
+
reporter: [
|
|
223
|
+
createChecklyReporter(),
|
|
224
|
+
['html', { outputFolder: 'playwright-report' }],
|
|
225
|
+
['list'],
|
|
226
|
+
['junit', { outputFile: 'test-results/junit.xml' }],
|
|
227
|
+
],
|
|
228
|
+
});
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Understanding Test Sessions
|
|
232
|
+
|
|
233
|
+
The reporter creates **suite-level test sessions**, not individual test file results.
|
|
234
|
+
|
|
235
|
+
When you run `npx playwright test`:
|
|
236
|
+
|
|
237
|
+
1. **One test session** is created, named after your directory
|
|
238
|
+
2. **One test result** for the entire run
|
|
239
|
+
3. **All assets uploaded together** in a single ZIP file
|
|
240
|
+
|
|
241
|
+
Benefits:
|
|
242
|
+
- Consolidated view of your entire test suite
|
|
243
|
+
- Efficient storage
|
|
244
|
+
- Track overall pass/fail rates over time
|
|
245
|
+
|
|
246
|
+
## Security
|
|
247
|
+
|
|
248
|
+
Always use environment variables for credentials. Never commit API keys to version control.
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
// DON'T DO THIS
|
|
252
|
+
createChecklyReporter({
|
|
253
|
+
apiKey: 'chk_api_...', // Hardcoded credentials!
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
// DO THIS
|
|
257
|
+
createChecklyReporter() // Reads from environment
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Documentation
|
|
261
|
+
|
|
262
|
+
For detailed documentation, visit [checklyhq.com/docs/detect/testing/playwright-reporter](https://www.checklyhq.com/docs/detect/testing/playwright-reporter/).
|
|
263
|
+
|
|
264
|
+
## License
|
|
265
|
+
|
|
266
|
+
Apache 2.0
|
package/dist/index.d.ts
CHANGED
|
@@ -1,219 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { JSONReportTestResult as JSONReportTestResult$1, Reporter } from '@playwright/test/reporter';
|
|
2
|
+
export { JSONReport, JSONReportError, JSONReportSTDIOEntry, JSONReportSpec, JSONReportSuite, JSONReportTest, JSONReportTestStep } from '@playwright/test/reporter';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Context passed to sessionName callback function
|
|
10
|
-
*/
|
|
11
|
-
interface SessionNameContext {
|
|
12
|
-
/**
|
|
13
|
-
* The directory name where tests are running
|
|
14
|
-
*/
|
|
15
|
-
directoryName: string;
|
|
16
|
-
/**
|
|
17
|
-
* Playwright's full configuration object
|
|
18
|
-
*/
|
|
19
|
-
config: FullConfig;
|
|
20
|
-
/**
|
|
21
|
-
* The root test suite containing all tests
|
|
22
|
-
*/
|
|
23
|
-
suite: Suite;
|
|
4
|
+
interface ChecklyConsoleLog {
|
|
5
|
+
type: 'log' | 'warn' | 'error' | 'info' | 'debug';
|
|
6
|
+
message: string;
|
|
7
|
+
timestamp: string;
|
|
24
8
|
}
|
|
9
|
+
interface ChecklyNetworkRequest {
|
|
10
|
+
url: string;
|
|
11
|
+
method: string;
|
|
12
|
+
status?: number;
|
|
13
|
+
duration?: number;
|
|
14
|
+
timestamp: string;
|
|
15
|
+
}
|
|
16
|
+
interface ChecklyData {
|
|
17
|
+
consoleLogs?: ChecklyConsoleLog[];
|
|
18
|
+
networkRequests?: ChecklyNetworkRequest[];
|
|
19
|
+
}
|
|
20
|
+
interface JSONReportTestResult extends JSONReportTestResult$1 {
|
|
21
|
+
_checkly?: ChecklyData;
|
|
22
|
+
}
|
|
23
|
+
|
|
25
24
|
/**
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
type SessionNameOption = string | ((context: SessionNameContext) => string);
|
|
29
|
-
/**
|
|
30
|
-
* Configuration options for ChecklyReporter
|
|
25
|
+
* Configuration options for the Checkly Playwright Reporter.
|
|
31
26
|
*/
|
|
32
27
|
interface ChecklyReporterOptions {
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Checkly API key for authentication
|
|
40
|
-
* Required for Phase 2 (upload functionality)
|
|
41
|
-
*/
|
|
28
|
+
/** Directory for report output. Defaults to Playwright's outputDir. */
|
|
29
|
+
outputDir?: string;
|
|
30
|
+
/** Enable verbose logging. */
|
|
31
|
+
verbose?: boolean;
|
|
32
|
+
/** Checkly API key. Can also be set via CHECKLY_API_KEY env var. */
|
|
42
33
|
apiKey?: string;
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
* @internal
|
|
53
|
-
*/
|
|
54
|
-
outputPath?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Path to the JSON report file generated by Playwright's json reporter
|
|
57
|
-
* @default 'test-results/playwright-test-report.json'
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
|
-
jsonReportPath?: string;
|
|
61
|
-
/**
|
|
62
|
-
* Directory containing test results and assets
|
|
63
|
-
* @default 'test-results'
|
|
64
|
-
* @internal
|
|
65
|
-
*/
|
|
66
|
-
testResultsDir?: string;
|
|
67
|
-
/**
|
|
68
|
-
* Dry run mode - skips API calls and only creates local ZIP file
|
|
69
|
-
* @default false
|
|
70
|
-
*/
|
|
34
|
+
/** Checkly account ID. Can also be set via CHECKLY_ACCOUNT_ID env var. */
|
|
35
|
+
accountId?: string;
|
|
36
|
+
/** Session name for the test run. Can be a string or a function. */
|
|
37
|
+
sessionName?: string | ((context: {
|
|
38
|
+
directoryName: string;
|
|
39
|
+
config: unknown;
|
|
40
|
+
suite: unknown;
|
|
41
|
+
}) => string);
|
|
42
|
+
/** Dry run mode - generate report but don't upload. */
|
|
71
43
|
dryRun?: boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Custom name for the test session
|
|
74
|
-
* Can be a string or a callback function for dynamic names
|
|
75
|
-
* @default 'Playwright Test Session: {directoryName}'
|
|
76
|
-
* @example
|
|
77
|
-
* // Static string
|
|
78
|
-
* sessionName: 'My E2E Tests'
|
|
79
|
-
*
|
|
80
|
-
* // Dynamic with callback
|
|
81
|
-
* sessionName: ({ directoryName, config }) => `E2E: ${directoryName} (${config.projects.length} projects)`
|
|
82
|
-
*/
|
|
83
|
-
sessionName?: SessionNameOption;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Warning types that can be attached to test results
|
|
87
|
-
*/
|
|
88
|
-
type ChecklyWarningType = 'trace-off' | 'trace-retained-on-failure' | 'trace-first-retry-only' | 'trace-retries-only' | 'trace-retained-on-first-failure' | 'trace-missing';
|
|
89
|
-
/**
|
|
90
|
-
* A warning attached to a test result
|
|
91
|
-
*/
|
|
92
|
-
interface ChecklyWarning {
|
|
93
|
-
/**
|
|
94
|
-
* Type of warning for programmatic handling
|
|
95
|
-
*/
|
|
96
|
-
type: ChecklyWarningType;
|
|
97
|
-
/**
|
|
98
|
-
* Human-readable warning message
|
|
99
|
-
*/
|
|
100
|
-
message: string;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Checkly-specific extensions added to JSONReportTestResult
|
|
104
|
-
*/
|
|
105
|
-
interface ChecklyTestResultExtensions {
|
|
106
|
-
/**
|
|
107
|
-
* Warnings about the test result (e.g., missing traces)
|
|
108
|
-
*/
|
|
109
|
-
warnings?: ChecklyWarning[];
|
|
110
44
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
*/
|
|
114
|
-
type JSONReportTestResult = JSONReportTestResult$1 & {
|
|
115
|
-
_checkly?: ChecklyTestResultExtensions;
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* Extended JSONReportTest with Checkly-extended results
|
|
119
|
-
*/
|
|
120
|
-
type JSONReportTest = Omit<JSONReportTest$1, 'results'> & {
|
|
121
|
-
results: JSONReportTestResult[];
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
* Extended JSONReportSpec with Checkly-extended tests
|
|
125
|
-
*/
|
|
126
|
-
type JSONReportSpec = Omit<JSONReportSpec$1, 'tests'> & {
|
|
127
|
-
tests: JSONReportTest[];
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* Extended JSONReportSuite with Checkly-extended specs and nested suites
|
|
131
|
-
*/
|
|
132
|
-
type JSONReportSuite = Omit<JSONReportSuite$1, 'suites' | 'specs'> & {
|
|
133
|
-
suites?: JSONReportSuite[];
|
|
134
|
-
specs: JSONReportSpec[];
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* Extended JSONReport with Checkly-extended suites
|
|
138
|
-
*/
|
|
139
|
-
type JSONReport = Omit<JSONReport$1, 'suites'> & {
|
|
140
|
-
suites: JSONReportSuite[];
|
|
141
|
-
};
|
|
45
|
+
type ChecklyReporterClass = new (options?: ChecklyReporterOptions) => Reporter;
|
|
46
|
+
declare const _default: ChecklyReporterClass;
|
|
142
47
|
|
|
143
48
|
/**
|
|
144
|
-
* Checkly
|
|
49
|
+
* Create a Checkly reporter configuration with full intellisense support.
|
|
145
50
|
*
|
|
146
|
-
*
|
|
147
|
-
* Designed to work alongside Playwright's built-in JSONReporter.
|
|
51
|
+
* Use this instead of the array-based syntax for better IDE experience.
|
|
148
52
|
*
|
|
149
53
|
* @example
|
|
150
|
-
*
|
|
54
|
+
* import { createChecklyReporter } from '@checkly/playwright-reporter'
|
|
55
|
+
*
|
|
151
56
|
* export default defineConfig({
|
|
152
57
|
* reporter: [
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* accountId: process.env.CHECKLY_ACCOUNT_ID,
|
|
157
|
-
* }]
|
|
158
|
-
* ]
|
|
159
|
-
* });
|
|
58
|
+
* createChecklyReporter({ outputDir: 'test-results' }),
|
|
59
|
+
* ],
|
|
60
|
+
* })
|
|
160
61
|
*/
|
|
161
|
-
declare
|
|
162
|
-
private options;
|
|
163
|
-
private assetCollector;
|
|
164
|
-
private zipper;
|
|
165
|
-
private testResults?;
|
|
166
|
-
private testSession?;
|
|
167
|
-
private startTime?;
|
|
168
|
-
private testCounts;
|
|
169
|
-
private stepsMap;
|
|
170
|
-
private warningsMap;
|
|
171
|
-
constructor(options?: ChecklyReporterOptions);
|
|
172
|
-
/**
|
|
173
|
-
* Resolves the session name from options
|
|
174
|
-
* Supports string, callback function, or falls back to default
|
|
175
|
-
*/
|
|
176
|
-
private resolveSessionName;
|
|
177
|
-
/**
|
|
178
|
-
* Checks if test result has a trace attachment and adds context-aware warning if missing
|
|
179
|
-
* The warning type depends on the trace configuration and test result state
|
|
180
|
-
*/
|
|
181
|
-
private checkTraceAttachment;
|
|
182
|
-
/**
|
|
183
|
-
* Called once before running tests
|
|
184
|
-
* Creates test session in Checkly if credentials provided
|
|
185
|
-
*/
|
|
186
|
-
onBegin(config: FullConfig, suite: Suite): void;
|
|
187
|
-
/**
|
|
188
|
-
* Called for each test when it completes
|
|
189
|
-
* Captures steps and warnings, tracks test results for final status calculation
|
|
190
|
-
*/
|
|
191
|
-
onTestEnd(test: TestCase, result: TestResult): void;
|
|
192
|
-
/**
|
|
193
|
-
* Called after all tests have completed
|
|
194
|
-
* This is where we create the ZIP archive and upload results
|
|
195
|
-
*/
|
|
196
|
-
onEnd(): Promise<void>;
|
|
197
|
-
private printSummary;
|
|
198
|
-
/**
|
|
199
|
-
* Injects captured steps and warnings into the JSON report
|
|
200
|
-
* Traverses the report structure and matches by test ID + retry
|
|
201
|
-
*/
|
|
202
|
-
private injectDataIntoReport;
|
|
203
|
-
/**
|
|
204
|
-
* Reconstructs config.projects and test.projectId from test data
|
|
205
|
-
* This is necessary for blob merge scenarios where Playwright's JSON reporter
|
|
206
|
-
* doesn't populate projects array or projectId fields
|
|
207
|
-
*/
|
|
208
|
-
private reconstructProjectsFromTests;
|
|
209
|
-
/**
|
|
210
|
-
* Uploads test results to Checkly API
|
|
211
|
-
*/
|
|
212
|
-
private uploadResults;
|
|
213
|
-
/**
|
|
214
|
-
* Called when a global error occurs
|
|
215
|
-
*/
|
|
216
|
-
onError(error: TestError): void;
|
|
217
|
-
}
|
|
62
|
+
declare function createChecklyReporter(options?: ChecklyReporterOptions): ['@checkly/playwright-reporter', ChecklyReporterOptions];
|
|
218
63
|
|
|
219
|
-
export {
|
|
64
|
+
export { type ChecklyConsoleLog, type ChecklyData, type ChecklyNetworkRequest, type ChecklyReporterOptions, type JSONReportTestResult, createChecklyReporter, _default as default };
|