@checkly/playwright-reporter 0.1.10 → 1.0.1
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/CHANGELOG.md +49 -0
- package/README.md +266 -0
- package/dist/index.d.ts +360 -267
- package/dist/index.js +1691 -781
- package/package.json +17 -14
package/dist/index.d.ts
CHANGED
|
@@ -1,308 +1,401 @@
|
|
|
1
|
-
|
|
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';
|
|
1
|
+
import { Reporter, FullConfig, Suite as Suite$1, TestCase, TestResult as TestResult$1, TestStep as TestStep$1, TestError as TestError$1, FullResult } from '@playwright/test/reporter';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
4
|
+
* Output Contract Schema
|
|
5
|
+
*
|
|
6
|
+
* This defines the JSON structure that our reporter MUST produce.
|
|
7
|
+
* It is designed to be compatible with Playwright 1.40 through 1.57+.
|
|
8
|
+
*
|
|
9
|
+
* Fields are categorized as:
|
|
10
|
+
* - REQUIRED: Must always be present (exist in all versions 1.40+)
|
|
11
|
+
* - OPTIONAL: May be present (added in newer versions, older consumers ignore them)
|
|
10
12
|
*/
|
|
11
|
-
interface SessionNameContext {
|
|
12
|
-
/**
|
|
13
|
-
* The directory name where tests are running
|
|
14
|
-
*/
|
|
15
|
-
directoryName: string;
|
|
16
|
-
/**
|
|
17
|
-
* Playwright's full configuration object
|
|
18
|
-
*/
|
|
19
|
-
config: FullConfig;
|
|
20
|
-
/**
|
|
21
|
-
* The root test suite containing all tests
|
|
22
|
-
*/
|
|
23
|
-
suite: Suite;
|
|
24
|
-
}
|
|
25
13
|
/**
|
|
26
|
-
*
|
|
14
|
+
* Individual test run status
|
|
27
15
|
*/
|
|
28
|
-
type
|
|
16
|
+
type TestStatus = 'passed' | 'failed' | 'skipped' | 'timedOut' | 'interrupted';
|
|
29
17
|
/**
|
|
30
|
-
*
|
|
18
|
+
* Overall test outcome (aggregated across retries)
|
|
31
19
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
accountId?: string;
|
|
38
|
-
/**
|
|
39
|
-
* Checkly API key for authentication
|
|
40
|
-
* Required for Phase 2 (upload functionality)
|
|
41
|
-
*/
|
|
42
|
-
apiKey?: string;
|
|
43
|
-
/**
|
|
44
|
-
* Checkly environment to use
|
|
45
|
-
* Can also be set via CHECKLY_ENV environment variable
|
|
46
|
-
* @default 'production'
|
|
47
|
-
*/
|
|
48
|
-
environment?: ChecklyEnvironment;
|
|
49
|
-
/**
|
|
50
|
-
* Output path for the generated ZIP file (for testing/debugging)
|
|
51
|
-
* @default 'checkly-report.zip'
|
|
52
|
-
* @internal
|
|
53
|
-
*/
|
|
54
|
-
outputPath?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Path to the JSON report file generated by Playwright's json reporter
|
|
57
|
-
* @default 'test-results/playwright-test-report.json'
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
|
-
jsonReportPath?: string;
|
|
61
|
-
/**
|
|
62
|
-
* Directory containing test results and assets
|
|
63
|
-
* @default 'test-results'
|
|
64
|
-
* @internal
|
|
65
|
-
*/
|
|
66
|
-
testResultsDir?: string;
|
|
67
|
-
/**
|
|
68
|
-
* Dry run mode - skips API calls and only creates local ZIP file
|
|
69
|
-
* @default false
|
|
70
|
-
*/
|
|
71
|
-
dryRun?: boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Custom name for the test session
|
|
74
|
-
* Can be a string or a callback function for dynamic names
|
|
75
|
-
* @default 'Playwright Test Session: {directoryName}'
|
|
76
|
-
* @example
|
|
77
|
-
* // Static string
|
|
78
|
-
* sessionName: 'My E2E Tests'
|
|
79
|
-
*
|
|
80
|
-
* // Dynamic with callback
|
|
81
|
-
* sessionName: ({ directoryName, config }) => `E2E: ${directoryName} (${config.projects.length} projects)`
|
|
82
|
-
*/
|
|
83
|
-
sessionName?: SessionNameOption;
|
|
84
|
-
/**
|
|
85
|
-
* Enable verbose logging for debugging
|
|
86
|
-
* Logs detailed information about each phase of report generation
|
|
87
|
-
* Can also be enabled via CHECKLY_REPORTER_VERBOSE=true environment variable
|
|
88
|
-
* @default false
|
|
89
|
-
*/
|
|
90
|
-
verbose?: boolean;
|
|
20
|
+
type TestOutcome = 'expected' | 'unexpected' | 'skipped' | 'flaky';
|
|
21
|
+
interface Location {
|
|
22
|
+
file: string;
|
|
23
|
+
line: number;
|
|
24
|
+
column: number;
|
|
91
25
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
26
|
+
interface TestError {
|
|
27
|
+
message?: string;
|
|
28
|
+
stack?: string;
|
|
29
|
+
location?: Location;
|
|
30
|
+
snippet?: string;
|
|
31
|
+
value?: string;
|
|
32
|
+
matcherResult?: unknown;
|
|
33
|
+
}
|
|
34
|
+
interface Attachment {
|
|
35
|
+
name: string;
|
|
36
|
+
contentType: string;
|
|
37
|
+
path?: string;
|
|
38
|
+
body?: string;
|
|
39
|
+
}
|
|
40
|
+
interface TestStep {
|
|
41
|
+
title: string;
|
|
42
|
+
duration: number;
|
|
43
|
+
error?: TestError;
|
|
44
|
+
steps?: TestStep[];
|
|
45
|
+
}
|
|
46
|
+
interface Annotation {
|
|
47
|
+
type: string;
|
|
48
|
+
description?: string;
|
|
49
|
+
location?: {
|
|
50
|
+
file: string;
|
|
51
|
+
line: number;
|
|
52
|
+
column: number;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
interface TestResult {
|
|
56
|
+
workerIndex: number;
|
|
57
|
+
parallelIndex: number;
|
|
58
|
+
status: TestStatus;
|
|
59
|
+
duration: number;
|
|
60
|
+
startTime: string;
|
|
61
|
+
retry: number;
|
|
62
|
+
errors: TestError[];
|
|
63
|
+
error?: TestError;
|
|
64
|
+
errorLocation?: Location;
|
|
65
|
+
stdout: Array<{
|
|
66
|
+
text: string;
|
|
67
|
+
} | {
|
|
68
|
+
buffer: string;
|
|
69
|
+
}>;
|
|
70
|
+
stderr: Array<{
|
|
71
|
+
text: string;
|
|
72
|
+
} | {
|
|
73
|
+
buffer: string;
|
|
74
|
+
}>;
|
|
75
|
+
attachments: Attachment[];
|
|
76
|
+
steps?: TestStep[];
|
|
77
|
+
annotations: Annotation[];
|
|
78
|
+
}
|
|
79
|
+
interface Test {
|
|
80
|
+
projectId: string;
|
|
81
|
+
projectName: string;
|
|
82
|
+
timeout: number;
|
|
83
|
+
expectedStatus: TestStatus;
|
|
84
|
+
annotations: Annotation[];
|
|
85
|
+
results: TestResult[];
|
|
86
|
+
status: TestOutcome;
|
|
87
|
+
}
|
|
88
|
+
interface Spec {
|
|
89
|
+
id: string;
|
|
90
|
+
title: string;
|
|
91
|
+
file: string;
|
|
92
|
+
line: number;
|
|
93
|
+
column: number;
|
|
94
|
+
tags: string[];
|
|
95
|
+
ok: boolean;
|
|
96
|
+
tests: Test[];
|
|
97
|
+
}
|
|
98
|
+
interface Suite {
|
|
99
|
+
title: string;
|
|
100
|
+
file: string;
|
|
101
|
+
line: number;
|
|
102
|
+
column: number;
|
|
103
|
+
specs: Spec[];
|
|
104
|
+
suites?: Suite[];
|
|
105
|
+
}
|
|
106
|
+
interface ProjectConfig {
|
|
107
|
+
id: string;
|
|
108
|
+
name: string;
|
|
109
|
+
testDir: string;
|
|
110
|
+
outputDir: string;
|
|
111
|
+
timeout: number;
|
|
112
|
+
retries: number;
|
|
113
|
+
repeatEach: number;
|
|
114
|
+
metadata: Record<string, unknown>;
|
|
115
|
+
testMatch: string[];
|
|
116
|
+
testIgnore: string[];
|
|
117
|
+
}
|
|
118
|
+
interface ReportConfig {
|
|
119
|
+
rootDir: string;
|
|
120
|
+
configFile?: string;
|
|
121
|
+
version: string;
|
|
122
|
+
workers: number;
|
|
123
|
+
fullyParallel: boolean;
|
|
124
|
+
forbidOnly: boolean;
|
|
125
|
+
globalTimeout: number;
|
|
126
|
+
maxFailures: number;
|
|
127
|
+
projects: ProjectConfig[];
|
|
128
|
+
shard?: {
|
|
129
|
+
current: number;
|
|
130
|
+
total: number;
|
|
131
|
+
} | null;
|
|
132
|
+
metadata: Record<string, unknown>;
|
|
133
|
+
tags?: string[];
|
|
134
|
+
updateSourceMethod?: string;
|
|
135
|
+
preserveOutput?: string;
|
|
136
|
+
quiet?: boolean;
|
|
137
|
+
reportSlowTests?: {
|
|
138
|
+
max: number;
|
|
139
|
+
threshold: number;
|
|
140
|
+
} | null;
|
|
141
|
+
webServer?: unknown;
|
|
142
|
+
globalSetup?: string | null;
|
|
143
|
+
globalTeardown?: string | null;
|
|
144
|
+
grep?: unknown;
|
|
145
|
+
grepInvert?: unknown;
|
|
146
|
+
reporter?: unknown;
|
|
147
|
+
updateSnapshots?: string;
|
|
148
|
+
}
|
|
149
|
+
interface Stats {
|
|
150
|
+
startTime: string;
|
|
151
|
+
duration: number;
|
|
152
|
+
expected: number;
|
|
153
|
+
unexpected: number;
|
|
154
|
+
flaky: number;
|
|
155
|
+
skipped: number;
|
|
156
|
+
}
|
|
157
|
+
interface JSONReport {
|
|
158
|
+
config: ReportConfig;
|
|
159
|
+
suites: Suite[];
|
|
160
|
+
errors: TestError[];
|
|
161
|
+
stats: Stats;
|
|
108
162
|
}
|
|
109
163
|
/**
|
|
110
|
-
*
|
|
164
|
+
* Type guard to check if an object is a valid JSONReport
|
|
111
165
|
*/
|
|
112
|
-
|
|
166
|
+
declare function isValidJSONReport(obj: unknown): obj is JSONReport;
|
|
113
167
|
/**
|
|
114
|
-
*
|
|
168
|
+
* Type guard to check if stats are valid
|
|
115
169
|
*/
|
|
116
|
-
|
|
117
|
-
url: string;
|
|
118
|
-
columnNumber: number;
|
|
119
|
-
lineNumber: number;
|
|
120
|
-
}
|
|
170
|
+
declare function isValidStats(obj: unknown): obj is Stats;
|
|
121
171
|
/**
|
|
122
|
-
*
|
|
123
|
-
* Matches the webapp's CheckRunNavigationTracePage.console array item type
|
|
172
|
+
* Type guard to check if a test result is valid
|
|
124
173
|
*/
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
*/
|
|
129
|
-
id: string;
|
|
130
|
-
/**
|
|
131
|
-
* Source location where the console message was triggered
|
|
132
|
-
*/
|
|
133
|
-
location: ConsoleMessageLocation;
|
|
134
|
-
/**
|
|
135
|
-
* The text content of the console message
|
|
136
|
-
*/
|
|
137
|
-
text: string;
|
|
174
|
+
declare function isValidTestResult(obj: unknown): obj is TestResult;
|
|
175
|
+
|
|
176
|
+
interface BaseReporterOptions {
|
|
138
177
|
/**
|
|
139
|
-
*
|
|
178
|
+
* Directory for output files. JSON report is written to `{outputDir}/checkly-report.json`.
|
|
140
179
|
*/
|
|
141
|
-
|
|
180
|
+
outputDir?: string;
|
|
142
181
|
/**
|
|
143
|
-
*
|
|
182
|
+
* @deprecated Use `outputDir` instead. Will be removed in next major version.
|
|
144
183
|
*/
|
|
145
|
-
|
|
184
|
+
outputFile?: string;
|
|
185
|
+
verbose?: boolean;
|
|
146
186
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
*/
|
|
151
|
-
interface NetworkRequest {
|
|
152
|
-
id: string;
|
|
153
|
-
url: string;
|
|
154
|
-
domain: string;
|
|
155
|
-
method: string;
|
|
156
|
-
resourceType: string;
|
|
157
|
-
statusCode: number;
|
|
158
|
-
statusText: string;
|
|
159
|
-
start: number;
|
|
160
|
-
startedAt: number;
|
|
161
|
-
finishedAt: number;
|
|
162
|
-
time: number;
|
|
163
|
-
hasFinished: boolean;
|
|
164
|
-
hasSucceeded: boolean;
|
|
165
|
-
requestHeaders: Record<string, string>;
|
|
166
|
-
responseHeaders: Record<string, string>;
|
|
167
|
-
transferBytes?: number;
|
|
168
|
-
resourceBytes?: number;
|
|
187
|
+
type LogFn = (message: string, data?: Record<string, unknown>) => void;
|
|
188
|
+
interface ExtensionContext$1 {
|
|
189
|
+
log: LogFn;
|
|
169
190
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
191
|
+
interface Extension$1 {
|
|
192
|
+
name: string;
|
|
193
|
+
onBegin?(ctx: ExtensionContext$1 & {
|
|
194
|
+
config: FullConfig;
|
|
195
|
+
suite: Suite$1;
|
|
196
|
+
}): void | Promise<void>;
|
|
197
|
+
onTestBegin?(ctx: ExtensionContext$1 & {
|
|
198
|
+
test: TestCase;
|
|
199
|
+
result: TestResult$1;
|
|
200
|
+
}): void | Promise<void>;
|
|
201
|
+
onStepBegin?(ctx: ExtensionContext$1 & {
|
|
202
|
+
test: TestCase;
|
|
203
|
+
result: TestResult$1;
|
|
204
|
+
step: TestStep$1;
|
|
205
|
+
}): void | Promise<void>;
|
|
206
|
+
onStepEnd?(ctx: ExtensionContext$1 & {
|
|
207
|
+
test: TestCase;
|
|
208
|
+
result: TestResult$1;
|
|
209
|
+
step: TestStep$1;
|
|
210
|
+
}): void | Promise<void>;
|
|
211
|
+
onTestEnd?(ctx: ExtensionContext$1 & {
|
|
212
|
+
test: TestCase;
|
|
213
|
+
result: TestResult$1;
|
|
214
|
+
}): void | Promise<void>;
|
|
215
|
+
onStdOut?(ctx: ExtensionContext$1 & {
|
|
216
|
+
chunk: string | Buffer;
|
|
217
|
+
test?: TestCase;
|
|
218
|
+
result?: TestResult$1;
|
|
219
|
+
}): void | Promise<void>;
|
|
220
|
+
onStdErr?(ctx: ExtensionContext$1 & {
|
|
221
|
+
chunk: string | Buffer;
|
|
222
|
+
test?: TestCase;
|
|
223
|
+
result?: TestResult$1;
|
|
224
|
+
}): void | Promise<void>;
|
|
225
|
+
onError?(ctx: ExtensionContext$1 & {
|
|
226
|
+
error: TestError$1;
|
|
227
|
+
}): void | Promise<void>;
|
|
228
|
+
onEnd?(ctx: ExtensionContext$1 & {
|
|
229
|
+
result: FullResult;
|
|
230
|
+
report: JSONReport;
|
|
231
|
+
addSummaryLine: (line: string) => void;
|
|
232
|
+
}): void | Promise<void>;
|
|
233
|
+
onExit?(ctx: ExtensionContext$1): void | Promise<void>;
|
|
234
|
+
}
|
|
235
|
+
declare class BaseReporter implements Reporter {
|
|
236
|
+
private config;
|
|
237
|
+
private suite;
|
|
238
|
+
private startTime;
|
|
239
|
+
private options;
|
|
240
|
+
private verbose;
|
|
241
|
+
private globalErrors;
|
|
242
|
+
private tests;
|
|
243
|
+
private expectedCount;
|
|
244
|
+
private unexpectedCount;
|
|
245
|
+
private flakyCount;
|
|
246
|
+
private skippedCount;
|
|
247
|
+
private _report;
|
|
248
|
+
private extensions;
|
|
249
|
+
private summaryLines;
|
|
250
|
+
private reconstructedProjects;
|
|
251
|
+
constructor(options?: BaseReporterOptions);
|
|
252
|
+
protected use(extension: Extension$1): this;
|
|
253
|
+
private log;
|
|
254
|
+
private createExtensionLogger;
|
|
255
|
+
onBegin(config: FullConfig, suite: Suite$1): void;
|
|
256
|
+
onTestBegin(test: TestCase, result: TestResult$1): void;
|
|
257
|
+
onStepBegin(test: TestCase, result: TestResult$1, step: TestStep$1): void;
|
|
258
|
+
onStepEnd(test: TestCase, result: TestResult$1, step: TestStep$1): void;
|
|
259
|
+
onTestEnd(test: TestCase, result: TestResult$1): void;
|
|
260
|
+
onStdOut(chunk: string | Buffer, test?: TestCase, result?: TestResult$1): void;
|
|
261
|
+
onStdErr(chunk: string | Buffer, test?: TestCase, result?: TestResult$1): void;
|
|
262
|
+
onError(error: TestError$1): void;
|
|
263
|
+
onEnd(result: FullResult): Promise<void>;
|
|
264
|
+
onExit(): Promise<void>;
|
|
265
|
+
printsToStdio(): boolean;
|
|
266
|
+
getReport(): JSONReport;
|
|
267
|
+
private buildReport;
|
|
268
|
+
/**
|
|
269
|
+
* Reconstructs projects from the suite structure when config.projects is empty.
|
|
270
|
+
* This handles the merge-reports scenario where Playwright doesn't populate
|
|
271
|
+
* config.projects but still provides project information via suite.project().
|
|
272
|
+
*/
|
|
273
|
+
private reconstructProjectsIfNeeded;
|
|
274
|
+
/**
|
|
275
|
+
* Recursively collects project information from test cases in the suite.
|
|
276
|
+
* Fallback for when suite.project() doesn't provide project info.
|
|
277
|
+
*/
|
|
278
|
+
private collectProjectsFromTests;
|
|
279
|
+
private serializeConfig;
|
|
280
|
+
private serializeProject;
|
|
281
|
+
/**
|
|
282
|
+
* Serialize suites following the same order as native Playwright JSON reporter.
|
|
283
|
+
* Iterates through suite tree structure (discovery order) rather than test completion order.
|
|
284
|
+
*/
|
|
285
|
+
private serializeSuites;
|
|
286
|
+
/**
|
|
287
|
+
* Recursively serialize a suite and its children.
|
|
288
|
+
* Returns null if the suite has no tests.
|
|
289
|
+
*/
|
|
290
|
+
private serializeSuite;
|
|
291
|
+
/**
|
|
292
|
+
* Merge tests from 'from' suite into 'to' suite (for multi-project scenarios).
|
|
293
|
+
* Matches native Playwright JSON reporter behavior - specs are NOT merged,
|
|
294
|
+
* each project gets its own spec even for the same test.
|
|
295
|
+
*/
|
|
296
|
+
private mergeSuites;
|
|
297
|
+
private serializeSpec;
|
|
298
|
+
/**
|
|
299
|
+
* Extract tags from test case - uses testCase.tags (1.42+) or extracts @tags from title
|
|
300
|
+
* Tags are returned without @ prefix to match native Playwright JSON reporter
|
|
301
|
+
*/
|
|
302
|
+
private extractTags;
|
|
303
|
+
private serializeTest;
|
|
304
|
+
/**
|
|
305
|
+
* Get the project name for a test case, handling merge-reports scenarios
|
|
306
|
+
* where project() may not be available in the expected way.
|
|
307
|
+
*/
|
|
308
|
+
private getProjectName;
|
|
309
|
+
private serializeTestResult;
|
|
310
|
+
private serializeStep;
|
|
311
|
+
private serializeError;
|
|
312
|
+
private serializeAnnotations;
|
|
313
|
+
private countTests;
|
|
314
|
+
private getFileName;
|
|
315
|
+
private mapOutcome;
|
|
316
|
+
private printSummary;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
type ChecklyEnvironment = 'local' | 'development' | 'staging' | 'production';
|
|
320
|
+
interface SessionNameContext {
|
|
321
|
+
directoryName: string;
|
|
322
|
+
config: FullConfig;
|
|
323
|
+
suite: Suite$1;
|
|
324
|
+
}
|
|
325
|
+
type SessionNameOption = string | ((context: SessionNameContext) => string);
|
|
326
|
+
interface ChecklyUploadOptions {
|
|
327
|
+
apiKey?: string;
|
|
328
|
+
accountId?: string;
|
|
329
|
+
environment?: ChecklyEnvironment;
|
|
330
|
+
sessionName?: SessionNameOption;
|
|
331
|
+
dryRun?: boolean;
|
|
174
332
|
/**
|
|
175
|
-
*
|
|
333
|
+
* Directory for assets and ZIP output. Defaults to Playwright's outputDir.
|
|
334
|
+
* - Assets (screenshots, videos, traces) are read from here
|
|
335
|
+
* - ZIP is written to `{outputDir}/checkly-report.zip`
|
|
176
336
|
*/
|
|
177
|
-
|
|
337
|
+
outputDir?: string;
|
|
178
338
|
/**
|
|
179
|
-
*
|
|
339
|
+
* @deprecated Use `outputDir` instead. Will be removed in next major version.
|
|
180
340
|
*/
|
|
181
|
-
|
|
341
|
+
testResultsDir?: string;
|
|
182
342
|
/**
|
|
183
|
-
*
|
|
343
|
+
* @deprecated ZIP is now written to `{outputDir}/checkly-report.zip`. Will be removed in next major version.
|
|
184
344
|
*/
|
|
185
|
-
|
|
345
|
+
outputPath?: string;
|
|
186
346
|
}
|
|
347
|
+
interface ExtensionContext {
|
|
348
|
+
log: LogFn;
|
|
349
|
+
}
|
|
350
|
+
interface Extension {
|
|
351
|
+
name: string;
|
|
352
|
+
onBegin?(ctx: ExtensionContext & {
|
|
353
|
+
config: FullConfig;
|
|
354
|
+
suite: Suite$1;
|
|
355
|
+
}): void | Promise<void>;
|
|
356
|
+
onTestEnd?(ctx: ExtensionContext & {
|
|
357
|
+
test: TestCase;
|
|
358
|
+
result: TestResult$1;
|
|
359
|
+
}): void | Promise<void>;
|
|
360
|
+
onEnd?(ctx: ExtensionContext & {
|
|
361
|
+
result: unknown;
|
|
362
|
+
report: JSONReport;
|
|
363
|
+
addSummaryLine: (line: string) => void;
|
|
364
|
+
}): void | Promise<void>;
|
|
365
|
+
}
|
|
366
|
+
declare function checklyUpload(options?: ChecklyUploadOptions): Extension;
|
|
367
|
+
|
|
187
368
|
/**
|
|
188
|
-
*
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
};
|
|
193
|
-
/**
|
|
194
|
-
* Extended JSONReportTest with Checkly-extended results
|
|
195
|
-
*/
|
|
196
|
-
type JSONReportTest = Omit<JSONReportTest$1, 'results'> & {
|
|
197
|
-
results: JSONReportTestResult[];
|
|
198
|
-
};
|
|
199
|
-
/**
|
|
200
|
-
* Extended JSONReportSpec with Checkly-extended tests
|
|
201
|
-
*/
|
|
202
|
-
type JSONReportSpec = Omit<JSONReportSpec$1, 'tests'> & {
|
|
203
|
-
tests: JSONReportTest[];
|
|
204
|
-
};
|
|
205
|
-
/**
|
|
206
|
-
* Extended JSONReportSuite with Checkly-extended specs and nested suites
|
|
369
|
+
* @checkly/playwright-reporter-next
|
|
370
|
+
*
|
|
371
|
+
* Standalone Playwright reporter for Checkly
|
|
372
|
+
* Compatible with Playwright 1.40 through 1.57+
|
|
207
373
|
*/
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
};
|
|
374
|
+
|
|
375
|
+
interface ChecklyReporterOptions extends BaseReporterOptions, ChecklyUploadOptions {
|
|
376
|
+
}
|
|
212
377
|
/**
|
|
213
|
-
*
|
|
378
|
+
* Full-featured reporter with all Checkly functionality.
|
|
379
|
+
* This is what Playwright loads when using the package.
|
|
214
380
|
*/
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
381
|
+
declare class ChecklyReporter extends BaseReporter {
|
|
382
|
+
constructor(options?: ChecklyReporterOptions);
|
|
383
|
+
}
|
|
218
384
|
|
|
219
385
|
/**
|
|
220
|
-
* Checkly
|
|
386
|
+
* Create a Checkly reporter configuration with full intellisense support.
|
|
221
387
|
*
|
|
222
|
-
*
|
|
223
|
-
* Designed to work alongside Playwright's built-in JSONReporter.
|
|
388
|
+
* Use this instead of the array-based syntax for better IDE experience.
|
|
224
389
|
*
|
|
225
390
|
* @example
|
|
226
|
-
*
|
|
391
|
+
* import { createChecklyReporter } from '@checkly/playwright-reporter'
|
|
392
|
+
*
|
|
227
393
|
* export default defineConfig({
|
|
228
394
|
* reporter: [
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
* accountId: process.env.CHECKLY_ACCOUNT_ID,
|
|
233
|
-
* }]
|
|
234
|
-
* ]
|
|
235
|
-
* });
|
|
395
|
+
* createChecklyReporter({ outputDir: 'test-results' }),
|
|
396
|
+
* ],
|
|
397
|
+
* })
|
|
236
398
|
*/
|
|
237
|
-
declare
|
|
238
|
-
private options;
|
|
239
|
-
private assetCollector;
|
|
240
|
-
private zipper;
|
|
241
|
-
private testResults?;
|
|
242
|
-
private testSession?;
|
|
243
|
-
private startTime?;
|
|
244
|
-
private testCounts;
|
|
245
|
-
private stepsMap;
|
|
246
|
-
private warningsMap;
|
|
247
|
-
private tracePathsMap;
|
|
248
|
-
private consoleMessagesMap;
|
|
249
|
-
private networkRequestsMap;
|
|
250
|
-
/**
|
|
251
|
-
* Log a message if verbose mode is enabled
|
|
252
|
-
*/
|
|
253
|
-
private log;
|
|
254
|
-
constructor(options?: ChecklyReporterOptions);
|
|
255
|
-
/**
|
|
256
|
-
* Resolves the session name from options
|
|
257
|
-
* Supports string, callback function, or falls back to default
|
|
258
|
-
*/
|
|
259
|
-
private resolveSessionName;
|
|
260
|
-
/**
|
|
261
|
-
* Checks if test result has a trace attachment and adds context-aware warning if missing
|
|
262
|
-
* Also captures trace file path for later console message extraction
|
|
263
|
-
* The warning type depends on the trace configuration and test result state
|
|
264
|
-
*/
|
|
265
|
-
private checkTraceAttachment;
|
|
266
|
-
/**
|
|
267
|
-
* Called once before running tests
|
|
268
|
-
* Creates test session in Checkly if credentials provided
|
|
269
|
-
*/
|
|
270
|
-
onBegin(config: FullConfig, suite: Suite): void;
|
|
271
|
-
/**
|
|
272
|
-
* Called for each test when it completes
|
|
273
|
-
* Captures steps and warnings, tracks test results for final status calculation
|
|
274
|
-
*/
|
|
275
|
-
onTestEnd(test: TestCase, result: TestResult): void;
|
|
276
|
-
/**
|
|
277
|
-
* Called after all tests have completed
|
|
278
|
-
* This is where we create the ZIP archive and upload results
|
|
279
|
-
*/
|
|
280
|
-
onEnd(): Promise<void>;
|
|
281
|
-
private printSummary;
|
|
282
|
-
/**
|
|
283
|
-
* Extracts console messages and network requests from all captured traces
|
|
284
|
-
* Called before injecting data into the report
|
|
285
|
-
*/
|
|
286
|
-
private extractDataFromTraces;
|
|
287
|
-
/**
|
|
288
|
-
* Injects captured steps, warnings, console messages, and network requests into the JSON report
|
|
289
|
-
* Traverses the report structure and matches by test ID + retry
|
|
290
|
-
*/
|
|
291
|
-
private injectDataIntoReport;
|
|
292
|
-
/**
|
|
293
|
-
* Reconstructs config.projects and test.projectId from test data
|
|
294
|
-
* This is necessary for blob merge scenarios where Playwright's JSON reporter
|
|
295
|
-
* doesn't populate projects array or projectId fields
|
|
296
|
-
*/
|
|
297
|
-
private reconstructProjectsFromTests;
|
|
298
|
-
/**
|
|
299
|
-
* Uploads test results to Checkly API
|
|
300
|
-
*/
|
|
301
|
-
private uploadResults;
|
|
302
|
-
/**
|
|
303
|
-
* Called when a global error occurs
|
|
304
|
-
*/
|
|
305
|
-
onError(error: TestError): void;
|
|
306
|
-
}
|
|
399
|
+
declare function createChecklyReporter(options?: ChecklyReporterOptions): ['@checkly/playwright-reporter', ChecklyReporterOptions];
|
|
307
400
|
|
|
308
|
-
export { ChecklyReporter, type ChecklyReporterOptions, type
|
|
401
|
+
export { type Annotation, type Attachment, BaseReporter, type BaseReporterOptions, ChecklyReporter, type ChecklyReporterOptions, type ChecklyUploadOptions, type JSONReport, type Location, type LogFn, type ProjectConfig, type ReportConfig, type Spec, type Stats, type Suite, type Test, type TestError, type TestOutcome, type TestResult, type TestStatus, type TestStep, checklyUpload, createChecklyReporter, ChecklyReporter as default, isValidJSONReport, isValidStats, isValidTestResult };
|