@arghajit/dummy 0.1.0-beta-1 → 0.1.0-beta-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 CHANGED
@@ -3,18 +3,9 @@
3
3
  ![Playwright Pulse Report](https://ocpaxmghzmfbuhxzxzae.supabase.co/storage/v1/object/public/images/image.png)
4
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
- <a href="https://pulse-report.netlify.app/" target="_blank"><h3>Live Demo</h3></a>
6
+ ## [Live Demo](https://pulse-report.netlify.app/)
7
7
 
8
- ## 🌟 Features
9
-
10
- - **Custom Playwright Reporter** - Collects detailed test results with rich metadata
11
- - **Sharding Support** - Seamlessly handles parallel test execution across shards
12
- - **Two Reporting Options**:
13
- - **Standalone HTML Report** - Self-contained, shareable single file
14
- - **Email Report** - Attached test summary with generated test report
15
- - **CI/CD Ready** - GitHub Actions workflow examples included
16
- - **Email Integration** - Send reports directly to stakeholders
17
- - **AI Analysis** - Get insights into your test results
8
+ ## ![Features](https://ocpaxmghzmfbuhxzxzae.supabase.co/storage/v1/object/public/images/features.svg)
18
9
 
19
10
  ## 📸 Screenshots
20
11
 
@@ -218,21 +209,7 @@ The dashboard includes AI-powered test analysis that provides:
218
209
  - merge-report is a custom Node.js script that combines all JSON files into one.
219
210
  - generate-report can build a static HTML dashboard if needed.
220
211
 
221
- ## 📂 Key Files
222
-
223
- ```bash
224
- playwright-pulse-reporter/
225
- ├── src/
226
- │ ├── reporter/ # Reporter implementation
227
- │ └── app/ # Next.js dashboard
228
- ├── scripts/
229
- │ └── generate-static-report.mjs # HTML generator
230
- | └── generate-trend.mjs # Generate Trends
231
- | └── merge-pulse-report.mjs # merge sharded reports
232
- | └── sendReport.mjs # Send email report
233
- ├── pulse-report/ # Generated reports
234
- └── sample-report.json # Example data
235
- ```
212
+ ## ![Features](https://ocpaxmghzmfbuhxzxzae.supabase.co/storage/v1/object/public/images/structures.svg)
236
213
 
237
214
  ## 🎉 What's New in v0.2.1
238
215
 
@@ -16,6 +16,7 @@ export declare class PlaywrightPulseReporter implements Reporter {
16
16
  onBegin(config: FullConfig, suite: Suite): void;
17
17
  onTestBegin(test: TestCase): void;
18
18
  private processStep;
19
+ getBrowserInfo(test: TestCase): Promise<string>;
19
20
  onTestEnd(test: TestCase, result: PwTestResult): Promise<void>;
20
21
  onError(error: any): void;
21
22
  private _writeShardResults;
@@ -39,6 +39,7 @@ const fs = __importStar(require("fs/promises"));
39
39
  const path = __importStar(require("path"));
40
40
  const crypto_1 = require("crypto");
41
41
  const attachment_utils_1 = require("./attachment-utils"); // Use relative path
42
+ const ua_parser_js_1 = require("ua-parser-js");
42
43
  const convertStatus = (status, testCase) => {
43
44
  if ((testCase === null || testCase === void 0 ? void 0 : testCase.expectedStatus) === "failed") {
44
45
  return "failed";
@@ -145,10 +146,41 @@ class PlaywrightPulseReporter {
145
146
  steps: [],
146
147
  };
147
148
  }
149
+ async getBrowserInfo(test) {
150
+ var _a, _b, _c;
151
+ const project = (_a = test.parent) === null || _a === void 0 ? void 0 : _a.project();
152
+ const userAgent = (_b = project === null || project === void 0 ? void 0 : project.use) === null || _b === void 0 ? void 0 : _b.userAgent;
153
+ const ua = userAgent || "Unknown User Agent";
154
+ const browserName = (_c = project === null || project === void 0 ? void 0 : project.use) === null || _c === void 0 ? void 0 : _c.defaultBrowserType;
155
+ try {
156
+ const parser = new ua_parser_js_1.UAParser(ua);
157
+ const result = parser.getResult();
158
+ // 1. Determine browser name
159
+ let browser = result.browser.name || browserName;
160
+ // 2. Handle mobile webviews
161
+ if (result.engine.name === "WebKit" && result.device.type === "mobile") {
162
+ browser = "Mobile Safari";
163
+ }
164
+ // 3. Clean version string
165
+ const version = result.browser.version
166
+ ? ` v${result.browser.version.split(".")[0]}`
167
+ : "";
168
+ // 4. OS information
169
+ const osInfo = result.os.name ? ` on ${result.os.name}` : "";
170
+ const osVersion = result.os.version
171
+ ? ` ${result.os.version.split(".")[0]}`
172
+ : "";
173
+ return `${browser}${version}${osInfo}${osVersion}`.trim();
174
+ }
175
+ catch (error) {
176
+ return browserName || "Unknown Browser";
177
+ }
178
+ }
148
179
  async onTestEnd(test, result) {
149
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
180
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
150
181
  const project = (_a = test.parent) === null || _a === void 0 ? void 0 : _a.project();
151
- const browserName = ((_b = project === null || project === void 0 ? void 0 : project.use) === null || _b === void 0 ? void 0 : _b.defaultBrowserType) || (project === null || project === void 0 ? void 0 : project.name) || "unknown";
182
+ const ua = (_b = project === null || project === void 0 ? void 0 : project.use) === null || _b === void 0 ? void 0 : _b.userAgent;
183
+ const browserName = ((_c = project === null || project === void 0 ? void 0 : project.use) === null || _c === void 0 ? void 0 : _c.defaultBrowserType) || (project === null || project === void 0 ? void 0 : project.name) || "unknown";
152
184
  const testStatus = convertStatus(result.status, test);
153
185
  const startTime = new Date(result.startTime);
154
186
  const endTime = new Date(startTime.getTime() + result.duration);
@@ -170,7 +202,7 @@ class PlaywrightPulseReporter {
170
202
  };
171
203
  let codeSnippet = undefined;
172
204
  try {
173
- if (((_c = test.location) === null || _c === void 0 ? void 0 : _c.file) && ((_d = test.location) === null || _d === void 0 ? void 0 : _d.line) && ((_e = test.location) === null || _e === void 0 ? void 0 : _e.column)) {
205
+ if (((_d = test.location) === null || _d === void 0 ? void 0 : _d.file) && ((_e = test.location) === null || _e === void 0 ? void 0 : _e.line) && ((_f = test.location) === null || _f === void 0 ? void 0 : _f.column)) {
174
206
  const relativePath = path.relative(this.config.rootDir, test.location.file);
175
207
  codeSnippet = `Test defined at: ${relativePath}:${test.location.line}:${test.location.column}`;
176
208
  }
@@ -195,16 +227,16 @@ class PlaywrightPulseReporter {
195
227
  id: uniqueTestId,
196
228
  runId: "TBD",
197
229
  name: test.titlePath().join(" > "),
198
- suiteName: (project === null || project === void 0 ? void 0 : project.name) || ((_f = this.config.projects[0]) === null || _f === void 0 ? void 0 : _f.name) || "Default Suite",
230
+ suiteName: (project === null || project === void 0 ? void 0 : project.name) || ((_g = this.config.projects[0]) === null || _g === void 0 ? void 0 : _g.name) || "Default Suite",
199
231
  status: testStatus,
200
232
  duration: result.duration,
201
233
  startTime: startTime,
202
234
  endTime: endTime,
203
235
  browser: browserName,
204
236
  retries: result.retry,
205
- steps: ((_g = result.steps) === null || _g === void 0 ? void 0 : _g.length) ? await processAllSteps(result.steps) : [],
206
- errorMessage: (_h = result.error) === null || _h === void 0 ? void 0 : _h.message,
207
- stackTrace: (_j = result.error) === null || _j === void 0 ? void 0 : _j.stack,
237
+ steps: ((_h = result.steps) === null || _h === void 0 ? void 0 : _h.length) ? await processAllSteps(result.steps) : [],
238
+ errorMessage: (_j = result.error) === null || _j === void 0 ? void 0 : _j.message,
239
+ stackTrace: (_k = result.error) === null || _k === void 0 ? void 0 : _k.stack,
208
240
  codeSnippet: codeSnippet,
209
241
  tags: test.tags.map((tag) => tag.startsWith("@") ? tag.substring(1) : tag),
210
242
  screenshots: [],
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-1",
4
+ "version": "0.1.0-beta-2",
5
5
  "description": "A Playwright reporter and dashboard for visualizing test results.",
6
6
  "keywords": [
7
7
  "playwright",
@@ -57,6 +57,7 @@
57
57
  "nodemailer": "^7.0.3",
58
58
  "patch-package": "^8.0.0",
59
59
  "recharts": "^2.15.1",
60
+ "ua-parser-js": "^2.0.3",
60
61
  "zod": "^3.24.2"
61
62
  },
62
63
  "devDependencies": {