@checkly/playwright-reporter 0.1.6 → 0.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkly/playwright-reporter",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Playwright reporter that generates ZIP archives containing JSON reports and test assets",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -9,24 +9,6 @@
9
9
  "dist",
10
10
  "README.md"
11
11
  ],
12
- "repository": {
13
- "type": "git",
14
- "url": "https://github.com/checkly/checkly-playwright-reporter-changelog.git"
15
- },
16
- "scripts": {
17
- "build": "tsup && npx --yes javascript-obfuscator raw-dist --output dist && cp raw-dist/*.d.ts dist/",
18
- "test": "vitest run",
19
- "test:watch": "vitest watch",
20
- "test:coverage": "vitest run --coverage",
21
- "typecheck": "tsc --noEmit",
22
- "format": "biome check --write --no-errors-on-unmatched",
23
- "lint": "biome lint",
24
- "lint:fix": "biome lint --write",
25
- "lint:ci": "biome ci --reporter=github",
26
- "clean": "rm -rf dist raw-dist coverage *.zip",
27
- "up": "taze -I",
28
- "prepare": "simple-git-hooks"
29
- },
30
12
  "keywords": [
31
13
  "playwright",
32
14
  "reporter",
@@ -37,38 +19,27 @@
37
19
  ],
38
20
  "author": "Checkly",
39
21
  "license": "Apache-2.0",
40
- "engines": {
41
- "node": ">=18.0.0"
42
- },
43
- "peerDependencies": {
44
- "@playwright/test": ">=1.40.0"
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/checkly/checkly-playwright-reporter.git",
25
+ "directory": "packages/reporter"
45
26
  },
46
27
  "dependencies": {
47
28
  "archiver": "git+ssh://git@github.com:checkly/node-archiver.git",
48
29
  "axios": "^1.12.2",
49
30
  "form-data": "^4.0.4"
50
31
  },
32
+ "peerDependencies": {
33
+ "@playwright/test": ">=1.40.0"
34
+ },
51
35
  "devDependencies": {
52
- "@biomejs/biome": "2.3.11",
53
36
  "@playwright/test": "^1.56.0",
54
- "@types/adm-zip": "^0.5.7",
55
- "@types/archiver": "^6.0.3",
56
- "@types/node": "^24.7.2",
57
- "@vitest/coverage-v8": "4.0.17",
58
- "adm-zip": "^0.5.16",
59
- "lint-staged": "16.2.7",
60
- "simple-git-hooks": "2.13.1",
61
- "taze": "19.9.2",
62
37
  "tsup": "8.5.1",
63
38
  "typescript": "^5.9.3",
64
- "vitest": "4.0.17"
65
- },
66
- "simple-git-hooks": {
67
- "pre-commit": "npx lint-staged"
39
+ "@checkly/reporter-clients": "0.1.6",
40
+ "@checkly/reporter-utils": "0.1.6"
68
41
  },
69
- "lint-staged": {
70
- "*.{js,ts}": [
71
- "biome check --write --no-errors-on-unmatched"
72
- ]
42
+ "scripts": {
43
+ "build": "tsup"
73
44
  }
74
- }
45
+ }
package/README.md DELETED
@@ -1,291 +0,0 @@
1
- # @checkly/playwright-reporter
2
-
3
- > Official Playwright reporter for Checkly - Upload test results and assets automatically
4
-
5
- [![npm version](https://badge.fury.io/js/@checkly%2Fplaywright-reporter.svg)](https://www.npmjs.com/package/@checkly/playwright-reporter)
6
- [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
7
-
8
- Seamlessly integrate Playwright test results with Checkly monitoring. Automatically upload test results, screenshots, videos, and traces to gain visibility into your application's health across test runs.
9
-
10
- > **Important**: This package is currently in an public beta.
11
- [Contact the Checkly team](https://app.checklyhq.com/?support=true) for support or feedback.
12
- Always ensure you're using the latest version. Expect breaking changes, features in development, and possible bugs.
13
-
14
- ## Installation
15
-
16
- ```bash
17
- npm install --save-dev @checkly/playwright-reporter
18
- ```
19
-
20
- **Requirements:**
21
- - Node.js >= 18.0.0
22
- - Playwright >= 1.40.0
23
- - A Checkly account ([sign up here](https://www.checklyhq.com/signup))
24
-
25
- ## Quick Start
26
-
27
- ### 1. Get Your Checkly Credentials
28
-
29
- 1. Log in to [Checkly](https://app.checklyhq.com)
30
- 2. Go to **Account Settings > API Keys** and create a new API key
31
- 3. Note your Account ID from /settings/account/general
32
-
33
- ### 2. Configure Playwright
34
-
35
- Add the reporter to your `playwright.config.ts`:
36
-
37
- ```typescript
38
- import { defineConfig } from '@playwright/test';
39
-
40
- export default defineConfig({
41
- reporter: [
42
- ['json', { outputFile: 'test-results/playwright-test-report.json' }],
43
- ['list'],
44
- ['@checkly/playwright-reporter']
45
- ],
46
- });
47
- ```
48
-
49
- > **Note**: The JSON reporter must come first to generate the report that this reporter consumes.
50
-
51
- ### 3. Set Environment Variables
52
-
53
- ```bash
54
- export CHECKLY_API_KEY=your_api_key_here
55
- export CHECKLY_ACCOUNT_ID=your_account_id_here
56
- ```
57
-
58
- ### 4. Run Your Tests
59
-
60
- ```bash
61
- npx playwright test
62
- ```
63
-
64
- You'll see a direct link to your test results:
65
-
66
- ```
67
- Running 5 tests using 5 workers
68
-
69
-
70
- 🔗 View test session: https://chkly.link/l/XSX35
71
-
72
- ✓ 1 [chromium] › tests/01-always-passing.spec.ts:4:7 › Always Passing Tests › basic math assertion (5ms)
73
- ✓ 2 [chromium] › tests/01-always-passing.spec.ts:33:7 › Always Passing Tests › async operation with timeout (104ms)
74
- ✓ 3 [chromium] › tests/01-always-passing.spec.ts:8:7 › Always Passing Tests › string manipulation (7ms)
75
- ✓ 4 [chromium] › tests/01-always-passing.spec.ts:14:7 › Always Passing Tests › array operations (20ms)
76
- ✓ 5 [chromium] › tests/01-always-passing.spec.ts:21:7 › Always Passing Tests › object properties (11ms)
77
-
78
- 5 passed (550ms)
79
-
80
- ======================================================
81
-
82
- 🦝 Checkly reporter: 0.1.0
83
- 🎭 Playwright: 1.56.0
84
- 📔 Project: chromium
85
- 🔗 Test session URL: https://chkly.link/l/XSX35
86
-
87
- ======================================================
88
- ```
89
-
90
- ## Configuration
91
-
92
- ### Environment Variables
93
-
94
- The reporter uses environment variables for configuration:
95
-
96
- | Variable | Description | Required |
97
- |----------|-------------|----------|
98
- | `CHECKLY_API_KEY` | Your Checkly API key | Yes* |
99
- | `CHECKLY_ACCOUNT_ID` | Your Checkly account ID | Yes* |
100
-
101
- \* Required for uploading results. Without these, the reporter creates a local ZIP file only.
102
-
103
- ### Configuration Options
104
-
105
- You can also pass options directly in `playwright.config.ts`:
106
-
107
- ```typescript
108
- ['@checkly/playwright-reporter', {
109
- apiKey: process.env.CHECKLY_API_KEY, // Not recommended, use env vars
110
- accountId: process.env.CHECKLY_ACCOUNT_ID, // Not recommended, use env vars
111
- dryRun: false, // Skip API calls, only create local ZIP
112
- sessionName: 'My E2E Tests', // Custom session name
113
- outputPath: 'checkly-report.zip', // Custom ZIP output path
114
- jsonReportPath: 'test-results/report.json', // Custom JSON report path
115
- testResultsDir: 'test-results' // Custom test results directory
116
- }]
117
- ```
118
-
119
- | Option | Type | Default | Description |
120
- |--------|------|---------|-------------|
121
- | `sessionName` | `string \| function` | `'Playwright Test Session: {dir}'` | Custom name for the test session |
122
- | `dryRun` | `boolean` | `false` | Skip all API calls and only create local ZIP file |
123
- | `apiKey` | `string` | - | Checkly API key (use env var instead) |
124
- | `accountId` | `string` | - | Checkly account ID (use env var instead) |
125
- | `outputPath` | `string` | `'checkly-report.zip'` | Path for the generated ZIP file |
126
- | `jsonReportPath` | `string` | `'test-results/playwright-test-report.json'` | Path to JSON report |
127
- | `testResultsDir` | `string` | `'test-results'` | Directory containing test results |
128
-
129
- > **Security Note**: Always use environment variables for credentials. Never commit API keys to version control.
130
-
131
- ### Custom Session Names
132
-
133
- By default, sessions are named after your project directory (e.g., `Playwright Test Session: my-app`). You can customize this with the `sessionName` option.
134
-
135
- **Static string:**
136
-
137
- ```typescript
138
- ['@checkly/playwright-reporter', {
139
- sessionName: 'E2E Tests - Production'
140
- }]
141
- ```
142
-
143
- **Dynamic with callback:**
144
-
145
- ```typescript
146
- ['@checkly/playwright-reporter', {
147
- sessionName: ({ directoryName, config, suite }) => {
148
- const projectCount = config.projects.length
149
- return `E2E: ${directoryName} (${projectCount} projects)`
150
- }
151
- }]
152
- ```
153
-
154
- The callback receives a context object with:
155
-
156
- | Property | Type | Description |
157
- |----------|------|-------------|
158
- | `directoryName` | `string` | The directory name where tests are running |
159
- | `config` | `FullConfig` | Playwright's full configuration object |
160
- | `suite` | `Suite` | The root test suite containing all tests |
161
-
162
- ## How It Works
163
-
164
- ### Suite-Level Test Sessions
165
-
166
- This reporter creates **one test session per test run**, not per individual test. By default, sessions are named after your project directory:
167
-
168
- ```
169
- Directory: /Users/john/my-app
170
- Session: Playwright Test Session: my-app
171
- ```
172
-
173
- You can customize the session name using the [`sessionName` option](#custom-session-names).
174
-
175
- All test results, screenshots, videos, and traces are bundled together in a single session for easy analysis.
176
-
177
- ### Flaky Test Detection
178
-
179
- The reporter automatically detects flaky tests:
180
-
181
- - **Flaky Test**: A test that failed initially but passed on retry
182
- - **Degraded Session**: A session with flaky tests but no complete failures
183
- - **Failed Session**: A session where at least one test never passed
184
-
185
- ### What Gets Uploaded
186
-
187
- - ✅ Test results and status (passed/failed/flaky)
188
- - ✅ Test execution duration
189
- - ✅ Screenshots (on failure or explicit capture)
190
- - ✅ Videos (full recordings)
191
- - ✅ Traces (Playwright traces for debugging)
192
- - ✅ Complete JSON test report
193
-
194
- ## Usage Examples
195
-
196
- ### Dry Run Mode (No API Calls)
197
-
198
- Use dry run mode to create ZIP files without making API calls:
199
-
200
- ```typescript
201
- export default defineConfig({
202
- reporter: [
203
- ['json', { outputFile: 'test-results/playwright-test-report.json' }],
204
- ['@checkly/playwright-reporter', {
205
- dryRun: true // Skip all API calls, only create local ZIP
206
- }]
207
- ],
208
- });
209
- ```
210
-
211
- Perfect for:
212
- - Local testing and validation
213
- - CI/CD pipelines without credentials
214
- - Debugging ZIP file contents
215
-
216
- ### Local Development (No Upload)
217
-
218
- Run tests locally without uploading to Checkly:
219
-
220
- ```bash
221
- # Simply don't set the environment variables
222
- npx playwright test
223
- ```
224
-
225
- The reporter will create a local `checkly-report.zip` file silently.
226
-
227
- ### Conditional Dry Run (CI vs Local)
228
-
229
- Automatically use dry run in CI, but enable API calls locally:
230
-
231
- ```typescript
232
- export default defineConfig({
233
- reporter: [
234
- ['json', { outputFile: 'test-results/playwright-test-report.json' }],
235
- ['@checkly/playwright-reporter', {
236
- dryRun: !!process.env.CI // Dry run in CI, normal mode locally
237
- }]
238
- ],
239
- });
240
- ```
241
-
242
- This allows you to:
243
- - Test locally with API credentials when available
244
- - Run validation in CI without requiring secrets
245
- - Keep ZIP files in CI for artifact upload
246
-
247
- ### GitHub Actions
248
-
249
- ```yaml
250
- name: Playwright Tests
251
- on: [push, pull_request]
252
-
253
- jobs:
254
- test:
255
- runs-on: ubuntu-latest
256
- steps:
257
- - uses: actions/checkout@v4
258
-
259
- - uses: actions/setup-node@v4
260
- with:
261
- node-version: 18
262
-
263
- - name: Install dependencies
264
- run: npm ci
265
-
266
- - name: Install Playwright browsers
267
- run: npx playwright install --with-deps
268
-
269
- - name: Run Playwright tests
270
- env:
271
- CHECKLY_API_KEY: ${{ secrets.CHECKLY_API_KEY }}
272
- CHECKLY_ACCOUNT_ID: ${{ secrets.CHECKLY_ACCOUNT_ID }}
273
- run: npx playwright test
274
- ```
275
-
276
- ### Multiple Reporters
277
-
278
- Combine with other Playwright reporters:
279
-
280
- ```typescript
281
- export default defineConfig({
282
- reporter: [
283
- ['json', { outputFile: 'test-results/playwright-test-report.json' }],
284
- ['@checkly/playwright-reporter'],
285
- ['html', { outputFolder: 'playwright-report' }],
286
- ['list']
287
- ],
288
- });
289
- ```
290
-
291
- Made with ❤️ by [Checkly](https://www.checklyhq.com)