@argos-ci/playwright 6.4.2 → 6.6.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.
@@ -0,0 +1,1984 @@
1
+ import { UploadParameters } from "@argos-ci/core";
2
+ import { BrowserContextOptions, Geolocation, HTTPCredentials, LaunchOptions, PageScreenshotOptions, ViewportSize } from "playwright-core";
3
+
4
+ //#region ../../node_modules/.pnpm/playwright@1.58.2/node_modules/playwright/types/test.d.ts
5
+ type BlobReporterOptions = {
6
+ outputDir?: string;
7
+ fileName?: string;
8
+ };
9
+ type ListReporterOptions = {
10
+ printSteps?: boolean;
11
+ };
12
+ type JUnitReporterOptions = {
13
+ outputFile?: string;
14
+ stripANSIControlSequences?: boolean;
15
+ includeProjectInTestName?: boolean;
16
+ };
17
+ type JsonReporterOptions = {
18
+ outputFile?: string;
19
+ };
20
+ type HtmlReporterOptions = {
21
+ outputFolder?: string;
22
+ open?: 'always' | 'never' | 'on-failure';
23
+ host?: string;
24
+ port?: number;
25
+ attachmentsBaseURL?: string;
26
+ title?: string;
27
+ noSnippets?: boolean;
28
+ noCopyPrompt?: boolean;
29
+ };
30
+ type ReporterDescription = Readonly<['blob'] | ['blob', BlobReporterOptions] | ['dot'] | ['line'] | ['list'] | ['list', ListReporterOptions] | ['github'] | ['junit'] | ['junit', JUnitReporterOptions] | ['json'] | ['json', JsonReporterOptions] | ['html'] | ['html', HtmlReporterOptions] | ['null'] | [string] | [string, any]>;
31
+ type UseOptions<TestArgs, WorkerArgs> = Partial<WorkerArgs> & Partial<TestArgs>;
32
+ /**
33
+ * Playwright Test supports running multiple test projects at the same time. This is useful for running tests in
34
+ * multiple configurations. For example, consider running tests against multiple browsers. This type describes format
35
+ * of a project in the configuration file, to access resolved configuration parameters at run time use
36
+ * [FullProject](https://playwright.dev/docs/api/class-fullproject).
37
+ *
38
+ * `TestProject` encapsulates configuration specific to a single project. Projects are configured in
39
+ * [testConfig.projects](https://playwright.dev/docs/api/class-testconfig#test-config-projects) specified in the
40
+ * [configuration file](https://playwright.dev/docs/test-configuration). Note that all properties of
41
+ * [TestProject](https://playwright.dev/docs/api/class-testproject) are available in the top-level
42
+ * [TestConfig](https://playwright.dev/docs/api/class-testconfig), in which case they are shared between all projects.
43
+ *
44
+ * Here is an example configuration that runs every test in Chromium, Firefox and WebKit, both Desktop and Mobile
45
+ * versions.
46
+ *
47
+ * ```js
48
+ * // playwright.config.ts
49
+ * import { defineConfig, devices } from '@playwright/test';
50
+ *
51
+ * export default defineConfig({
52
+ * // Options shared for all projects.
53
+ * timeout: 30000,
54
+ * use: {
55
+ * ignoreHTTPSErrors: true,
56
+ * },
57
+ *
58
+ * // Options specific to each project.
59
+ * projects: [
60
+ * {
61
+ * name: 'chromium',
62
+ * use: devices['Desktop Chrome'],
63
+ * },
64
+ * {
65
+ * name: 'firefox',
66
+ * use: devices['Desktop Firefox'],
67
+ * },
68
+ * {
69
+ * name: 'webkit',
70
+ * use: devices['Desktop Safari'],
71
+ * },
72
+ * {
73
+ * name: 'Mobile Chrome',
74
+ * use: devices['Pixel 5'],
75
+ * },
76
+ * {
77
+ * name: 'Mobile Safari',
78
+ * use: devices['iPhone 12'],
79
+ * },
80
+ * ],
81
+ * });
82
+ * ```
83
+ *
84
+ */
85
+ /**
86
+ * Runtime representation of the test project configuration. It is accessible in the tests via
87
+ * [testInfo.project](https://playwright.dev/docs/api/class-testinfo#test-info-project) and
88
+ * [workerInfo.project](https://playwright.dev/docs/api/class-workerinfo#worker-info-project) and is passed to the
89
+ * test reporters. To see the format of the project in the Playwright configuration file please see
90
+ * [TestProject](https://playwright.dev/docs/api/class-testproject) instead.
91
+ */
92
+ interface FullProject<TestArgs = {}, WorkerArgs = {}> {
93
+ /**
94
+ * See [testProject.use](https://playwright.dev/docs/api/class-testproject#test-project-use).
95
+ */
96
+ use: UseOptions<PlaywrightTestOptions & TestArgs, PlaywrightWorkerOptions & WorkerArgs>;
97
+ /**
98
+ * See [testProject.dependencies](https://playwright.dev/docs/api/class-testproject#test-project-dependencies).
99
+ */
100
+ dependencies: Array<string>;
101
+ /**
102
+ * See [testProject.grep](https://playwright.dev/docs/api/class-testproject#test-project-grep).
103
+ */
104
+ grep: RegExp | Array<RegExp>;
105
+ /**
106
+ * See [testProject.grepInvert](https://playwright.dev/docs/api/class-testproject#test-project-grep-invert).
107
+ */
108
+ grepInvert: null | RegExp | Array<RegExp>;
109
+ /**
110
+ * See [testProject.metadata](https://playwright.dev/docs/api/class-testproject#test-project-metadata).
111
+ */
112
+ metadata: Metadata;
113
+ /**
114
+ * See [testProject.name](https://playwright.dev/docs/api/class-testproject#test-project-name).
115
+ */
116
+ name: string;
117
+ /**
118
+ * See [testProject.outputDir](https://playwright.dev/docs/api/class-testproject#test-project-output-dir).
119
+ */
120
+ outputDir: string;
121
+ /**
122
+ * See [testProject.repeatEach](https://playwright.dev/docs/api/class-testproject#test-project-repeat-each).
123
+ */
124
+ repeatEach: number;
125
+ /**
126
+ * See [testProject.retries](https://playwright.dev/docs/api/class-testproject#test-project-retries).
127
+ */
128
+ retries: number;
129
+ /**
130
+ * See [testProject.snapshotDir](https://playwright.dev/docs/api/class-testproject#test-project-snapshot-dir).
131
+ */
132
+ snapshotDir: string;
133
+ /**
134
+ * See [testProject.teardown](https://playwright.dev/docs/api/class-testproject#test-project-teardown).
135
+ */
136
+ teardown?: string;
137
+ /**
138
+ * See [testProject.testDir](https://playwright.dev/docs/api/class-testproject#test-project-test-dir).
139
+ */
140
+ testDir: string;
141
+ /**
142
+ * See [testProject.testIgnore](https://playwright.dev/docs/api/class-testproject#test-project-test-ignore).
143
+ */
144
+ testIgnore: string | RegExp | Array<string | RegExp>;
145
+ /**
146
+ * See [testProject.testMatch](https://playwright.dev/docs/api/class-testproject#test-project-test-match).
147
+ */
148
+ testMatch: string | RegExp | Array<string | RegExp>;
149
+ /**
150
+ * See [testProject.timeout](https://playwright.dev/docs/api/class-testproject#test-project-timeout).
151
+ */
152
+ timeout: number;
153
+ }
154
+ type Metadata = {
155
+ [key: string]: any;
156
+ };
157
+ /**
158
+ * Resolved configuration which is accessible via
159
+ * [testInfo.config](https://playwright.dev/docs/api/class-testinfo#test-info-config) and is passed to the test
160
+ * reporters. To see the format of Playwright configuration file, please see
161
+ * [TestConfig](https://playwright.dev/docs/api/class-testconfig) instead.
162
+ */
163
+ interface FullConfig<TestArgs = {}, WorkerArgs = {}> {
164
+ /**
165
+ * List of resolved projects.
166
+ */
167
+ projects: FullProject<TestArgs, WorkerArgs>[];
168
+ /**
169
+ * See [testConfig.reporter](https://playwright.dev/docs/api/class-testconfig#test-config-reporter).
170
+ */
171
+ reporter: ReporterDescription[];
172
+ /**
173
+ * See [testConfig.webServer](https://playwright.dev/docs/api/class-testconfig#test-config-web-server).
174
+ */
175
+ webServer: TestConfigWebServer | null;
176
+ /**
177
+ * Path to the configuration file used to run the tests. The value is an empty string if no config file was used.
178
+ */
179
+ configFile?: string;
180
+ /**
181
+ * See [testConfig.forbidOnly](https://playwright.dev/docs/api/class-testconfig#test-config-forbid-only).
182
+ */
183
+ forbidOnly: boolean;
184
+ /**
185
+ * See [testConfig.fullyParallel](https://playwright.dev/docs/api/class-testconfig#test-config-fully-parallel).
186
+ */
187
+ fullyParallel: boolean;
188
+ /**
189
+ * See [testConfig.globalSetup](https://playwright.dev/docs/api/class-testconfig#test-config-global-setup).
190
+ */
191
+ globalSetup: null | string;
192
+ /**
193
+ * See [testConfig.globalTeardown](https://playwright.dev/docs/api/class-testconfig#test-config-global-teardown).
194
+ */
195
+ globalTeardown: null | string;
196
+ /**
197
+ * See [testConfig.globalTimeout](https://playwright.dev/docs/api/class-testconfig#test-config-global-timeout).
198
+ */
199
+ globalTimeout: number;
200
+ /**
201
+ * See [testConfig.grep](https://playwright.dev/docs/api/class-testconfig#test-config-grep).
202
+ */
203
+ grep: RegExp | Array<RegExp>;
204
+ /**
205
+ * See [testConfig.grepInvert](https://playwright.dev/docs/api/class-testconfig#test-config-grep-invert).
206
+ */
207
+ grepInvert: null | RegExp | Array<RegExp>;
208
+ /**
209
+ * See [testConfig.maxFailures](https://playwright.dev/docs/api/class-testconfig#test-config-max-failures).
210
+ */
211
+ maxFailures: number;
212
+ /**
213
+ * See [testConfig.metadata](https://playwright.dev/docs/api/class-testconfig#test-config-metadata).
214
+ */
215
+ metadata: Metadata;
216
+ /**
217
+ * See [testConfig.preserveOutput](https://playwright.dev/docs/api/class-testconfig#test-config-preserve-output).
218
+ */
219
+ preserveOutput: "always" | "never" | "failures-only";
220
+ /**
221
+ * See [testConfig.quiet](https://playwright.dev/docs/api/class-testconfig#test-config-quiet).
222
+ */
223
+ quiet: boolean;
224
+ /**
225
+ * See [testConfig.reportSlowTests](https://playwright.dev/docs/api/class-testconfig#test-config-report-slow-tests).
226
+ */
227
+ reportSlowTests: null | {
228
+ /**
229
+ * The maximum number of slow test files to report.
230
+ */
231
+ max: number;
232
+ /**
233
+ * Test file duration in milliseconds that is considered slow.
234
+ */
235
+ threshold: number;
236
+ };
237
+ /**
238
+ * Base directory for all relative paths used in the reporters.
239
+ */
240
+ rootDir: string;
241
+ /**
242
+ * See [testConfig.shard](https://playwright.dev/docs/api/class-testconfig#test-config-shard).
243
+ */
244
+ shard: null | {
245
+ /**
246
+ * The total number of shards.
247
+ */
248
+ total: number;
249
+ /**
250
+ * The index of the shard to execute, one-based.
251
+ */
252
+ current: number;
253
+ };
254
+ /**
255
+ * Resolved global tags. See [testConfig.tag](https://playwright.dev/docs/api/class-testconfig#test-config-tag).
256
+ */
257
+ tags: Array<string>;
258
+ /**
259
+ * See [testConfig.updateSnapshots](https://playwright.dev/docs/api/class-testconfig#test-config-update-snapshots).
260
+ */
261
+ updateSnapshots: "all" | "changed" | "missing" | "none";
262
+ /**
263
+ * See
264
+ * [testConfig.updateSourceMethod](https://playwright.dev/docs/api/class-testconfig#test-config-update-source-method).
265
+ */
266
+ updateSourceMethod: "overwrite" | "3way" | "patch";
267
+ /**
268
+ * Playwright version.
269
+ */
270
+ version: string;
271
+ /**
272
+ * See [testConfig.workers](https://playwright.dev/docs/api/class-testconfig#test-config-workers).
273
+ */
274
+ workers: number;
275
+ }
276
+ type BrowserName = 'chromium' | 'firefox' | 'webkit';
277
+ type BrowserChannel = Exclude<LaunchOptions['channel'], undefined>;
278
+ type ColorScheme = Exclude<BrowserContextOptions['colorScheme'], undefined>;
279
+ type ClientCertificate = Exclude<BrowserContextOptions['clientCertificates'], undefined>[0];
280
+ type ExtraHTTPHeaders = Exclude<BrowserContextOptions['extraHTTPHeaders'], undefined>;
281
+ type Proxy = Exclude<BrowserContextOptions['proxy'], undefined>;
282
+ type StorageState = Exclude<BrowserContextOptions['storageState'], undefined>;
283
+ type ServiceWorkerPolicy = Exclude<BrowserContextOptions['serviceWorkers'], undefined>;
284
+ type ConnectOptions = {
285
+ /**
286
+ * A browser websocket endpoint to connect to.
287
+ */
288
+ wsEndpoint: string;
289
+ /**
290
+ * Additional HTTP headers to be sent with web socket connect request.
291
+ */
292
+ headers?: {
293
+ [key: string]: string;
294
+ };
295
+ /**
296
+ * This option exposes network available on the connecting client to the browser being connected to.
297
+ * Consists of a list of rules separated by comma.
298
+ *
299
+ * Available rules:
300
+ * - Hostname pattern, for example: `example.com`, `*.org:99`, `x.*.y.com`, `*foo.org`.
301
+ * - IP literal, for example: `127.0.0.1`, `0.0.0.0:99`, `[::1]`, `[0:0::1]:99`.
302
+ * - `<loopback>` that matches local loopback interfaces: `localhost`, `*.localhost`, `127.0.0.1`, `[::1]`.
303
+ * Some common examples:
304
+ * - `"*"` to expose all network.
305
+ * - `"<loopback>"` to expose localhost network.
306
+ * - `"*.test.internal-domain,*.staging.internal-domain,<loopback>"` to expose test/staging deployments and localhost.
307
+ */
308
+ exposeNetwork?: string;
309
+ /**
310
+ * Timeout in milliseconds for the connection to be established. Optional, defaults to no timeout.
311
+ */
312
+ timeout?: number;
313
+ };
314
+ /**
315
+ * Playwright Test provides many options to configure test environment,
316
+ * [Browser](https://playwright.dev/docs/api/class-browser),
317
+ * [BrowserContext](https://playwright.dev/docs/api/class-browsercontext) and more.
318
+ *
319
+ * These options are usually provided in the [configuration file](https://playwright.dev/docs/test-configuration) through
320
+ * [testConfig.use](https://playwright.dev/docs/api/class-testconfig#test-config-use) and
321
+ * [testProject.use](https://playwright.dev/docs/api/class-testproject#test-project-use).
322
+ *
323
+ * ```js
324
+ * // playwright.config.ts
325
+ * import { defineConfig } from '@playwright/test';
326
+ * export default defineConfig({
327
+ * use: {
328
+ * headless: false,
329
+ * viewport: { width: 1280, height: 720 },
330
+ * ignoreHTTPSErrors: true,
331
+ * video: 'on-first-retry',
332
+ * },
333
+ * });
334
+ * ```
335
+ *
336
+ * Alternatively, with [test.use(options)](https://playwright.dev/docs/api/class-test#test-use) you can override some
337
+ * options for a file.
338
+ *
339
+ * ```js
340
+ * // example.spec.ts
341
+ * import { test, expect } from '@playwright/test';
342
+ *
343
+ * // Run tests in this file with portrait-like viewport.
344
+ * test.use({ viewport: { width: 600, height: 900 } });
345
+ *
346
+ * test('my portrait test', async ({ page }) => {
347
+ * // ...
348
+ * });
349
+ * ```
350
+ *
351
+ */
352
+ interface PlaywrightWorkerOptions {
353
+ /**
354
+ * Name of the browser that runs tests. Defaults to `'chromium'`. Most of the time you should set `browserName` in
355
+ * your [TestConfig](https://playwright.dev/docs/api/class-testconfig):
356
+ *
357
+ * **Usage**
358
+ *
359
+ * ```js
360
+ * // playwright.config.ts
361
+ * import { defineConfig, devices } from '@playwright/test';
362
+ *
363
+ * export default defineConfig({
364
+ * use: {
365
+ * browserName: 'firefox',
366
+ * },
367
+ * });
368
+ * ```
369
+ *
370
+ */
371
+ browserName: BrowserName;
372
+ defaultBrowserType: BrowserName;
373
+ /**
374
+ * Whether to run browser in headless mode. More details for
375
+ * [Chromium](https://developers.google.com/web/updates/2017/04/headless-chrome) and
376
+ * [Firefox](https://hacks.mozilla.org/2017/12/using-headless-mode-in-firefox/). Defaults to `true`.
377
+ *
378
+ * **Usage**
379
+ *
380
+ * ```js
381
+ * // playwright.config.ts
382
+ * import { defineConfig } from '@playwright/test';
383
+ *
384
+ * export default defineConfig({
385
+ * use: {
386
+ * headless: false
387
+ * },
388
+ * });
389
+ * ```
390
+ *
391
+ */
392
+ headless: boolean;
393
+ /**
394
+ * Browser distribution channel.
395
+ *
396
+ * Use "chromium" to [opt in to new headless mode](https://playwright.dev/docs/browsers#chromium-new-headless-mode).
397
+ *
398
+ * Use "chrome", "chrome-beta", "chrome-dev", "chrome-canary", "msedge", "msedge-beta", "msedge-dev", or
399
+ * "msedge-canary" to use branded [Google Chrome and Microsoft Edge](https://playwright.dev/docs/browsers#google-chrome--microsoft-edge).
400
+ *
401
+ * **Usage**
402
+ *
403
+ * ```js
404
+ * // playwright.config.ts
405
+ * import { defineConfig } from '@playwright/test';
406
+ *
407
+ * export default defineConfig({
408
+ * projects: [
409
+ * {
410
+ * name: 'Microsoft Edge',
411
+ * use: {
412
+ * ...devices['Desktop Edge'],
413
+ * channel: 'msedge'
414
+ * },
415
+ * },
416
+ * ]
417
+ * });
418
+ * ```
419
+ *
420
+ */
421
+ channel: BrowserChannel | undefined;
422
+ /**
423
+ * Options used to launch the browser, as passed to
424
+ * [browserType.launch([options])](https://playwright.dev/docs/api/class-browsertype#browser-type-launch). Specific
425
+ * options [testOptions.headless](https://playwright.dev/docs/api/class-testoptions#test-options-headless) and
426
+ * [testOptions.channel](https://playwright.dev/docs/api/class-testoptions#test-options-channel) take priority over
427
+ * this.
428
+ *
429
+ * **NOTE** Use custom browser args at your own risk, as some of them may break Playwright functionality.
430
+ *
431
+ * **Usage**
432
+ *
433
+ * ```js
434
+ * // playwright.config.ts
435
+ * import { defineConfig } from '@playwright/test';
436
+ *
437
+ * export default defineConfig({
438
+ * projects: [
439
+ * {
440
+ * name: 'chromium',
441
+ * use: {
442
+ * ...devices['Desktop Chrome'],
443
+ * launchOptions: {
444
+ * args: ['--start-maximized']
445
+ * }
446
+ * }
447
+ * }
448
+ * ]
449
+ * });
450
+ * ```
451
+ *
452
+ */
453
+ launchOptions: Omit<LaunchOptions, 'tracesDir'>;
454
+ /**
455
+ * **Usage**
456
+ *
457
+ * ```js
458
+ * // playwright.config.ts
459
+ * import { defineConfig } from '@playwright/test';
460
+ *
461
+ * export default defineConfig({
462
+ * use: {
463
+ * connectOptions: {
464
+ * wsEndpoint: 'ws://localhost:5678',
465
+ * },
466
+ * },
467
+ * });
468
+ * ```
469
+ *
470
+ * When connect options are specified, default
471
+ * [fixtures.browser](https://playwright.dev/docs/api/class-fixtures#fixtures-browser),
472
+ * [fixtures.context](https://playwright.dev/docs/api/class-fixtures#fixtures-context) and
473
+ * [fixtures.page](https://playwright.dev/docs/api/class-fixtures#fixtures-page) use the remote browser instead of
474
+ * launching a browser locally, and any launch options like
475
+ * [testOptions.headless](https://playwright.dev/docs/api/class-testoptions#test-options-headless) or
476
+ * [testOptions.channel](https://playwright.dev/docs/api/class-testoptions#test-options-channel) are ignored.
477
+ */
478
+ connectOptions: ConnectOptions | undefined;
479
+ /**
480
+ * Whether to automatically capture a screenshot after each test. Defaults to `'off'`.
481
+ * - `'off'`: Do not capture screenshots.
482
+ * - `'on'`: Capture screenshot after each test.
483
+ * - `'only-on-failure'`: Capture screenshot after each test failure.
484
+ * - `'on-first-failure'`: Capture screenshot after each test's first failure.
485
+ *
486
+ * **Usage**
487
+ *
488
+ * ```js
489
+ * // playwright.config.ts
490
+ * import { defineConfig } from '@playwright/test';
491
+ *
492
+ * export default defineConfig({
493
+ * use: {
494
+ * screenshot: 'only-on-failure',
495
+ * },
496
+ * });
497
+ * ```
498
+ *
499
+ * Learn more about [automatic screenshots](https://playwright.dev/docs/test-use-options#recording-options).
500
+ */
501
+ screenshot: ScreenshotMode | {
502
+ mode: ScreenshotMode;
503
+ } & Pick<PageScreenshotOptions, 'fullPage' | 'omitBackground'>;
504
+ /**
505
+ * Whether to record trace for each test. Defaults to `'off'`.
506
+ * - `'off'`: Do not record trace.
507
+ * - `'on'`: Record trace for each test.
508
+ * - `'on-first-retry'`: Record trace only when retrying a test for the first time.
509
+ * - `'on-all-retries'`: Record trace only when retrying a test.
510
+ * - `'retain-on-failure'`: Record trace for each test. When test run passes, remove the recorded trace.
511
+ * - `'retain-on-first-failure'`: Record trace for the first run of each test, but not for retries. When test run
512
+ * passes, remove the recorded trace.
513
+ *
514
+ * For more control, pass an object that specifies `mode` and trace features to enable.
515
+ *
516
+ * **Usage**
517
+ *
518
+ * ```js
519
+ * // playwright.config.ts
520
+ * import { defineConfig } from '@playwright/test';
521
+ *
522
+ * export default defineConfig({
523
+ * use: {
524
+ * trace: 'on-first-retry'
525
+ * },
526
+ * });
527
+ * ```
528
+ *
529
+ * Learn more about [recording trace](https://playwright.dev/docs/test-use-options#recording-options).
530
+ */
531
+ trace: TraceMode | /** deprecated */'retry-with-trace' | {
532
+ mode: TraceMode;
533
+ snapshots?: boolean;
534
+ screenshots?: boolean;
535
+ sources?: boolean;
536
+ attachments?: boolean;
537
+ };
538
+ /**
539
+ * Whether to record video for each test. Defaults to `'off'`.
540
+ * - `'off'`: Do not record video.
541
+ * - `'on'`: Record video for each test.
542
+ * - `'retain-on-failure'`: Record video for each test, but remove all videos from successful test runs.
543
+ * - `'on-first-retry'`: Record video only when retrying a test for the first time.
544
+ *
545
+ * To control video size, pass an object with `mode` and `size` properties. If video size is not specified, it will be
546
+ * equal to [testOptions.viewport](https://playwright.dev/docs/api/class-testoptions#test-options-viewport) scaled
547
+ * down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual
548
+ * picture of each page will be scaled down if necessary to fit the specified size.
549
+ *
550
+ * **Usage**
551
+ *
552
+ * ```js
553
+ * // playwright.config.ts
554
+ * import { defineConfig } from '@playwright/test';
555
+ *
556
+ * export default defineConfig({
557
+ * use: {
558
+ * video: 'on-first-retry',
559
+ * },
560
+ * });
561
+ * ```
562
+ *
563
+ * Learn more about [recording video](https://playwright.dev/docs/test-use-options#recording-options).
564
+ */
565
+ video: VideoMode | /** deprecated */'retry-with-video' | {
566
+ mode: VideoMode;
567
+ size?: ViewportSize;
568
+ };
569
+ }
570
+ type ScreenshotMode = 'off' | 'on' | 'only-on-failure' | 'on-first-failure';
571
+ type TraceMode = 'off' | 'on' | 'retain-on-failure' | 'on-first-retry' | 'on-all-retries' | 'retain-on-first-failure';
572
+ type VideoMode = 'off' | 'on' | 'retain-on-failure' | 'on-first-retry';
573
+ /**
574
+ * Playwright Test provides many options to configure test environment,
575
+ * [Browser](https://playwright.dev/docs/api/class-browser),
576
+ * [BrowserContext](https://playwright.dev/docs/api/class-browsercontext) and more.
577
+ *
578
+ * These options are usually provided in the [configuration file](https://playwright.dev/docs/test-configuration) through
579
+ * [testConfig.use](https://playwright.dev/docs/api/class-testconfig#test-config-use) and
580
+ * [testProject.use](https://playwright.dev/docs/api/class-testproject#test-project-use).
581
+ *
582
+ * ```js
583
+ * // playwright.config.ts
584
+ * import { defineConfig } from '@playwright/test';
585
+ * export default defineConfig({
586
+ * use: {
587
+ * headless: false,
588
+ * viewport: { width: 1280, height: 720 },
589
+ * ignoreHTTPSErrors: true,
590
+ * video: 'on-first-retry',
591
+ * },
592
+ * });
593
+ * ```
594
+ *
595
+ * Alternatively, with [test.use(options)](https://playwright.dev/docs/api/class-test#test-use) you can override some
596
+ * options for a file.
597
+ *
598
+ * ```js
599
+ * // example.spec.ts
600
+ * import { test, expect } from '@playwright/test';
601
+ *
602
+ * // Run tests in this file with portrait-like viewport.
603
+ * test.use({ viewport: { width: 600, height: 900 } });
604
+ *
605
+ * test('my portrait test', async ({ page }) => {
606
+ * // ...
607
+ * });
608
+ * ```
609
+ *
610
+ */
611
+ interface PlaywrightTestOptions {
612
+ /**
613
+ * Whether to automatically download all the attachments. Defaults to `true` where all the downloads are accepted.
614
+ *
615
+ * **Usage**
616
+ *
617
+ * ```js
618
+ * // playwright.config.ts
619
+ * import { defineConfig } from '@playwright/test';
620
+ *
621
+ * export default defineConfig({
622
+ * use: {
623
+ * acceptDownloads: false,
624
+ * },
625
+ * });
626
+ * ```
627
+ *
628
+ */
629
+ acceptDownloads: boolean;
630
+ /**
631
+ * Toggles bypassing page's Content-Security-Policy. Defaults to `false`.
632
+ *
633
+ * **Usage**
634
+ *
635
+ * ```js
636
+ * // playwright.config.ts
637
+ * import { defineConfig } from '@playwright/test';
638
+ *
639
+ * export default defineConfig({
640
+ * use: {
641
+ * bypassCSP: true,
642
+ * }
643
+ * });
644
+ * ```
645
+ *
646
+ */
647
+ bypassCSP: boolean;
648
+ /**
649
+ * Emulates [prefers-colors-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)
650
+ * media feature, supported values are `'light'` and `'dark'`. See
651
+ * [page.emulateMedia([options])](https://playwright.dev/docs/api/class-page#page-emulate-media) for more details.
652
+ * Passing `null` resets emulation to system defaults. Defaults to `'light'`.
653
+ *
654
+ * **Usage**
655
+ *
656
+ * ```js
657
+ * // playwright.config.ts
658
+ * import { defineConfig } from '@playwright/test';
659
+ *
660
+ * export default defineConfig({
661
+ * use: {
662
+ * colorScheme: 'dark',
663
+ * },
664
+ * });
665
+ * ```
666
+ *
667
+ */
668
+ colorScheme: ColorScheme;
669
+ /**
670
+ * TLS Client Authentication allows the server to request a client certificate and verify it.
671
+ *
672
+ * **Details**
673
+ *
674
+ * An array of client certificates to be used. Each certificate object must have either both `certPath` and `keyPath`,
675
+ * a single `pfxPath`, or their corresponding direct value equivalents (`cert` and `key`, or `pfx`). Optionally,
676
+ * `passphrase` property should be provided if the certificate is encrypted. The `origin` property should be provided
677
+ * with an exact match to the request origin that the certificate is valid for.
678
+ *
679
+ * Client certificate authentication is only active when at least one client certificate is provided. If you want to
680
+ * reject all client certificates sent by the server, you need to provide a client certificate with an `origin` that
681
+ * does not match any of the domains you plan to visit.
682
+ *
683
+ * **NOTE** When using WebKit on macOS, accessing `localhost` will not pick up client certificates. You can make it
684
+ * work by replacing `localhost` with `local.playwright`.
685
+ *
686
+ * **Usage**
687
+ *
688
+ * ```js
689
+ * // playwright.config.ts
690
+ * import { defineConfig } from '@playwright/test';
691
+ *
692
+ * export default defineConfig({
693
+ * use: {
694
+ * clientCertificates: [{
695
+ * origin: 'https://example.com',
696
+ * certPath: './cert.pem',
697
+ * keyPath: './key.pem',
698
+ * passphrase: 'mysecretpassword',
699
+ * }],
700
+ * },
701
+ * });
702
+ * ```
703
+ *
704
+ */
705
+ clientCertificates: ClientCertificate[] | undefined;
706
+ /**
707
+ * Specify device scale factor (can be thought of as dpr). Defaults to `1`. Learn more about
708
+ * [emulating devices with device scale factor](https://playwright.dev/docs/emulation#devices).
709
+ *
710
+ * **Usage**
711
+ *
712
+ * ```js
713
+ * // playwright.config.ts
714
+ * import { defineConfig } from '@playwright/test';
715
+ *
716
+ * export default defineConfig({
717
+ * use: {
718
+ * viewport: { width: 2560, height: 1440 },
719
+ * deviceScaleFactor: 2,
720
+ * },
721
+ * });
722
+ * ```
723
+ *
724
+ */
725
+ deviceScaleFactor: number | undefined;
726
+ /**
727
+ * An object containing additional HTTP headers to be sent with every request. Defaults to none.
728
+ *
729
+ * **Usage**
730
+ *
731
+ * ```js
732
+ * // playwright.config.ts
733
+ * import { defineConfig } from '@playwright/test';
734
+ *
735
+ * export default defineConfig({
736
+ * use: {
737
+ * extraHTTPHeaders: {
738
+ * 'X-My-Header': 'value',
739
+ * },
740
+ * },
741
+ * });
742
+ * ```
743
+ *
744
+ */
745
+ extraHTTPHeaders: ExtraHTTPHeaders | undefined;
746
+ /**
747
+ * **Usage**
748
+ *
749
+ * ```js
750
+ * // playwright.config.ts
751
+ * import { defineConfig } from '@playwright/test';
752
+ *
753
+ * export default defineConfig({
754
+ * use: {
755
+ * geolocation: { longitude: 12.492507, latitude: 41.889938 },
756
+ * },
757
+ * });
758
+ * ```
759
+ *
760
+ * Learn more about [geolocation](https://playwright.dev/docs/emulation#color-scheme-and-media).
761
+ */
762
+ geolocation: Geolocation | undefined;
763
+ /**
764
+ * Specifies if viewport supports touch events. Defaults to false. Learn more about
765
+ * [mobile emulation](https://playwright.dev/docs/emulation#devices).
766
+ *
767
+ * **Usage**
768
+ *
769
+ * ```js
770
+ * // playwright.config.ts
771
+ * import { defineConfig } from '@playwright/test';
772
+ *
773
+ * export default defineConfig({
774
+ * use: {
775
+ * hasTouch: true
776
+ * },
777
+ * });
778
+ * ```
779
+ *
780
+ */
781
+ hasTouch: boolean;
782
+ /**
783
+ * Credentials for [HTTP authentication](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication). If no
784
+ * origin is specified, the username and password are sent to any servers upon unauthorized responses.
785
+ *
786
+ * **Usage**
787
+ *
788
+ * ```js
789
+ * // playwright.config.ts
790
+ * import { defineConfig } from '@playwright/test';
791
+ *
792
+ * export default defineConfig({
793
+ * use: {
794
+ * httpCredentials: {
795
+ * username: 'user',
796
+ * password: 'pass',
797
+ * },
798
+ * },
799
+ * });
800
+ * ```
801
+ *
802
+ */
803
+ httpCredentials: HTTPCredentials | undefined;
804
+ /**
805
+ * Whether to ignore HTTPS errors when sending network requests. Defaults to `false`.
806
+ *
807
+ * **Usage**
808
+ *
809
+ * ```js
810
+ * // playwright.config.ts
811
+ * import { defineConfig } from '@playwright/test';
812
+ *
813
+ * export default defineConfig({
814
+ * use: {
815
+ * ignoreHTTPSErrors: true,
816
+ * },
817
+ * });
818
+ * ```
819
+ *
820
+ */
821
+ ignoreHTTPSErrors: boolean;
822
+ /**
823
+ * Whether the `meta viewport` tag is taken into account and touch events are enabled. isMobile is a part of device,
824
+ * so you don't actually need to set it manually. Defaults to `false` and is not supported in Firefox. Learn more
825
+ * about [mobile emulation](https://playwright.dev/docs/emulation#ismobile).
826
+ *
827
+ * **Usage**
828
+ *
829
+ * ```js
830
+ * // playwright.config.ts
831
+ * import { defineConfig } from '@playwright/test';
832
+ *
833
+ * export default defineConfig({
834
+ * use: {
835
+ * isMobile: false,
836
+ * },
837
+ * });
838
+ * ```
839
+ *
840
+ */
841
+ isMobile: boolean;
842
+ /**
843
+ * Whether or not to enable JavaScript in the context. Defaults to `true`. Learn more about
844
+ * [disabling JavaScript](https://playwright.dev/docs/emulation#javascript-enabled).
845
+ *
846
+ * **Usage**
847
+ *
848
+ * ```js
849
+ * // playwright.config.ts
850
+ * import { defineConfig } from '@playwright/test';
851
+ *
852
+ * export default defineConfig({
853
+ * use: {
854
+ * javaScriptEnabled: false,
855
+ * },
856
+ * });
857
+ * ```
858
+ *
859
+ */
860
+ javaScriptEnabled: boolean;
861
+ /**
862
+ * Specify user locale, for example `en-GB`, `de-DE`, etc. Locale will affect `navigator.language` value,
863
+ * `Accept-Language` request header value as well as number and date formatting rules. Defaults to `en-US`. Learn more
864
+ * about emulation in our [emulation guide](https://playwright.dev/docs/emulation#locale--timezone).
865
+ *
866
+ * **Usage**
867
+ *
868
+ * ```js
869
+ * // playwright.config.ts
870
+ * import { defineConfig } from '@playwright/test';
871
+ *
872
+ * export default defineConfig({
873
+ * use: {
874
+ * locale: 'it-IT',
875
+ * },
876
+ * });
877
+ * ```
878
+ *
879
+ */
880
+ locale: string | undefined;
881
+ /**
882
+ * Whether to emulate network being offline. Defaults to `false`. Learn more about
883
+ * [network emulation](https://playwright.dev/docs/emulation#offline).
884
+ *
885
+ * **Usage**
886
+ *
887
+ * ```js
888
+ * // playwright.config.ts
889
+ * import { defineConfig } from '@playwright/test';
890
+ *
891
+ * export default defineConfig({
892
+ * use: {
893
+ * offline: true
894
+ * },
895
+ * });
896
+ * ```
897
+ *
898
+ */
899
+ offline: boolean;
900
+ /**
901
+ * A list of permissions to grant to all pages in this context. See
902
+ * [browserContext.grantPermissions(permissions[, options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-grant-permissions)
903
+ * for more details. Defaults to none.
904
+ *
905
+ * **Usage**
906
+ *
907
+ * ```js
908
+ * // playwright.config.ts
909
+ * import { defineConfig } from '@playwright/test';
910
+ *
911
+ * export default defineConfig({
912
+ * use: {
913
+ * permissions: ['notifications'],
914
+ * },
915
+ * });
916
+ * ```
917
+ *
918
+ */
919
+ permissions: string[] | undefined;
920
+ /**
921
+ * Network proxy settings.
922
+ *
923
+ * **Usage**
924
+ *
925
+ * ```js
926
+ * // playwright.config.ts
927
+ * import { defineConfig } from '@playwright/test';
928
+ *
929
+ * export default defineConfig({
930
+ * use: {
931
+ * proxy: {
932
+ * server: 'http://myproxy.com:3128',
933
+ * bypass: 'localhost',
934
+ * },
935
+ * },
936
+ * });
937
+ * ```
938
+ *
939
+ */
940
+ proxy: Proxy | undefined;
941
+ /**
942
+ * Learn more about [storage state and auth](https://playwright.dev/docs/auth).
943
+ *
944
+ * Populates context with given storage state. This option can be used to initialize context with logged-in
945
+ * information obtained via
946
+ * [browserContext.storageState([options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-storage-state).
947
+ *
948
+ * **Usage**
949
+ *
950
+ * ```js
951
+ * // playwright.config.ts
952
+ * import { defineConfig } from '@playwright/test';
953
+ *
954
+ * export default defineConfig({
955
+ * use: {
956
+ * storageState: 'storage-state.json',
957
+ * },
958
+ * });
959
+ * ```
960
+ *
961
+ * **Details**
962
+ *
963
+ * When storage state is set up in the config, it is possible to reset storage state for a file:
964
+ *
965
+ * ```js
966
+ * // not-signed-in.spec.ts
967
+ * import { test } from '@playwright/test';
968
+ *
969
+ * // Reset storage state for this file to avoid being authenticated
970
+ * test.use({ storageState: { cookies: [], origins: [] } });
971
+ *
972
+ * test('not signed in test', async ({ page }) => {
973
+ * // ...
974
+ * });
975
+ * ```
976
+ *
977
+ */
978
+ storageState: StorageState | undefined;
979
+ /**
980
+ * Changes the timezone of the context. See
981
+ * [ICU's metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1)
982
+ * for a list of supported timezone IDs. Defaults to the system timezone.
983
+ *
984
+ * **Usage**
985
+ *
986
+ * ```js
987
+ * // playwright.config.ts
988
+ * import { defineConfig } from '@playwright/test';
989
+ *
990
+ * export default defineConfig({
991
+ * use: {
992
+ * timezoneId: 'Europe/Rome',
993
+ * },
994
+ * });
995
+ * ```
996
+ *
997
+ */
998
+ timezoneId: string | undefined;
999
+ /**
1000
+ * Specific user agent to use in this context.
1001
+ *
1002
+ * **Usage**
1003
+ *
1004
+ * ```js
1005
+ * // playwright.config.ts
1006
+ * import { defineConfig } from '@playwright/test';
1007
+ *
1008
+ * export default defineConfig({
1009
+ * use: {
1010
+ * userAgent: 'some custom ua',
1011
+ * },
1012
+ * });
1013
+ * ```
1014
+ *
1015
+ */
1016
+ userAgent: string | undefined;
1017
+ /**
1018
+ * Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use `null` to disable the consistent
1019
+ * viewport emulation. Learn more about [viewport emulation](https://playwright.dev/docs/emulation#viewport).
1020
+ *
1021
+ * **NOTE** The `null` value opts out from the default presets, makes viewport depend on the host window size defined
1022
+ * by the operating system. It makes the execution of the tests non-deterministic.
1023
+ *
1024
+ * **Usage**
1025
+ *
1026
+ * ```js
1027
+ * // playwright.config.ts
1028
+ * import { defineConfig } from '@playwright/test';
1029
+ *
1030
+ * export default defineConfig({
1031
+ * use: {
1032
+ * viewport: { width: 100, height: 100 },
1033
+ * },
1034
+ * });
1035
+ * ```
1036
+ *
1037
+ */
1038
+ viewport: ViewportSize | null;
1039
+ /**
1040
+ * When using [page.goto(url[, options])](https://playwright.dev/docs/api/class-page#page-goto),
1041
+ * [page.route(url, handler[, options])](https://playwright.dev/docs/api/class-page#page-route),
1042
+ * [page.waitForURL(url[, options])](https://playwright.dev/docs/api/class-page#page-wait-for-url),
1043
+ * [page.waitForRequest(urlOrPredicate[, options])](https://playwright.dev/docs/api/class-page#page-wait-for-request),
1044
+ * or
1045
+ * [page.waitForResponse(urlOrPredicate[, options])](https://playwright.dev/docs/api/class-page#page-wait-for-response)
1046
+ * it takes the base URL in consideration by using the
1047
+ * [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL.
1048
+ * Unset by default. Examples:
1049
+ * - baseURL: `http://localhost:3000` and navigating to `/bar.html` results in `http://localhost:3000/bar.html`
1050
+ * - baseURL: `http://localhost:3000/foo/` and navigating to `./bar.html` results in
1051
+ * `http://localhost:3000/foo/bar.html`
1052
+ * - baseURL: `http://localhost:3000/foo` (without trailing slash) and navigating to `./bar.html` results in
1053
+ * `http://localhost:3000/bar.html`
1054
+ *
1055
+ * **Usage**
1056
+ *
1057
+ * ```js
1058
+ * import { defineConfig, devices } from '@playwright/test';
1059
+ *
1060
+ * export default defineConfig({
1061
+ * use: {
1062
+ * /* Base URL to use in actions like `await page.goto('/')`. *\/
1063
+ * baseURL: 'http://localhost:3000',
1064
+ * },
1065
+ * });
1066
+ * ```
1067
+ *
1068
+ */
1069
+ baseURL: string | undefined;
1070
+ /**
1071
+ * Options used to create the context, as passed to
1072
+ * [browser.newContext([options])](https://playwright.dev/docs/api/class-browser#browser-new-context). Specific
1073
+ * options like [testOptions.viewport](https://playwright.dev/docs/api/class-testoptions#test-options-viewport) take
1074
+ * priority over this.
1075
+ *
1076
+ * **Usage**
1077
+ *
1078
+ * ```js
1079
+ * // playwright.config.ts
1080
+ * import { defineConfig } from '@playwright/test';
1081
+ *
1082
+ * export default defineConfig({
1083
+ * use: {
1084
+ * contextOptions: {
1085
+ * reducedMotion: 'reduce',
1086
+ * },
1087
+ * },
1088
+ * });
1089
+ * ```
1090
+ *
1091
+ */
1092
+ contextOptions: BrowserContextOptions;
1093
+ /**
1094
+ * Default timeout for each Playwright action in milliseconds, defaults to 0 (no timeout).
1095
+ *
1096
+ * This is a default timeout for all Playwright actions, same as configured via
1097
+ * [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout).
1098
+ *
1099
+ * **Usage**
1100
+ *
1101
+ * ```js
1102
+ * import { defineConfig, devices } from '@playwright/test';
1103
+ *
1104
+ * export default defineConfig({
1105
+ * use: {
1106
+ * /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). *\/
1107
+ * actionTimeout: 0,
1108
+ * },
1109
+ * });
1110
+ * ```
1111
+ *
1112
+ * Learn more about [various timeouts](https://playwright.dev/docs/test-timeouts).
1113
+ */
1114
+ actionTimeout: number;
1115
+ /**
1116
+ * Timeout for each navigation action in milliseconds. Defaults to 0 (no timeout).
1117
+ *
1118
+ * This is a default navigation timeout, same as configured via
1119
+ * [page.setDefaultNavigationTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-navigation-timeout).
1120
+ *
1121
+ * **Usage**
1122
+ *
1123
+ * ```js
1124
+ * // playwright.config.ts
1125
+ * import { defineConfig } from '@playwright/test';
1126
+ *
1127
+ * export default defineConfig({
1128
+ * use: {
1129
+ * navigationTimeout: 3000,
1130
+ * },
1131
+ * });
1132
+ * ```
1133
+ *
1134
+ * Learn more about [various timeouts](https://playwright.dev/docs/test-timeouts).
1135
+ */
1136
+ navigationTimeout: number;
1137
+ /**
1138
+ * Whether to allow sites to register Service workers. Defaults to `'allow'`.
1139
+ * - `'allow'`: [Service Workers](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API) can be
1140
+ * registered.
1141
+ * - `'block'`: Playwright will block all registration of Service Workers.
1142
+ *
1143
+ * **Usage**
1144
+ *
1145
+ * ```js
1146
+ * // playwright.config.ts
1147
+ * import { defineConfig } from '@playwright/test';
1148
+ *
1149
+ * export default defineConfig({
1150
+ * use: {
1151
+ * serviceWorkers: 'allow'
1152
+ * },
1153
+ * });
1154
+ * ```
1155
+ *
1156
+ */
1157
+ serviceWorkers: ServiceWorkerPolicy;
1158
+ /**
1159
+ * Custom attribute to be used in
1160
+ * [page.getByTestId(testId)](https://playwright.dev/docs/api/class-page#page-get-by-test-id). `data-testid` is used
1161
+ * by default.
1162
+ *
1163
+ * **Usage**
1164
+ *
1165
+ * ```js
1166
+ * // playwright.config.ts
1167
+ * import { defineConfig } from '@playwright/test';
1168
+ *
1169
+ * export default defineConfig({
1170
+ * use: {
1171
+ * testIdAttribute: 'pw-test-id',
1172
+ * },
1173
+ * });
1174
+ * ```
1175
+ *
1176
+ */
1177
+ testIdAttribute: string;
1178
+ }
1179
+ // --- BEGINGLOBAL ---
1180
+ declare global {
1181
+ export namespace PlaywrightTest {
1182
+ export interface Matchers<R, T = unknown> {}
1183
+ }
1184
+ } // --- ENDGLOBAL ---
1185
+ /**
1186
+ * These tests are executed in Playwright environment that launches the browser
1187
+ * and provides a fresh page to each test.
1188
+ */
1189
+ /**
1190
+ * Represents a location in the source code where [TestCase] or [Suite] is defined.
1191
+ */
1192
+ interface Location {
1193
+ /**
1194
+ * Column number in the source file.
1195
+ */
1196
+ column: number;
1197
+ /**
1198
+ * Path to the source file.
1199
+ */
1200
+ file: string;
1201
+ /**
1202
+ * Line number in the source file.
1203
+ */
1204
+ line: number;
1205
+ }
1206
+ interface TestConfigWebServer {
1207
+ /**
1208
+ * Shell command to start. For example `npm run start`..
1209
+ */
1210
+ command: string;
1211
+ /**
1212
+ * Current working directory of the spawned process, defaults to the directory of the configuration file.
1213
+ */
1214
+ cwd?: string;
1215
+ /**
1216
+ * Environment variables to set for the command, `process.env` by default.
1217
+ */
1218
+ env?: {
1219
+ [key: string]: string;
1220
+ };
1221
+ /**
1222
+ * How to shut down the process. If unspecified, the process group is forcefully `SIGKILL`ed. If set to `{ signal:
1223
+ * 'SIGTERM', timeout: 500 }`, the process group is sent a `SIGTERM` signal, followed by `SIGKILL` if it doesn't exit
1224
+ * within 500ms. You can also use `SIGINT` as the signal instead. A `0` timeout means no `SIGKILL` will be sent.
1225
+ * Windows doesn't support `SIGTERM` and `SIGINT` signals, so this option is ignored on Windows. Note that shutting
1226
+ * down a Docker container requires `SIGTERM`.
1227
+ */
1228
+ gracefulShutdown?: {
1229
+ signal: "SIGINT" | "SIGTERM";
1230
+ timeout: number;
1231
+ };
1232
+ /**
1233
+ * Whether to ignore HTTPS errors when fetching the `url`. Defaults to `false`.
1234
+ */
1235
+ ignoreHTTPSErrors?: boolean;
1236
+ /**
1237
+ * Specifies a custom name for the web server. This name will be prefixed to log messages. Defaults to `[WebServer]`.
1238
+ */
1239
+ name?: string;
1240
+ /**
1241
+ * The port that your http server is expected to appear on. It does wait until it accepts connections. Either `port`
1242
+ * or `url` should be specified.
1243
+ */
1244
+ port?: number;
1245
+ /**
1246
+ * If true, it will re-use an existing server on the `port` or `url` when available. If no server is running on that
1247
+ * `port` or `url`, it will run the command to start a new server. If `false`, it will throw if an existing process is
1248
+ * listening on the `port` or `url`. This should be commonly set to `!process.env.CI` to allow the local dev server
1249
+ * when running tests locally.
1250
+ */
1251
+ reuseExistingServer?: boolean;
1252
+ /**
1253
+ * Whether to pipe the stderr of the command to the process stderr or ignore it. Defaults to `"pipe"`.
1254
+ */
1255
+ stderr?: "pipe" | "ignore";
1256
+ /**
1257
+ * If `"pipe"`, it will pipe the stdout of the command to the process stdout. If `"ignore"`, it will ignore the stdout
1258
+ * of the command. Default to `"ignore"`.
1259
+ */
1260
+ stdout?: "pipe" | "ignore";
1261
+ /**
1262
+ * Consider command started only when given output has been produced.
1263
+ */
1264
+ wait?: {
1265
+ /**
1266
+ * Regular expression to wait for in the `stdout` of the command output. Named capture groups are stored in the
1267
+ * environment, for example `/Listening on port (?<my_server_port>\d+)/` will store the port number in
1268
+ * `process.env['MY_SERVER_PORT']`.
1269
+ */
1270
+ stdout?: RegExp;
1271
+ /**
1272
+ * Regular expression to wait for in the `stderr` of the command output. Named capture groups are stored in the
1273
+ * environment, for example `/Listening on port (?<my_server_port>\d+)/` will store the port number in
1274
+ * `process.env['MY_SERVER_PORT']`.
1275
+ */
1276
+ stderr?: RegExp;
1277
+ };
1278
+ /**
1279
+ * How long to wait for the process to start up and be available in milliseconds. Defaults to 60000.
1280
+ */
1281
+ timeout?: number;
1282
+ /**
1283
+ * The url on your http server that is expected to return a 2xx, 3xx, 400, 401, 402, or 403 status code when the
1284
+ * server is ready to accept connections. Redirects (3xx status codes) are being followed and the new location is
1285
+ * checked. Either `port` or `url` should be specified.
1286
+ */
1287
+ url?: string;
1288
+ }
1289
+ //#endregion
1290
+ //#region ../../node_modules/.pnpm/playwright@1.58.2/node_modules/playwright/types/testReporter.d.ts
1291
+ /**
1292
+ * Result of the full test run.
1293
+ */
1294
+ interface FullResult {
1295
+ /**
1296
+ * Status:
1297
+ * - 'passed' - everything went as expected.
1298
+ * - 'failed' - any test has failed.
1299
+ * - 'timedout' - the global time has been reached.
1300
+ * - 'interrupted' - interrupted by the user.
1301
+ */
1302
+ status: 'passed' | 'failed' | 'timedout' | 'interrupted';
1303
+ /**
1304
+ * Test start wall time.
1305
+ */
1306
+ startTime: Date;
1307
+ /**
1308
+ * Test duration in milliseconds.
1309
+ */
1310
+ duration: number;
1311
+ }
1312
+ /**
1313
+ * Test runner notifies the reporter about various events during test execution. All methods of the reporter are
1314
+ * optional.
1315
+ *
1316
+ * You can create a custom reporter by implementing a class with some of the reporter methods. Make sure to export
1317
+ * this class as default.
1318
+ *
1319
+ * ```js
1320
+ * // my-awesome-reporter.ts
1321
+ * import type {
1322
+ * Reporter, FullConfig, Suite, TestCase, TestResult, FullResult
1323
+ * } from '@playwright/test/reporter';
1324
+ *
1325
+ * class MyReporter implements Reporter {
1326
+ * constructor(options: { customOption?: string } = {}) {
1327
+ * console.log(`my-awesome-reporter setup with customOption set to ${options.customOption}`);
1328
+ * }
1329
+ *
1330
+ * onBegin(config: FullConfig, suite: Suite) {
1331
+ * console.log(`Starting the run with ${suite.allTests().length} tests`);
1332
+ * }
1333
+ *
1334
+ * onTestBegin(test: TestCase) {
1335
+ * console.log(`Starting test ${test.title}`);
1336
+ * }
1337
+ *
1338
+ * onTestEnd(test: TestCase, result: TestResult) {
1339
+ * console.log(`Finished test ${test.title}: ${result.status}`);
1340
+ * }
1341
+ *
1342
+ * onEnd(result: FullResult) {
1343
+ * console.log(`Finished the run: ${result.status}`);
1344
+ * }
1345
+ * }
1346
+ * export default MyReporter;
1347
+ * ```
1348
+ *
1349
+ * Now use this reporter with
1350
+ * [testConfig.reporter](https://playwright.dev/docs/api/class-testconfig#test-config-reporter). Learn more about
1351
+ * [using reporters](https://playwright.dev/docs/test-reporters).
1352
+ *
1353
+ * ```js
1354
+ * // playwright.config.ts
1355
+ * import { defineConfig } from '@playwright/test';
1356
+ *
1357
+ * export default defineConfig({
1358
+ * reporter: [['./my-awesome-reporter.ts', { customOption: 'some value' }]],
1359
+ * });
1360
+ * ```
1361
+ *
1362
+ * Here is a typical order of reporter calls:
1363
+ * - [reporter.onBegin(config, suite)](https://playwright.dev/docs/api/class-reporter#reporter-on-begin) is called
1364
+ * once with a root suite that contains all other suites and tests. Learn more about
1365
+ * [suites hierarchy][Suite](https://playwright.dev/docs/api/class-suite).
1366
+ * - [reporter.onTestBegin(test, result)](https://playwright.dev/docs/api/class-reporter#reporter-on-test-begin) is
1367
+ * called for each test run. It is given a [TestCase](https://playwright.dev/docs/api/class-testcase) that is
1368
+ * executed, and a [TestResult](https://playwright.dev/docs/api/class-testresult) that is almost empty. Test
1369
+ * result will be populated while the test runs (for example, with steps and stdio) and will get final `status`
1370
+ * once the test finishes.
1371
+ * - [reporter.onStepBegin(test, result, step)](https://playwright.dev/docs/api/class-reporter#reporter-on-step-begin)
1372
+ * and
1373
+ * [reporter.onStepEnd(test, result, step)](https://playwright.dev/docs/api/class-reporter#reporter-on-step-end)
1374
+ * are called for each executed step inside the test. When steps are executed, test run has not finished yet.
1375
+ * - [reporter.onTestEnd(test, result)](https://playwright.dev/docs/api/class-reporter#reporter-on-test-end) is
1376
+ * called when test run has finished. By this time, [TestResult](https://playwright.dev/docs/api/class-testresult)
1377
+ * is complete and you can use
1378
+ * [testResult.status](https://playwright.dev/docs/api/class-testresult#test-result-status),
1379
+ * [testResult.error](https://playwright.dev/docs/api/class-testresult#test-result-error) and more.
1380
+ * - [reporter.onEnd(result)](https://playwright.dev/docs/api/class-reporter#reporter-on-end) is called once after
1381
+ * all tests that should run had finished.
1382
+ * - [reporter.onExit()](https://playwright.dev/docs/api/class-reporter#reporter-on-exit) is called immediately
1383
+ * before the test runner exits.
1384
+ *
1385
+ * Additionally,
1386
+ * [reporter.onStdOut(chunk, test, result)](https://playwright.dev/docs/api/class-reporter#reporter-on-std-out) and
1387
+ * [reporter.onStdErr(chunk, test, result)](https://playwright.dev/docs/api/class-reporter#reporter-on-std-err) are
1388
+ * called when standard output is produced in the worker process, possibly during a test execution, and
1389
+ * [reporter.onError(error)](https://playwright.dev/docs/api/class-reporter#reporter-on-error) is called when
1390
+ * something went wrong outside of the test execution.
1391
+ *
1392
+ * If your custom reporter does not print anything to the terminal, implement
1393
+ * [reporter.printsToStdio()](https://playwright.dev/docs/api/class-reporter#reporter-prints-to-stdio) and return
1394
+ * `false`. This way, Playwright will use one of the standard terminal reporters in addition to your custom reporter
1395
+ * to enhance user experience.
1396
+ *
1397
+ * **Reporter errors**
1398
+ *
1399
+ * Playwright will swallow any errors thrown in your custom reporter methods. If you need to detect or fail on
1400
+ * reporter errors, you must wrap and handle them yourself.
1401
+ *
1402
+ * **Merged report API notes**
1403
+ *
1404
+ * When merging multiple [`blob`](https://playwright.dev/docs/test-reporters#blob-reporter) reports via
1405
+ * [`merge-reports`](https://playwright.dev/docs/test-sharding#merge-reports-cli) CLI command, the same
1406
+ * [Reporter](https://playwright.dev/docs/api/class-reporter) API is called to produce final reports and all existing
1407
+ * reporters should work without any changes. There some subtle differences though which might affect some custom
1408
+ * reporters.
1409
+ * - Projects from different shards are always kept as separate
1410
+ * [TestProject](https://playwright.dev/docs/api/class-testproject) objects. E.g. if project 'Desktop Chrome' was
1411
+ * sharded across 5 machines then there will be 5 instances of projects with the same name in the config passed to
1412
+ * [reporter.onBegin(config, suite)](https://playwright.dev/docs/api/class-reporter#reporter-on-begin).
1413
+ */
1414
+ interface Reporter {
1415
+ /**
1416
+ * Called after all tests have been run, or testing has been interrupted. Note that this method may return a [Promise]
1417
+ * and Playwright Test will await it. Reporter is allowed to override the status and hence affect the exit code of the
1418
+ * test runner.
1419
+ * @param result Result of the full test run, `status` can be one of:
1420
+ * - `'passed'` - Everything went as expected.
1421
+ * - `'failed'` - Any test has failed.
1422
+ * - `'timedout'` - The
1423
+ * [testConfig.globalTimeout](https://playwright.dev/docs/api/class-testconfig#test-config-global-timeout) has
1424
+ * been reached.
1425
+ * - `'interrupted'` - Interrupted by the user.
1426
+ */
1427
+ onEnd?(result: FullResult): Promise<{
1428
+ status?: FullResult['status'];
1429
+ } | undefined | void> | void;
1430
+ /**
1431
+ * Called once before running tests. All tests have been already discovered and put into a hierarchy of
1432
+ * [Suite](https://playwright.dev/docs/api/class-suite)s.
1433
+ * @param config Resolved configuration.
1434
+ * @param suite The root suite that contains all projects, files and test cases.
1435
+ */
1436
+ onBegin?(config: FullConfig, suite: Suite): void;
1437
+ /**
1438
+ * Called on some global error, for example unhandled exception in the worker process.
1439
+ * @param error The error.
1440
+ */
1441
+ onError?(error: TestError): void;
1442
+ /**
1443
+ * Called immediately before test runner exists. At this point all the reporters have received the
1444
+ * [reporter.onEnd(result)](https://playwright.dev/docs/api/class-reporter#reporter-on-end) signal, so all the reports
1445
+ * should be build. You can run the code that uploads the reports in this hook.
1446
+ */
1447
+ onExit?(): Promise<void>;
1448
+ /**
1449
+ * Called when something has been written to the standard error in the worker process.
1450
+ * @param chunk Output chunk.
1451
+ * @param test Test that was running. Note that output may happen when no test is running, in which case this will be [void].
1452
+ * @param result Result of the test run, this object gets populated while the test runs.
1453
+ */
1454
+ onStdErr?(chunk: string | Buffer, test: void | TestCase, result: void | TestResult): void;
1455
+ /**
1456
+ * Called when something has been written to the standard output in the worker process.
1457
+ * @param chunk Output chunk.
1458
+ * @param test Test that was running. Note that output may happen when no test is running, in which case this will be [void].
1459
+ * @param result Result of the test run, this object gets populated while the test runs.
1460
+ */
1461
+ onStdOut?(chunk: string | Buffer, test: void | TestCase, result: void | TestResult): void;
1462
+ /**
1463
+ * Called when a test step started in the worker process.
1464
+ * @param test Test that the step belongs to.
1465
+ * @param result Result of the test run, this object gets populated while the test runs.
1466
+ * @param step Test step instance that has started.
1467
+ */
1468
+ onStepBegin?(test: TestCase, result: TestResult, step: TestStep): void;
1469
+ /**
1470
+ * Called when a test step finished in the worker process.
1471
+ * @param test Test that the step belongs to.
1472
+ * @param result Result of the test run.
1473
+ * @param step Test step instance that has finished.
1474
+ */
1475
+ onStepEnd?(test: TestCase, result: TestResult, step: TestStep): void;
1476
+ /**
1477
+ * Called after a test has been started in the worker process.
1478
+ * @param test Test that has been started.
1479
+ * @param result Result of the test run, this object gets populated while the test runs.
1480
+ */
1481
+ onTestBegin?(test: TestCase, result: TestResult): void;
1482
+ /**
1483
+ * Called after a test has been finished in the worker process.
1484
+ * @param test Test that has been finished.
1485
+ * @param result Result of the test run.
1486
+ */
1487
+ onTestEnd?(test: TestCase, result: TestResult): void;
1488
+ /**
1489
+ * Whether this reporter uses stdio for reporting. When it does not, Playwright Test could add some output to enhance
1490
+ * user experience. If your reporter does not print to the terminal, it is strongly recommended to return `false`.
1491
+ */
1492
+ printsToStdio?(): boolean;
1493
+ }
1494
+ /**
1495
+ * `Suite` is a group of tests. All tests in Playwright Test form the following hierarchy:
1496
+ * - Root suite has a child suite for each [FullProject](https://playwright.dev/docs/api/class-fullproject).
1497
+ * - Project suite #1. Has a child suite for each test file in the project.
1498
+ * - File suite #1
1499
+ * - [TestCase](https://playwright.dev/docs/api/class-testcase) #1
1500
+ * - [TestCase](https://playwright.dev/docs/api/class-testcase) #2
1501
+ * - Suite corresponding to a
1502
+ * [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe)
1503
+ * group
1504
+ * - [TestCase](https://playwright.dev/docs/api/class-testcase) #1 in a group
1505
+ * - [TestCase](https://playwright.dev/docs/api/class-testcase) #2 in a group
1506
+ * - < more test cases ... >
1507
+ * - File suite #2
1508
+ * - < more file suites ... >
1509
+ * - Project suite #2
1510
+ * - < more project suites ... >
1511
+ *
1512
+ * Reporter is given a root suite in the
1513
+ * [reporter.onBegin(config, suite)](https://playwright.dev/docs/api/class-reporter#reporter-on-begin) method.
1514
+ */
1515
+ interface Suite {
1516
+ /**
1517
+ * Returns the list of all test cases in this suite and its descendants, as opposite to
1518
+ * [suite.tests](https://playwright.dev/docs/api/class-suite#suite-tests).
1519
+ */
1520
+ allTests(): Array<TestCase>;
1521
+ /**
1522
+ * Test cases and suites defined directly in this suite. The elements are returned in their declaration order. You can
1523
+ * differentiate between various entry types by using
1524
+ * [testCase.type](https://playwright.dev/docs/api/class-testcase#test-case-type) and
1525
+ * [suite.type](https://playwright.dev/docs/api/class-suite#suite-type).
1526
+ */
1527
+ entries(): Array<TestCase | Suite>;
1528
+ /**
1529
+ * Configuration of the project this suite belongs to, or [void] for the root suite.
1530
+ */
1531
+ project(): FullProject | undefined;
1532
+ /**
1533
+ * Returns a list of titles from the root down to this suite.
1534
+ */
1535
+ titlePath(): Array<string>;
1536
+ /**
1537
+ * Location in the source where the suite is defined. Missing for root and project suites.
1538
+ */
1539
+ location?: Location;
1540
+ /**
1541
+ * Parent suite, missing for the root suite.
1542
+ */
1543
+ parent?: Suite;
1544
+ /**
1545
+ * Child suites. See [Suite](https://playwright.dev/docs/api/class-suite) for the hierarchy of suites.
1546
+ */
1547
+ suites: Array<Suite>;
1548
+ /**
1549
+ * Test cases in the suite. Note that only test cases defined directly in this suite are in the list. Any test cases
1550
+ * defined in nested
1551
+ * [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe) groups are
1552
+ * listed in the child [suite.suites](https://playwright.dev/docs/api/class-suite#suite-suites).
1553
+ */
1554
+ tests: Array<TestCase>;
1555
+ /**
1556
+ * Suite title.
1557
+ * - Empty for root suite.
1558
+ * - Project name for project suite.
1559
+ * - File path for file suite.
1560
+ * - Title passed to
1561
+ * [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe) for a
1562
+ * group suite.
1563
+ */
1564
+ title: string;
1565
+ /**
1566
+ * Returns the type of the suite. The Suites form the following hierarchy: `root` -> `project` -> `file` -> `describe`
1567
+ * -> ...`describe` -> `test`.
1568
+ */
1569
+ type: "root" | "project" | "file" | "describe";
1570
+ }
1571
+ /**
1572
+ * `TestCase` corresponds to every
1573
+ * [test.(call)(title[, details, body])](https://playwright.dev/docs/api/class-test#test-call) call in a test file.
1574
+ * When a single [test.(call)(title[, details, body])](https://playwright.dev/docs/api/class-test#test-call) is
1575
+ * running in multiple projects or repeated multiple times, it will have multiple `TestCase` objects in corresponding
1576
+ * projects' suites.
1577
+ */
1578
+ interface TestCase {
1579
+ /**
1580
+ * Whether the test is considered running fine. Non-ok tests fail the test run with non-zero exit code.
1581
+ */
1582
+ ok(): boolean;
1583
+ /**
1584
+ * Testing outcome for this test. Note that outcome is not the same as
1585
+ * [testResult.status](https://playwright.dev/docs/api/class-testresult#test-result-status):
1586
+ * - Test that is expected to fail and actually fails is `'expected'`.
1587
+ * - Test that passes on a second retry is `'flaky'`.
1588
+ */
1589
+ outcome(): "skipped" | "expected" | "unexpected" | "flaky";
1590
+ /**
1591
+ * Returns a list of titles from the root down to this test.
1592
+ */
1593
+ titlePath(): Array<string>;
1594
+ /**
1595
+ * [testResult.annotations](https://playwright.dev/docs/api/class-testresult#test-result-annotations) of the last test
1596
+ * run.
1597
+ */
1598
+ annotations: Array<{
1599
+ /**
1600
+ * Annotation type, for example `'skip'` or `'fail'`.
1601
+ */
1602
+ type: string;
1603
+ /**
1604
+ * Optional description.
1605
+ */
1606
+ description?: string;
1607
+ /**
1608
+ * Optional location in the source where the annotation is added.
1609
+ */
1610
+ location?: Location;
1611
+ }>;
1612
+ /**
1613
+ * Expected test status.
1614
+ * - Tests marked as
1615
+ * [test.skip([title, details, body, condition, callback, description])](https://playwright.dev/docs/api/class-test#test-skip)
1616
+ * or
1617
+ * [test.fixme([title, details, body, condition, callback, description])](https://playwright.dev/docs/api/class-test#test-fixme)
1618
+ * are expected to be `'skipped'`.
1619
+ * - Tests marked as
1620
+ * [test.fail([title, details, body, condition, callback, description])](https://playwright.dev/docs/api/class-test#test-fail)
1621
+ * are expected to be `'failed'`.
1622
+ * - Other tests are expected to be `'passed'`.
1623
+ *
1624
+ * See also [testResult.status](https://playwright.dev/docs/api/class-testresult#test-result-status) for the actual
1625
+ * status.
1626
+ */
1627
+ expectedStatus: "passed" | "failed" | "timedOut" | "skipped" | "interrupted";
1628
+ /**
1629
+ * A test ID that is computed based on the test file name, test title and project name. The ID is unique within
1630
+ * Playwright session.
1631
+ */
1632
+ id: string;
1633
+ /**
1634
+ * Location in the source where the test is defined.
1635
+ */
1636
+ location: Location;
1637
+ /**
1638
+ * Suite this test case belongs to.
1639
+ */
1640
+ parent: Suite;
1641
+ /**
1642
+ * Contains the repeat index when running in "repeat each" mode. This mode is enabled by passing `--repeat-each` to
1643
+ * the [command line](https://playwright.dev/docs/test-cli).
1644
+ */
1645
+ repeatEachIndex: number;
1646
+ /**
1647
+ * Results for each run of this test.
1648
+ */
1649
+ results: Array<TestResult>;
1650
+ /**
1651
+ * The maximum number of retries given to this test in the configuration.
1652
+ *
1653
+ * Learn more about [test retries](https://playwright.dev/docs/test-retries#retries).
1654
+ */
1655
+ retries: number;
1656
+ /**
1657
+ * The list of tags defined on the test or suite via
1658
+ * [test.(call)(title[, details, body])](https://playwright.dev/docs/api/class-test#test-call) or
1659
+ * [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe), as well as
1660
+ * `@`-tokens extracted from test and suite titles.
1661
+ *
1662
+ * Learn more about [test tags](https://playwright.dev/docs/test-annotations#tag-tests).
1663
+ */
1664
+ tags: Array<string>;
1665
+ /**
1666
+ * The timeout given to the test. Affected by
1667
+ * [testConfig.timeout](https://playwright.dev/docs/api/class-testconfig#test-config-timeout),
1668
+ * [testProject.timeout](https://playwright.dev/docs/api/class-testproject#test-project-timeout),
1669
+ * [test.setTimeout(timeout)](https://playwright.dev/docs/api/class-test#test-set-timeout),
1670
+ * [test.slow([condition, callback, description])](https://playwright.dev/docs/api/class-test#test-slow) and
1671
+ * [testInfo.setTimeout(timeout)](https://playwright.dev/docs/api/class-testinfo#test-info-set-timeout).
1672
+ */
1673
+ timeout: number;
1674
+ /**
1675
+ * Test title as passed to the
1676
+ * [test.(call)(title[, details, body])](https://playwright.dev/docs/api/class-test#test-call) call.
1677
+ */
1678
+ title: string;
1679
+ /**
1680
+ * Returns "test". Useful for detecting test cases in
1681
+ * [suite.entries()](https://playwright.dev/docs/api/class-suite#suite-entries).
1682
+ */
1683
+ type: "test";
1684
+ }
1685
+ /**
1686
+ * Information about an error thrown during test execution.
1687
+ */
1688
+ interface TestError {
1689
+ /**
1690
+ * Error cause. Set when there is a
1691
+ * [cause](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause) for the
1692
+ * error. Will be `undefined` if there is no cause or if the cause is not an instance of [Error].
1693
+ */
1694
+ cause?: TestError;
1695
+ /**
1696
+ * Error location in the source code.
1697
+ */
1698
+ location?: Location;
1699
+ /**
1700
+ * Error message. Set when [Error] (or its subclass) has been thrown.
1701
+ */
1702
+ message?: string;
1703
+ /**
1704
+ * Source code snippet with highlighted error.
1705
+ */
1706
+ snippet?: string;
1707
+ /**
1708
+ * Error stack. Set when [Error] (or its subclass) has been thrown.
1709
+ */
1710
+ stack?: string;
1711
+ /**
1712
+ * The value that was thrown. Set when anything except the [Error] (or its subclass) has been thrown.
1713
+ */
1714
+ value?: string;
1715
+ }
1716
+ /**
1717
+ * A result of a single [TestCase](https://playwright.dev/docs/api/class-testcase) run.
1718
+ */
1719
+ interface TestResult {
1720
+ /**
1721
+ * The list of annotations applicable to the current test. Includes:
1722
+ * - annotations defined on the test or suite via
1723
+ * [test.(call)(title[, details, body])](https://playwright.dev/docs/api/class-test#test-call) and
1724
+ * [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe);
1725
+ * - annotations implicitly added by methods
1726
+ * [test.skip([title, details, body, condition, callback, description])](https://playwright.dev/docs/api/class-test#test-skip),
1727
+ * [test.fixme([title, details, body, condition, callback, description])](https://playwright.dev/docs/api/class-test#test-fixme)
1728
+ * and
1729
+ * [test.fail([title, details, body, condition, callback, description])](https://playwright.dev/docs/api/class-test#test-fail);
1730
+ * - annotations appended to
1731
+ * [testInfo.annotations](https://playwright.dev/docs/api/class-testinfo#test-info-annotations) during the test
1732
+ * execution.
1733
+ *
1734
+ * Annotations are available during test execution through
1735
+ * [testInfo.annotations](https://playwright.dev/docs/api/class-testinfo#test-info-annotations).
1736
+ *
1737
+ * Learn more about [test annotations](https://playwright.dev/docs/test-annotations).
1738
+ */
1739
+ annotations: Array<{
1740
+ /**
1741
+ * Annotation type, for example `'skip'` or `'fail'`.
1742
+ */
1743
+ type: string;
1744
+ /**
1745
+ * Optional description.
1746
+ */
1747
+ description?: string;
1748
+ /**
1749
+ * Optional location in the source where the annotation is added.
1750
+ */
1751
+ location?: Location;
1752
+ }>;
1753
+ /**
1754
+ * The list of files or buffers attached during the test execution through
1755
+ * [testInfo.attachments](https://playwright.dev/docs/api/class-testinfo#test-info-attachments).
1756
+ */
1757
+ attachments: Array<{
1758
+ /**
1759
+ * Attachment name.
1760
+ */
1761
+ name: string;
1762
+ /**
1763
+ * Content type of this attachment to properly present in the report, for example `'application/json'` or
1764
+ * `'image/png'`.
1765
+ */
1766
+ contentType: string;
1767
+ /**
1768
+ * Optional path on the filesystem to the attached file.
1769
+ */
1770
+ path?: string;
1771
+ /**
1772
+ * Optional attachment body used instead of a file.
1773
+ */
1774
+ body?: Buffer;
1775
+ }>;
1776
+ /**
1777
+ * Running time in milliseconds.
1778
+ */
1779
+ duration: number;
1780
+ /**
1781
+ * First error thrown during test execution, if any. This is equal to the first element in
1782
+ * [testResult.errors](https://playwright.dev/docs/api/class-testresult#test-result-errors).
1783
+ */
1784
+ error?: TestError;
1785
+ /**
1786
+ * Errors thrown during the test execution.
1787
+ */
1788
+ errors: Array<TestError>;
1789
+ /**
1790
+ * The index of the worker between `0` and `workers - 1`. It is guaranteed that workers running at the same time have
1791
+ * a different `parallelIndex`.
1792
+ */
1793
+ parallelIndex: number;
1794
+ /**
1795
+ * When test is retried multiple times, each retry attempt is given a sequential number.
1796
+ *
1797
+ * Learn more about [test retries](https://playwright.dev/docs/test-retries#retries).
1798
+ */
1799
+ retry: number;
1800
+ /**
1801
+ * Start time of this particular test run.
1802
+ */
1803
+ startTime: Date;
1804
+ /**
1805
+ * The status of this test result. See also
1806
+ * [testCase.expectedStatus](https://playwright.dev/docs/api/class-testcase#test-case-expected-status).
1807
+ */
1808
+ status: "passed" | "failed" | "timedOut" | "skipped" | "interrupted";
1809
+ /**
1810
+ * Anything written to the standard error during the test run.
1811
+ */
1812
+ stderr: Array<string | Buffer>;
1813
+ /**
1814
+ * Anything written to the standard output during the test run.
1815
+ */
1816
+ stdout: Array<string | Buffer>;
1817
+ /**
1818
+ * List of steps inside this test run.
1819
+ */
1820
+ steps: Array<TestStep>;
1821
+ /**
1822
+ * Index of the worker where the test was run. If the test was not run a single time, for example when the user
1823
+ * interrupted testing, the only result will have a `workerIndex` equal to `-1`.
1824
+ *
1825
+ * Learn more about [parallelism and sharding](https://playwright.dev/docs/test-parallel) with Playwright Test.
1826
+ */
1827
+ workerIndex: number;
1828
+ }
1829
+ /**
1830
+ * Represents a step in the [TestRun].
1831
+ */
1832
+ interface TestStep {
1833
+ /**
1834
+ * Returns a list of step titles from the root step down to this step.
1835
+ */
1836
+ titlePath(): Array<string>;
1837
+ /**
1838
+ * The list of annotations applicable to the current test step.
1839
+ */
1840
+ annotations: Array<{
1841
+ /**
1842
+ * Annotation type, for example `'skip'`.
1843
+ */
1844
+ type: string;
1845
+ /**
1846
+ * Optional description.
1847
+ */
1848
+ description?: string;
1849
+ /**
1850
+ * Optional location in the source where the annotation is added.
1851
+ */
1852
+ location?: Location;
1853
+ }>;
1854
+ /**
1855
+ * The list of files or buffers attached in the step execution through
1856
+ * [testInfo.attach(name[, options])](https://playwright.dev/docs/api/class-testinfo#test-info-attach).
1857
+ */
1858
+ attachments: Array<{
1859
+ /**
1860
+ * Attachment name.
1861
+ */
1862
+ name: string;
1863
+ /**
1864
+ * Content type of this attachment to properly present in the report, for example `'application/json'` or
1865
+ * `'image/png'`.
1866
+ */
1867
+ contentType: string;
1868
+ /**
1869
+ * Optional path on the filesystem to the attached file.
1870
+ */
1871
+ path?: string;
1872
+ /**
1873
+ * Optional attachment body used instead of a file.
1874
+ */
1875
+ body?: Buffer;
1876
+ }>;
1877
+ /**
1878
+ * Step category to differentiate steps with different origin and verbosity. Built-in categories are:
1879
+ * - `expect` for expect calls
1880
+ * - `fixture` for fixtures setup and teardown
1881
+ * - `hook` for hooks initialization and teardown
1882
+ * - `pw:api` for Playwright API calls.
1883
+ * - `test.step` for test.step API calls.
1884
+ * - `test.attach` for testInfo.attach API calls.
1885
+ */
1886
+ category: string;
1887
+ /**
1888
+ * Running time in milliseconds.
1889
+ */
1890
+ duration: number;
1891
+ /**
1892
+ * Error thrown during the step execution, if any.
1893
+ */
1894
+ error?: TestError;
1895
+ /**
1896
+ * Optional location in the source where the step is defined.
1897
+ */
1898
+ location?: Location;
1899
+ /**
1900
+ * Parent step, if any.
1901
+ */
1902
+ parent?: TestStep;
1903
+ /**
1904
+ * Start time of this particular test step.
1905
+ */
1906
+ startTime: Date;
1907
+ /**
1908
+ * List of steps inside this step.
1909
+ */
1910
+ steps: Array<TestStep>;
1911
+ /**
1912
+ * User-friendly test step title.
1913
+ */
1914
+ title: string;
1915
+ }
1916
+ //#endregion
1917
+ //#region src/reporter.d.ts
1918
+ /**
1919
+ * Dynamic build name.
1920
+ * We require all values in order to ensure it works correctly in parallel mode.
1921
+ */
1922
+ type DynamicBuildName<T extends readonly string[]> = {
1923
+ /**
1924
+ * The values that the build name can take.
1925
+ * It is required to ensure Argos will always upload
1926
+ * for each build name in order to work in sharding mode.
1927
+ */
1928
+ values: readonly [...T];
1929
+ /**
1930
+ * Get the build name for a test case.
1931
+ * Returns any of the values in `values`.
1932
+ */
1933
+ get: (test: TestCase) => T[number];
1934
+ };
1935
+ type ArgosReporterOptions<T extends string[] = string[]> = Omit<UploadParameters, "files" | "root" | "buildName" | "metadata"> & {
1936
+ /**
1937
+ * Upload the report to Argos.
1938
+ * @default true
1939
+ */
1940
+ uploadToArgos?: boolean;
1941
+ /**
1942
+ * If true, the reporter will not fail the test suite when the upload fails.
1943
+ * @default false
1944
+ */
1945
+ ignoreUploadFailures?: boolean;
1946
+ /**
1947
+ * The name of the build in Argos.
1948
+ * Can be a string or a function that receives the test case and returns the build name.
1949
+ */
1950
+ buildName?: string | DynamicBuildName<T> | null;
1951
+ };
1952
+ declare function createArgosReporterOptions<T extends string[]>(options: ArgosReporterOptions<T>): ArgosReporterOptions<T>;
1953
+ declare class ArgosReporter implements Reporter {
1954
+ rootUploadDirectoryPromise: null | Promise<string>;
1955
+ uploadDirectoryPromises: Map<string, Promise<string>>;
1956
+ config: ArgosReporterOptions;
1957
+ playwrightConfig: FullConfig;
1958
+ uploadToArgos: boolean;
1959
+ constructor(config: ArgosReporterOptions);
1960
+ /**
1961
+ * Write a file to the temporary directory.
1962
+ */
1963
+ writeFile(path: string, body: Buffer | string): Promise<void>;
1964
+ /**
1965
+ * Copy a file to the temporary directory.
1966
+ */
1967
+ copyFile(from: string, to: string): Promise<void>;
1968
+ /**
1969
+ * Copy the trace file if found in the result.
1970
+ */
1971
+ copyTraceIfFound(result: TestResult, path: string): Promise<void>;
1972
+ /**
1973
+ * Get the root upload directory (cached).
1974
+ */
1975
+ getRootUploadDirectory(): Promise<string>;
1976
+ onBegin(config: FullConfig): void;
1977
+ onTestEnd(test: TestCase, result: TestResult): Promise<void>;
1978
+ onEnd(result: FullResult): Promise<{
1979
+ status: "failed";
1980
+ } | undefined>;
1981
+ printsToStdio(): boolean;
1982
+ }
1983
+ //#endregion
1984
+ export { ArgosReporterOptions, createArgosReporterOptions, ArgosReporter as default };