@arghajit/playwright-pulse-report 0.3.3 → 0.3.5
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 +95 -85
- package/dist/lib/report-types.d.ts +2 -0
- package/dist/reporter/playwright-pulse-reporter.d.ts +18 -1
- package/dist/reporter/playwright-pulse-reporter.js +157 -129
- package/dist/reporter/tsconfig.reporter.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +53 -9
- package/dist/utils/compression-utils.d.ts +19 -0
- package/dist/utils/compression-utils.js +112 -0
- package/package.json +18 -9
- package/scripts/config-reader.mjs +114 -124
- package/scripts/generate-email-report.mjs +96 -21
- package/scripts/generate-report.mjs +1172 -531
- package/scripts/generate-static-report.mjs +1269 -540
- package/scripts/generate-trend.mjs +8 -4
- package/scripts/{merge-pulse-report.js → merge-pulse-report.mjs} +64 -35
- package/scripts/merge-sequential-reports.mjs +172 -0
- package/scripts/sendReport.mjs +156 -202
- package/scripts/terminal-logo.mjs +51 -0
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -26
- package/dist/playwright-pulse-reporter.d.ts +0 -26
- package/dist/playwright-pulse-reporter.js +0 -304
- package/dist/reporter/lib/report-types.d.ts +0 -8
- package/dist/reporter/lib/report-types.js +0 -2
- package/dist/reporter/reporter/playwright-pulse-reporter.d.ts +0 -1
- package/dist/reporter/reporter/playwright-pulse-reporter.js +0 -398
- package/dist/reporter/types/index.d.ts +0 -52
- package/dist/reporter/types/index.js +0 -2
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ _The ultimate Playwright reporter — Interactive dashboard with historical tren
|
|
|
10
10
|
|
|
11
11
|
## [Live Demo](https://arghajit47.github.io/playwright-pulse/demo.html)
|
|
12
12
|
|
|
13
|
-
## 
|
|
13
|
+
## 
|
|
14
14
|
|
|
15
15
|
## **Documentation**: [Pulse Report](https://arghajit47.github.io/playwright-pulse/)
|
|
16
16
|
|
|
@@ -21,7 +21,7 @@ The project provides these utility commands:
|
|
|
21
21
|
| Command | Description |
|
|
22
22
|
|------------------------|-----------------------------------------------------------------------------|
|
|
23
23
|
| `generate-report` | Generates playwright-pulse-report.html, Loads screenshots and images dynamically from the attachments/ directory, Produces a lighter HTML file with faster initial load, Requires attachments/ directory to be present when viewing the report |
|
|
24
|
-
| `generate-pulse-report`| Generates `playwright-pulse-static-report.html`, Self-contained, no server required, Preserves all dashboard functionality, all the attachments are
|
|
24
|
+
| `generate-pulse-report`| Generates `playwright-pulse-static-report.html`, Self-contained, no server required, Preserves all dashboard functionality, all the attachments are embedded in the report, no need to have attachments/ directory when viewing the report, with a dark theme and better initial load handling |
|
|
25
25
|
| `merge-pulse-report` | Combines multiple parallel test json reports, basically used in sharding |
|
|
26
26
|
| `generate-trend` | Analyzes historical trends in test results |
|
|
27
27
|
| `generate-email-report`| Generates email-friendly report versions |
|
|
@@ -101,24 +101,7 @@ npx merge-pulse-report --outputDir {YOUR_CUSTOM_REPORT_FOLDER}
|
|
|
101
101
|
|
|
102
102
|
**Important:** Make sure your `playwright.config.ts` custom directory matches the CLI script:
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
import { defineConfig } from "@playwright/test";
|
|
106
|
-
import * as path from "path";
|
|
107
|
-
|
|
108
|
-
const CUSTOM_REPORT_DIR = path.resolve(__dirname, "{YOUR_CUSTOM_REPORT_FOLDER}");
|
|
109
|
-
|
|
110
|
-
export default defineConfig({
|
|
111
|
-
reporter: [
|
|
112
|
-
["list"],
|
|
113
|
-
[
|
|
114
|
-
"@arghajit/playwright-pulse-report",
|
|
115
|
-
{
|
|
116
|
-
outputDir: CUSTOM_REPORT_DIR, // Must match CLI --outputDir
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
],
|
|
120
|
-
});
|
|
121
|
-
```
|
|
104
|
+

|
|
122
105
|
|
|
123
106
|
## 📊 Report Options
|
|
124
107
|
|
|
@@ -240,76 +223,102 @@ Under the hood, this will:
|
|
|
240
223
|
### Basic Workflow
|
|
241
224
|
|
|
242
225
|
```yaml
|
|
243
|
-
#
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
- name:
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
- name:
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
226
|
+
# .github/workflows/playwright.yml
|
|
227
|
+
name: Playwright Tests
|
|
228
|
+
on:
|
|
229
|
+
push:
|
|
230
|
+
branches: [ main, master ]
|
|
231
|
+
pull_request:
|
|
232
|
+
branches: [ main, master ]
|
|
233
|
+
jobs:
|
|
234
|
+
test:
|
|
235
|
+
timeout-minutes: 60
|
|
236
|
+
runs-on: ubuntu-latest
|
|
237
|
+
steps:
|
|
238
|
+
- uses: actions/checkout@v4
|
|
239
|
+
- uses: actions/setup-node@v4
|
|
240
|
+
with:
|
|
241
|
+
node-version: lts/*
|
|
242
|
+
- name: Install dependencies
|
|
243
|
+
run: npm ci
|
|
244
|
+
- name: Install Playwright Browsers
|
|
245
|
+
run: npx playwright install --with-deps
|
|
246
|
+
- name: Run Playwright tests
|
|
247
|
+
run: npm run test
|
|
248
|
+
- name: Generate Pulse Report
|
|
249
|
+
run: npx generate-report
|
|
250
|
+
- uses: actions/upload-artifact@v4
|
|
251
|
+
if: always()
|
|
252
|
+
with:
|
|
253
|
+
name: pulse-report
|
|
254
|
+
path: pulse-report/
|
|
255
|
+
retention-days: 30
|
|
269
256
|
```
|
|
270
257
|
|
|
258
|
+
For more details, please refer to the [Pulse Report Basic CI/CD Integration](https://arghajit47.github.io/playwright-pulse/advanced-usage.html).
|
|
259
|
+
|
|
271
260
|
### Sharded Workflow
|
|
272
261
|
|
|
273
262
|
```yaml
|
|
274
|
-
#
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
263
|
+
# .github/workflows/playwright.yml
|
|
264
|
+
name: Playwright Tests with Pulse Report
|
|
265
|
+
on: [push]
|
|
266
|
+
jobs:
|
|
267
|
+
test:
|
|
268
|
+
timeout-minutes: 60
|
|
269
|
+
runs-on: ubuntu-latest
|
|
270
|
+
strategy:
|
|
271
|
+
fail-fast: false
|
|
272
|
+
matrix:
|
|
273
|
+
shard: [1, 2, 3, 4]
|
|
274
|
+
steps:
|
|
275
|
+
- uses: actions/checkout@v4
|
|
276
|
+
- uses: actions/setup-node@v4
|
|
277
|
+
with:
|
|
278
|
+
node-version: 18
|
|
279
|
+
- run: npm ci
|
|
280
|
+
- run: npx playwright install --with-deps
|
|
281
|
+
- run: npx playwright test --shard=${{ matrix.shard }}/${{ strategy.job-total }}
|
|
282
|
+
- uses: actions/upload-artifact@v4
|
|
283
|
+
if: always()
|
|
284
|
+
with:
|
|
285
|
+
name: pulse-report-shard-${{ matrix.shard }}
|
|
286
|
+
path: pulse-report/
|
|
287
|
+
retention-days: 1
|
|
288
|
+
|
|
289
|
+
merge-report:
|
|
290
|
+
needs: test
|
|
291
|
+
if: always()
|
|
292
|
+
runs-on: ubuntu-latest
|
|
293
|
+
steps:
|
|
294
|
+
- uses: actions/checkout@v4
|
|
295
|
+
- uses: actions/setup-node@v4
|
|
296
|
+
with:
|
|
297
|
+
node-version: 18
|
|
298
|
+
- run: npm ci
|
|
299
|
+
|
|
300
|
+
# Download all shard artifacts to a single directory
|
|
301
|
+
- uses: actions/download-artifact@v4
|
|
302
|
+
with:
|
|
303
|
+
path: all-reports
|
|
304
|
+
pattern: pulse-report-shard-*
|
|
305
|
+
|
|
306
|
+
# Merge all shard reports into a single report
|
|
307
|
+
- run: npx merge-pulse-report -o all-reports
|
|
308
|
+
|
|
309
|
+
# Generate the final HTML report
|
|
310
|
+
- run: npx generate-pulse-report -o all-reports
|
|
311
|
+
|
|
312
|
+
# Upload the final merged report
|
|
313
|
+
- uses: actions/upload-artifact@v4
|
|
314
|
+
with:
|
|
315
|
+
name: final-playwright-pulse-report
|
|
316
|
+
path: all-reports/
|
|
317
|
+
retention-days: 7
|
|
311
318
|
```
|
|
312
319
|
|
|
320
|
+
For more details, please refer to the [Pulse Report Sharded CI/CD Integration](https://arghajit47.github.io/playwright-pulse/sharding.html).
|
|
321
|
+
|
|
313
322
|
## 🧠 Notes
|
|
314
323
|
|
|
315
324
|
- <strong>`npm run generate-report` generates a HTML report ( screenshots/images will be taken in realtime from 'attachments/' directory ).</strong>
|
|
@@ -319,13 +328,14 @@ Under the hood, this will:
|
|
|
319
328
|
- After the test matrix completes, reports are downloaded, renamed, and merged.
|
|
320
329
|
- merge-report is a custom Node.js script that combines all JSON files into one.
|
|
321
330
|
|
|
322
|
-
## 
|
|
323
332
|
|
|
324
333
|
### 🚀 **Upgrade Now**
|
|
325
334
|
|
|
326
335
|
```bash
|
|
327
336
|
npm install @arghajit/playwright-pulse-report@latest
|
|
328
337
|
```
|
|
338
|
+
|
|
329
339
|
---
|
|
330
340
|
|
|
331
341
|
## ⚙️ Advanced Configuration
|
|
@@ -340,7 +350,7 @@ npx playwright test test1.spec.ts && npx playwright test test2.spec.ts
|
|
|
340
350
|
|
|
341
351
|
By default, In this above scenario, the report from test1 will be lost. To solve this, you can use the resetOnEachRun option.
|
|
342
352
|
|
|
343
|
-
```
|
|
353
|
+
```javascript
|
|
344
354
|
// playwright.config.ts
|
|
345
355
|
import { defineConfig } from "@playwright/test";
|
|
346
356
|
import * as path from "path";
|
|
@@ -4,11 +4,13 @@ export declare class PlaywrightPulseReporter implements Reporter {
|
|
|
4
4
|
private config;
|
|
5
5
|
private suite;
|
|
6
6
|
private results;
|
|
7
|
+
private _pendingTestEnds;
|
|
7
8
|
private runStartTime;
|
|
8
9
|
private options;
|
|
9
10
|
private outputDir;
|
|
10
11
|
private attachmentsDir;
|
|
11
12
|
private baseOutputFile;
|
|
13
|
+
private individualReportsSubDir;
|
|
12
14
|
private isSharded;
|
|
13
15
|
private shardIndex;
|
|
14
16
|
private resetOnEachRun;
|
|
@@ -17,17 +19,32 @@ export declare class PlaywrightPulseReporter implements Reporter {
|
|
|
17
19
|
onBegin(config: FullConfig, suite: Suite): void;
|
|
18
20
|
onTestBegin(test: TestCase): void;
|
|
19
21
|
private _getSeverity;
|
|
22
|
+
private extractCodeSnippet;
|
|
20
23
|
private getBrowserDetails;
|
|
21
24
|
private processStep;
|
|
22
25
|
onTestEnd(test: TestCase, result: PwTestResult): Promise<void>;
|
|
26
|
+
private _processTestEnd;
|
|
23
27
|
private _getFinalizedResults;
|
|
24
28
|
onError(error: any): void;
|
|
25
29
|
private _getEnvDetails;
|
|
26
30
|
private _writeShardResults;
|
|
27
31
|
private _mergeShardResults;
|
|
28
32
|
private _cleanupTemporaryFiles;
|
|
33
|
+
/**
|
|
34
|
+
* Removes all individual run JSON files from the `pulse-results/` directory
|
|
35
|
+
* that were left over from previous test sessions.
|
|
36
|
+
*
|
|
37
|
+
* When `resetOnEachRun: false`, each run writes its own timestamped JSON to
|
|
38
|
+
* `pulse-results/` and then `_mergeAllRunReports()` merges them all. However,
|
|
39
|
+
* if files from *older* sessions accumulate there (e.g. because a previous run
|
|
40
|
+
* was interrupted before the post-merge cleanup, or because the user ran tests
|
|
41
|
+
* on a previous day), `_getFinalizedResults()` de-duplicates by `test.id` and
|
|
42
|
+
* collapses results from both sessions into a single entry — producing a
|
|
43
|
+
* `totalTests` count lower than the actual number of tests that ran.
|
|
44
|
+
*
|
|
45
|
+
* Cleaning up at `onBegin` time guarantees each run starts with a fresh slate.
|
|
46
|
+
*/
|
|
29
47
|
private _ensureDirExists;
|
|
30
48
|
onEnd(result: FullResult): Promise<void>;
|
|
31
|
-
private _mergeAllRunReports;
|
|
32
49
|
}
|
|
33
50
|
export default PlaywrightPulseReporter;
|