@smoothdeploy/playwright 1.58.4 → 1.61.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.
Files changed (182) hide show
  1. package/ThirdPartyNotices.txt +8 -5036
  2. package/lib/agents/agentParser.js +2 -2
  3. package/lib/agents/generateAgents.js +69 -22
  4. package/lib/agents/playwright-test-healer.agent.md +1 -0
  5. package/lib/agents/playwright-test-planner.agent.md +2 -1
  6. package/lib/cli/reportActions.js +78 -0
  7. package/lib/cli/testActions.js +213 -0
  8. package/lib/common/index.js +2931 -0
  9. package/lib/common/index.js.txt +35 -0
  10. package/lib/errorContext.js +130 -0
  11. package/lib/index.js +276 -219
  12. package/lib/{isomorphic/testServerConnection.js → isomorphic.js} +70 -35
  13. package/lib/isomorphic.js.txt +9 -0
  14. package/lib/loader/loaderProcessEntry.js +34 -0
  15. package/lib/loader/loaderProcessEntry.js.txt +9 -0
  16. package/lib/matchers/expect.js +12990 -249
  17. package/lib/matchers/expect.js.LICENSE +693 -0
  18. package/lib/matchers/expect.js.txt +72 -0
  19. package/lib/mcp/test/browserBackend.js +49 -22
  20. package/lib/mcp/test/generatorTools.js +16 -16
  21. package/lib/mcp/test/plannerTools.js +25 -20
  22. package/lib/mcp/test/seed.js +7 -7
  23. package/lib/mcp/test/testBackend.js +30 -30
  24. package/lib/mcp/test/testContext.js +54 -33
  25. package/lib/mcp/test/testTools.js +15 -25
  26. package/lib/{internalsForTest.js → package.js} +13 -8
  27. package/lib/program.js +71 -265
  28. package/lib/runner/index.js +8389 -0
  29. package/lib/runner/index.js.txt +60 -0
  30. package/lib/transform/babelBundle.js +71002 -18
  31. package/lib/transform/babelBundle.js.LICENSE +2359 -0
  32. package/lib/transform/babelBundle.js.txt +325 -0
  33. package/lib/transform/esmLoader.js +5994 -33
  34. package/lib/transform/esmLoader.js.LICENSE +335 -0
  35. package/lib/transform/esmLoader.js.txt +57 -0
  36. package/lib/util.js +48 -48
  37. package/lib/worker/workerProcessEntry.js +1868 -0
  38. package/lib/worker/workerProcessEntry.js.txt +20 -0
  39. package/package.json +5 -16
  40. package/test.mjs +1 -0
  41. package/types/test.d.ts +238 -28
  42. package/types/testReporter.d.ts +7 -5
  43. package/lib/common/config.js +0 -282
  44. package/lib/common/configLoader.js +0 -344
  45. package/lib/common/esmLoaderHost.js +0 -104
  46. package/lib/common/expectBundle.js +0 -28
  47. package/lib/common/expectBundleImpl.js +0 -407
  48. package/lib/common/fixtures.js +0 -302
  49. package/lib/common/ipc.js +0 -60
  50. package/lib/common/poolBuilder.js +0 -85
  51. package/lib/common/process.js +0 -132
  52. package/lib/common/suiteUtils.js +0 -140
  53. package/lib/common/test.js +0 -321
  54. package/lib/common/testLoader.js +0 -101
  55. package/lib/common/testType.js +0 -298
  56. package/lib/common/validators.js +0 -68
  57. package/lib/fsWatcher.js +0 -67
  58. package/lib/isomorphic/events.js +0 -77
  59. package/lib/isomorphic/folders.js +0 -30
  60. package/lib/isomorphic/stringInternPool.js +0 -69
  61. package/lib/isomorphic/teleReceiver.js +0 -521
  62. package/lib/isomorphic/teleSuiteUpdater.js +0 -157
  63. package/lib/isomorphic/testServerInterface.js +0 -16
  64. package/lib/isomorphic/testTree.js +0 -329
  65. package/lib/isomorphic/types.d.js +0 -16
  66. package/lib/loader/loaderMain.js +0 -59
  67. package/lib/matchers/matcherHint.js +0 -44
  68. package/lib/matchers/matchers.js +0 -383
  69. package/lib/matchers/toBeTruthy.js +0 -75
  70. package/lib/matchers/toEqual.js +0 -100
  71. package/lib/matchers/toHaveURL.js +0 -101
  72. package/lib/matchers/toMatchAriaSnapshot.js +0 -159
  73. package/lib/matchers/toMatchSnapshot.js +0 -342
  74. package/lib/matchers/toMatchText.js +0 -99
  75. package/lib/mcp/browser/browserContextFactory.js +0 -329
  76. package/lib/mcp/browser/browserServerBackend.js +0 -84
  77. package/lib/mcp/browser/config.js +0 -421
  78. package/lib/mcp/browser/context.js +0 -244
  79. package/lib/mcp/browser/response.js +0 -278
  80. package/lib/mcp/browser/sessionLog.js +0 -75
  81. package/lib/mcp/browser/tab.js +0 -343
  82. package/lib/mcp/browser/tools/common.js +0 -65
  83. package/lib/mcp/browser/tools/console.js +0 -46
  84. package/lib/mcp/browser/tools/dialogs.js +0 -60
  85. package/lib/mcp/browser/tools/evaluate.js +0 -61
  86. package/lib/mcp/browser/tools/files.js +0 -58
  87. package/lib/mcp/browser/tools/form.js +0 -63
  88. package/lib/mcp/browser/tools/install.js +0 -72
  89. package/lib/mcp/browser/tools/keyboard.js +0 -107
  90. package/lib/mcp/browser/tools/mouse.js +0 -107
  91. package/lib/mcp/browser/tools/navigate.js +0 -71
  92. package/lib/mcp/browser/tools/network.js +0 -63
  93. package/lib/mcp/browser/tools/open.js +0 -57
  94. package/lib/mcp/browser/tools/pdf.js +0 -49
  95. package/lib/mcp/browser/tools/runCode.js +0 -78
  96. package/lib/mcp/browser/tools/screenshot.js +0 -93
  97. package/lib/mcp/browser/tools/snapshot.js +0 -173
  98. package/lib/mcp/browser/tools/tabs.js +0 -67
  99. package/lib/mcp/browser/tools/tool.js +0 -47
  100. package/lib/mcp/browser/tools/tracing.js +0 -74
  101. package/lib/mcp/browser/tools/utils.js +0 -94
  102. package/lib/mcp/browser/tools/verify.js +0 -143
  103. package/lib/mcp/browser/tools/wait.js +0 -63
  104. package/lib/mcp/browser/tools.js +0 -84
  105. package/lib/mcp/browser/watchdog.js +0 -44
  106. package/lib/mcp/config.d.js +0 -16
  107. package/lib/mcp/extension/cdpRelay.js +0 -351
  108. package/lib/mcp/extension/extensionContextFactory.js +0 -76
  109. package/lib/mcp/extension/protocol.js +0 -28
  110. package/lib/mcp/index.js +0 -61
  111. package/lib/mcp/log.js +0 -35
  112. package/lib/mcp/program.js +0 -111
  113. package/lib/mcp/sdk/exports.js +0 -28
  114. package/lib/mcp/sdk/http.js +0 -152
  115. package/lib/mcp/sdk/inProcessTransport.js +0 -71
  116. package/lib/mcp/sdk/server.js +0 -223
  117. package/lib/mcp/sdk/tool.js +0 -47
  118. package/lib/mcp/terminal/cli.js +0 -296
  119. package/lib/mcp/terminal/command.js +0 -56
  120. package/lib/mcp/terminal/commands.js +0 -333
  121. package/lib/mcp/terminal/daemon.js +0 -129
  122. package/lib/mcp/terminal/help.json +0 -32
  123. package/lib/mcp/terminal/helpGenerator.js +0 -88
  124. package/lib/mcp/terminal/socketConnection.js +0 -80
  125. package/lib/plugins/gitCommitInfoPlugin.js +0 -198
  126. package/lib/plugins/index.js +0 -28
  127. package/lib/plugins/webServerPlugin.js +0 -237
  128. package/lib/reporters/base.js +0 -634
  129. package/lib/reporters/blob.js +0 -138
  130. package/lib/reporters/dot.js +0 -99
  131. package/lib/reporters/empty.js +0 -32
  132. package/lib/reporters/github.js +0 -128
  133. package/lib/reporters/html.js +0 -633
  134. package/lib/reporters/internalReporter.js +0 -138
  135. package/lib/reporters/json.js +0 -254
  136. package/lib/reporters/junit.js +0 -232
  137. package/lib/reporters/line.js +0 -131
  138. package/lib/reporters/list.js +0 -253
  139. package/lib/reporters/listModeReporter.js +0 -69
  140. package/lib/reporters/markdown.js +0 -144
  141. package/lib/reporters/merge.js +0 -558
  142. package/lib/reporters/multiplexer.js +0 -112
  143. package/lib/reporters/reporterV2.js +0 -102
  144. package/lib/reporters/smoothdeploy.js +0 -333
  145. package/lib/reporters/teleEmitter.js +0 -317
  146. package/lib/reporters/versions/blobV1.js +0 -16
  147. package/lib/runner/dispatcher.js +0 -531
  148. package/lib/runner/failureTracker.js +0 -72
  149. package/lib/runner/lastRun.js +0 -77
  150. package/lib/runner/loadUtils.js +0 -334
  151. package/lib/runner/loaderHost.js +0 -89
  152. package/lib/runner/processHost.js +0 -180
  153. package/lib/runner/projectUtils.js +0 -241
  154. package/lib/runner/rebase.js +0 -189
  155. package/lib/runner/reporters.js +0 -140
  156. package/lib/runner/sigIntWatcher.js +0 -96
  157. package/lib/runner/storage.js +0 -91
  158. package/lib/runner/taskRunner.js +0 -127
  159. package/lib/runner/tasks.js +0 -410
  160. package/lib/runner/testGroups.js +0 -125
  161. package/lib/runner/testRunner.js +0 -398
  162. package/lib/runner/testServer.js +0 -269
  163. package/lib/runner/uiModeReporter.js +0 -30
  164. package/lib/runner/vcs.js +0 -72
  165. package/lib/runner/watchMode.js +0 -396
  166. package/lib/runner/workerHost.js +0 -104
  167. package/lib/third_party/pirates.js +0 -62
  168. package/lib/third_party/tsconfig-loader.js +0 -103
  169. package/lib/transform/babelBundleImpl.js +0 -461
  170. package/lib/transform/compilationCache.js +0 -274
  171. package/lib/transform/md.js +0 -221
  172. package/lib/transform/portTransport.js +0 -67
  173. package/lib/transform/transform.js +0 -303
  174. package/lib/utilsBundle.js +0 -50
  175. package/lib/utilsBundleImpl.js +0 -103
  176. package/lib/worker/fixtureRunner.js +0 -262
  177. package/lib/worker/testInfo.js +0 -536
  178. package/lib/worker/testTracing.js +0 -345
  179. package/lib/worker/timeoutManager.js +0 -174
  180. package/lib/worker/util.js +0 -31
  181. package/lib/worker/workerMain.js +0 -530
  182. /package/lib/{common/globals.js → globals.js} +0 -0
@@ -0,0 +1,20 @@
1
+ # packages/playwright/lib/worker/workerProcessEntry.js
2
+ # total: 74.1 KB
3
+
4
+ ## Inlined (8)
5
+ 4.4 KB packages/playwright/src/util.ts
6
+ 8.6 KB packages/playwright/src/worker/fixtureRunner.ts
7
+ 21.0 KB packages/playwright/src/worker/testInfo.ts
8
+ 11.6 KB packages/playwright/src/worker/testTracing.ts
9
+ 5.4 KB packages/playwright/src/worker/timeoutManager.ts
10
+ 0.3 KB packages/playwright/src/worker/util.ts
11
+ 21.0 KB packages/playwright/src/worker/workerMain.ts
12
+ 0.1 KB packages/playwright/src/worker/workerProcessEntry.ts
13
+
14
+ ## External (6)
15
+ ../common
16
+ ../globals
17
+ ../matchers/expect
18
+ playwright-core/lib/coreBundle
19
+ playwright-core/lib/utilsBundle
20
+ playwright-core/package.json
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smoothdeploy/playwright",
3
- "version": "1.58.4",
3
+ "version": "1.61.0",
4
4
  "description": "A high-level API to automate web browsers",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,30 +19,19 @@
19
19
  "default": "./index.js"
20
20
  },
21
21
  "./package.json": "./package.json",
22
- "./lib/common/configLoader": "./lib/common/configLoader.js",
22
+ "./lib/common": "./lib/common/index.js",
23
23
  "./lib/fsWatcher": "./lib/fsWatcher.js",
24
24
  "./lib/mcp/index": "./lib/mcp/index.js",
25
- "./lib/mcp/browser/tools": "./lib/mcp/browser/tools.js",
26
- "./lib/mcp/program": "./lib/mcp/program.js",
27
- "./lib/mcp/sdk/bundle": "./lib/mcp/sdk/bundle.js",
28
- "./lib/mcp/sdk/exports": "./lib/mcp/sdk/exports.js",
29
25
  "./lib/program": "./lib/program.js",
30
- "./lib/reporters/base": "./lib/reporters/base.js",
31
- "./lib/reporters/list": "./lib/reporters/list.js",
26
+ "./lib/runner": "./lib/runner/index.js",
27
+ "./lib/isomorphic": "./lib/isomorphic/index.js",
32
28
  "./lib/transform/babelBundle": "./lib/transform/babelBundle.js",
33
- "./lib/transform/compilationCache": "./lib/transform/compilationCache.js",
34
- "./lib/transform/esmLoader": "./lib/transform/esmLoader.js",
35
- "./lib/transform/transform": "./lib/transform/transform.js",
36
- "./lib/internalsForTest": "./lib/internalsForTest.js",
37
- "./lib/plugins": "./lib/plugins/index.js",
38
- "./lib/runner/testRunner": "./lib/runner/testRunner.js",
39
29
  "./jsx-runtime": {
40
30
  "import": "./jsx-runtime.mjs",
41
31
  "require": "./jsx-runtime.js",
42
32
  "default": "./jsx-runtime.js"
43
33
  },
44
34
  "./lib/util": "./lib/util.js",
45
- "./lib/utilsBundle": "./lib/utilsBundle.js",
46
35
  "./types/test": {
47
36
  "types": "./types/test.d.ts"
48
37
  },
@@ -64,7 +53,7 @@
64
53
  },
65
54
  "license": "Apache-2.0",
66
55
  "dependencies": {
67
- "playwright-core": "npm:@smoothdeploy/playwright-core@1.58.4"
56
+ "playwright-core": "npm:@smoothdeploy/playwright-core@1.61.0"
68
57
  },
69
58
  "optionalDependencies": {
70
59
  "fsevents": "2.3.2"
package/test.mjs CHANGED
@@ -26,6 +26,7 @@ export const request = playwright.request;
26
26
  export const _electron = playwright._electron;
27
27
  export const _android = playwright._android;
28
28
  export const _baseTest = playwright._baseTest;
29
+ export const _utilityTest = playwright._utilityTest;
29
30
  export const test = playwright.test;
30
31
  export const expect = playwright.expect;
31
32
  export const defineConfig = playwright.defineConfig;
package/types/test.d.ts CHANGED
@@ -19,8 +19,8 @@ import type { APIRequestContext, Browser, BrowserContext, BrowserContextOptions,
19
19
  export * from 'playwright-core';
20
20
 
21
21
  export type BlobReporterOptions = { outputDir?: string, fileName?: string };
22
- export type ListReporterOptions = { printSteps?: boolean };
23
- export type JUnitReporterOptions = { outputFile?: string, stripANSIControlSequences?: boolean, includeProjectInTestName?: boolean };
22
+ export type ListReporterOptions = { printSteps?: boolean, printFailuresInline?: boolean };
23
+ export type JUnitReporterOptions = { outputFile?: string, stripANSIControlSequences?: boolean, includeProjectInTestName?: boolean, includeRetries?: boolean };
24
24
  export type JsonReporterOptions = { outputFile?: string };
25
25
  export type HtmlReporterOptions = {
26
26
  outputFolder?: string;
@@ -31,6 +31,7 @@ export type HtmlReporterOptions = {
31
31
  title?: string;
32
32
  noSnippets?: boolean;
33
33
  noCopyPrompt?: boolean;
34
+ doNotInlineAssets?: boolean;
34
35
  };
35
36
 
36
37
  export type ReporterDescription = Readonly<
@@ -236,6 +237,13 @@ interface TestProject<TestArgs = {}, WorkerArgs = {}> {
236
237
  * for details.
237
238
  */
238
239
  pathTemplate?: string;
240
+
241
+ /**
242
+ * Default timeout for
243
+ * [expect(page).toHaveScreenshot(name[, options])](https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1)
244
+ * in milliseconds, defaults to the global expect timeout. Setting to `0` disables the timeout.
245
+ */
246
+ timeout?: number;
239
247
  };
240
248
 
241
249
  /**
@@ -250,6 +258,13 @@ interface TestProject<TestArgs = {}, WorkerArgs = {}> {
250
258
  * for details.
251
259
  */
252
260
  pathTemplate?: string;
261
+
262
+ /**
263
+ * Controls how children of the snapshot root are matched against the actual accessibility tree. This is equivalent to
264
+ * adding a `/children` property at the top of every aria snapshot template. Individual snapshots can override this by
265
+ * including an explicit `/children` property.
266
+ */
267
+ children?: "contain"|"equal"|"deep-equal";
253
268
  };
254
269
 
255
270
  /**
@@ -521,6 +536,8 @@ interface TestProject<TestArgs = {}, WorkerArgs = {}> {
521
536
  * config)
522
537
  * - `{testFileDir}` - Directories in relative path from `testDir` to **test file**.
523
538
  * - Value: `page`
539
+ * - `{testFileBaseName}` - Test file name without the last extension.
540
+ * - Value: `page-click.spec`
524
541
  * - `{testFileName}` - Test file name with extension.
525
542
  * - Value: `page-click.spec.ts`
526
543
  * - `{testFilePath}` - Relative path from `testDir` to **test file**.
@@ -764,6 +781,11 @@ export interface FullProject<TestArgs = {}, WorkerArgs = {}> {
764
781
  */
765
782
  grepInvert: null|RegExp|Array<RegExp>;
766
783
 
784
+ /**
785
+ * See [testProject.ignoreSnapshots](https://playwright.dev/docs/api/class-testproject#test-project-ignore-snapshots).
786
+ */
787
+ ignoreSnapshots: boolean;
788
+
767
789
  /**
768
790
  * See [testProject.metadata](https://playwright.dev/docs/api/class-testproject#test-project-metadata).
769
791
  */
@@ -1176,6 +1198,13 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
1176
1198
  * for details.
1177
1199
  */
1178
1200
  pathTemplate?: string;
1201
+
1202
+ /**
1203
+ * Controls how children of the snapshot root are matched against the actual accessibility tree. This is equivalent to
1204
+ * adding a `/children` property at the top of every aria snapshot template. Individual snapshots can override this by
1205
+ * including an explicit `/children` property.
1206
+ */
1207
+ children?: "contain"|"equal"|"deep-equal";
1179
1208
  };
1180
1209
 
1181
1210
  /**
@@ -1750,6 +1779,8 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
1750
1779
  * config)
1751
1780
  * - `{testFileDir}` - Directories in relative path from `testDir` to **test file**.
1752
1781
  * - Value: `page`
1782
+ * - `{testFileBaseName}` - Test file name without the last extension.
1783
+ * - Value: `page-click.spec`
1753
1784
  * - `{testFileName}` - Test file name with extension.
1754
1785
  * - Value: `page-click.spec.ts`
1755
1786
  * - `{testFilePath}` - Relative path from `testDir` to **test file**.
@@ -1987,11 +2018,25 @@ export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {
1987
2018
  * See [testConfig.webServer](https://playwright.dev/docs/api/class-testconfig#test-config-web-server).
1988
2019
  */
1989
2020
  webServer: TestConfigWebServer | null;
2021
+ /**
2022
+ * Snapshot of [`process.argv`](https://nodejs.org/api/process.html#processargv) captured in the runner process.
2023
+ * Useful for reading custom command-line arguments — for example, args supplied after the `--` separator (`npx
2024
+ * playwright test -- --build-path=./out`). Playwright does not parse these; consumers are responsible for slicing and
2025
+ * interpreting them with any argument-parsing library.
2026
+ */
2027
+ argv: Array<string>;
2028
+
1990
2029
  /**
1991
2030
  * Path to the configuration file used to run the tests. The value is an empty string if no config file was used.
1992
2031
  */
1993
2032
  configFile?: string;
1994
2033
 
2034
+ /**
2035
+ * See
2036
+ * [testConfig.failOnFlakyTests](https://playwright.dev/docs/api/class-testconfig#test-config-fail-on-flaky-tests).
2037
+ */
2038
+ failOnFlakyTests: boolean;
2039
+
1995
2040
  /**
1996
2041
  * See [testConfig.forbidOnly](https://playwright.dev/docs/api/class-testconfig#test-config-forbid-only).
1997
2042
  */
@@ -2650,7 +2695,7 @@ export type TestDetails = {
2650
2695
  annotation?: TestDetailsAnnotation | TestDetailsAnnotation[];
2651
2696
  }
2652
2697
 
2653
- type TestBody<TestArgs> = (args: TestArgs, testInfo: TestInfo) => Promise<void> | void;
2698
+ type TestBody<TestArgs> = (args: TestArgs, testInfo: TestInfo) => Promise<unknown> | unknown;
2654
2699
  type ConditionBody<TestArgs> = (args: TestArgs) => boolean;
2655
2700
 
2656
2701
  /**
@@ -5511,6 +5556,29 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
5511
5556
  only(title: string, details: TestDetails, body: TestBody<TestArgs & WorkerArgs>): void;
5512
5557
  }
5513
5558
 
5559
+ /**
5560
+ * Aborts the currently running test by throwing an error. The test is immediately marked as failed and execution
5561
+ * stops. This is useful from inside a fixture or a route handler when you have detected an unrecoverable misuse and
5562
+ * want to fail the test right away.
5563
+ *
5564
+ * **Usage**
5565
+ *
5566
+ * ```js
5567
+ * import { test, expect } from '@playwright/test';
5568
+ *
5569
+ * test('does not publish to shared page', async ({ page }) => {
5570
+ * await page.route('**\/publish', route => {
5571
+ * test.abort('Tests must not publish to the shared page. Use the `clone` option.');
5572
+ * return route.abort();
5573
+ * });
5574
+ * // ...
5575
+ * });
5576
+ * ```
5577
+ *
5578
+ * @param message Optional message describing the reason for the abort. It will be included in the failure error.
5579
+ */
5580
+ abort(message?: string): never;
5581
+
5514
5582
  /**
5515
5583
  * Marks a test as "slow". Slow test will be given triple the default timeout.
5516
5584
  *
@@ -6897,14 +6965,21 @@ export interface PlaywrightWorkerOptions {
6897
6965
  resultScreenshots: boolean;
6898
6966
  pauseOnFailure: boolean;
6899
6967
  /**
6900
- * Whether to record trace for each test. Defaults to `'off'`.
6968
+ * Whether to record trace for each test. Defaults to `'off'`. The initial run of a test is the "first run";
6969
+ * subsequent runs caused by [retries](https://playwright.dev/docs/test-retries) are "retries".
6901
6970
  * - `'off'`: Do not record trace.
6902
- * - `'on'`: Record trace for each test.
6903
- * - `'on-first-retry'`: Record trace only when retrying a test for the first time.
6904
- * - `'on-all-retries'`: Record trace only when retrying a test.
6905
- * - `'retain-on-failure'`: Record trace for each test. When test run passes, remove the recorded trace.
6906
- * - `'retain-on-first-failure'`: Record trace for the first run of each test, but not for retries. When test run
6907
- * passes, remove the recorded trace.
6971
+ * - `'on'`: Record and keep a trace for every run.
6972
+ * - `'on-first-retry'`: Record and keep a trace only for the first retry of a test.
6973
+ * - `'on-all-retries'`: Record and keep a trace for every retry.
6974
+ * - `'retain-on-failure'`: Record a trace for every run, but keep it only for runs that failed. A failed run's
6975
+ * trace is kept even when a later retry passes.
6976
+ * - `'retain-on-first-failure'`: Record a trace only for the first run of a test (not for retries), and keep it
6977
+ * only if that run failed.
6978
+ * - `'retain-on-failure-and-retries'`: Record a trace for every run, and keep it for any run that failed or that is
6979
+ * a retry.
6980
+ *
6981
+ * See [trace modes](https://playwright.dev/docs/test-use-options#trace-modes) for a side-by-side comparison of what each mode records and
6982
+ * keeps.
6908
6983
  *
6909
6984
  * For more control, pass an object that specifies `mode` and trace features to enable.
6910
6985
  *
@@ -6925,17 +7000,31 @@ export interface PlaywrightWorkerOptions {
6925
7000
  */
6926
7001
  trace: TraceMode | /** deprecated */ 'retry-with-trace' | { mode: TraceMode, snapshots?: boolean, screenshots?: boolean, sources?: boolean, attachments?: boolean };
6927
7002
  /**
6928
- * Whether to record video for each test. Defaults to `'off'`.
7003
+ * Whether to record video for each test. Defaults to `'off'`. The initial run of a test is the "first run";
7004
+ * subsequent runs caused by [retries](https://playwright.dev/docs/test-retries) are "retries".
6929
7005
  * - `'off'`: Do not record video.
6930
- * - `'on'`: Record video for each test.
6931
- * - `'retain-on-failure'`: Record video for each test, but remove all videos from successful test runs.
6932
- * - `'on-first-retry'`: Record video only when retrying a test for the first time.
7006
+ * - `'on'`: Record and keep a video for every run.
7007
+ * - `'on-first-retry'`: Record and keep a video only for the first retry of a test.
7008
+ * - `'on-all-retries'`: Record and keep a video for every retry.
7009
+ * - `'retain-on-failure'`: Record a video for every run, but keep it only for runs that failed. A failed run's
7010
+ * video is kept even when a later retry passes.
7011
+ * - `'retain-on-first-failure'`: Record a video only for the first run of a test (not for retries), and keep it
7012
+ * only if that run failed.
7013
+ * - `'retain-on-failure-and-retries'`: Record a video for every run, and keep it for any run that failed or that is
7014
+ * a retry.
7015
+ *
7016
+ * See [video modes](https://playwright.dev/docs/test-use-options#video-modes) for a side-by-side comparison of what each mode records and
7017
+ * keeps.
6933
7018
  *
6934
7019
  * To control video size, pass an object with `mode` and `size` properties. If video size is not specified, it will be
6935
7020
  * equal to [testOptions.viewport](https://playwright.dev/docs/api/class-testoptions#test-options-viewport) scaled
6936
7021
  * down to fit into 800x800. If `viewport` is not configured explicitly the video size defaults to 800x450. Actual
6937
7022
  * picture of each page will be scaled down if necessary to fit the specified size.
6938
7023
  *
7024
+ * To annotate actions in the video, pass `show` with `action` and/or `test` sub-options. The `action` option controls
7025
+ * visual highlights on interacted elements with an optional `delay` in milliseconds (defaults to `500`). The `test`
7026
+ * option controls which test information is displayed as a status overlay.
7027
+ *
6939
7028
  * **Usage**
6940
7029
  *
6941
7030
  * ```js
@@ -6951,13 +7040,12 @@ export interface PlaywrightWorkerOptions {
6951
7040
  *
6952
7041
  * Learn more about [recording video](https://playwright.dev/docs/test-use-options#recording-options).
6953
7042
  */
6954
- video: VideoMode | /** deprecated */ 'retry-with-video' | { mode: VideoMode, size?: ViewportSize };
7043
+ video: VideoMode | /** deprecated */ 'retry-with-video' | { mode: VideoMode, size?: ViewportSize, show?: { actions?: { duration?: number, position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', fontSize?: number }, test?: { level?: 'file' | 'title' | 'step', position?: 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right', fontSize?: number } } };
6955
7044
  }
6956
7045
 
6957
7046
  export type ScreenshotMode = 'off' | 'on' | 'only-on-failure' | 'on-first-failure';
6958
- export type TraceMode = 'off' | 'on' | 'retain-on-failure' | 'on-first-retry' | 'on-all-retries' | 'retain-on-first-failure';
6959
- export type VideoMode = 'off' | 'on' | 'retain-on-failure' | 'on-first-retry';
6960
-
7047
+ export type TraceMode = 'off' | 'on' | 'retain-on-failure' | 'on-first-retry' | 'on-all-retries' | 'retain-on-first-failure' | 'retain-on-failure-and-retries';
7048
+ export type VideoMode = 'off' | 'on' | 'retain-on-failure' | 'on-first-retry' | 'on-all-retries' | 'retain-on-first-failure' | 'retain-on-failure-and-retries';
6961
7049
  /**
6962
7050
  * Playwright Test provides many options to configure test environment,
6963
7051
  * [Browser](https://playwright.dev/docs/api/class-browser),
@@ -7546,7 +7634,7 @@ export interface PlaywrightTestOptions {
7546
7634
  /**
7547
7635
  * Custom attribute to be used in
7548
7636
  * [page.getByTestId(testId)](https://playwright.dev/docs/api/class-page#page-get-by-test-id). `data-testid` is used
7549
- * by default.
7637
+ * by default. To match elements with any of several attributes, pass them as a comma-separated list.
7550
7638
  *
7551
7639
  * **Usage**
7552
7640
  *
@@ -7561,6 +7649,19 @@ export interface PlaywrightTestOptions {
7561
7649
  * });
7562
7650
  * ```
7563
7651
  *
7652
+ * Multiple attributes:
7653
+ *
7654
+ * ```js
7655
+ * // playwright.config.ts
7656
+ * import { defineConfig } from '@playwright/test';
7657
+ *
7658
+ * export default defineConfig({
7659
+ * use: {
7660
+ * testIdAttribute: 'data-pw,data-ti',
7661
+ * },
7662
+ * });
7663
+ * ```
7664
+ *
7564
7665
  */
7565
7666
  testIdAttribute: string;
7566
7667
  }
@@ -7716,6 +7817,9 @@ type CustomProperties<T> = ExcludeProps<T, PlaywrightTestOptions & PlaywrightWor
7716
7817
  export type PlaywrightTestProject<TestArgs = {}, WorkerArgs = {}> = Project<PlaywrightTestOptions & CustomProperties<TestArgs>, PlaywrightWorkerOptions & CustomProperties<WorkerArgs>>;
7717
7818
  export type PlaywrightTestConfig<TestArgs = {}, WorkerArgs = {}> = Config<PlaywrightTestOptions & CustomProperties<TestArgs>, PlaywrightWorkerOptions & CustomProperties<WorkerArgs>>;
7718
7819
 
7820
+ // Use the global URLPattern type if available (Node.js 22+, modern browsers),
7821
+ // otherwise fall back to `never` so it disappears from union types.
7822
+ type URLPattern = typeof globalThis extends { URLPattern: new (...args: any) => infer T } ? T : never;
7719
7823
  type AsymmetricMatcher = Record<string, any>;
7720
7824
 
7721
7825
  interface AsymmetricMatchers {
@@ -7903,7 +8007,11 @@ interface AsymmetricMatchers {
7903
8007
  */
7904
8008
  interface GenericAssertions<R> {
7905
8009
  /**
7906
- * Makes the assertion check for the opposite condition. For example, the following code passes:
8010
+ * Makes the assertion check for the opposite condition.
8011
+ *
8012
+ * **Usage**
8013
+ *
8014
+ * For example, the following code passes:
7907
8015
  *
7908
8016
  * ```js
7909
8017
  * const value = 1;
@@ -7912,6 +8020,34 @@ interface GenericAssertions<R> {
7912
8020
  *
7913
8021
  */
7914
8022
  not: GenericAssertions<R>;
8023
+ /**
8024
+ * Use `resolves` to unwrap the value of a fulfilled promise so any other matcher can be chained. If the promise is
8025
+ * rejected the assertion fails.
8026
+ *
8027
+ * For example, this code tests that the promise resolves and that the resulting value is `'lemon'`:
8028
+ *
8029
+ * ```js
8030
+ * test('resolves to lemon', async () => {
8031
+ * await expect(Promise.resolve('lemon')).resolves.toBe('lemon');
8032
+ * });
8033
+ * ```
8034
+ *
8035
+ */
8036
+ resolves: GenericAssertions<R>;
8037
+ /**
8038
+ * Use `.rejects` to unwrap the reason of a rejected promise so any other matcher can be chained. If the promise is
8039
+ * fulfilled the assertion fails.
8040
+ *
8041
+ * For example, this code tests that the promise rejects with reason `'octopus'`:
8042
+ *
8043
+ * ```js
8044
+ * test('rejects to octopus', async () => {
8045
+ * await expect(Promise.reject(new Error('octopus'))).rejects.toThrow('octopus');
8046
+ * });
8047
+ * ```
8048
+ *
8049
+ */
8050
+ rejects: GenericAssertions<R>;
7915
8051
  /**
7916
8052
  * Compares value with
7917
8053
  * [`expected`](https://playwright.dev/docs/api/class-genericassertions#generic-assertions-to-be-option-expected) by
@@ -8472,7 +8608,7 @@ type PollMatchers<R, T, ExtendedMatchers> = {
8472
8608
 
8473
8609
  export type Expect<ExtendedMatchers = {}> = {
8474
8610
  <T = unknown>(actual: T, messageOrOptions?: string | { message?: string }): MakeMatchers<void, T, ExtendedMatchers>;
8475
- soft: <T = unknown>(actual: T, messageOrOptions?: string | { message?: string }) => MakeMatchers<void, T, ExtendedMatchers>;
8611
+ soft: Expect<ExtendedMatchers>;
8476
8612
  poll: <T = unknown>(actual: () => T | Promise<T>, messageOrOptions?: string | { message?: string, timeout?: number, intervals?: number[] }) => PollMatchers<Promise<void>, T, ExtendedMatchers>;
8477
8613
  extend<MoreMatchers extends Record<string, (this: ExpectMatcherState, receiver: any, ...args: any[]) => MatcherReturnType | Promise<MatcherReturnType>>>(matchers: MoreMatchers): Expect<ExtendedMatchers & MoreMatchers>;
8478
8614
  configure: (configuration: {
@@ -8565,8 +8701,11 @@ interface APIResponseAssertions {
8565
8701
  toBeOK(): Promise<void>;
8566
8702
 
8567
8703
  /**
8568
- * Makes the assertion check for the opposite condition. For example, this code tests that the response status is not
8569
- * successful:
8704
+ * Makes the assertion check for the opposite condition.
8705
+ *
8706
+ * **Usage**
8707
+ *
8708
+ * For example, this code tests that the response status is not successful:
8570
8709
  *
8571
8710
  * ```js
8572
8711
  * await expect(response).not.toBeOK();
@@ -9161,6 +9300,11 @@ interface LocatorAssertions {
9161
9300
  * @param options
9162
9301
  */
9163
9302
  toHaveCSS(name: string, value: string|RegExp, options?: {
9303
+ /**
9304
+ * Pseudo-element to read computed styles from.
9305
+ */
9306
+ pseudo?: "before"|"after";
9307
+
9164
9308
  /**
9165
9309
  * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9166
9310
  */
@@ -9597,8 +9741,11 @@ interface LocatorAssertions {
9597
9741
  }): Promise<void>;
9598
9742
 
9599
9743
  /**
9600
- * Makes the assertion check for the opposite condition. For example, this code tests that the Locator doesn't contain
9601
- * text `"error"`:
9744
+ * Makes the assertion check for the opposite condition.
9745
+ *
9746
+ * **Usage**
9747
+ *
9748
+ * For example, this code tests that the Locator doesn't contain text `"error"`:
9602
9749
  *
9603
9750
  * ```js
9604
9751
  * await expect(locator).not.toContainText('error');
@@ -9686,6 +9833,9 @@ interface PageAssertions {
9686
9833
  * // Check for the page URL to contain 'doc', followed by an optional 's', followed by '/'
9687
9834
  * await expect(page).toHaveURL(/docs?\//);
9688
9835
  *
9836
+ * // Check for the page URL to match the URL pattern
9837
+ * await expect(page).toHaveURL(new URLPattern({ pathname: '/docs/*' }));
9838
+ *
9689
9839
  * // Check for the predicate to be satisfied
9690
9840
  * // For example: verify query strings
9691
9841
  * await expect(page).toHaveURL(url => {
@@ -9701,7 +9851,7 @@ interface PageAssertions {
9701
9851
  * against the current browser URL.
9702
9852
  * @param options
9703
9853
  */
9704
- toHaveURL(url: string|RegExp|((url: URL) => boolean), options?: {
9854
+ toHaveURL(url: string|RegExp|URLPattern|((url: URL) => boolean), options?: {
9705
9855
  /**
9706
9856
  * Whether to perform case-insensitive match.
9707
9857
  * [`ignoreCase`](https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-url-option-ignore-case)
@@ -9717,8 +9867,62 @@ interface PageAssertions {
9717
9867
  }): Promise<void>;
9718
9868
 
9719
9869
  /**
9720
- * Makes the assertion check for the opposite condition. For example, this code tests that the page URL doesn't
9721
- * contain `"error"`:
9870
+ * Asserts that the page body matches the given [accessibility snapshot](https://playwright.dev/docs/aria-snapshots).
9871
+ *
9872
+ * **Usage**
9873
+ *
9874
+ * ```js
9875
+ * await page.goto('https://demo.playwright.dev/todomvc/');
9876
+ * await expect(page).toMatchAriaSnapshot(`
9877
+ * - heading "todos"
9878
+ * - textbox "What needs to be done?"
9879
+ * `);
9880
+ * ```
9881
+ *
9882
+ * @param expected
9883
+ * @param options
9884
+ */
9885
+ toMatchAriaSnapshot(expected: string, options?: {
9886
+ /**
9887
+ * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9888
+ */
9889
+ timeout?: number;
9890
+ }): Promise<void>;
9891
+
9892
+ /**
9893
+ * Asserts that the page body matches the given [accessibility snapshot](https://playwright.dev/docs/aria-snapshots).
9894
+ *
9895
+ * Snapshot is stored in a separate `.aria.yml` file in a location configured by
9896
+ * `expect.toMatchAriaSnapshot.pathTemplate` and/or `snapshotPathTemplate` properties in the configuration file.
9897
+ *
9898
+ * **Usage**
9899
+ *
9900
+ * ```js
9901
+ * await expect(page).toMatchAriaSnapshot();
9902
+ * await expect(page).toMatchAriaSnapshot({ name: 'home.aria.yml' });
9903
+ * ```
9904
+ *
9905
+ * @param options
9906
+ */
9907
+ toMatchAriaSnapshot(options?: {
9908
+ /**
9909
+ * Name of the snapshot to store in the snapshot folder corresponding to this test. Generates sequential names if not
9910
+ * specified.
9911
+ */
9912
+ name?: string;
9913
+
9914
+ /**
9915
+ * Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
9916
+ */
9917
+ timeout?: number;
9918
+ }): Promise<void>;
9919
+
9920
+ /**
9921
+ * Makes the assertion check for the opposite condition.
9922
+ *
9923
+ * **Usage**
9924
+ *
9925
+ * For example, this code tests that the page URL doesn't contain `"error"`:
9722
9926
  *
9723
9927
  * ```js
9724
9928
  * await expect(page).not.toHaveURL('error');
@@ -9880,6 +10084,12 @@ export interface TestInfoError {
9880
10084
  */
9881
10085
  cause?: TestInfoError;
9882
10086
 
10087
+ /**
10088
+ * Additional context for the error, such as the aria snapshot of the receiver at the time of an `expect(...)` matcher
10089
+ * failure.
10090
+ */
10091
+ errorContext?: string;
10092
+
9883
10093
  /**
9884
10094
  * Error message. Set when [Error] (or its subclass) has been thrown.
9885
10095
  */
@@ -15,8 +15,8 @@
15
15
  * limitations under the License.
16
16
  */
17
17
 
18
- import type { TestStatus, Metadata, PlaywrightTestOptions, PlaywrightWorkerOptions, ReporterDescription, FullConfig, FullProject, Location } from './test';
19
- export type { FullConfig, FullProject, TestStatus, Location } from './test';
18
+ import type { TestStatus, Metadata, PlaywrightTestOptions, PlaywrightWorkerOptions, ReporterDescription, FullConfig, FullProject, Location, WorkerInfo } from './test';
19
+ export type { FullConfig, FullProject, TestStatus, Location, WorkerInfo } from './test';
20
20
 
21
21
  /**
22
22
  * Result of the full test run.
@@ -119,8 +119,8 @@ export interface FullResult {
119
119
  * [reporter.onStdOut(chunk, test, result)](https://playwright.dev/docs/api/class-reporter#reporter-on-std-out) and
120
120
  * [reporter.onStdErr(chunk, test, result)](https://playwright.dev/docs/api/class-reporter#reporter-on-std-err) are
121
121
  * called when standard output is produced in the worker process, possibly during a test execution, and
122
- * [reporter.onError(error)](https://playwright.dev/docs/api/class-reporter#reporter-on-error) is called when
123
- * something went wrong outside of the test execution.
122
+ * [reporter.onError(error[, workerInfo])](https://playwright.dev/docs/api/class-reporter#reporter-on-error) is called
123
+ * when something went wrong outside of the test execution.
124
124
  *
125
125
  * If your custom reporter does not print anything to the terminal, implement
126
126
  * [reporter.printsToStdio()](https://playwright.dev/docs/api/class-reporter#reporter-prints-to-stdio) and return
@@ -169,8 +169,10 @@ export interface Reporter {
169
169
  /**
170
170
  * Called on some global error, for example unhandled exception in the worker process.
171
171
  * @param error The error.
172
+ * @param workerInfo Contains information about the worker that produced this error. `undefined` for errors that are not associated with
173
+ * a specific worker.
172
174
  */
173
- onError?(error: TestError): void;
175
+ onError?(error: TestError, workerInfo?: WorkerInfo): void;
174
176
 
175
177
  /**
176
178
  * Called immediately before test runner exists. At this point all the reporters have received the