@arghajit/dummy 0.1.0-beta-15 → 0.1.0-beta-17

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  # Playwright Pluse Report
2
2
 
3
3
  ![Playwright Pulse Report](https://ocpaxmghzmfbuhxzxzae.supabase.co/storage/v1/object/public/images/image.png)
4
- *The ultimate Playwright reporter — Interactive dashboard with historical trend analytics, CI/CD-ready standalone HTML reports, and sharding support for scalable test execution.*
4
+ _The ultimate Playwright reporter — Interactive dashboard with historical trend analytics, CI/CD-ready standalone HTML reports, and sharding support for scalable test execution._
5
5
 
6
6
  ## [Live Demo](https://pulse-report.netlify.app/)
7
7
 
@@ -58,10 +58,12 @@
58
58
  ## 🛠️ How It Works
59
59
 
60
60
  1. **Reporter Collection**:
61
+
61
62
  - Custom reporter collects detailed results during test execution
62
63
  - Handles sharding by merging `.pulse-shard-results-*.json` files
63
64
 
64
65
  2. **JSON Output**:
66
+
65
67
  - Generates comprehensive `playwright-pulse-report.json`
66
68
 
67
69
  3. **Visualization Options**:
@@ -84,18 +86,20 @@ pnpm add @arghajit/playwright-pulse-report@latest --save-dev
84
86
 
85
87
  ```typescript
86
88
  // playwright.config.ts
87
- import { defineConfig } from '@playwright/test';
88
- import * as path from 'path';
89
+ import { defineConfig } from "@playwright/test";
90
+ import * as path from "path";
89
91
 
90
-
91
- const PULSE_REPORT_DIR = path.resolve(__dirname, 'pulse-report');
92
+ const PULSE_REPORT_DIR = path.resolve(__dirname, "pulse-report");
92
93
 
93
94
  export default defineConfig({
94
95
  reporter: [
95
- ['list'],
96
- ['@arghajit/playwright-pulse-report', {
97
- outputDir: PULSE_REPORT_DIR
98
- }]
96
+ ["list"],
97
+ [
98
+ "@arghajit/playwright-pulse-report",
99
+ {
100
+ outputDir: PULSE_REPORT_DIR,
101
+ },
102
+ ],
99
103
  ],
100
104
  // Other configurations...
101
105
  });
@@ -112,9 +116,11 @@ npx send-email # Sends email report
112
116
 
113
117
  ## 📊 Report Options
114
118
 
115
- ### Option 1: Static HTML Report
119
+ ### Option 1: Static HTML Report (Embedded Attachments)
116
120
 
117
121
  ```bash
122
+ npm run generate-pulse-report
123
+ or,
118
124
  npx generate-pulse-report
119
125
  ```
120
126
 
@@ -122,7 +128,20 @@ npx generate-pulse-report
122
128
  - Self-contained, no server required
123
129
  - Preserves all dashboard functionality
124
130
 
125
- ### Option 2: Email Report
131
+ ### Option 2: HTML Report (Attachment-based)
132
+
133
+ ```bash
134
+ npm run generate-report
135
+ or,
136
+ npx generate-report
137
+ ```
138
+
139
+ - Generates playwright-pulse-report.html
140
+ - Loads screenshots and images dynamically from the attachments/ directory
141
+ - Produces a lighter HTML file with faster initial load
142
+ - Requires attachments/ directory to be present when viewing the report
143
+
144
+ ### Option 3: Email Report
126
145
 
127
146
  1. Configure `.env`:
128
147
 
@@ -138,7 +157,7 @@ npx generate-pulse-report
138
157
  npx send-email
139
158
  ```
140
159
 
141
- NOTE: The email will be send with a light-weight html file, which can be opened in mail preview application.
160
+ NOTE: The email will be send with a light-weight html file, which can be opened in mail preview application.
142
161
 
143
162
  ## 🤖 AI Analysis
144
163
 
@@ -173,7 +192,7 @@ The dashboard includes AI-powered test analysis that provides:
173
192
  - name: Generate Pulse Report
174
193
  run: |
175
194
  npm run script merge-report
176
- npm run script generate-report
195
+ npm run generate-report [or, npm run generate-pulse-report]
177
196
 
178
197
  # Upload final merged report as CI artifact
179
198
  - name: Upload Pulse report
@@ -213,8 +232,8 @@ The dashboard includes AI-powered test analysis that provides:
213
232
  # Merge all sharded JSON reports into one final output
214
233
  - name: Generate Pulse Report
215
234
  run: |
216
- npm run script merge-report
217
- npm run script generate-report
235
+ npm run merge-report
236
+ npm run generate-report [or, npm run generate-pulse-report]
218
237
 
219
238
  # Upload final merged report as CI artifact
220
239
  - name: Upload Pulse report
@@ -222,18 +241,18 @@ The dashboard includes AI-powered test analysis that provides:
222
241
  with:
223
242
  name: pulse-report
224
243
  path: pulse-report/
225
-
226
244
  ```
227
245
 
228
246
  ## 🧠 Notes
229
247
 
248
+ - <strong>`npm run generate-report` generates a HTML report ( screenshots/images will be taken in realtime from 'attachments/' directory ).</strong>
249
+ - <strong>`npm run generate-pulse-report` generates a fully self-contained static HTML report( All screenshots and images are embedded directly into the HTML using base64 encoding, which simplifies distribution but may result in larger file sizes and longer load times ).</strong>
230
250
  - Each shard generates its own playwright-pulse-report.json inside pulse-report/.
231
251
  - Artifacts are named using the shard type (matrix.config.type).
232
252
  - After the test matrix completes, reports are downloaded, renamed, and merged.
233
253
  - merge-report is a custom Node.js script that combines all JSON files into one.
234
- - generate-report can build a static HTML dashboard if needed.
235
254
 
236
- ## ![Features](https://ocpaxmghzmfbuhxzxzae.supabase.co/storage/v1/object/public/images/structures.svg)
255
+ ## ![Features](https://ocpaxmghzmfbuhxzxzae.supabase.co/storage/v1/object/public/images//pulse-folder-structures.svg)
237
256
 
238
257
  ### 🚀 **Upgrade Now**
239
258
 
@@ -247,4 +266,10 @@ For issues or feature requests, please [Contact Me](mailto:arghajitsingha47@gmai
247
266
 
248
267
  ---
249
268
 
269
+ ## 🙌🏼 Thank you
270
+
271
+ Special Thanks to [@suman-vishwakarma](https://www.linkedin.com/in/suman-vishwakarma-426108185/) and [@sagnik-ghosh](https://www.linkedin.com/in/sagnikghosh99/), for continuous UAT feedback.
272
+
273
+ ---
274
+
250
275
  <div align="center">Made by Arghajit Singha | MIT Licensed</div>
@@ -245,10 +245,27 @@ class PlaywrightPulseReporter {
245
245
  });
246
246
  }
247
247
  const uniqueTestId = test.id;
248
- // --- ADDED THIS SECTION for testData ---
248
+ // --- REFINED THIS SECTION for testData ---
249
+ const maxWorkers = this.config.workers;
250
+ let mappedWorkerId;
251
+ // First, check for the special case where a test is not assigned a worker (e.g., global setup failure).
252
+ if (result.workerIndex === -1) {
253
+ mappedWorkerId = -1; // Keep it as -1 to clearly identify this special case.
254
+ }
255
+ else if (maxWorkers && maxWorkers > 0) {
256
+ // If there's a valid worker, map it to the concurrency slot...
257
+ const zeroBasedId = result.workerIndex % maxWorkers;
258
+ // ...and then shift it to be 1-based (1 to n).
259
+ mappedWorkerId = zeroBasedId + 1;
260
+ }
261
+ else {
262
+ // Fallback for when maxWorkers is not defined: just use the original index (and shift to 1-based).
263
+ mappedWorkerId = result.workerIndex + 1;
264
+ }
249
265
  const testSpecificData = {
250
- workerId: result.workerIndex,
251
- totalWorkers: this.config.workers,
266
+ workerId: mappedWorkerId,
267
+ uniqueWorkerIndex: result.workerIndex, // We'll keep the original for diagnostics
268
+ totalWorkers: maxWorkers,
252
269
  configFile: this.config.configFile,
253
270
  metadata: this.config.metadata
254
271
  ? JSON.stringify(this.config.metadata)
@@ -275,7 +292,7 @@ class PlaywrightPulseReporter {
275
292
  tracePath: undefined,
276
293
  stdout: stdoutMessages.length > 0 ? stdoutMessages : undefined,
277
294
  stderr: stderrMessages.length > 0 ? stderrMessages : undefined,
278
- // --- ADDED THESE LINES from testSpecificData ---
295
+ // --- UPDATED THESE LINES from testSpecificData ---
279
296
  ...testSpecificData,
280
297
  };
281
298
  try {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arghajit/dummy",
3
3
  "author": "Arghajit Singha",
4
- "version": "0.1.0-beta-15",
4
+ "version": "0.1.0-beta-17",
5
5
  "description": "A Playwright reporter and dashboard for visualizing test results.",
6
6
  "keywords": [
7
7
  "playwright",
@@ -26,6 +26,7 @@
26
26
  "license": "MIT",
27
27
  "bin": {
28
28
  "generate-pulse-report": "./scripts/generate-static-report.mjs",
29
+ "generate-report": "./scripts/generate-report.mjs",
29
30
  "merge-pulse-report": "./scripts/merge-pulse-report.js",
30
31
  "send-email": "./scripts/sendReport.mjs",
31
32
  "generate-trend": "./scripts/generate-trend.mjs",
@@ -42,6 +43,7 @@
42
43
  "typecheck": "tsc --noEmit",
43
44
  "prepublishOnly": "npm run build:reporter",
44
45
  "report:static": "node ./scripts/generate-static-report.mjs",
46
+ "report:generate": "node ./scripts/generate-report.mjs",
45
47
  "report:merge": "node ./scripts/merge-pulse-report.js",
46
48
  "report:email": "node ./scripts/sendReport.mjs",
47
49
  "report:minify": "node ./scripts/generate-email-report.mjs"