@arghajit/dummy 0.1.2-beta-9 → 0.1.2-beta-10
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/dist/reporter/attachment-utils.d.ts +27 -9
- package/dist/reporter/attachment-utils.js +34 -62
- package/dist/reporter/index.d.ts +0 -2
- package/dist/reporter/index.js +0 -3
- package/dist/reporter/playwright-pulse-reporter.d.ts +110 -29
- package/dist/reporter/playwright-pulse-reporter.js +311 -531
- package/package.json +1 -1
|
@@ -1,10 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
interface PwTestResult {
|
|
2
|
+
retry: number;
|
|
3
|
+
attachments: Array<{
|
|
4
|
+
name: string;
|
|
5
|
+
contentType?: string;
|
|
6
|
+
path?: string;
|
|
7
|
+
body?: any;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
10
|
+
interface PlaywrightPulseReporterOptions {
|
|
11
|
+
outputDir?: string;
|
|
12
|
+
outputFile?: string;
|
|
13
|
+
base64Images?: boolean;
|
|
14
|
+
open?: boolean;
|
|
15
|
+
resetOnEachRun?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface TestResult {
|
|
18
|
+
screenshots?: string[];
|
|
19
|
+
videoPath?: string[];
|
|
20
|
+
tracePath?: string;
|
|
21
|
+
attachments?: Array<{
|
|
22
|
+
name: string;
|
|
23
|
+
path: string;
|
|
24
|
+
contentType?: string;
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
10
27
|
export declare function attachFiles(testId: string, pwResult: PwTestResult, pulseResult: TestResult, config: PlaywrightPulseReporterOptions): void;
|
|
28
|
+
export {};
|
|
@@ -1,53 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.attachFiles = attachFiles;
|
|
37
|
-
const path =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
4
|
+
const path = {
|
|
5
|
+
resolve: (...paths) => paths.join("/"),
|
|
6
|
+
join: (...paths) => paths.join("/"),
|
|
7
|
+
extname: (p) => {
|
|
8
|
+
const parts = p.split(".");
|
|
9
|
+
return parts.length > 1 ? "." + parts.pop() : "";
|
|
10
|
+
},
|
|
11
|
+
basename: (p, ext) => {
|
|
12
|
+
const base = p.split("/").pop() || "";
|
|
13
|
+
return ext ? base.replace(ext, "") : base;
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
const fs = {
|
|
17
|
+
existsSync: (path) => {
|
|
18
|
+
console.log(`Checking if ${path} exists`);
|
|
19
|
+
return false;
|
|
20
|
+
},
|
|
21
|
+
mkdirSync: (path, options) => {
|
|
22
|
+
console.log(`Creating directory ${path}`);
|
|
23
|
+
},
|
|
24
|
+
readFileSync: (path, encoding) => {
|
|
25
|
+
console.log(`Reading file ${path}`);
|
|
26
|
+
return "";
|
|
27
|
+
},
|
|
28
|
+
copyFileSync: (src, dest) => {
|
|
29
|
+
console.log(`Copying ${src} to ${dest}`);
|
|
30
|
+
},
|
|
31
|
+
writeFileSync: (path, data) => {
|
|
32
|
+
console.log(`Writing to ${path}`);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
const ATTACHMENTS_SUBDIR = "attachments";
|
|
47
36
|
function attachFiles(testId, pwResult, pulseResult, config) {
|
|
48
37
|
const baseReportDir = config.outputDir || "pulse-report";
|
|
49
38
|
const attachmentsBaseDir = path.resolve(baseReportDir, ATTACHMENTS_SUBDIR);
|
|
50
|
-
const attachmentsSubFolder = testId.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
39
|
+
const attachmentsSubFolder = `${testId}-retry-${pwResult.retry || 0}`.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
51
40
|
const testAttachmentsDir = path.join(attachmentsBaseDir, attachmentsSubFolder);
|
|
52
41
|
try {
|
|
53
42
|
if (!fs.existsSync(testAttachmentsDir)) {
|
|
@@ -61,7 +50,6 @@ function attachFiles(testId, pwResult, pulseResult, config) {
|
|
|
61
50
|
if (!pwResult.attachments)
|
|
62
51
|
return;
|
|
63
52
|
const { base64Images } = config;
|
|
64
|
-
// --- MODIFICATION: Initialize all attachment arrays to prevent errors ---
|
|
65
53
|
pulseResult.screenshots = [];
|
|
66
54
|
pulseResult.videoPath = [];
|
|
67
55
|
pulseResult.attachments = [];
|
|
@@ -91,15 +79,10 @@ function attachFiles(testId, pwResult, pulseResult, config) {
|
|
|
91
79
|
handleAttachment(attachmentPath, body, fullPath, relativePath, "tracePath", pulseResult, attachment);
|
|
92
80
|
}
|
|
93
81
|
else {
|
|
94
|
-
// --- MODIFICATION: Enabled handling for all other file types ---
|
|
95
82
|
handleAttachment(attachmentPath, body, fullPath, relativePath, "attachments", pulseResult, attachment);
|
|
96
83
|
}
|
|
97
84
|
});
|
|
98
85
|
}
|
|
99
|
-
/**
|
|
100
|
-
* Handles image attachments, either embedding as base64 or copying the file.
|
|
101
|
-
* (This function is unchanged)
|
|
102
|
-
*/
|
|
103
86
|
function handleImage(attachmentPath, body, base64Embed, fullPath, relativePath, pulseResult, attachmentName) {
|
|
104
87
|
let screenshotData = undefined;
|
|
105
88
|
if (attachmentPath) {
|
|
@@ -135,12 +118,7 @@ function handleImage(attachmentPath, body, base64Embed, fullPath, relativePath,
|
|
|
135
118
|
pulseResult.screenshots.push(screenshotData);
|
|
136
119
|
}
|
|
137
120
|
}
|
|
138
|
-
|
|
139
|
-
* Handles non-image attachments by copying the file or writing the buffer.
|
|
140
|
-
*/
|
|
141
|
-
function handleAttachment(attachmentPath, body, fullPath, relativePath, resultKey, // MODIFIED: Added 'attachments'
|
|
142
|
-
pulseResult, originalAttachment // MODIFIED: Pass original attachment
|
|
143
|
-
) {
|
|
121
|
+
function handleAttachment(attachmentPath, body, fullPath, relativePath, resultKey, pulseResult, originalAttachment) {
|
|
144
122
|
var _a, _b;
|
|
145
123
|
try {
|
|
146
124
|
if (attachmentPath) {
|
|
@@ -149,7 +127,6 @@ pulseResult, originalAttachment // MODIFIED: Pass original attachment
|
|
|
149
127
|
else if (body) {
|
|
150
128
|
fs.writeFileSync(fullPath, body);
|
|
151
129
|
}
|
|
152
|
-
// --- MODIFICATION: Logic to handle different properties correctly ---
|
|
153
130
|
switch (resultKey) {
|
|
154
131
|
case "videoPath":
|
|
155
132
|
(_a = pulseResult.videoPath) === null || _a === void 0 ? void 0 : _a.push(relativePath);
|
|
@@ -170,11 +147,6 @@ pulseResult, originalAttachment // MODIFIED: Pass original attachment
|
|
|
170
147
|
console.error(`Pulse Reporter: Failed to copy/write attachment to ${fullPath}. Error: ${error.message}`);
|
|
171
148
|
}
|
|
172
149
|
}
|
|
173
|
-
/**
|
|
174
|
-
* Determines a file extension based on content type.
|
|
175
|
-
* @param contentType The MIME type string.
|
|
176
|
-
* @returns A file extension string.
|
|
177
|
-
*/
|
|
178
150
|
function getFileExtension(contentType) {
|
|
179
151
|
var _a;
|
|
180
152
|
if (!contentType)
|
package/dist/reporter/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { PlaywrightPulseReporter } from "./playwright-pulse-reporter";
|
|
2
2
|
export default PlaywrightPulseReporter;
|
|
3
3
|
export { PlaywrightPulseReporter };
|
|
4
|
-
export type { PlaywrightPulseReport } from "../lib/report-types";
|
|
5
|
-
export type { TestResult, TestRun, TestStep, TestStatus } from "../types";
|
package/dist/reporter/index.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PlaywrightPulseReporter = void 0;
|
|
4
|
-
// src/reporter/index.ts
|
|
5
4
|
const playwright_pulse_reporter_1 = require("./playwright-pulse-reporter");
|
|
6
5
|
Object.defineProperty(exports, "PlaywrightPulseReporter", { enumerable: true, get: function () { return playwright_pulse_reporter_1.PlaywrightPulseReporter; } });
|
|
7
|
-
// Export the reporter class as the default export for CommonJS compatibility
|
|
8
|
-
// and also as a named export for potential ES module consumers.
|
|
9
6
|
exports.default = playwright_pulse_reporter_1.PlaywrightPulseReporter;
|
|
@@ -1,39 +1,120 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
interface FullConfig {
|
|
2
|
+
workers: number;
|
|
3
|
+
outputDir?: string;
|
|
4
|
+
shard?: {
|
|
5
|
+
current: number;
|
|
6
|
+
};
|
|
7
|
+
projects: Array<{
|
|
8
|
+
name?: string;
|
|
9
|
+
}>;
|
|
10
|
+
metadata?: any;
|
|
11
|
+
configFile?: string;
|
|
12
|
+
}
|
|
13
|
+
interface FullResult {
|
|
14
|
+
status: string;
|
|
15
|
+
duration: number;
|
|
16
|
+
}
|
|
17
|
+
interface Reporter {
|
|
18
|
+
onBegin?(config: FullConfig, suite: Suite): void;
|
|
19
|
+
onTestEnd?(test: TestCase, result: PwTestResult): void | Promise<void>;
|
|
20
|
+
onEnd?(result: FullResult): void | Promise<void>;
|
|
21
|
+
onError?(error: Error): void;
|
|
22
|
+
printsToStdio?(): boolean;
|
|
23
|
+
}
|
|
24
|
+
interface Suite {
|
|
25
|
+
}
|
|
26
|
+
interface TestCase {
|
|
27
|
+
id: string;
|
|
28
|
+
title: string;
|
|
29
|
+
tags: string[];
|
|
30
|
+
location?: {
|
|
31
|
+
file: string;
|
|
32
|
+
line: number;
|
|
33
|
+
column: number;
|
|
34
|
+
};
|
|
35
|
+
titlePath(): string[];
|
|
36
|
+
parent?: {
|
|
37
|
+
title?: string;
|
|
38
|
+
project?(): any;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
interface PwTestResult {
|
|
42
|
+
status: "passed" | "failed" | "timedOut" | "skipped" | "interrupted";
|
|
43
|
+
duration: number;
|
|
44
|
+
startTime: Date;
|
|
45
|
+
retry: number;
|
|
46
|
+
workerIndex: number;
|
|
47
|
+
stdout: Array<string | any>;
|
|
48
|
+
stderr: Array<string | any>;
|
|
49
|
+
error?: {
|
|
50
|
+
message?: string;
|
|
51
|
+
stack?: string;
|
|
52
|
+
snippet?: string;
|
|
53
|
+
};
|
|
54
|
+
steps: PwStep[];
|
|
55
|
+
attachments: Array<{
|
|
56
|
+
name: string;
|
|
57
|
+
contentType?: string;
|
|
58
|
+
path?: string;
|
|
59
|
+
body?: any;
|
|
60
|
+
}>;
|
|
61
|
+
}
|
|
62
|
+
interface PwStep {
|
|
63
|
+
title: string;
|
|
64
|
+
category: string;
|
|
65
|
+
startTime: Date;
|
|
66
|
+
duration: number;
|
|
67
|
+
error?: {
|
|
68
|
+
message?: string;
|
|
69
|
+
stack?: string;
|
|
70
|
+
snippet?: string;
|
|
71
|
+
};
|
|
72
|
+
count?: number;
|
|
73
|
+
location?: {
|
|
74
|
+
file: string;
|
|
75
|
+
line: number;
|
|
76
|
+
column: number;
|
|
77
|
+
};
|
|
78
|
+
steps?: PwStep[];
|
|
79
|
+
}
|
|
80
|
+
type PulseTestStatus = "passed" | "failed" | "skipped" | "flaky";
|
|
81
|
+
interface PulseTestStep {
|
|
82
|
+
title: string;
|
|
83
|
+
category: string;
|
|
84
|
+
startTime: Date;
|
|
85
|
+
duration: number;
|
|
86
|
+
error?: {
|
|
87
|
+
message: string;
|
|
88
|
+
stack?: string;
|
|
89
|
+
snippet?: string;
|
|
90
|
+
};
|
|
91
|
+
count: number;
|
|
92
|
+
location?: string;
|
|
93
|
+
status: PulseTestStatus;
|
|
94
|
+
}
|
|
95
|
+
interface PlaywrightPulseReporterOptions {
|
|
96
|
+
outputDir?: string;
|
|
97
|
+
outputFile?: string;
|
|
98
|
+
base64Images?: boolean;
|
|
99
|
+
open?: boolean;
|
|
100
|
+
resetOnEachRun?: boolean;
|
|
101
|
+
}
|
|
3
102
|
export declare class PlaywrightPulseReporter implements Reporter {
|
|
4
|
-
private
|
|
5
|
-
private suite;
|
|
6
|
-
private results;
|
|
7
|
-
private runStartTime;
|
|
8
|
-
private options;
|
|
9
|
-
private outputDir;
|
|
10
|
-
private attachmentsDir;
|
|
11
|
-
private baseOutputFile;
|
|
12
|
-
private isSharded;
|
|
13
|
-
private shardIndex;
|
|
14
|
-
private resetOnEachRun;
|
|
103
|
+
private testResults;
|
|
15
104
|
private currentRunId;
|
|
105
|
+
private outputDir;
|
|
106
|
+
private totalWorkers;
|
|
107
|
+
private shardIndex?;
|
|
108
|
+
private options;
|
|
16
109
|
constructor(options?: PlaywrightPulseReporterOptions);
|
|
17
110
|
printsToStdio(): boolean;
|
|
18
111
|
onBegin(config: FullConfig, suite: Suite): void;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
private processStep;
|
|
112
|
+
getBrowserDetails(project: any): string;
|
|
113
|
+
processStep(step: PwStep): Promise<PulseTestStep>;
|
|
22
114
|
onTestEnd(test: TestCase, result: PwTestResult): Promise<void>;
|
|
23
|
-
private _getBaseTestId;
|
|
24
|
-
private _getStatusOrder;
|
|
25
|
-
/**
|
|
26
|
-
* Groups all run attempts for a single logical test case and creates consolidated test results.
|
|
27
|
-
* This matches Playwright's default structure where retry attempts are grouped under one test entry.
|
|
28
|
-
* @param allAttempts An array of all individual test run attempts.
|
|
29
|
-
* @returns An array of ConsolidatedTestResult objects, where each object represents one logical test with all its retry attempts.
|
|
30
|
-
*/
|
|
31
115
|
private _getFinalizedResults;
|
|
32
|
-
/**
|
|
33
|
-
* Helper method to get summary statistics from consolidated results
|
|
34
|
-
*/
|
|
35
116
|
private _getSummaryStats;
|
|
36
|
-
onError(error:
|
|
117
|
+
onError(error: Error): void;
|
|
37
118
|
private _getEnvDetails;
|
|
38
119
|
private _writeShardResults;
|
|
39
120
|
private _mergeShardResults;
|
|
@@ -42,4 +123,4 @@ export declare class PlaywrightPulseReporter implements Reporter {
|
|
|
42
123
|
onEnd(result: FullResult): Promise<void>;
|
|
43
124
|
private _mergeAllRunReports;
|
|
44
125
|
}
|
|
45
|
-
export
|
|
126
|
+
export {};
|