@checkly/playwright-reporter 0.1.6 → 0.1.8
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/index.d.ts +55 -137
- package/dist/index.js +1057 -1
- package/package.json +13 -42
- package/README.md +0 -291
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
export { Asset, AssetCollector, ZipEntry, ZipResult, Zipper, ZipperOptions } from '@checkly/reporter-utils';
|
|
2
|
+
import { FullConfig, Suite, JSONReport as JSONReport$1, JSONReportSuite as JSONReportSuite$1, JSONReportSpec as JSONReportSpec$1, JSONReportTest as JSONReportTest$1, JSONReportTestResult as JSONReportTestResult$1, Reporter, TestCase, TestResult, TestError } from '@playwright/test/reporter';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Checkly environment for API endpoints
|
|
@@ -82,112 +83,62 @@ interface ChecklyReporterOptions {
|
|
|
82
83
|
sessionName?: SessionNameOption;
|
|
83
84
|
}
|
|
84
85
|
/**
|
|
85
|
-
*
|
|
86
|
+
* Warning types that can be attached to test results
|
|
86
87
|
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Relative path within the ZIP archive
|
|
94
|
-
*/
|
|
95
|
-
archivePath: string;
|
|
88
|
+
type ChecklyWarningType = 'trace-off' | 'trace-retained-on-failure' | 'trace-first-retry-only' | 'trace-retries-only' | 'trace-retained-on-first-failure' | 'trace-missing';
|
|
89
|
+
/**
|
|
90
|
+
* A warning attached to a test result
|
|
91
|
+
*/
|
|
92
|
+
interface ChecklyWarning {
|
|
96
93
|
/**
|
|
97
|
-
* Type of
|
|
94
|
+
* Type of warning for programmatic handling
|
|
98
95
|
*/
|
|
99
|
-
type:
|
|
96
|
+
type: ChecklyWarningType;
|
|
100
97
|
/**
|
|
101
|
-
*
|
|
98
|
+
* Human-readable warning message
|
|
102
99
|
*/
|
|
103
|
-
|
|
100
|
+
message: string;
|
|
104
101
|
}
|
|
105
102
|
/**
|
|
106
|
-
*
|
|
103
|
+
* Checkly-specific extensions added to JSONReportTestResult
|
|
107
104
|
*/
|
|
108
|
-
interface
|
|
105
|
+
interface ChecklyTestResultExtensions {
|
|
109
106
|
/**
|
|
110
|
-
*
|
|
107
|
+
* Warnings about the test result (e.g., missing traces)
|
|
111
108
|
*/
|
|
112
|
-
|
|
109
|
+
warnings?: ChecklyWarning[];
|
|
113
110
|
}
|
|
114
111
|
/**
|
|
115
|
-
*
|
|
112
|
+
* Extended JSONReportTestResult with Checkly-specific data
|
|
116
113
|
*/
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
*/
|
|
121
|
-
zipPath: string;
|
|
122
|
-
/**
|
|
123
|
-
* Total size of ZIP file in bytes
|
|
124
|
-
*/
|
|
125
|
-
size: number;
|
|
126
|
-
/**
|
|
127
|
-
* Number of entries in ZIP
|
|
128
|
-
*/
|
|
129
|
-
entryCount: number;
|
|
130
|
-
/**
|
|
131
|
-
* Metadata about ZIP entries (for range-based access)
|
|
132
|
-
*/
|
|
133
|
-
entries: ZipEntry[];
|
|
134
|
-
}
|
|
114
|
+
type JSONReportTestResult = JSONReportTestResult$1 & {
|
|
115
|
+
_checkly?: ChecklyTestResultExtensions;
|
|
116
|
+
};
|
|
135
117
|
/**
|
|
136
|
-
*
|
|
118
|
+
* Extended JSONReportTest with Checkly-extended results
|
|
137
119
|
*/
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
*/
|
|
142
|
-
name: string;
|
|
143
|
-
/**
|
|
144
|
-
* Starting byte offset in ZIP file
|
|
145
|
-
*/
|
|
146
|
-
start: number;
|
|
147
|
-
/**
|
|
148
|
-
* Ending byte offset in ZIP file
|
|
149
|
-
*/
|
|
150
|
-
end: number;
|
|
151
|
-
}
|
|
152
|
-
|
|
120
|
+
type JSONReportTest = Omit<JSONReportTest$1, 'results'> & {
|
|
121
|
+
results: JSONReportTestResult[];
|
|
122
|
+
};
|
|
153
123
|
/**
|
|
154
|
-
*
|
|
124
|
+
* Extended JSONReportSpec with Checkly-extended tests
|
|
155
125
|
*/
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
*/
|
|
173
|
-
private shouldSkipFile;
|
|
174
|
-
/**
|
|
175
|
-
* Creates an Asset object from file path
|
|
176
|
-
*/
|
|
177
|
-
private createAsset;
|
|
178
|
-
/**
|
|
179
|
-
* Determines asset type and content type from file extension
|
|
180
|
-
*/
|
|
181
|
-
private determineAssetType;
|
|
182
|
-
/**
|
|
183
|
-
* Gets content type for image files
|
|
184
|
-
*/
|
|
185
|
-
private getImageContentType;
|
|
186
|
-
/**
|
|
187
|
-
* Gets content type for video files
|
|
188
|
-
*/
|
|
189
|
-
private getVideoContentType;
|
|
190
|
-
}
|
|
126
|
+
type JSONReportSpec = Omit<JSONReportSpec$1, 'tests'> & {
|
|
127
|
+
tests: JSONReportTest[];
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Extended JSONReportSuite with Checkly-extended specs and nested suites
|
|
131
|
+
*/
|
|
132
|
+
type JSONReportSuite = Omit<JSONReportSuite$1, 'suites' | 'specs'> & {
|
|
133
|
+
suites?: JSONReportSuite[];
|
|
134
|
+
specs: JSONReportSpec[];
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Extended JSONReport with Checkly-extended suites
|
|
138
|
+
*/
|
|
139
|
+
type JSONReport = Omit<JSONReport$1, 'suites'> & {
|
|
140
|
+
suites: JSONReportSuite[];
|
|
141
|
+
};
|
|
191
142
|
|
|
192
143
|
/**
|
|
193
144
|
* Checkly Playwright Reporter
|
|
@@ -215,12 +166,19 @@ declare class ChecklyReporter implements Reporter {
|
|
|
215
166
|
private testSession?;
|
|
216
167
|
private startTime?;
|
|
217
168
|
private testCounts;
|
|
169
|
+
private stepsMap;
|
|
170
|
+
private warningsMap;
|
|
218
171
|
constructor(options?: ChecklyReporterOptions);
|
|
219
172
|
/**
|
|
220
173
|
* Resolves the session name from options
|
|
221
174
|
* Supports string, callback function, or falls back to default
|
|
222
175
|
*/
|
|
223
176
|
private resolveSessionName;
|
|
177
|
+
/**
|
|
178
|
+
* Checks if test result has a trace attachment and adds context-aware warning if missing
|
|
179
|
+
* The warning type depends on the trace configuration and test result state
|
|
180
|
+
*/
|
|
181
|
+
private checkTraceAttachment;
|
|
224
182
|
/**
|
|
225
183
|
* Called once before running tests
|
|
226
184
|
* Creates test session in Checkly if credentials provided
|
|
@@ -228,7 +186,7 @@ declare class ChecklyReporter implements Reporter {
|
|
|
228
186
|
onBegin(config: FullConfig, suite: Suite): void;
|
|
229
187
|
/**
|
|
230
188
|
* Called for each test when it completes
|
|
231
|
-
*
|
|
189
|
+
* Captures steps and warnings, tracks test results for final status calculation
|
|
232
190
|
*/
|
|
233
191
|
onTestEnd(test: TestCase, result: TestResult): void;
|
|
234
192
|
/**
|
|
@@ -237,6 +195,11 @@ declare class ChecklyReporter implements Reporter {
|
|
|
237
195
|
*/
|
|
238
196
|
onEnd(): Promise<void>;
|
|
239
197
|
private printSummary;
|
|
198
|
+
/**
|
|
199
|
+
* Injects captured steps and warnings into the JSON report
|
|
200
|
+
* Traverses the report structure and matches by test ID + retry
|
|
201
|
+
*/
|
|
202
|
+
private injectDataIntoReport;
|
|
240
203
|
/**
|
|
241
204
|
* Uploads test results to Checkly API
|
|
242
205
|
*/
|
|
@@ -247,49 +210,4 @@ declare class ChecklyReporter implements Reporter {
|
|
|
247
210
|
onError(error: TestError): void;
|
|
248
211
|
}
|
|
249
212
|
|
|
250
|
-
|
|
251
|
-
* Creates ZIP archives containing test reports and assets
|
|
252
|
-
* Uses Checkly's fork of node-archiver with byte offset tracking
|
|
253
|
-
*/
|
|
254
|
-
declare class Zipper {
|
|
255
|
-
private outputPath;
|
|
256
|
-
constructor(options: ZipperOptions);
|
|
257
|
-
/**
|
|
258
|
-
* Creates a ZIP archive containing the JSON report and assets
|
|
259
|
-
* @param reportPath - Path to the JSON report file
|
|
260
|
-
* @param assets - Array of assets to include in the ZIP
|
|
261
|
-
* @returns ZIP creation result with metadata
|
|
262
|
-
*/
|
|
263
|
-
createZip(reportPath: string, assets: Asset[]): Promise<ZipResult>;
|
|
264
|
-
/**
|
|
265
|
-
* Transforms the JSON report to use relative paths for attachments
|
|
266
|
-
* This ensures the UI can map attachment paths to ZIP entries
|
|
267
|
-
* @param reportPath - Path to the original JSON report
|
|
268
|
-
* @returns Path to the transformed JSON report (in temp directory)
|
|
269
|
-
*/
|
|
270
|
-
private transformJsonReport;
|
|
271
|
-
/**
|
|
272
|
-
* Recursively transforms attachment paths in the report structure
|
|
273
|
-
* Converts absolute paths to relative paths matching ZIP structure
|
|
274
|
-
* @param obj - Object to transform (mutated in place)
|
|
275
|
-
*/
|
|
276
|
-
private transformAttachmentPaths;
|
|
277
|
-
/**
|
|
278
|
-
* Normalizes attachment paths by extracting the relevant snapshot directory portion.
|
|
279
|
-
* Supports Playwright's default and common custom snapshot directory patterns.
|
|
280
|
-
*
|
|
281
|
-
* Priority order (first match wins):
|
|
282
|
-
* 1. test-results/ (highest priority, existing behavior)
|
|
283
|
-
* 2. *-snapshots/ (Playwright default pattern)
|
|
284
|
-
* 3. __screenshots__/ (common custom pattern)
|
|
285
|
-
* 4. __snapshots__/ (common custom pattern)
|
|
286
|
-
* 5. screenshots/ (simple custom pattern)
|
|
287
|
-
* 6. snapshots/ (simple custom pattern)
|
|
288
|
-
*
|
|
289
|
-
* @param attachmentPath - Absolute or relative path to attachment
|
|
290
|
-
* @returns Normalized path starting from the matched directory, or original path if no match
|
|
291
|
-
*/
|
|
292
|
-
private normalizeAttachmentPath;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
export { type Asset, AssetCollector, ChecklyReporter, type ChecklyReporterOptions, type ZipEntry, type ZipResult, Zipper, type ZipperOptions, ChecklyReporter as default };
|
|
213
|
+
export { ChecklyReporter, type ChecklyReporterOptions, type ChecklyTestResultExtensions, type ChecklyWarning, type ChecklyWarningType, type JSONReport, type JSONReportSpec, type JSONReportSuite, type JSONReportTest, type JSONReportTestResult, ChecklyReporter as default };
|