@checkly/playwright-reporter 0.1.10 → 1.1.0
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 +114 -0
- package/README.md +266 -0
- package/dist/index.d.ts +45 -289
- package/dist/index.js +1769 -814
- package/package.json +17 -15
package/dist/index.d.ts
CHANGED
|
@@ -1,308 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { JSONReportTestResult as JSONReportTestResult$1, Reporter } from '@playwright/test/reporter';
|
|
2
|
+
export { JSONReport, JSONReportError, JSONReportSTDIOEntry, JSONReportSpec, JSONReportSuite, JSONReportTest, JSONReportTestStep } from '@playwright/test/reporter';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
type ChecklyEnvironment = 'local' | 'development' | 'staging' | 'production';
|
|
8
|
-
/**
|
|
9
|
-
* Context passed to sessionName callback function
|
|
10
|
-
*/
|
|
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
|
-
/**
|
|
26
|
-
* Session name can be a static string or a function that returns a string
|
|
27
|
-
*/
|
|
28
|
-
type SessionNameOption = string | ((context: SessionNameContext) => string);
|
|
29
|
-
/**
|
|
30
|
-
* Configuration options for ChecklyReporter
|
|
31
|
-
*/
|
|
32
|
-
interface ChecklyReporterOptions {
|
|
33
|
-
/**
|
|
34
|
-
* Checkly account ID for uploading test results
|
|
35
|
-
* Required for Phase 2 (upload functionality)
|
|
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;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Warning types that can be attached to test results
|
|
94
|
-
*/
|
|
95
|
-
type ChecklyWarningType = 'trace-off' | 'trace-retained-on-failure' | 'trace-first-retry-only' | 'trace-retries-only' | 'trace-retained-on-first-failure' | 'trace-missing';
|
|
96
|
-
/**
|
|
97
|
-
* A warning attached to a test result
|
|
98
|
-
*/
|
|
99
|
-
interface ChecklyWarning {
|
|
100
|
-
/**
|
|
101
|
-
* Type of warning for programmatic handling
|
|
102
|
-
*/
|
|
103
|
-
type: ChecklyWarningType;
|
|
104
|
-
/**
|
|
105
|
-
* Human-readable warning message
|
|
106
|
-
*/
|
|
4
|
+
interface ChecklyConsoleLog {
|
|
5
|
+
type: 'log' | 'warn' | 'error' | 'info' | 'debug';
|
|
107
6
|
message: string;
|
|
7
|
+
timestamp: string;
|
|
108
8
|
}
|
|
109
|
-
|
|
110
|
-
* Console message type matching the webapp's CheckRunNavigationTracePage.console type
|
|
111
|
-
*/
|
|
112
|
-
type ConsoleMessageType = 'debug' | 'error' | 'info' | 'log' | 'warning';
|
|
113
|
-
/**
|
|
114
|
-
* Location of a console message in source code
|
|
115
|
-
*/
|
|
116
|
-
interface ConsoleMessageLocation {
|
|
9
|
+
interface ChecklyNetworkRequest {
|
|
117
10
|
url: string;
|
|
118
|
-
|
|
119
|
-
|
|
11
|
+
method: string;
|
|
12
|
+
status?: number;
|
|
13
|
+
duration?: number;
|
|
14
|
+
timestamp: string;
|
|
120
15
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
*/
|
|
125
|
-
interface ConsoleMessage {
|
|
126
|
-
/**
|
|
127
|
-
* Unique identifier for the console message
|
|
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;
|
|
138
|
-
/**
|
|
139
|
-
* Timestamp when the message was logged (milliseconds)
|
|
140
|
-
*/
|
|
141
|
-
timestamp: number;
|
|
142
|
-
/**
|
|
143
|
-
* Type of console message
|
|
144
|
-
*/
|
|
145
|
-
type: ConsoleMessageType;
|
|
16
|
+
interface ChecklyData {
|
|
17
|
+
consoleLogs?: ChecklyConsoleLog[];
|
|
18
|
+
networkRequests?: ChecklyNetworkRequest[];
|
|
146
19
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
* Matches the webapp's CheckRunNavigationTraceNetworkEntry type
|
|
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;
|
|
20
|
+
interface JSONReportTestResult extends JSONReportTestResult$1 {
|
|
21
|
+
_checkly?: ChecklyData;
|
|
169
22
|
}
|
|
23
|
+
|
|
170
24
|
/**
|
|
171
|
-
*
|
|
25
|
+
* Configuration options for the Checkly Playwright Reporter.
|
|
172
26
|
*/
|
|
173
|
-
interface
|
|
174
|
-
/**
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
27
|
+
interface ChecklyReporterOptions {
|
|
28
|
+
/** Directory for report output. Defaults to Playwright's outputDir. */
|
|
29
|
+
outputDir?: string;
|
|
30
|
+
/** Enable verbose logging. */
|
|
31
|
+
verbose?: boolean;
|
|
32
|
+
/** Checkly API key. Can also be set via CHECKLY_API_KEY env var. */
|
|
33
|
+
apiKey?: string;
|
|
34
|
+
/** Checkly account ID. Can also be set via CHECKLY_ACCOUNT_ID env var. */
|
|
35
|
+
accountId?: string;
|
|
36
|
+
/** Session name for the test run. Can be a string or a function. */
|
|
37
|
+
sessionName?: string | ((context: {
|
|
38
|
+
directoryName: string;
|
|
39
|
+
config: unknown;
|
|
40
|
+
suite: unknown;
|
|
41
|
+
}) => string);
|
|
42
|
+
/** Dry run mode - generate report but don't upload. */
|
|
43
|
+
dryRun?: boolean;
|
|
186
44
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
*/
|
|
190
|
-
type JSONReportTestResult = JSONReportTestResult$1 & {
|
|
191
|
-
_checkly?: ChecklyTestResultExtensions;
|
|
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
|
|
207
|
-
*/
|
|
208
|
-
type JSONReportSuite = Omit<JSONReportSuite$1, 'suites' | 'specs'> & {
|
|
209
|
-
suites?: JSONReportSuite[];
|
|
210
|
-
specs: JSONReportSpec[];
|
|
211
|
-
};
|
|
212
|
-
/**
|
|
213
|
-
* Extended JSONReport with Checkly-extended suites
|
|
214
|
-
*/
|
|
215
|
-
type JSONReport = Omit<JSONReport$1, 'suites'> & {
|
|
216
|
-
suites: JSONReportSuite[];
|
|
217
|
-
};
|
|
45
|
+
type ChecklyReporterClass = new (options?: ChecklyReporterOptions) => Reporter;
|
|
46
|
+
declare const _default: ChecklyReporterClass;
|
|
218
47
|
|
|
219
48
|
/**
|
|
220
|
-
* Checkly
|
|
49
|
+
* Create a Checkly reporter configuration with full intellisense support.
|
|
221
50
|
*
|
|
222
|
-
*
|
|
223
|
-
* Designed to work alongside Playwright's built-in JSONReporter.
|
|
51
|
+
* Use this instead of the array-based syntax for better IDE experience.
|
|
224
52
|
*
|
|
225
53
|
* @example
|
|
226
|
-
*
|
|
54
|
+
* import { createChecklyReporter } from '@checkly/playwright-reporter'
|
|
55
|
+
*
|
|
227
56
|
* export default defineConfig({
|
|
228
57
|
* reporter: [
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
* accountId: process.env.CHECKLY_ACCOUNT_ID,
|
|
233
|
-
* }]
|
|
234
|
-
* ]
|
|
235
|
-
* });
|
|
58
|
+
* createChecklyReporter({ outputDir: 'test-results' }),
|
|
59
|
+
* ],
|
|
60
|
+
* })
|
|
236
61
|
*/
|
|
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
|
-
}
|
|
62
|
+
declare function createChecklyReporter(options?: ChecklyReporterOptions): ['@checkly/playwright-reporter', ChecklyReporterOptions];
|
|
307
63
|
|
|
308
|
-
export {
|
|
64
|
+
export { type ChecklyConsoleLog, type ChecklyData, type ChecklyNetworkRequest, type ChecklyReporterOptions, type JSONReportTestResult, createChecklyReporter, _default as default };
|