rebrowser-playwright-core 1.52.0 → 1.64.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (395) hide show
  1. package/ThirdPartyNotices.txt +7 -1554
  2. package/bin/install_webkit_wsl.ps1 +33 -0
  3. package/bin/reinstall_chrome_beta_linux.sh +1 -1
  4. package/bin/reinstall_chrome_beta_mac.sh +1 -1
  5. package/bin/reinstall_chrome_stable_linux.sh +1 -1
  6. package/bin/reinstall_chrome_stable_mac.sh +1 -1
  7. package/bin/reinstall_msedge_beta_linux.sh +1 -1
  8. package/bin/reinstall_msedge_beta_mac.sh +1 -1
  9. package/bin/reinstall_msedge_dev_linux.sh +1 -1
  10. package/bin/reinstall_msedge_dev_mac.sh +1 -1
  11. package/bin/reinstall_msedge_stable_linux.sh +1 -1
  12. package/bin/reinstall_msedge_stable_mac.sh +1 -1
  13. package/browsers.json +16 -44
  14. package/cli.js +5 -1
  15. package/index.js +2 -17
  16. package/lib/bootstrap.js +149 -0
  17. package/lib/coreBundle.js +78218 -0
  18. package/lib/entry/cliDaemon.js +5 -0
  19. package/lib/entry/dashboardApp.js +3 -0
  20. package/lib/entry/mcp.js +10 -0
  21. package/lib/entry/oopBrowserDownload.js +3 -0
  22. package/lib/{server/deviceDescriptors.js → package.js} +18 -7
  23. package/lib/server/electron/loader.js +108 -14
  24. package/lib/serverRegistry.js +1939 -0
  25. package/lib/serverRegistry.js.LICENSE +65 -0
  26. package/lib/tools/cli-client/channelSessions.js +141 -0
  27. package/lib/tools/cli-client/cli.js +7 -0
  28. package/lib/tools/cli-client/help.json +808 -0
  29. package/lib/tools/cli-client/minimist.js +128 -0
  30. package/lib/tools/cli-client/output.js +352 -0
  31. package/lib/tools/cli-client/program.js +422 -0
  32. package/lib/tools/cli-client/registry.js +180 -0
  33. package/lib/tools/cli-client/session.js +261 -0
  34. package/lib/tools/dashboard/appIcon.png +0 -0
  35. package/lib/tools/skills/playwright-cli/SKILL.md +493 -0
  36. package/lib/tools/skills/playwright-cli/references/element-attributes.md +23 -0
  37. package/lib/tools/skills/playwright-cli/references/playwright-tests.md +39 -0
  38. package/lib/tools/skills/playwright-cli/references/pr-attachments.md +60 -0
  39. package/lib/tools/skills/playwright-cli/references/request-mocking.md +87 -0
  40. package/lib/tools/skills/playwright-cli/references/running-code.md +245 -0
  41. package/lib/tools/skills/playwright-cli/references/session-management.md +227 -0
  42. package/lib/tools/skills/playwright-cli/references/storage-state.md +275 -0
  43. package/lib/tools/skills/playwright-cli/references/test-generation.md +433 -0
  44. package/lib/tools/skills/playwright-cli/references/tracing.md +139 -0
  45. package/lib/tools/skills/playwright-cli/references/video-recording.md +216 -0
  46. package/lib/tools/skills/playwright-component-testing/SKILL.md +136 -0
  47. package/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
  48. package/lib/tools/skills/playwright-component-testing/references/migration.md +89 -0
  49. package/lib/tools/skills/playwright-component-testing/references/react.md +69 -0
  50. package/lib/tools/skills/playwright-component-testing/references/typing.md +173 -0
  51. package/lib/tools/skills/playwright-component-testing/references/vue.md +77 -0
  52. package/lib/tools/skills/playwright-trace/SKILL.md +174 -0
  53. package/lib/tools/utils/extension.js +112 -0
  54. package/lib/tools/utils/socketConnection.js +108 -0
  55. package/lib/utilsBundle.js +86038 -66
  56. package/lib/utilsBundle.js.LICENSE +1890 -0
  57. package/lib/vite/dashboard/assets/codeMirrorModule--QdMvsKi.css +1 -0
  58. package/lib/vite/dashboard/assets/codeMirrorModule-CQ8RZGBm.js +32 -0
  59. package/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
  60. package/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
  61. package/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
  62. package/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
  63. package/lib/vite/dashboard/assets/index-AwgwcYie.css +1 -0
  64. package/lib/vite/dashboard/assets/index-hRvO4yU2.js +12 -0
  65. package/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
  66. package/lib/vite/dashboard/index.html +29 -0
  67. package/lib/vite/dashboard/playwright-logo.svg +24 -0
  68. package/lib/vite/htmlReport/index.html +2 -61
  69. package/lib/vite/htmlReport/report.css +2 -0
  70. package/lib/vite/htmlReport/report.js +32 -0
  71. package/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
  72. package/lib/vite/recorder/assets/codeMirrorModule-DK72OMRi.js +32 -0
  73. package/lib/vite/recorder/assets/index-BZpYJZ-P.css +1 -0
  74. package/lib/vite/recorder/assets/index-Cn0mmDuv.js +129 -0
  75. package/lib/vite/recorder/index.html +3 -3
  76. package/lib/vite/traceViewer/assets/codeMirrorModule-BEB2e8M3.js +32 -0
  77. package/lib/vite/traceViewer/assets/defaultSettingsView-D-g2vrvf.js +184 -0
  78. package/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
  79. package/lib/vite/traceViewer/assets/xtermModule-B794rD2Z.js +7 -0
  80. package/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
  81. package/lib/vite/traceViewer/defaultSettingsView.C8BeHuxd.css +1 -0
  82. package/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
  83. package/lib/vite/traceViewer/index.html +9 -8
  84. package/lib/vite/traceViewer/index.oNry3Hjv.js +1 -0
  85. package/lib/vite/traceViewer/manifest.webmanifest +16 -0
  86. package/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
  87. package/lib/vite/traceViewer/snapshot.html +4 -15
  88. package/lib/vite/traceViewer/sw.bundle.js +4 -3
  89. package/lib/vite/traceViewer/uiMode.CYwC_gH1.js +5 -0
  90. package/lib/vite/traceViewer/uiMode.CyMfwkXJ.css +1 -0
  91. package/lib/vite/traceViewer/uiMode.html +6 -5
  92. package/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
  93. package/lib/webp_codec.LICENSE +173 -0
  94. package/lib/webp_codec.wasm +0 -0
  95. package/lib/{utilsBundleImpl/xdg-open → xdg-open} +338 -137
  96. package/package.json +6 -16
  97. package/types/protocol.d.ts +10495 -8030
  98. package/types/structs.d.ts +8 -1
  99. package/types/types.d.ts +9256 -4825
  100. package/lib/androidServerImpl.js +0 -63
  101. package/lib/browserServerImpl.js +0 -88
  102. package/lib/cli/driver.js +0 -97
  103. package/lib/cli/program.js +0 -567
  104. package/lib/cli/programWithTestStub.js +0 -74
  105. package/lib/client/accessibility.js +0 -49
  106. package/lib/client/android.js +0 -365
  107. package/lib/client/api.js +0 -137
  108. package/lib/client/artifact.js +0 -79
  109. package/lib/client/browser.js +0 -136
  110. package/lib/client/browserContext.js +0 -539
  111. package/lib/client/browserType.js +0 -193
  112. package/lib/client/cdpSession.js +0 -51
  113. package/lib/client/channelOwner.js +0 -205
  114. package/lib/client/clientHelper.js +0 -64
  115. package/lib/client/clientInstrumentation.js +0 -55
  116. package/lib/client/clientStackTrace.js +0 -69
  117. package/lib/client/clock.js +0 -68
  118. package/lib/client/connection.js +0 -318
  119. package/lib/client/consoleMessage.js +0 -55
  120. package/lib/client/coverage.js +0 -44
  121. package/lib/client/dialog.js +0 -56
  122. package/lib/client/download.js +0 -62
  123. package/lib/client/electron.js +0 -133
  124. package/lib/client/elementHandle.js +0 -284
  125. package/lib/client/errors.js +0 -77
  126. package/lib/client/eventEmitter.js +0 -314
  127. package/lib/client/events.js +0 -98
  128. package/lib/client/fetch.js +0 -367
  129. package/lib/client/fileChooser.js +0 -46
  130. package/lib/client/fileUtils.js +0 -34
  131. package/lib/client/frame.js +0 -386
  132. package/lib/client/harRouter.js +0 -87
  133. package/lib/client/input.js +0 -82
  134. package/lib/client/jsHandle.js +0 -105
  135. package/lib/client/jsonPipe.js +0 -39
  136. package/lib/client/localUtils.js +0 -61
  137. package/lib/client/locator.js +0 -362
  138. package/lib/client/network.js +0 -751
  139. package/lib/client/page.js +0 -709
  140. package/lib/client/platform.js +0 -74
  141. package/lib/client/playwright.js +0 -85
  142. package/lib/client/selectors.js +0 -75
  143. package/lib/client/stream.js +0 -39
  144. package/lib/client/timeoutSettings.js +0 -75
  145. package/lib/client/tracing.js +0 -114
  146. package/lib/client/types.js +0 -28
  147. package/lib/client/video.js +0 -59
  148. package/lib/client/waiter.js +0 -142
  149. package/lib/client/webError.js +0 -39
  150. package/lib/client/webSocket.js +0 -111
  151. package/lib/client/worker.js +0 -63
  152. package/lib/client/writableStream.js +0 -39
  153. package/lib/generated/clockSource.js +0 -28
  154. package/lib/generated/consoleApiSource.js +0 -28
  155. package/lib/generated/injectedScriptSource.js +0 -28
  156. package/lib/generated/pollingRecorderSource.js +0 -28
  157. package/lib/generated/utilityScriptSource.js +0 -28
  158. package/lib/generated/webSocketMockSource.js +0 -378
  159. package/lib/inProcessFactory.js +0 -59
  160. package/lib/inprocess.js +0 -3
  161. package/lib/outofprocess.js +0 -78
  162. package/lib/protocol/debug.js +0 -211
  163. package/lib/protocol/serializers.js +0 -192
  164. package/lib/protocol/validator.js +0 -2825
  165. package/lib/protocol/validatorPrimitives.js +0 -179
  166. package/lib/remote/playwrightConnection.js +0 -266
  167. package/lib/remote/playwrightServer.js +0 -139
  168. package/lib/server/accessibility.js +0 -69
  169. package/lib/server/android/android.js +0 -451
  170. package/lib/server/android/backendAdb.js +0 -179
  171. package/lib/server/artifact.js +0 -127
  172. package/lib/server/bidi/bidiBrowser.js +0 -380
  173. package/lib/server/bidi/bidiChromium.js +0 -152
  174. package/lib/server/bidi/bidiConnection.js +0 -187
  175. package/lib/server/bidi/bidiExecutionContext.js +0 -220
  176. package/lib/server/bidi/bidiFirefox.js +0 -112
  177. package/lib/server/bidi/bidiInput.js +0 -146
  178. package/lib/server/bidi/bidiNetworkManager.js +0 -320
  179. package/lib/server/bidi/bidiOverCdp.js +0 -102
  180. package/lib/server/bidi/bidiPage.js +0 -530
  181. package/lib/server/bidi/bidiPdf.js +0 -106
  182. package/lib/server/bidi/third_party/bidiCommands.d.js +0 -22
  183. package/lib/server/bidi/third_party/bidiDeserializer.js +0 -98
  184. package/lib/server/bidi/third_party/bidiKeyboard.js +0 -256
  185. package/lib/server/bidi/third_party/bidiProtocol.js +0 -152
  186. package/lib/server/bidi/third_party/bidiSerializer.js +0 -148
  187. package/lib/server/bidi/third_party/firefoxPrefs.js +0 -259
  188. package/lib/server/browser.js +0 -140
  189. package/lib/server/browserContext.js +0 -650
  190. package/lib/server/browserType.js +0 -326
  191. package/lib/server/callLog.js +0 -82
  192. package/lib/server/chromium/chromium.js +0 -376
  193. package/lib/server/chromium/chromiumSwitches.js +0 -101
  194. package/lib/server/chromium/crAccessibility.js +0 -263
  195. package/lib/server/chromium/crBrowser.js +0 -498
  196. package/lib/server/chromium/crConnection.js +0 -324
  197. package/lib/server/chromium/crCoverage.js +0 -232
  198. package/lib/server/chromium/crDevTools.js +0 -117
  199. package/lib/server/chromium/crDragDrop.js +0 -126
  200. package/lib/server/chromium/crExecutionContext.js +0 -145
  201. package/lib/server/chromium/crInput.js +0 -184
  202. package/lib/server/chromium/crNetworkManager.js +0 -666
  203. package/lib/server/chromium/crPage.js +0 -1055
  204. package/lib/server/chromium/crPdf.js +0 -121
  205. package/lib/server/chromium/crProtocolHelper.js +0 -145
  206. package/lib/server/chromium/crServiceWorker.js +0 -130
  207. package/lib/server/chromium/defaultFontFamilies.js +0 -162
  208. package/lib/server/chromium/protocol.d.js +0 -16
  209. package/lib/server/chromium/videoRecorder.js +0 -121
  210. package/lib/server/clock.js +0 -137
  211. package/lib/server/codegen/csharp.js +0 -329
  212. package/lib/server/codegen/java.js +0 -270
  213. package/lib/server/codegen/javascript.js +0 -268
  214. package/lib/server/codegen/jsonl.js +0 -51
  215. package/lib/server/codegen/language.js +0 -111
  216. package/lib/server/codegen/languages.js +0 -68
  217. package/lib/server/codegen/python.js +0 -277
  218. package/lib/server/codegen/types.js +0 -16
  219. package/lib/server/console.js +0 -53
  220. package/lib/server/cookieStore.js +0 -204
  221. package/lib/server/debugController.js +0 -185
  222. package/lib/server/debugger.js +0 -136
  223. package/lib/server/deviceDescriptorsSource.json +0 -1669
  224. package/lib/server/dialog.js +0 -72
  225. package/lib/server/dispatchers/androidDispatcher.js +0 -293
  226. package/lib/server/dispatchers/artifactDispatcher.js +0 -118
  227. package/lib/server/dispatchers/browserContextDispatcher.js +0 -328
  228. package/lib/server/dispatchers/browserDispatcher.js +0 -151
  229. package/lib/server/dispatchers/browserTypeDispatcher.js +0 -55
  230. package/lib/server/dispatchers/cdpSessionDispatcher.js +0 -44
  231. package/lib/server/dispatchers/debugControllerDispatcher.js +0 -87
  232. package/lib/server/dispatchers/dialogDispatcher.js +0 -47
  233. package/lib/server/dispatchers/dispatcher.js +0 -346
  234. package/lib/server/dispatchers/electronDispatcher.js +0 -90
  235. package/lib/server/dispatchers/elementHandlerDispatcher.js +0 -191
  236. package/lib/server/dispatchers/frameDispatcher.js +0 -224
  237. package/lib/server/dispatchers/jsHandleDispatcher.js +0 -80
  238. package/lib/server/dispatchers/jsonPipeDispatcher.js +0 -58
  239. package/lib/server/dispatchers/localUtilsDispatcher.js +0 -155
  240. package/lib/server/dispatchers/networkDispatchers.js +0 -204
  241. package/lib/server/dispatchers/pageDispatcher.js +0 -328
  242. package/lib/server/dispatchers/playwrightDispatcher.js +0 -100
  243. package/lib/server/dispatchers/selectorsDispatcher.js +0 -40
  244. package/lib/server/dispatchers/streamDispatcher.js +0 -60
  245. package/lib/server/dispatchers/tracingDispatcher.js +0 -59
  246. package/lib/server/dispatchers/webSocketRouteDispatcher.js +0 -154
  247. package/lib/server/dispatchers/writableStreamDispatcher.js +0 -73
  248. package/lib/server/dom.js +0 -869
  249. package/lib/server/download.js +0 -70
  250. package/lib/server/electron/electron.js +0 -277
  251. package/lib/server/errors.js +0 -69
  252. package/lib/server/fetch.js +0 -640
  253. package/lib/server/fileChooser.js +0 -43
  254. package/lib/server/fileUploadUtils.js +0 -84
  255. package/lib/server/firefox/ffAccessibility.js +0 -238
  256. package/lib/server/firefox/ffBrowser.js +0 -404
  257. package/lib/server/firefox/ffConnection.js +0 -147
  258. package/lib/server/firefox/ffExecutionContext.js +0 -149
  259. package/lib/server/firefox/ffInput.js +0 -159
  260. package/lib/server/firefox/ffNetworkManager.js +0 -254
  261. package/lib/server/firefox/ffPage.js +0 -501
  262. package/lib/server/firefox/firefox.js +0 -106
  263. package/lib/server/firefox/protocol.d.js +0 -16
  264. package/lib/server/formData.js +0 -147
  265. package/lib/server/frameSelectors.js +0 -137
  266. package/lib/server/frames.js +0 -1555
  267. package/lib/server/har/harRecorder.js +0 -147
  268. package/lib/server/har/harTracer.js +0 -606
  269. package/lib/server/harBackend.js +0 -157
  270. package/lib/server/helper.js +0 -100
  271. package/lib/server/index.js +0 -61
  272. package/lib/server/input.js +0 -280
  273. package/lib/server/instrumentation.js +0 -75
  274. package/lib/server/javascript.js +0 -299
  275. package/lib/server/launchApp.js +0 -110
  276. package/lib/server/localUtils.js +0 -211
  277. package/lib/server/macEditingCommands.js +0 -143
  278. package/lib/server/network.js +0 -583
  279. package/lib/server/page.js +0 -790
  280. package/lib/server/pageBinding.js +0 -88
  281. package/lib/server/pipeTransport.js +0 -89
  282. package/lib/server/playwright.js +0 -81
  283. package/lib/server/progress.js +0 -104
  284. package/lib/server/protocolError.js +0 -52
  285. package/lib/server/recorder/chat.js +0 -161
  286. package/lib/server/recorder/contextRecorder.js +0 -286
  287. package/lib/server/recorder/recorderApp.js +0 -184
  288. package/lib/server/recorder/recorderCollection.js +0 -116
  289. package/lib/server/recorder/recorderFrontend.js +0 -16
  290. package/lib/server/recorder/recorderRunner.js +0 -135
  291. package/lib/server/recorder/recorderUtils.js +0 -100
  292. package/lib/server/recorder/throttledFile.js +0 -57
  293. package/lib/server/recorder.js +0 -360
  294. package/lib/server/registry/browserFetcher.js +0 -175
  295. package/lib/server/registry/dependencies.js +0 -371
  296. package/lib/server/registry/index.js +0 -1271
  297. package/lib/server/registry/nativeDeps.js +0 -1105
  298. package/lib/server/registry/oopDownloadBrowserMain.js +0 -120
  299. package/lib/server/screenshotter.js +0 -332
  300. package/lib/server/selectors.js +0 -112
  301. package/lib/server/socksClientCertificatesInterceptor.js +0 -321
  302. package/lib/server/socksInterceptor.js +0 -95
  303. package/lib/server/storageScript.js +0 -154
  304. package/lib/server/timeoutSettings.js +0 -89
  305. package/lib/server/trace/recorder/snapshotter.js +0 -143
  306. package/lib/server/trace/recorder/snapshotterInjected.js +0 -539
  307. package/lib/server/trace/recorder/tracing.js +0 -593
  308. package/lib/server/trace/test/inMemorySnapshotter.js +0 -87
  309. package/lib/server/trace/viewer/traceViewer.js +0 -249
  310. package/lib/server/transport.js +0 -183
  311. package/lib/server/types.js +0 -28
  312. package/lib/server/usKeyboardLayout.js +0 -145
  313. package/lib/server/utils/ascii.js +0 -44
  314. package/lib/server/utils/comparators.js +0 -161
  315. package/lib/server/utils/crypto.js +0 -216
  316. package/lib/server/utils/debug.js +0 -47
  317. package/lib/server/utils/debugLogger.js +0 -114
  318. package/lib/server/utils/env.js +0 -68
  319. package/lib/server/utils/eventsHelper.js +0 -39
  320. package/lib/server/utils/expectUtils.js +0 -38
  321. package/lib/server/utils/fileUtils.js +0 -191
  322. package/lib/server/utils/happyEyeballs.js +0 -207
  323. package/lib/server/utils/hostPlatform.js +0 -109
  324. package/lib/server/utils/httpServer.js +0 -218
  325. package/lib/server/utils/image_tools/colorUtils.js +0 -89
  326. package/lib/server/utils/image_tools/compare.js +0 -109
  327. package/lib/server/utils/image_tools/imageChannel.js +0 -78
  328. package/lib/server/utils/image_tools/stats.js +0 -102
  329. package/lib/server/utils/linuxUtils.js +0 -71
  330. package/lib/server/utils/network.js +0 -217
  331. package/lib/server/utils/nodePlatform.js +0 -148
  332. package/lib/server/utils/pipeTransport.js +0 -84
  333. package/lib/server/utils/processLauncher.js +0 -238
  334. package/lib/server/utils/profiler.js +0 -65
  335. package/lib/server/utils/socksProxy.js +0 -511
  336. package/lib/server/utils/spawnAsync.js +0 -41
  337. package/lib/server/utils/task.js +0 -51
  338. package/lib/server/utils/userAgent.js +0 -98
  339. package/lib/server/utils/wsServer.js +0 -132
  340. package/lib/server/utils/zipFile.js +0 -74
  341. package/lib/server/utils/zones.js +0 -57
  342. package/lib/server/webkit/protocol.d.js +0 -16
  343. package/lib/server/webkit/webkit.js +0 -100
  344. package/lib/server/webkit/wkAccessibility.js +0 -237
  345. package/lib/server/webkit/wkBrowser.js +0 -312
  346. package/lib/server/webkit/wkConnection.js +0 -149
  347. package/lib/server/webkit/wkExecutionContext.js +0 -153
  348. package/lib/server/webkit/wkInput.js +0 -181
  349. package/lib/server/webkit/wkInterceptableRequest.js +0 -169
  350. package/lib/server/webkit/wkPage.js +0 -1114
  351. package/lib/server/webkit/wkProvisionalPage.js +0 -83
  352. package/lib/server/webkit/wkWorkers.js +0 -104
  353. package/lib/third_party/pixelmatch.js +0 -255
  354. package/lib/utils/isomorphic/ariaSnapshot.js +0 -384
  355. package/lib/utils/isomorphic/assert.js +0 -31
  356. package/lib/utils/isomorphic/builtins.js +0 -90
  357. package/lib/utils/isomorphic/colors.js +0 -72
  358. package/lib/utils/isomorphic/cssParser.js +0 -246
  359. package/lib/utils/isomorphic/cssTokenizer.js +0 -1051
  360. package/lib/utils/isomorphic/headers.js +0 -53
  361. package/lib/utils/isomorphic/locatorGenerators.js +0 -655
  362. package/lib/utils/isomorphic/locatorParser.js +0 -176
  363. package/lib/utils/isomorphic/locatorUtils.js +0 -81
  364. package/lib/utils/isomorphic/manualPromise.js +0 -115
  365. package/lib/utils/isomorphic/mimeType.js +0 -460
  366. package/lib/utils/isomorphic/multimap.js +0 -81
  367. package/lib/utils/isomorphic/rtti.js +0 -43
  368. package/lib/utils/isomorphic/selectorParser.js +0 -387
  369. package/lib/utils/isomorphic/semaphore.js +0 -54
  370. package/lib/utils/isomorphic/stackTrace.js +0 -158
  371. package/lib/utils/isomorphic/stringUtils.js +0 -176
  372. package/lib/utils/isomorphic/time.js +0 -44
  373. package/lib/utils/isomorphic/timeoutRunner.js +0 -67
  374. package/lib/utils/isomorphic/traceUtils.js +0 -59
  375. package/lib/utils/isomorphic/types.js +0 -16
  376. package/lib/utils/isomorphic/urlMatch.js +0 -167
  377. package/lib/utils/isomorphic/utilityScriptSerializers.js +0 -248
  378. package/lib/utils.js +0 -101
  379. package/lib/utilsBundleImpl/index.js +0 -208
  380. package/lib/vite/recorder/assets/codeMirrorModule-C3UTv-Ge.css +0 -1
  381. package/lib/vite/recorder/assets/codeMirrorModule-DVQi6prl.js +0 -24
  382. package/lib/vite/recorder/assets/index-97EUAAbk.js +0 -184
  383. package/lib/vite/recorder/assets/index-eHBmevrY.css +0 -1
  384. package/lib/vite/traceViewer/assets/codeMirrorModule-DwAiTpyC.js +0 -24
  385. package/lib/vite/traceViewer/assets/defaultSettingsView-DkkRvn5X.js +0 -265
  386. package/lib/vite/traceViewer/assets/xtermModule-BoAIEibi.js +0 -9
  387. package/lib/vite/traceViewer/codeMirrorModule.C3UTv-Ge.css +0 -1
  388. package/lib/vite/traceViewer/defaultSettingsView.QdHITyLI.css +0 -1
  389. package/lib/vite/traceViewer/index.CFOW-Ezb.css +0 -1
  390. package/lib/vite/traceViewer/index.DvtSwn6E.js +0 -2
  391. package/lib/vite/traceViewer/uiMode.BatfzHMG.css +0 -1
  392. package/lib/vite/traceViewer/uiMode.Sdytl9wc.js +0 -5
  393. package/lib/vite/traceViewer/xtermModule.Beg8tuEN.css +0 -32
  394. package/lib/zipBundle.js +0 -34
  395. package/lib/zipBundleImpl.js +0 -5
@@ -0,0 +1,89 @@
1
+ # Migrating from @playwright/experimental-ct-react / -vue
2
+
3
+ The CT packages compiled JSX in the test file and marshalled it into the browser. The gallery
4
+ pattern moves the scenario into a story export that runs natively in the browser: structure (which
5
+ component, its children, providers) plus behavior (state and callbacks, recorded into a hidden
6
+ form for the test to assert on). Plain data props travel through `mount(storyId, props)`;
7
+ `update()` and `unmount()` work as before.
8
+
9
+ ## Concept mapping
10
+
11
+ | `@playwright/experimental-ct-*` | Gallery pattern |
12
+ |---|---|
13
+ | `mount(<Button title="…" onClick={spy} />)` | Stateful story: the story provides `onClick`, records the effect into a hidden form input; the test asserts `toHaveValue()` |
14
+ | Plain data props from the test | Unchanged in spirit: `mount(id, props)` |
15
+ | JSX children / slots from the test | Cannot cross — bake each composition into its own story export (Vue: `.story.vue` for slot-heavy scenarios) |
16
+ | `component.update(<Button count={2} />)` | `component.update({ count: 2 })` — state-preserving, needs the gallery to reuse its root (`gallery-spec.md`) |
17
+ | `component.unmount()` | `component.unmount()` — backed by the gallery's `window.unmount()` |
18
+ | `beforeMount`/`afterMount` in `playwright/index.ts` | The body of the gallery's `window.mount` (global), or story decorators (per-story) |
19
+ | `hooksConfig` per-test variation | Props: `mount('App/Routing', { route: '/dashboard' })` — the story/decorator interprets them |
20
+ | `router` fixture / MSW handlers in Node | `page.route()` in the test, or MSW `setupWorker` inside a story/decorator |
21
+ | `playwright/index.html` (styles, fonts, theme) | The gallery's `index.html` / entry module imports |
22
+ | `ctViteConfig`, `ctPort`, `ctTemplateDir`, `ctCacheDir` | Gone — the gallery runs through the app's own dev server; port lives in `webServer` + `baseURL`; location is `playwright/gallery/` |
23
+ | `defineConfig` from `@playwright/experimental-ct-react` | Plain `defineConfig` from `@playwright/test`, with `baseURL` = gallery URL, `serviceWorkers: 'block'`, `reuseContext: true` (see `SKILL.md`) |
24
+
25
+ The CT packages were removed in Playwright 1.63 and are no longer published, so migrate while
26
+ pinned to Playwright 1.62 and upgrade once the last spec is ported.
27
+
28
+ ## Steps
29
+
30
+ 1. Set up the gallery and config per `SKILL.md`. Keep the old CT project running until the last
31
+ spec is migrated.
32
+ 2. For each CT spec, split every `mount(<…/>)` call: JSX structure becomes a story export next to
33
+ the component; plain data props stay in the test as `mount`'s second argument. Callback spies
34
+ become story state recorded into a hidden form. A call site that only varies data props usually
35
+ needs just one generic story that spreads them:
36
+ `export const Default = (props: ButtonProps) => <Button title="Submit" {...props} />`.
37
+ 3. Rewrite the spec: import `test`/`expect` from `@playwright/test`; `mount(<X a={1}/>)`
38
+ → `mount('X/Default', { a: 1 })`; `update(<X a={2}/>)` → `update({ a: 2 })`;
39
+ `unmount()` unchanged. `mount` returns a locator for the gallery root — scope the queries:
40
+ `component.getByRole('button').click()`. Spy assertions become `toHaveValue()` on the story's
41
+ recorded state.
42
+ 4. Port `beforeMount` hooks: app-wide setup into the gallery's `window.mount`; per-test
43
+ `hooksConfig` branches into props interpreted by a story or decorator.
44
+ 5. When all specs are green, delete the CT project from the config, drop the
45
+ `@playwright/experimental-ct-*` dependency, remove `playwright/index.html`,
46
+ `playwright/index.ts*` and `playwright/.cache`, and lift the Playwright version pin.
47
+
48
+ ## Gotchas
49
+
50
+ - **Story ids are strings.** Renaming or moving a story breaks specs at runtime, not compile time
51
+ — and the suffix-matching resolution can silently match a different story after a rename.
52
+ Gallery types (`typing.md`) turn registered ids into a compile-time check.
53
+ - **Per-test JSX is gone.** Any test that built a different JSX tree per test (children matrices,
54
+ inline wrappers) becomes one story export per composition.
55
+
56
+ ## Before / after
57
+
58
+ ```tsx
59
+ // Before (CT)
60
+ import { test, expect } from '@playwright/experimental-ct-react';
61
+ import Button from '../src/components/Button';
62
+
63
+ test('click', async ({ mount }) => {
64
+ const messages: string[] = [];
65
+ const component = await mount(<Button title="Submit" onClick={data => messages.push(data)} />);
66
+ await component.click();
67
+ expect(messages).toEqual(['hello']);
68
+ });
69
+ ```
70
+
71
+ ```tsx
72
+ // After: src/components/Button.story.tsx
73
+ import Button from './Button';
74
+
75
+ export const Default = (props: { onClick?: (data: string) => void }) =>
76
+ <Button title="Submit" {...props} />;
77
+ ```
78
+
79
+ ```ts
80
+ // After: src/components/Button.spec.ts
81
+ import { test, expect } from '@playwright/test';
82
+
83
+ test('click', async ({ mount }) => {
84
+ const messages: string[] = [];
85
+ const component = await mount('components/Button/Default', { onClick: (data: string) => messages.push(data) });
86
+ await component.click();
87
+ expect(messages).toEqual(['hello']);
88
+ });
89
+ ```
@@ -0,0 +1,69 @@
1
+ # React setup
2
+
3
+ Follow the setup workflow in `SKILL.md`. Implement the gallery per `references/gallery-spec.md` (which has a React worked example); this page covers React-specific details.
4
+
5
+ ## Files
6
+
7
+ - `playwright/gallery/` — the gallery you implement to `references/gallery-spec.md` (an `index.html` + a `main.tsx` module). Requires `react` and `react-dom` 18+ (`createRoot`).
8
+ - Stories: `src/**/*.story.tsx` (the glob also picks up `.story.jsx`); example in `templates/react/Button.story.tsx`.
9
+
10
+ ## StrictMode
11
+
12
+ Wrap the rendered story in `<React.StrictMode>` in your gallery to match how most apps render. In development builds StrictMode intentionally double-invokes render functions and effects. This matters for stories that record events with counters set in effects — recording via state updates from event handlers (like the `CountsClicks` example story) is unaffected. If a story misbehaves under StrictMode, that is usually a real finding about the component; drop the wrapper only if the app itself does not use StrictMode.
13
+
14
+ ## Global providers
15
+
16
+ If components require context (theme, store, i18n, router), create one shared decorator and use it in stories, so each story states its scenario and nothing more:
17
+
18
+ ```tsx
19
+ // src/stories/decorators.tsx
20
+ import { ThemeProvider } from '../theme';
21
+ import { MemoryRouter } from 'react-router-dom';
22
+
23
+ export function AppScaffold({ children, route = '/' }: { children: React.ReactNode, route?: string }) {
24
+ return (
25
+ <ThemeProvider theme="light">
26
+ <MemoryRouter initialEntries={[route]}>{children}</MemoryRouter>
27
+ </ThemeProvider>
28
+ );
29
+ }
30
+ ```
31
+
32
+ ```tsx
33
+ // src/components/ProfilePage.story.tsx
34
+ export const LoggedIn = () => (
35
+ <AppScaffold route="/profile/42">
36
+ <ProfilePage user={{ id: 42, name: 'Test User' }} />
37
+ </AppScaffold>
38
+ );
39
+ ```
40
+
41
+ Do not build the decorator into the gallery — keeping it in story files makes the wrapping visible and lets stories opt out.
42
+
43
+ ## Typed props
44
+
45
+ `mount` is generic over the story: pass the story type as a template argument to type-check per-test props (and `update()`). Props are inferred from the component signature; function and class components both work.
46
+
47
+ ```tsx
48
+ // src/components/Button.story.tsx
49
+ export const WithTitle = ({ title = 'Default' }: { title?: string }) =>
50
+ <Button title={title} />;
51
+ ```
52
+
53
+ ```ts
54
+ // src/components/button.spec.ts
55
+ import type { WithTitle } from './Button.story';
56
+
57
+ const component = await mount<typeof WithTitle>('components/Button/WithTitle', { title: 'Hello' });
58
+ ```
59
+
60
+ Alternatively, generate gallery types so the id itself is typed and no type import is needed: `mount('acme-ui/components/Button/WithTitle', { title: 'Hello' })` — see `references/typing.md`.
61
+
62
+ ## CSS
63
+
64
+ - Global stylesheets: import them in your gallery entry (`playwright/gallery/main.tsx`, e.g. `import '../../src/index.css'`), mirroring the app's own entry point.
65
+ - Tailwind: if content scanning is path-based, make sure `*.story.tsx` files are covered.
66
+
67
+ ## Data fetching
68
+
69
+ For libraries with client objects (React Query, Apollo), create the client inside the story or decorator so each navigation starts fresh.
@@ -0,0 +1,173 @@
1
+ # Typing `mount()`
2
+
3
+ `mount(storyId, props?)` accepts any string id and any serializable props. Two optional layers
4
+ add type checking on top; both are supported and can be mixed in one project.
5
+
6
+ | | Explicit story type | Gallery types |
7
+ |---|---|---|
8
+ | Call | `mount<typeof WithTitle>('components/Button/WithTitle', { title })` | `mount('acme-ui/components/Button/WithTitle', { title })` |
9
+ | Checks | props and `update()` | props, `update()`, and the id itself (autocomplete, rename safety) |
10
+ | Needs | `import type { WithTitle } from './Button.story'` in the spec | a generated `stories.d.ts` kept in sync by a gallery plugin |
11
+ | Id grammar | any suffix the gallery resolves | full id, prefixed with the package name |
12
+
13
+ ## Explicit story type
14
+
15
+ Pass the story type as a template argument. Nothing to set up; works in every project.
16
+
17
+ ```ts
18
+ import type { WithTitle } from './Button.story';
19
+
20
+ const component = await mount<typeof WithTitle>('components/Button/WithTitle', { title: 'Hello' });
21
+ await component.update({ title: 'Again' });
22
+ ```
23
+
24
+ Use `import type` so the story (and with it React/Vue and CSS imports) is never loaded into the
25
+ Node test process. Function components, class components and `defineComponent` stories all infer
26
+ their props; see the `Typed props` sections in `react.md` / `vue.md` for framework details.
27
+
28
+ ## Gallery types
29
+
30
+ `@playwright/test` exports an empty `interface Stories {}`. When a story id is a key of `Stories`,
31
+ `mount` types the props from that entry; any other string keeps untyped props, so adoption can be
32
+ partial. A tiny Vite plugin next to the gallery generates `stories.d.ts`, which fills `Stories` in
33
+ via module augmentation:
34
+
35
+ ```ts
36
+ // playwright/gallery/stories.d.ts (generated)
37
+ type StoriesOf<Prefix extends string, Mod> = { [K in keyof Mod & string as `${Prefix}/${K}`]: Mod[K] };
38
+
39
+ declare module '@playwright/test' {
40
+ interface Stories extends
41
+ StoriesOf<'acme-ui/components/Button', typeof import('../../src/components/Button.story')>,
42
+ StoriesOf<'acme-ui/components/Expandable', typeof import('../../src/components/Expandable.story')> {}
43
+ }
44
+
45
+ export {};
46
+ ```
47
+
48
+ One line per story file; export names and prop types come from the story module itself, so the
49
+ file only changes when a story file is added, removed or moved. Specs then need no type imports:
50
+
51
+ ```ts
52
+ const component = await mount('acme-ui/components/Button/WithTitle', { title: 'Hello' });
53
+ // ^ autocompletes registered ids ^ checked against WithTitle's props
54
+ ```
55
+
56
+ ### Namespace ids with the package name
57
+
58
+ `Stories` is merged per TypeScript program. In a monorepo whose packages share one `tsconfig`,
59
+ two packages both registering `components/Button/Default` with different props fail with
60
+ `TS2320: Interface 'Stories' cannot simultaneously extend types ...` at the `Stories` declaration,
61
+ and even distinct ids leak into each other's autocomplete. Prefix every id with the package name,
62
+ `<package>/<path under src>/<Export>`, from the start, so the convention holds when a project
63
+ becomes a package. Read the name from `package.json` in both places that derive ids, so they
64
+ cannot drift:
65
+
66
+ ```ts
67
+ // playwright/gallery/main.tsx
68
+ import packageJSON from '../../package.json';
69
+
70
+ const id = (f: string) => packageJSON.name + '/' + f.replace(/^(\.\.\/)+src\//, '').replace(/\.story\.\w+$/, '');
71
+ ```
72
+
73
+ Suffix resolution keeps working at runtime, so `mount('Button/Primary')` still renders; only the
74
+ full prefixed id is typed.
75
+
76
+ ### The plugin
77
+
78
+ Framework-agnostic: it only lists story files. Adjust `storyFile` to match the gallery's glob.
79
+
80
+ ```ts
81
+ // playwright/gallery/storyTypes.ts
82
+ import fs from 'fs';
83
+ import path from 'path';
84
+ import type { Plugin } from 'vite';
85
+
86
+ const storyFile = /\.story\.(tsx|jsx)$/;
87
+
88
+ export function storyTypes(options: { prefix: string, src: string, outFile: string }): Plugin {
89
+ const generate = () => {
90
+ const content = render(listStoryFiles(options.src), options);
91
+ if (fs.existsSync(options.outFile) && fs.readFileSync(options.outFile, 'utf8') === content)
92
+ return;
93
+ fs.writeFileSync(options.outFile, content);
94
+ };
95
+ return {
96
+ name: 'story-types',
97
+ buildStart() {
98
+ this.addWatchFile(options.src);
99
+ generate();
100
+ },
101
+ configureServer(server) {
102
+ const onFile = (file: string) => {
103
+ if (storyFile.test(file))
104
+ generate();
105
+ };
106
+ server.watcher.on('add', onFile);
107
+ server.watcher.on('unlink', onFile);
108
+ },
109
+ };
110
+ }
111
+
112
+ function listStoryFiles(dir: string): string[] {
113
+ const result: string[] = [];
114
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
115
+ const file = path.join(dir, entry.name);
116
+ if (entry.isDirectory())
117
+ result.push(...listStoryFiles(file));
118
+ else if (storyFile.test(entry.name))
119
+ result.push(file);
120
+ }
121
+ return result.sort();
122
+ }
123
+
124
+ function render(files: string[], { prefix, src, outFile }: { prefix: string, src: string, outFile: string }): string {
125
+ const outDir = path.dirname(outFile);
126
+ const posix = (p: string) => p.split(path.sep).join('/');
127
+ const entries = files.map(file => {
128
+ const id = prefix + '/' + posix(path.relative(src, file)).replace(storyFile, '');
129
+ const specifier = posix(path.relative(outDir, file)).replace(/\.\w+$/, '');
130
+ return ` StoriesOf<'${id}', typeof import('${specifier.startsWith('.') ? specifier : './' + specifier}')>`;
131
+ });
132
+ const stories = entries.length ? `interface Stories extends\n${entries.join(',\n')} {}` : 'interface Stories {}';
133
+ return `// Generated by storyTypes.ts, do not edit.
134
+
135
+ type StoriesOf<Prefix extends string, Mod> = { [K in keyof Mod & string as \`\${Prefix}/\${K}\`]: Mod[K] };
136
+
137
+ declare module '@playwright/test' {
138
+ ${stories}
139
+ }
140
+
141
+ export {};
142
+ `;
143
+ }
144
+ ```
145
+
146
+ Register it on whichever Vite server serves the gallery (the app's `vite.config.ts`, or the
147
+ standalone `playwright/vite.config.ts`):
148
+
149
+ ```ts
150
+ import packageJSON from './package.json';
151
+ import { storyTypes } from './playwright/gallery/storyTypes';
152
+
153
+ export default defineConfig({
154
+ plugins: [
155
+ react(),
156
+ storyTypes({
157
+ prefix: packageJSON.name,
158
+ src: path.resolve(__dirname, 'src'),
159
+ outFile: path.resolve(__dirname, 'playwright/gallery/stories.d.ts'),
160
+ }),
161
+ ],
162
+ });
163
+ ```
164
+
165
+ The file is regenerated on every dev-server start and build, and while the server runs, whenever
166
+ a story file appears or disappears. Its content is deterministic, so **commit it**: type-checking
167
+ in CI or an editor must not depend on a running dev server. Nothing imports the file, so list it
168
+ explicitly in the project's `tsconfig` (`"files": ["playwright/gallery/stories.d.ts"]`) so that
169
+ `tsc` and editors load it.
170
+
171
+ For `.story.vue` single-file components, map the `default` export to the bare path in
172
+ `StoriesOf` (`K extends 'default' ? Prefix : \`${Prefix}/${K}\``) and rely on `vue-tsc` for the
173
+ SFC's types; a story without inferable props types as `unknown` props, which accepts anything.
@@ -0,0 +1,77 @@
1
+ # Vue setup
2
+
3
+ Follow the setup workflow in `SKILL.md`. Implement the gallery per `references/gallery-spec.md`, exposing `window.mount`/`window.unmount` — in Vue, mount with `app = createApp(h(story, props)); app.mount('#root')` and unmount with `app.unmount()`; this page covers Vue-specific details.
4
+
5
+ ## Files
6
+
7
+ - `playwright/gallery/` — the gallery you implement to `references/gallery-spec.md` (an `index.html` + a `main.ts` module). Requires Vue 3.
8
+ - Stories: `src/**/*.story.{ts,js,vue}`; example in `templates/vue/Button.story.ts`.
9
+
10
+ ## Two ways to write stories
11
+
12
+ **Render-function stories** (`Button.story.ts`) — several scenarios per file, one named export each; see `templates/vue/Button.story.ts`. Uses `defineComponent` + `h()`, no SFC compilation involved.
13
+
14
+ **Single-file-component stories** (`Button.primary.story.vue`) — one story per file, full template syntax:
15
+
16
+ ```vue
17
+ <script setup lang="ts">
18
+ import { ref } from 'vue';
19
+ import Button from './Button.vue';
20
+ const clicks = ref(0);
21
+ </script>
22
+
23
+ <template>
24
+ <Button title="Submit" @click="clicks++" />
25
+ <form hidden><input data-testid="click-count" readonly :value="String(clicks)" /></form>
26
+ </template>
27
+ ```
28
+
29
+ An SFC story is addressed by its path without the extension: `mount('components/Button.primary')`. Prefer SFC stories when the scenario needs slots or non-trivial templates.
30
+
31
+ ## Global plugins
32
+
33
+ Apps that rely on plugins (Pinia, vue-router, i18n) should wrap components with a decorator story helper that creates a fresh instance per story:
34
+
35
+ ```ts
36
+ // src/stories/decorators.ts
37
+ import { defineComponent, h, type Component } from 'vue';
38
+ import { createPinia } from 'pinia';
39
+
40
+ export function withStore(story: Component) {
41
+ return defineComponent(() => {
42
+ const pinia = createPinia();
43
+ return () => h(story, { pinia });
44
+ });
45
+ }
46
+ ```
47
+
48
+ For plugins that must be installed on the app instance (`app.use(...)`), add them in your gallery right after `createApp(...)` — that is the equivalent of the app's own bootstrap.
49
+
50
+ ## Typed props
51
+
52
+ A story that takes per-test props declares them twice: in the setup signature (for the type) and in the `props` option (so Vue delivers them as props rather than `attrs`):
53
+
54
+ ```ts
55
+ // src/components/Button.story.ts
56
+ export const WithTitle = defineComponent(
57
+ (props: { title?: string }) => () => h(Button, { title: props.title ?? 'Default' }),
58
+ { props: ['title'] },
59
+ );
60
+ ```
61
+
62
+ `mount` is generic over the story: pass the story type as a template argument to type-check the props (and `update()`):
63
+
64
+ ```ts
65
+ // src/components/button.spec.ts
66
+ import type { WithTitle } from './Button.story';
67
+
68
+ const component = await mount<typeof WithTitle>('components/Button/WithTitle', { title: 'Hello' });
69
+ ```
70
+
71
+ Alternatively, generate gallery types so the id itself is typed and no type import is needed: `mount('acme-ui/components/Button/WithTitle', { title: 'Hello' })` — see `references/typing.md`.
72
+
73
+ Options-API stories (`defineComponent({ props: { ... } })`) infer props the same way. For `.story.vue` SFC stories, prop types are only inferable when the setup generates SFC types (Volar/vue-tsc); otherwise pass the props type directly: `mount<{ title?: string }>('components/Button.primary', { title: 'Hello' })`.
74
+
75
+ ## CSS
76
+
77
+ Import global stylesheets in your gallery entry (`playwright/gallery/main.ts`, e.g. `import '../../src/assets/main.css'`), mirroring the app's entry point.
@@ -0,0 +1,174 @@
1
+ ---
2
+ name: playwright-trace
3
+ description: Inspect Playwright trace files from the command line — list actions, view requests, console, errors, snapshots and screenshots.
4
+ allowed-tools: Bash(npx playwright trace:*)
5
+ ---
6
+
7
+ # Playwright Trace CLI
8
+
9
+ Inspect `.zip` trace files produced by Playwright tests without opening a browser.
10
+
11
+ ## Workflow
12
+
13
+ 1. Start with `trace open <trace.zip>` to extract the trace and see its metadata.
14
+ 2. Use `trace actions` to see all actions with their action IDs.
15
+ 3. Use `trace action <action-id>` to drill into a specific action — see parameters, logs, source location, and available snapshots.
16
+ 4. Use `trace requests`, `trace console`, or `trace errors` for cross-cutting views.
17
+ 5. Use `trace snapshot <action-id>` to get the DOM snapshot, or run a browser command against it.
18
+ 6. Use `trace close` to remove the extracted trace data when done.
19
+
20
+ All commands after `open` operate on the currently opened trace — no need to pass the trace file again. Opening a new trace replaces the previous one.
21
+
22
+ ## Commands
23
+
24
+ ### Open a trace
25
+
26
+ ```bash
27
+ # Extract trace and show metadata: browser, viewport, duration, action/error counts
28
+ npx playwright trace open <trace.zip>
29
+ ```
30
+
31
+ ### Close a trace
32
+
33
+ ```bash
34
+ # Remove extracted trace data
35
+ npx playwright trace close
36
+ ```
37
+
38
+ ### Actions
39
+
40
+ ```bash
41
+ # List all actions as a tree with action IDs and timing
42
+ npx playwright trace actions
43
+
44
+ # Filter by action title (regex, case-insensitive)
45
+ npx playwright trace actions --grep "click"
46
+
47
+ # Only failed actions
48
+ npx playwright trace actions --errors-only
49
+ ```
50
+
51
+ ### Action details
52
+
53
+ ```bash
54
+ # Show full details for one action: params, result, logs, source, snapshots
55
+ npx playwright trace action <action-id>
56
+ ```
57
+
58
+ The `action` command displays available snapshot phases (before, action, after) and the exact command to extract them.
59
+
60
+ ### Requests
61
+
62
+ ```bash
63
+ # All network requests: start time (on the `trace actions` clock), method, status, URL, duration, size
64
+ npx playwright trace requests
65
+
66
+ # Filter by URL pattern
67
+ npx playwright trace requests --grep "api"
68
+
69
+ # Filter by HTTP method
70
+ npx playwright trace requests --method POST
71
+
72
+ # Only failed requests (status >= 400)
73
+ npx playwright trace requests --failed
74
+ ```
75
+
76
+ ### Request details
77
+
78
+ ```bash
79
+ # Show full details for one request: headers, body, security
80
+ npx playwright trace request <request-id>
81
+ ```
82
+
83
+ ### Console
84
+
85
+ ```bash
86
+ # All console messages and stdout/stderr
87
+ npx playwright trace console
88
+
89
+ # Only errors
90
+ npx playwright trace console --errors-only
91
+
92
+ # Only browser console (no stdout/stderr)
93
+ npx playwright trace console --browser
94
+
95
+ # Only stdout/stderr (no browser console)
96
+ npx playwright trace console --stdio
97
+
98
+ # Filter by message text pattern
99
+ npx playwright trace console --grep "failed to fetch"
100
+ ```
101
+
102
+ ### Errors
103
+
104
+ ```bash
105
+ # All errors with stack traces and associated actions
106
+ npx playwright trace errors
107
+ ```
108
+
109
+ ### Snapshots
110
+
111
+ The `snapshot` command loads the DOM snapshot for an action into a headless browser and runs a single browser command against it. Without a browser command, it returns the accessibility snapshot.
112
+
113
+ ```bash
114
+ # Get the accessibility snapshot (default)
115
+ npx playwright trace snapshot <action-id>
116
+
117
+ # Use a specific phase
118
+ npx playwright trace snapshot <action-id> --phase before
119
+
120
+ # Run eval to query the DOM
121
+ npx playwright trace snapshot <action-id> -- eval "document.title"
122
+ npx playwright trace snapshot <action-id> -- eval "document.querySelector('#error').textContent"
123
+
124
+ # Eval on a specific element ref (from the snapshot)
125
+ npx playwright trace snapshot <action-id> -- eval "el => el.getAttribute('data-testid')" e5
126
+
127
+ # Take a screenshot of the snapshot
128
+ npx playwright trace snapshot <action-id> -- screenshot
129
+
130
+ # Redirect output to a file
131
+ npx playwright trace snapshot <action-id> -- eval "document.body.outerHTML" --filename=page.html
132
+ npx playwright trace snapshot <action-id> -- screenshot --filename=screenshot.png
133
+ ```
134
+
135
+ Only three browser commands are useful on a frozen snapshot: `snapshot`, `eval`, and `screenshot`.
136
+
137
+ ### Attachments
138
+
139
+ ```bash
140
+ # List all trace attachments
141
+ npx playwright trace attachments
142
+
143
+ # Extract an attachment by its number
144
+ npx playwright trace attachment 1
145
+ npx playwright trace attachment 1 -o out.png
146
+ ```
147
+
148
+ ## Typical investigation
149
+
150
+ ```bash
151
+ # 1. Open the trace and see what's inside
152
+ npx playwright trace open test-results/my-test/trace.zip
153
+
154
+ # 2. What actions ran?
155
+ npx playwright trace actions
156
+
157
+ # 3. Which action failed?
158
+ npx playwright trace actions --errors-only
159
+
160
+ # 4. What went wrong?
161
+ npx playwright trace action 12
162
+
163
+ # 5. What did the page look like at that moment?
164
+ npx playwright trace snapshot 12
165
+
166
+ # 6. Query the DOM for more detail
167
+ npx playwright trace snapshot 12 -- eval "document.querySelector('.error-message').textContent"
168
+
169
+ # 7. Any relevant network failures?
170
+ npx playwright trace requests --failed
171
+
172
+ # 8. Any console errors?
173
+ npx playwright trace console --errors-only
174
+ ```