@testream/playwright-reporter 0.3.0 → 0.4.1
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/LICENSE +3 -4
- package/README.md +11 -282
- package/package.json +4 -4
package/LICENSE
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
Proprietary License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 Testream Team. All rights reserved.
|
|
4
4
|
|
|
5
5
|
This software and associated documentation files (the "Software") are licensed,
|
|
6
6
|
not sold, to you for use only under the terms of this license.
|
|
7
7
|
|
|
8
8
|
GRANT OF LICENSE:
|
|
9
9
|
You are granted a non-exclusive, non-transferable license to use the Software
|
|
10
|
-
solely for the purpose of integrating test result reporting with the
|
|
11
|
-
Manager service.
|
|
10
|
+
solely for the purpose of integrating test result reporting with the Testream service.
|
|
12
11
|
|
|
13
12
|
RESTRICTIONS:
|
|
14
13
|
- You may not modify, adapt, or create derivative works of the Software
|
|
15
14
|
- You may not distribute, sublicense, lease, or rent the Software
|
|
16
15
|
- You may not reverse engineer, decompile, or disassemble the Software
|
|
17
|
-
- The Software may only be used in conjunction with the
|
|
16
|
+
- The Software may only be used in conjunction with the Testream service
|
|
18
17
|
|
|
19
18
|
OWNERSHIP:
|
|
20
19
|
The Software is licensed, not sold. This license does not grant you any rights
|
package/README.md
CHANGED
|
@@ -1,300 +1,29 @@
|
|
|
1
1
|
# @testream/playwright-reporter
|
|
2
2
|
|
|
3
|
-
Playwright
|
|
3
|
+
Bridges Playwright test runs from your codebase into Jira with Testream. Once configured, it uploads results automatically.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- **Docs:** https://testream.github.io/docs/reporters/playwright
|
|
6
|
+
- **Docs repository:** https://github.com/testream/docs
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
- 📊 **CTRF Format** - Generates standardized JSON test reports using `playwright-ctrf-json-reporter`
|
|
9
|
-
- ☁️ **Automatic Upload** - Uploads test results and artifacts to your backend API
|
|
10
|
-
- 📎 **Artifact Support** - Automatically uploads screenshots, videos, and traces
|
|
11
|
-
- 🔄 **CI/CD Ready** - Auto-detects git context from GitHub Actions, GitLab CI, CircleCI, Jenkins
|
|
12
|
-
- ⚙️ **Configurable** - Full control over report generation and upload behavior
|
|
13
|
-
- 🛡️ **Error Handling** - Graceful failure modes with optional strict mode
|
|
14
|
-
|
|
15
|
-
## Installation
|
|
8
|
+
## Quick Start
|
|
16
9
|
|
|
17
10
|
```bash
|
|
18
11
|
npm install --save-dev @testream/playwright-reporter
|
|
19
12
|
```
|
|
20
13
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Add the reporter to your `playwright.config.ts`:
|
|
24
|
-
|
|
25
|
-
```typescript
|
|
26
|
-
import { defineConfig } from '@playwright/test';
|
|
27
|
-
|
|
28
|
-
export default defineConfig({
|
|
29
|
-
reporter: [
|
|
30
|
-
['list'], // Keep the default list reporter
|
|
31
|
-
[
|
|
32
|
-
'@testream/playwright-reporter',
|
|
33
|
-
{
|
|
34
|
-
// Required: API configuration
|
|
35
|
-
apiKey: process.env.TEST_MANAGER_API_KEY,
|
|
36
|
-
projectKey: 'PROJECT-1',
|
|
37
|
-
|
|
38
|
-
// Optional: Git context (auto-detected in CI environments)
|
|
39
|
-
branch: process.env.BRANCH_NAME,
|
|
40
|
-
commitSha: process.env.COMMIT_SHA,
|
|
41
|
-
|
|
42
|
-
// Optional: Upload behavior
|
|
43
|
-
uploadEnabled: true,
|
|
44
|
-
failOnUploadError: false,
|
|
45
|
-
|
|
46
|
-
// Optional: CTRF report options
|
|
47
|
-
outputFile: 'ctrf-report.json',
|
|
48
|
-
outputDir: 'ctrf',
|
|
49
|
-
screenshot: true,
|
|
50
|
-
annotations: false,
|
|
51
|
-
testType: 'e2e',
|
|
52
|
-
|
|
53
|
-
// Optional: Environment metadata
|
|
54
|
-
appName: 'My App',
|
|
55
|
-
appVersion: '1.0.0',
|
|
56
|
-
buildName: 'Build #123',
|
|
57
|
-
buildNumber: '123',
|
|
58
|
-
buildUrl: 'https://ci.example.com/build/123',
|
|
59
|
-
testEnvironment: 'staging',
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
],
|
|
63
|
-
// ... other config
|
|
64
|
-
});
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
## Configuration Options
|
|
68
|
-
|
|
69
|
-
### Required Options
|
|
70
|
-
|
|
71
|
-
| Option | Type | Description |
|
|
72
|
-
|--------|------|-------------|
|
|
73
|
-
| `apiKey` | `string` | API key for authentication (store in environment variables) |
|
|
74
|
-
| `projectKey` | `string` | Project key to associate test results with |
|
|
75
|
-
|
|
76
|
-
### Optional Options
|
|
77
|
-
|
|
78
|
-
| Option | Type | Default | Description |
|
|
79
|
-
|--------|------|---------|-------------|
|
|
80
|
-
| `uploadEnabled` | `boolean` | `true` | Enable/disable automatic upload to backend |
|
|
81
|
-
| `failOnUploadError` | `boolean` | `false` | Fail the test run if upload fails |
|
|
82
|
-
| `branch` | `string` | Auto-detected | Git branch name |
|
|
83
|
-
| `commitSha` | `string` | Auto-detected | Git commit SHA |
|
|
84
|
-
| `outputFile` | `string` | `'ctrf-report.json'` | Local CTRF report filename |
|
|
85
|
-
| `outputDir` | `string` | `'ctrf'` | Local CTRF report directory |
|
|
86
|
-
| `screenshot` | `boolean` | `true` | Include screenshots in the report |
|
|
87
|
-
| `annotations` | `boolean` | `false` | Include Playwright annotations |
|
|
88
|
-
| `testType` | `string` | `'e2e'` | Test type (e.g., 'api', 'e2e', 'unit') |
|
|
89
|
-
| `appName` | `string` | - | Application name under test |
|
|
90
|
-
| `appVersion` | `string` | - | Application version under test |
|
|
91
|
-
| `buildName` | `string` | - | Build name |
|
|
92
|
-
| `buildNumber` | `string` | - | Build number |
|
|
93
|
-
| `buildUrl` | `string` | - | Build URL |
|
|
94
|
-
| `testEnvironment` | `string` | - | Test environment (e.g., 'staging', 'production') |
|
|
95
|
-
|
|
96
|
-
## Usage
|
|
97
|
-
|
|
98
|
-
### Basic Usage
|
|
99
|
-
|
|
100
|
-
Once configured, the reporter automatically:
|
|
101
|
-
1. Generates a CTRF report during test execution
|
|
102
|
-
2. Uploads the report to your backend after tests complete
|
|
103
|
-
3. Uploads any test artifacts (screenshots, videos, traces)
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
npx playwright test
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Capturing Screenshots
|
|
110
|
-
|
|
111
|
-
To include screenshots in your reports, attach them in your tests:
|
|
112
|
-
|
|
113
|
-
```typescript
|
|
114
|
-
import { test, expect } from '@playwright/test';
|
|
115
|
-
|
|
116
|
-
test('example test', async ({ page }, testInfo) => {
|
|
117
|
-
await page.goto('https://playwright.dev');
|
|
118
|
-
|
|
119
|
-
// Capture screenshot
|
|
120
|
-
const screenshot = await page.screenshot({
|
|
121
|
-
quality: 50,
|
|
122
|
-
type: 'jpeg'
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
await testInfo.attach('screenshot', {
|
|
126
|
-
body: screenshot,
|
|
127
|
-
contentType: 'image/jpeg',
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### Disable Upload for Local Development
|
|
133
|
-
|
|
134
|
-
```typescript
|
|
14
|
+
```ts
|
|
135
15
|
// playwright.config.ts
|
|
136
|
-
export default defineConfig({
|
|
137
|
-
reporter: [
|
|
138
|
-
[
|
|
139
|
-
'@testream/playwright-reporter',
|
|
140
|
-
{
|
|
141
|
-
apiKey: process.env.TEST_MANAGER_API_KEY,
|
|
142
|
-
projectKey: 'PROJECT-1',
|
|
143
|
-
uploadEnabled: process.env.CI === 'true', // Only upload in CI
|
|
144
|
-
},
|
|
145
|
-
],
|
|
146
|
-
],
|
|
147
|
-
});
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### Environment Variables
|
|
151
|
-
|
|
152
|
-
It's recommended to store sensitive configuration in environment variables:
|
|
153
|
-
|
|
154
|
-
```bash
|
|
155
|
-
# .env
|
|
156
|
-
TEST_MANAGER_API_KEY=your-api-key-here
|
|
157
|
-
TEST_MANAGER_PROJECT_KEY=PROJECT-1
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
Then load them in your config:
|
|
161
|
-
|
|
162
|
-
```typescript
|
|
163
16
|
import { defineConfig } from '@playwright/test';
|
|
164
|
-
import * as dotenv from 'dotenv';
|
|
165
|
-
|
|
166
|
-
dotenv.config();
|
|
167
17
|
|
|
168
18
|
export default defineConfig({
|
|
169
19
|
reporter: [
|
|
170
|
-
[
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
},
|
|
176
|
-
],
|
|
20
|
+
['@testream/playwright-reporter', {
|
|
21
|
+
apiKey: process.env.TESTREAM_API_KEY,
|
|
22
|
+
projectKey: 'PROJ',
|
|
23
|
+
uploadEnabled: true,
|
|
24
|
+
}],
|
|
177
25
|
],
|
|
178
26
|
});
|
|
179
27
|
```
|
|
180
28
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
### GitHub Actions
|
|
184
|
-
|
|
185
|
-
The reporter automatically detects GitHub Actions environment variables:
|
|
186
|
-
|
|
187
|
-
```yaml
|
|
188
|
-
name: Playwright Tests
|
|
189
|
-
on: [push, pull_request]
|
|
190
|
-
|
|
191
|
-
jobs:
|
|
192
|
-
test:
|
|
193
|
-
runs-on: ubuntu-latest
|
|
194
|
-
steps:
|
|
195
|
-
- uses: actions/checkout@v4
|
|
196
|
-
|
|
197
|
-
- name: Setup Node.js
|
|
198
|
-
uses: actions/setup-node@v4
|
|
199
|
-
with:
|
|
200
|
-
node-version: '20'
|
|
201
|
-
|
|
202
|
-
- name: Install dependencies
|
|
203
|
-
run: npm ci
|
|
204
|
-
|
|
205
|
-
- name: Install Playwright Browsers
|
|
206
|
-
run: npx playwright install --with-deps
|
|
207
|
-
|
|
208
|
-
- name: Run tests
|
|
209
|
-
run: npx playwright test
|
|
210
|
-
env:
|
|
211
|
-
TEST_MANAGER_API_KEY: ${{ secrets.TEST_MANAGER_API_KEY }}
|
|
212
|
-
TEST_MANAGER_API_URL: ${{ secrets.TEST_MANAGER_API_URL }}
|
|
213
|
-
TEST_MANAGER_PROJECT_KEY: 'PROJECT-1'
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
### GitLab CI
|
|
217
|
-
|
|
218
|
-
```yaml
|
|
219
|
-
test:
|
|
220
|
-
image: mcr.microsoft.com/playwright:latest
|
|
221
|
-
script:
|
|
222
|
-
- npm ci
|
|
223
|
-
- npx playwright test
|
|
224
|
-
variables:
|
|
225
|
-
TEST_MANAGER_API_KEY: $TEST_MANAGER_API_KEY
|
|
226
|
-
TEST_MANAGER_API_URL: $TEST_MANAGER_API_URL
|
|
227
|
-
TEST_MANAGER_PROJECT_KEY: "PROJECT-1"
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
### CircleCI
|
|
231
|
-
|
|
232
|
-
```yaml
|
|
233
|
-
version: 2.1
|
|
234
|
-
jobs:
|
|
235
|
-
test:
|
|
236
|
-
docker:
|
|
237
|
-
- image: mcr.microsoft.com/playwright:latest
|
|
238
|
-
steps:
|
|
239
|
-
- checkout
|
|
240
|
-
- run: npm ci
|
|
241
|
-
- run: npx playwright test
|
|
242
|
-
environment:
|
|
243
|
-
TEST_MANAGER_API_KEY: $TEST_MANAGER_API_KEY
|
|
244
|
-
TEST_MANAGER_API_URL: $TEST_MANAGER_API_URL
|
|
245
|
-
TEST_MANAGER_PROJECT_KEY: "PROJECT-1"
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
## Troubleshooting
|
|
249
|
-
|
|
250
|
-
### Upload Failures
|
|
251
|
-
|
|
252
|
-
If uploads fail, the reporter logs detailed error messages but doesn't fail your tests by default:
|
|
253
|
-
|
|
254
|
-
```
|
|
255
|
-
❌ Failed to upload report: API ingest failed: HTTP 401: Unauthorized
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
To make upload failures fail the test run:
|
|
259
|
-
|
|
260
|
-
```typescript
|
|
261
|
-
{
|
|
262
|
-
failOnUploadError: true
|
|
263
|
-
}
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
### Missing Artifacts
|
|
267
|
-
|
|
268
|
-
Ensure artifacts are properly attached in tests and that file paths are accessible when the reporter runs.
|
|
269
|
-
|
|
270
|
-
### Git Context Not Detected
|
|
271
|
-
|
|
272
|
-
Manually specify branch and commit in configuration:
|
|
273
|
-
|
|
274
|
-
```typescript
|
|
275
|
-
{
|
|
276
|
-
branch: process.env.GIT_BRANCH || 'main',
|
|
277
|
-
commitSha: process.env.GIT_COMMIT || 'unknown',
|
|
278
|
-
}
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
## How It Works
|
|
282
|
-
|
|
283
|
-
1. **Test Execution**: Playwright runs your tests
|
|
284
|
-
2. **CTRF Generation**: `playwright-ctrf-json-reporter` generates a CTRF-format JSON report
|
|
285
|
-
3. **Report Upload**: Report is POSTed to `/api/v1/ingest` endpoint
|
|
286
|
-
4. **Artifact Upload**: Each test attachment is uploaded to `/api/v1/artifacts/:reportId`
|
|
287
|
-
5. **Linking**: Artifacts are linked to test results via test names
|
|
288
|
-
|
|
289
|
-
## Related Packages
|
|
290
|
-
|
|
291
|
-
- [playwright-ctrf-json-reporter](https://www.npmjs.com/package/playwright-ctrf-json-reporter) - Underlying CTRF reporter
|
|
292
|
-
- [@testream/upload-action](https://www.npmjs.com/package/@testream/upload-action) - CLI and GitHub Action for uploading CTRF reports
|
|
293
|
-
|
|
294
|
-
## License
|
|
295
|
-
|
|
296
|
-
Proprietary - See LICENSE file
|
|
297
|
-
|
|
298
|
-
## Support
|
|
299
|
-
|
|
300
|
-
For issues and questions, contact your Jira Test Manager administrator.
|
|
29
|
+
Need more configuration options? See the full guide at https://testream.github.io/docs/reporters/playwright.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testream/playwright-reporter",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Playwright CTRF reporter with automatic upload to
|
|
3
|
+
"version": "0.4.1",
|
|
4
|
+
"description": "Playwright CTRF reporter with automatic upload to Testream",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "git+https://github.com/
|
|
17
|
+
"url": "git+https://github.com/testream/docs.git"
|
|
18
18
|
},
|
|
19
19
|
"keywords": [
|
|
20
20
|
"playwright",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"test-results",
|
|
26
26
|
"jira"
|
|
27
27
|
],
|
|
28
|
-
"author": "
|
|
28
|
+
"author": "Testream",
|
|
29
29
|
"license": "SEE LICENSE IN LICENSE",
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|