@testream/playwright-reporter 0.4.0 → 0.4.2
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/README.md +11 -274
- package/dist/reporter.d.ts.map +1 -1
- package/dist/reporter.js +15 -13
- package/dist/reporter.js.map +1 -1
- package/dist/types.d.ts +0 -86
- package/dist/types.d.ts.map +1 -1
- package/dist/uploader.d.ts +5 -4
- package/dist/uploader.d.ts.map +1 -1
- package/dist/uploader.js +29 -10
- package/dist/uploader.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,292 +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
|
-
- 📊 **Automatic Upload** - Uploads test results and artifacts to Testream
|
|
9
|
-
- 📎 **Artifact Support** - Automatically uploads screenshots, videos, and traces
|
|
10
|
-
- 🔄 **CI/CD Ready** - Auto-detects git context from GitHub Actions, GitLab CI, CircleCI, Jenkins
|
|
11
|
-
- ⚙️ **Configurable** - Full control over upload behavior and metadata
|
|
12
|
-
- 🛡️ **Error Handling** - Graceful failure modes with optional strict mode
|
|
13
|
-
|
|
14
|
-
## Installation
|
|
8
|
+
## Quick Start
|
|
15
9
|
|
|
16
10
|
```bash
|
|
17
11
|
npm install --save-dev @testream/playwright-reporter
|
|
18
12
|
```
|
|
19
13
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Add the reporter to your `playwright.config.ts`:
|
|
23
|
-
|
|
24
|
-
```typescript
|
|
25
|
-
import { defineConfig } from '@playwright/test';
|
|
26
|
-
|
|
27
|
-
export default defineConfig({
|
|
28
|
-
reporter: [
|
|
29
|
-
['list'], // Keep the default list reporter
|
|
30
|
-
[
|
|
31
|
-
'@testream/playwright-reporter',
|
|
32
|
-
{
|
|
33
|
-
// Required: API configuration
|
|
34
|
-
apiKey: process.env.TESTREAM_API_KEY,
|
|
35
|
-
projectKey: 'PROJECT-1',
|
|
36
|
-
|
|
37
|
-
// Optional: Git context (auto-detected in CI environments)
|
|
38
|
-
branch: process.env.BRANCH_NAME,
|
|
39
|
-
commitSha: process.env.COMMIT_SHA,
|
|
40
|
-
|
|
41
|
-
// Optional: Upload behavior
|
|
42
|
-
uploadEnabled: true,
|
|
43
|
-
failOnUploadError: false,
|
|
44
|
-
|
|
45
|
-
// Optional: CTRF report options
|
|
46
|
-
outputFile: 'ctrf-report.json',
|
|
47
|
-
outputDir: 'ctrf',
|
|
48
|
-
screenshot: true,
|
|
49
|
-
annotations: false,
|
|
50
|
-
testType: 'e2e',
|
|
51
|
-
|
|
52
|
-
// Optional: Environment metadata
|
|
53
|
-
appName: 'My App',
|
|
54
|
-
appVersion: '1.0.0',
|
|
55
|
-
buildName: 'Build #123',
|
|
56
|
-
buildNumber: '123',
|
|
57
|
-
buildUrl: 'https://ci.example.com/build/123',
|
|
58
|
-
testEnvironment: 'staging',
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
],
|
|
62
|
-
// ... other config
|
|
63
|
-
});
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Configuration Options
|
|
67
|
-
|
|
68
|
-
### Required Options
|
|
69
|
-
|
|
70
|
-
| Option | Type | Description |
|
|
71
|
-
|--------|------|-------------|
|
|
72
|
-
| `apiKey` | `string` | API key for authentication (store in environment variables) |
|
|
73
|
-
| `projectKey` | `string` | Project key to associate test results with |
|
|
74
|
-
|
|
75
|
-
### Optional Options
|
|
76
|
-
|
|
77
|
-
| Option | Type | Default | Description |
|
|
78
|
-
|--------|------|---------|-------------|
|
|
79
|
-
| `uploadEnabled` | `boolean` | `true` | Enable/disable automatic upload to backend |
|
|
80
|
-
| `failOnUploadError` | `boolean` | `false` | Fail the test run if upload fails |
|
|
81
|
-
| `branch` | `string` | Auto-detected | Git branch name |
|
|
82
|
-
| `commitSha` | `string` | Auto-detected | Git commit SHA |
|
|
83
|
-
| `outputFile` | `string` | `'ctrf-report.json'` | Local CTRF report filename |
|
|
84
|
-
| `outputDir` | `string` | `'ctrf'` | Local CTRF report directory |
|
|
85
|
-
| `screenshot` | `boolean` | `true` | Include screenshots in the report |
|
|
86
|
-
| `annotations` | `boolean` | `false` | Include Playwright annotations |
|
|
87
|
-
| `testType` | `string` | `'e2e'` | Test type (e.g., 'api', 'e2e', 'unit') |
|
|
88
|
-
| `appName` | `string` | - | Application name under test |
|
|
89
|
-
| `appVersion` | `string` | - | Application version under test |
|
|
90
|
-
| `buildName` | `string` | - | Build name |
|
|
91
|
-
| `buildNumber` | `string` | - | Build number |
|
|
92
|
-
| `buildUrl` | `string` | - | Build URL |
|
|
93
|
-
| `testEnvironment` | `string` | - | Test environment (e.g., 'staging', 'production') |
|
|
94
|
-
|
|
95
|
-
## Usage
|
|
96
|
-
|
|
97
|
-
### Basic Usage
|
|
98
|
-
|
|
99
|
-
Once configured, the reporter automatically:
|
|
100
|
-
1. Generates a CTRF report during test execution
|
|
101
|
-
2. Uploads the report to your backend after tests complete
|
|
102
|
-
3. Uploads any test artifacts (screenshots, videos, traces)
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
npx playwright test
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### Capturing Screenshots
|
|
109
|
-
|
|
110
|
-
To include screenshots in your reports, attach them in your tests:
|
|
111
|
-
|
|
112
|
-
```typescript
|
|
113
|
-
import { test, expect } from '@playwright/test';
|
|
114
|
-
|
|
115
|
-
test('example test', async ({ page }, testInfo) => {
|
|
116
|
-
await page.goto('https://playwright.dev');
|
|
117
|
-
|
|
118
|
-
// Capture screenshot
|
|
119
|
-
const screenshot = await page.screenshot({
|
|
120
|
-
quality: 50,
|
|
121
|
-
type: 'jpeg'
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
await testInfo.attach('screenshot', {
|
|
125
|
-
body: screenshot,
|
|
126
|
-
contentType: 'image/jpeg',
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### Disable Upload for Local Development
|
|
132
|
-
|
|
133
|
-
```typescript
|
|
14
|
+
```ts
|
|
134
15
|
// playwright.config.ts
|
|
135
|
-
export default defineConfig({
|
|
136
|
-
reporter: [
|
|
137
|
-
[
|
|
138
|
-
'@testream/playwright-reporter',
|
|
139
|
-
{
|
|
140
|
-
apiKey: process.env.TESTREAM_API_KEY,
|
|
141
|
-
projectKey: 'PROJECT-1',
|
|
142
|
-
uploadEnabled: process.env.CI === 'true', // Only upload in CI
|
|
143
|
-
},
|
|
144
|
-
],
|
|
145
|
-
],
|
|
146
|
-
});
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
### Environment Variables
|
|
150
|
-
|
|
151
|
-
It's recommended to store sensitive configuration in environment variables:
|
|
152
|
-
|
|
153
|
-
```bash
|
|
154
|
-
# .env
|
|
155
|
-
TESTREAM_API_KEY=your-api-key-here
|
|
156
|
-
TESTREAM_PROJECT_KEY=PROJECT-1
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
Then load them in your config:
|
|
160
|
-
|
|
161
|
-
```typescript
|
|
162
16
|
import { defineConfig } from '@playwright/test';
|
|
163
|
-
import * as dotenv from 'dotenv';
|
|
164
|
-
|
|
165
|
-
dotenv.config();
|
|
166
17
|
|
|
167
18
|
export default defineConfig({
|
|
168
19
|
reporter: [
|
|
169
|
-
[
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
},
|
|
175
|
-
],
|
|
20
|
+
['@testream/playwright-reporter', {
|
|
21
|
+
apiKey: process.env.TESTREAM_API_KEY,
|
|
22
|
+
projectKey: 'PROJ',
|
|
23
|
+
uploadEnabled: true,
|
|
24
|
+
}],
|
|
176
25
|
],
|
|
177
26
|
});
|
|
178
27
|
```
|
|
179
28
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
### GitHub Actions
|
|
183
|
-
|
|
184
|
-
The reporter automatically detects GitHub Actions environment variables:
|
|
185
|
-
|
|
186
|
-
```yaml
|
|
187
|
-
name: Playwright Tests
|
|
188
|
-
on: [push, pull_request]
|
|
189
|
-
|
|
190
|
-
jobs:
|
|
191
|
-
test:
|
|
192
|
-
runs-on: ubuntu-latest
|
|
193
|
-
steps:
|
|
194
|
-
- uses: actions/checkout@v4
|
|
195
|
-
|
|
196
|
-
- name: Setup Node.js
|
|
197
|
-
uses: actions/setup-node@v4
|
|
198
|
-
with:
|
|
199
|
-
node-version: '20'
|
|
200
|
-
|
|
201
|
-
- name: Install dependencies
|
|
202
|
-
run: npm ci
|
|
203
|
-
|
|
204
|
-
- name: Install Playwright Browsers
|
|
205
|
-
run: npx playwright install --with-deps
|
|
206
|
-
|
|
207
|
-
- run: npx playwright test
|
|
208
|
-
env:
|
|
209
|
-
TESTREAM_API_KEY: ${{ secrets.TESTREAM_API_KEY }}
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
### GitLab CI
|
|
213
|
-
|
|
214
|
-
```yaml
|
|
215
|
-
test:
|
|
216
|
-
image: mcr.microsoft.com/playwright:latest
|
|
217
|
-
script:
|
|
218
|
-
- npm ci
|
|
219
|
-
- npx playwright test
|
|
220
|
-
variables:
|
|
221
|
-
TESTREAM_API_KEY: $TESTREAM_API_KEY
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
### CircleCI
|
|
225
|
-
|
|
226
|
-
```yaml
|
|
227
|
-
version: 2.1
|
|
228
|
-
jobs:
|
|
229
|
-
test:
|
|
230
|
-
docker:
|
|
231
|
-
- image: mcr.microsoft.com/playwright:latest
|
|
232
|
-
steps:
|
|
233
|
-
- checkout
|
|
234
|
-
- run: npm ci
|
|
235
|
-
- run: npx playwright test
|
|
236
|
-
environment:
|
|
237
|
-
TESTREAM_API_KEY: $TESTREAM_API_KEY
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
## Troubleshooting
|
|
241
|
-
|
|
242
|
-
### Upload Failures
|
|
243
|
-
|
|
244
|
-
If uploads fail, the reporter logs detailed error messages but doesn't fail your tests by default:
|
|
245
|
-
|
|
246
|
-
```
|
|
247
|
-
❌ Failed to upload report: API ingest failed: HTTP 401: Unauthorized
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
To make upload failures fail the test run:
|
|
251
|
-
|
|
252
|
-
```typescript
|
|
253
|
-
{
|
|
254
|
-
failOnUploadError: true
|
|
255
|
-
}
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
### Missing Artifacts
|
|
259
|
-
|
|
260
|
-
Ensure artifacts are properly attached in tests and that file paths are accessible when the reporter runs.
|
|
261
|
-
|
|
262
|
-
### Git Context Not Detected
|
|
263
|
-
|
|
264
|
-
Manually specify branch and commit in configuration:
|
|
265
|
-
|
|
266
|
-
```typescript
|
|
267
|
-
{
|
|
268
|
-
branch: process.env.GIT_BRANCH || 'main',
|
|
269
|
-
commitSha: process.env.GIT_COMMIT || 'unknown',
|
|
270
|
-
}
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
## How It Works
|
|
274
|
-
|
|
275
|
-
1. **Test Execution**: Playwright runs your tests
|
|
276
|
-
2. **Report Generation**: A test report is generated in standard format
|
|
277
|
-
3. **Report Upload**: The report is uploaded to Testream
|
|
278
|
-
4. **Artifact Upload**: Test artifacts (screenshots, videos, etc.) are uploaded
|
|
279
|
-
5. **Results Display**: View your results in the Testream dashboard
|
|
280
|
-
|
|
281
|
-
## Related Packages
|
|
282
|
-
|
|
283
|
-
- [playwright-ctrf-json-reporter](https://www.npmjs.com/package/playwright-ctrf-json-reporter) - Underlying CTRF reporter
|
|
284
|
-
- [@testream/upload-action](https://www.npmjs.com/package/@testream/upload-action) - CLI and GitHub Action for uploading CTRF reports
|
|
285
|
-
|
|
286
|
-
## License
|
|
287
|
-
|
|
288
|
-
Proprietary - See LICENSE file
|
|
289
|
-
|
|
290
|
-
## Support
|
|
291
|
-
|
|
292
|
-
For issues and questions, visit the [Testream Support Portal](https://testream.example.com/support).
|
|
29
|
+
Need more configuration options? See the full guide at https://testream.github.io/docs/reporters/playwright.
|
package/dist/reporter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,KAAK,EACL,QAAQ,EACR,UAAU,EACV,UAAU,EACX,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,KAAK,EACL,QAAQ,EACR,UAAU,EACV,UAAU,EACX,MAAM,2BAA2B,CAAC;AAInC,OAAO,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAMvD;;GAEG;AACH,qBAAa,gCAAiC,YAAW,QAAQ;IAC/D,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,YAAY,CAAW;IAC/B,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,UAAU,CAAS;gBAEf,MAAM,EAAE,4BAA4B;IA+DhD;;OAEG;IACH,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAsB/C;;OAEG;IACH,WAAW,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI;IAMtD;;OAEG;IACH,SAAS,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI;IAMpD;;OAEG;IACH,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAM5B;;OAEG;IACH,WAAW,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,GAAG,IAAI;IAMjE;;OAEG;IACH,SAAS,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,GAAG,IAAI;IAM/D;;OAEG;IACG,KAAK,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CA6D/C;AAED,eAAe,gCAAgC,CAAC"}
|
package/dist/reporter.js
CHANGED
|
@@ -119,7 +119,7 @@ class PlaywrightCTRFReporterWithUpload {
|
|
|
119
119
|
}
|
|
120
120
|
console.log('');
|
|
121
121
|
console.log('='.repeat(60));
|
|
122
|
-
console.log('
|
|
122
|
+
console.log('Playwright Test Manager Reporter');
|
|
123
123
|
console.log('='.repeat(60));
|
|
124
124
|
if (this.config.uploadEnabled) {
|
|
125
125
|
console.log(`Project: ${this.config.projectKey}`);
|
|
@@ -188,13 +188,13 @@ class PlaywrightCTRFReporterWithUpload {
|
|
|
188
188
|
// If upload is disabled, we're done
|
|
189
189
|
if (!this.config.uploadEnabled || !this.uploader) {
|
|
190
190
|
console.log('');
|
|
191
|
-
console.log('
|
|
191
|
+
console.log('CTRF report generated');
|
|
192
192
|
console.log(` ${this.reportPath}`);
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
195
|
console.log('');
|
|
196
196
|
console.log('='.repeat(60));
|
|
197
|
-
console.log('
|
|
197
|
+
console.log('Uploading Test Results');
|
|
198
198
|
console.log('='.repeat(60));
|
|
199
199
|
try {
|
|
200
200
|
// Read the generated CTRF report
|
|
@@ -210,22 +210,24 @@ class PlaywrightCTRFReporterWithUpload {
|
|
|
210
210
|
if (this.config.commitSha && !report.extra.commitSha) {
|
|
211
211
|
report.extra.commitSha = this.config.commitSha;
|
|
212
212
|
}
|
|
213
|
-
// Upload report
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
213
|
+
// Upload report (artifacts are uploaded internally)
|
|
214
|
+
const uploadResult = await this.uploader.uploadReport(report);
|
|
215
|
+
if (uploadResult.success) {
|
|
216
|
+
console.log('='.repeat(60));
|
|
217
|
+
console.log('Upload Complete');
|
|
218
|
+
console.log('='.repeat(60));
|
|
219
|
+
console.log('');
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
console.error('Upload completed with errors');
|
|
223
|
+
console.error('');
|
|
218
224
|
}
|
|
219
|
-
console.log('='.repeat(60));
|
|
220
|
-
console.log('✅ Upload Complete');
|
|
221
|
-
console.log('='.repeat(60));
|
|
222
|
-
console.log('');
|
|
223
225
|
}
|
|
224
226
|
catch (error) {
|
|
225
227
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
226
228
|
console.error('');
|
|
227
229
|
console.error('='.repeat(60));
|
|
228
|
-
console.error('
|
|
230
|
+
console.error('Upload Failed');
|
|
229
231
|
console.error('='.repeat(60));
|
|
230
232
|
console.error(`Error: ${errorMessage}`);
|
|
231
233
|
console.error('');
|
package/dist/reporter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reporter.js","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,gDAAkC;AAClC,2CAA6B;
|
|
1
|
+
{"version":3,"file":"reporter.js","sourceRoot":"","sources":["../src/reporter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,gDAAkC;AAClC,2CAA6B;AAG7B,yCAA8D;AAE9D,sCAAsC;AACtC,kGAAmE;AAEnE;;GAEG;AACH,MAAa,gCAAgC;IAM3C,YAAY,MAAoC;QAHxC,aAAQ,GAA0B,IAAI,CAAC;QAI7C,2DAA2D;QAC3D,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;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AAC;gBAClC,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;CACF;AA3MD,4EA2MC;AAED,kBAAe,gCAAgC,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -84,90 +84,4 @@ export interface PlaywrightCTRFReporterConfig {
|
|
|
84
84
|
*/
|
|
85
85
|
testEnvironment?: string;
|
|
86
86
|
}
|
|
87
|
-
/**
|
|
88
|
-
* Attachment from CTRF report
|
|
89
|
-
*/
|
|
90
|
-
export interface CTRFAttachment {
|
|
91
|
-
name: string;
|
|
92
|
-
contentType: string;
|
|
93
|
-
path: string;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* CTRF Test result
|
|
97
|
-
*/
|
|
98
|
-
export interface CTRFTest {
|
|
99
|
-
name: string;
|
|
100
|
-
status: 'passed' | 'failed' | 'skipped' | 'pending';
|
|
101
|
-
duration: number;
|
|
102
|
-
attachments?: CTRFAttachment[];
|
|
103
|
-
[key: string]: any;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* CTRF Report structure
|
|
107
|
-
*/
|
|
108
|
-
export interface CTRFReport {
|
|
109
|
-
reportId: string;
|
|
110
|
-
timestamp: string;
|
|
111
|
-
results: {
|
|
112
|
-
tool: {
|
|
113
|
-
name: string;
|
|
114
|
-
version: string;
|
|
115
|
-
};
|
|
116
|
-
summary: {
|
|
117
|
-
tests: number;
|
|
118
|
-
passed: number;
|
|
119
|
-
failed: number;
|
|
120
|
-
skipped: number;
|
|
121
|
-
pending: number;
|
|
122
|
-
other: number;
|
|
123
|
-
start: number;
|
|
124
|
-
stop: number;
|
|
125
|
-
suites: number;
|
|
126
|
-
};
|
|
127
|
-
tests: CTRFTest[];
|
|
128
|
-
};
|
|
129
|
-
extra?: {
|
|
130
|
-
branch?: string;
|
|
131
|
-
commitSha?: string;
|
|
132
|
-
};
|
|
133
|
-
[key: string]: any;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Response from the ingest API endpoint
|
|
137
|
-
*/
|
|
138
|
-
export interface IngestResponse {
|
|
139
|
-
reportId: string;
|
|
140
|
-
testRunId: string;
|
|
141
|
-
summary: {
|
|
142
|
-
passed: number;
|
|
143
|
-
failed: number;
|
|
144
|
-
skipped: number;
|
|
145
|
-
total: number;
|
|
146
|
-
};
|
|
147
|
-
testResults: Array<{
|
|
148
|
-
id: string;
|
|
149
|
-
name: string;
|
|
150
|
-
attachments: Array<{
|
|
151
|
-
id: string;
|
|
152
|
-
name: string;
|
|
153
|
-
path: string;
|
|
154
|
-
}>;
|
|
155
|
-
}>;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Response from artifact upload endpoint
|
|
159
|
-
*/
|
|
160
|
-
export interface ArtifactUploadResponse {
|
|
161
|
-
artifactId: string;
|
|
162
|
-
storageUrl: string;
|
|
163
|
-
linkedToAttachment: boolean;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* API error response
|
|
167
|
-
*/
|
|
168
|
-
export interface ApiErrorResponse {
|
|
169
|
-
error: string;
|
|
170
|
-
details?: string;
|
|
171
|
-
reportId?: string;
|
|
172
|
-
}
|
|
173
87
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,UAAU,CAAC,EAAE,M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IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B"}
|
package/dist/uploader.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CTRFReport,
|
|
1
|
+
import { CTRFReport, UploadResult } from '@jira-test-manager/shared-types';
|
|
2
|
+
import { PlaywrightCTRFReporterConfig } from './types';
|
|
2
3
|
/**
|
|
3
4
|
* Upload CTRF report and artifacts to the backend API
|
|
4
5
|
*/
|
|
@@ -9,11 +10,11 @@ export declare class ReportUploader {
|
|
|
9
10
|
/**
|
|
10
11
|
* Upload CTRF report to the backend
|
|
11
12
|
*/
|
|
12
|
-
uploadReport(report: CTRFReport): Promise<
|
|
13
|
+
uploadReport(report: CTRFReport): Promise<UploadResult>;
|
|
13
14
|
/**
|
|
14
|
-
* Upload all artifacts from the CTRF report
|
|
15
|
+
* Upload all artifacts from the CTRF report (internal method)
|
|
15
16
|
*/
|
|
16
|
-
uploadArtifacts
|
|
17
|
+
private uploadArtifacts;
|
|
17
18
|
/**
|
|
18
19
|
* Upload a single artifact file
|
|
19
20
|
*/
|
package/dist/uploader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploader.d.ts","sourceRoot":"","sources":["../src/uploader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"uploader.d.ts","sourceRoot":"","sources":["../src/uploader.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,UAAU,EAIV,YAAY,EACb,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAEvD;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAGiE;IAE/E,OAAO,CAAC,MAAM,CAAkD;gBAEpD,MAAM,EAAE,4BAA4B;IAWhD;;OAEG;IACG,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;IAoF7D;;OAEG;YACW,eAAe;IAyE7B;;OAEG;YACW,oBAAoB;CAmDnC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CA2ClG"}
|
package/dist/uploader.js
CHANGED
|
@@ -37,6 +37,7 @@ exports.ReportUploader = void 0;
|
|
|
37
37
|
exports.detectGitContext = detectGitContext;
|
|
38
38
|
const fs = __importStar(require("fs/promises"));
|
|
39
39
|
const path = __importStar(require("path"));
|
|
40
|
+
const crypto_1 = require("crypto");
|
|
40
41
|
/**
|
|
41
42
|
* Upload CTRF report and artifacts to the backend API
|
|
42
43
|
*/
|
|
@@ -56,8 +57,13 @@ class ReportUploader {
|
|
|
56
57
|
* Upload CTRF report to the backend
|
|
57
58
|
*/
|
|
58
59
|
async uploadReport(report) {
|
|
60
|
+
// Ensure reportId exists
|
|
61
|
+
if (!report.reportId) {
|
|
62
|
+
report.reportId = (0, crypto_1.randomUUID)();
|
|
63
|
+
console.log(`Generated reportId: ${report.reportId}`);
|
|
64
|
+
}
|
|
59
65
|
try {
|
|
60
|
-
console.log('
|
|
66
|
+
console.log('Uploading test results to backend...');
|
|
61
67
|
const ingestPayload = {
|
|
62
68
|
reportId: report.reportId,
|
|
63
69
|
report,
|
|
@@ -76,8 +82,11 @@ class ReportUploader {
|
|
|
76
82
|
// Handle idempotent duplicate reports
|
|
77
83
|
if (response.status === 409) {
|
|
78
84
|
const errorData = (await response.json());
|
|
79
|
-
console.warn(
|
|
80
|
-
return
|
|
85
|
+
console.warn(`Report already exists: ${errorData.reportId}`);
|
|
86
|
+
return {
|
|
87
|
+
success: true,
|
|
88
|
+
reportId: errorData.reportId || report.reportId,
|
|
89
|
+
};
|
|
81
90
|
}
|
|
82
91
|
if (!response.ok) {
|
|
83
92
|
let errorMessage;
|
|
@@ -94,11 +103,18 @@ class ReportUploader {
|
|
|
94
103
|
throw new Error(`API ingest failed: ${errorMessage}`);
|
|
95
104
|
}
|
|
96
105
|
const result = (await response.json());
|
|
97
|
-
console.log(
|
|
106
|
+
console.log(`Report uploaded successfully`);
|
|
98
107
|
console.log(` Report ID: ${result.reportId}`);
|
|
99
108
|
console.log(` Test Run ID: ${result.testRunId}`);
|
|
100
109
|
console.log(` Summary: ${result.summary.passed}/${result.summary.total} passed`);
|
|
101
|
-
|
|
110
|
+
// Upload artifacts if present
|
|
111
|
+
await this.uploadArtifacts(report, result);
|
|
112
|
+
return {
|
|
113
|
+
success: true,
|
|
114
|
+
reportId: result.reportId,
|
|
115
|
+
testRunId: result.testRunId,
|
|
116
|
+
summary: result.summary,
|
|
117
|
+
};
|
|
102
118
|
}
|
|
103
119
|
catch (error) {
|
|
104
120
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -107,13 +123,17 @@ class ReportUploader {
|
|
|
107
123
|
throw new Error(message);
|
|
108
124
|
}
|
|
109
125
|
else {
|
|
110
|
-
console.error(
|
|
111
|
-
return
|
|
126
|
+
console.error(`${message}`);
|
|
127
|
+
return {
|
|
128
|
+
success: false,
|
|
129
|
+
reportId: report.reportId,
|
|
130
|
+
error: errorMessage,
|
|
131
|
+
};
|
|
112
132
|
}
|
|
113
133
|
}
|
|
114
134
|
}
|
|
115
135
|
/**
|
|
116
|
-
* Upload all artifacts from the CTRF report
|
|
136
|
+
* Upload all artifacts from the CTRF report (internal method)
|
|
117
137
|
*/
|
|
118
138
|
async uploadArtifacts(report, ingestResponse) {
|
|
119
139
|
try {
|
|
@@ -167,7 +187,7 @@ class ReportUploader {
|
|
|
167
187
|
throw new Error(message);
|
|
168
188
|
}
|
|
169
189
|
else {
|
|
170
|
-
console.error(
|
|
190
|
+
console.error(`${message}`);
|
|
171
191
|
return 0;
|
|
172
192
|
}
|
|
173
193
|
}
|
|
@@ -215,7 +235,6 @@ class ReportUploader {
|
|
|
215
235
|
const errorText = await response.text();
|
|
216
236
|
throw new Error(`HTTP ${response.status}: ${errorText}`);
|
|
217
237
|
}
|
|
218
|
-
await response.json();
|
|
219
238
|
return true;
|
|
220
239
|
}
|
|
221
240
|
}
|
package/dist/uploader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploader.js","sourceRoot":"","sources":["../src/uploader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"uploader.js","sourceRoot":"","sources":["../src/uploader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgQA,4CA2CC;AA3SD,gDAAkC;AAClC,2CAA6B;AAC7B,mCAAoC;AAUpC;;GAEG;AACH,MAAa,cAAc;IAQzB,YAAY,MAAoC;QAFxC,WAAM,GAAW,sCAAsC,CAAC;QAG9D,IAAI,CAAC,MAAM,GAAG;YACZ,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,IAAI,KAAK;SACrD,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,MAAkB;QACnC,yBAAyB;QACzB,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YACrB,MAAM,CAAC,QAAQ,GAAG,IAA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1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testream/playwright-reporter",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Playwright CTRF reporter with automatic upload to Testream",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -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",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"@playwright/test": ">=1.40.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
+
"@jira-test-manager/shared-types": "*",
|
|
37
38
|
"playwright-ctrf-json-reporter": "^0.0.27"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|