rebrowser-playwright-core 1.52.0 → 1.64.100

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 +78322 -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,275 @@
1
+ # Storage Management
2
+
3
+ Manage cookies, localStorage, sessionStorage, and browser storage state.
4
+
5
+ ## Storage State
6
+
7
+ Save and restore complete browser state including cookies and storage.
8
+
9
+ ### Save Storage State
10
+
11
+ ```bash
12
+ # Save to auto-generated filename (storage-state-{timestamp}.json)
13
+ playwright-cli state-save
14
+
15
+ # Save to specific filename
16
+ playwright-cli state-save my-auth-state.json
17
+ ```
18
+
19
+ ### Restore Storage State
20
+
21
+ ```bash
22
+ # Load storage state from file
23
+ playwright-cli state-load my-auth-state.json
24
+
25
+ # Reload page to apply cookies
26
+ playwright-cli open https://example.com
27
+ ```
28
+
29
+ ### Storage State File Format
30
+
31
+ The saved file contains:
32
+
33
+ ```json
34
+ {
35
+ "cookies": [
36
+ {
37
+ "name": "session_id",
38
+ "value": "abc123",
39
+ "domain": "example.com",
40
+ "path": "/",
41
+ "expires": 1893456000,
42
+ "httpOnly": true,
43
+ "secure": true,
44
+ "sameSite": "Lax"
45
+ }
46
+ ],
47
+ "origins": [
48
+ {
49
+ "origin": "https://example.com",
50
+ "localStorage": [
51
+ { "name": "theme", "value": "dark" },
52
+ { "name": "user_id", "value": "12345" }
53
+ ]
54
+ }
55
+ ]
56
+ }
57
+ ```
58
+
59
+ ## Cookies
60
+
61
+ ### List All Cookies
62
+
63
+ ```bash
64
+ playwright-cli cookie-list
65
+ ```
66
+
67
+ ### Filter Cookies by Domain
68
+
69
+ ```bash
70
+ playwright-cli cookie-list --domain=example.com
71
+ ```
72
+
73
+ ### Filter Cookies by Path
74
+
75
+ ```bash
76
+ playwright-cli cookie-list --path=/api
77
+ ```
78
+
79
+ ### Get Specific Cookie
80
+
81
+ ```bash
82
+ playwright-cli cookie-get session_id
83
+ ```
84
+
85
+ ### Set a Cookie
86
+
87
+ ```bash
88
+ # Basic cookie
89
+ playwright-cli cookie-set session abc123
90
+
91
+ # Cookie with options
92
+ playwright-cli cookie-set session abc123 --domain=example.com --path=/ --httpOnly --secure --sameSite=Lax
93
+
94
+ # Cookie with expiration (Unix timestamp)
95
+ playwright-cli cookie-set remember_me token123 --expires=1893456000
96
+ ```
97
+
98
+ ### Delete a Cookie
99
+
100
+ ```bash
101
+ playwright-cli cookie-delete session_id
102
+ ```
103
+
104
+ ### Clear All Cookies
105
+
106
+ ```bash
107
+ playwright-cli cookie-clear
108
+ ```
109
+
110
+ ### Advanced: Multiple Cookies or Custom Options
111
+
112
+ For complex scenarios like adding multiple cookies at once, use `run-code`:
113
+
114
+ ```bash
115
+ playwright-cli run-code "async page => {
116
+ await page.context().addCookies([
117
+ { name: 'session_id', value: 'sess_abc123', domain: 'example.com', path: '/', httpOnly: true },
118
+ { name: 'preferences', value: JSON.stringify({ theme: 'dark' }), domain: 'example.com', path: '/' }
119
+ ]);
120
+ }"
121
+ ```
122
+
123
+ ## Local Storage
124
+
125
+ ### List All localStorage Items
126
+
127
+ ```bash
128
+ playwright-cli localstorage-list
129
+ ```
130
+
131
+ ### Get Single Value
132
+
133
+ ```bash
134
+ playwright-cli localstorage-get token
135
+ ```
136
+
137
+ ### Set Value
138
+
139
+ ```bash
140
+ playwright-cli localstorage-set theme dark
141
+ ```
142
+
143
+ ### Set JSON Value
144
+
145
+ ```bash
146
+ playwright-cli localstorage-set user_settings '{"theme":"dark","language":"en"}'
147
+ ```
148
+
149
+ ### Delete Single Item
150
+
151
+ ```bash
152
+ playwright-cli localstorage-delete token
153
+ ```
154
+
155
+ ### Clear All localStorage
156
+
157
+ ```bash
158
+ playwright-cli localstorage-clear
159
+ ```
160
+
161
+ ### Advanced: Multiple Operations
162
+
163
+ For complex scenarios like setting multiple values at once, use `run-code`:
164
+
165
+ ```bash
166
+ playwright-cli run-code "async page => {
167
+ await page.evaluate(() => {
168
+ localStorage.setItem('token', 'jwt_abc123');
169
+ localStorage.setItem('user_id', '12345');
170
+ localStorage.setItem('expires_at', Date.now() + 3600000);
171
+ });
172
+ }"
173
+ ```
174
+
175
+ ## Session Storage
176
+
177
+ ### List All sessionStorage Items
178
+
179
+ ```bash
180
+ playwright-cli sessionstorage-list
181
+ ```
182
+
183
+ ### Get Single Value
184
+
185
+ ```bash
186
+ playwright-cli sessionstorage-get form_data
187
+ ```
188
+
189
+ ### Set Value
190
+
191
+ ```bash
192
+ playwright-cli sessionstorage-set step 3
193
+ ```
194
+
195
+ ### Delete Single Item
196
+
197
+ ```bash
198
+ playwright-cli sessionstorage-delete step
199
+ ```
200
+
201
+ ### Clear sessionStorage
202
+
203
+ ```bash
204
+ playwright-cli sessionstorage-clear
205
+ ```
206
+
207
+ ## IndexedDB
208
+
209
+ ### List Databases
210
+
211
+ ```bash
212
+ playwright-cli run-code "async page => {
213
+ return await page.evaluate(async () => {
214
+ const databases = await indexedDB.databases();
215
+ return databases;
216
+ });
217
+ }"
218
+ ```
219
+
220
+ ### Delete Database
221
+
222
+ ```bash
223
+ playwright-cli run-code "async page => {
224
+ await page.evaluate(() => {
225
+ indexedDB.deleteDatabase('myDatabase');
226
+ });
227
+ }"
228
+ ```
229
+
230
+ ## Common Patterns
231
+
232
+ ### Authentication State Reuse
233
+
234
+ ```bash
235
+ # Step 1: Login and save state
236
+ playwright-cli open https://app.example.com/login
237
+ playwright-cli snapshot
238
+ playwright-cli fill e1 "user@example.com"
239
+ playwright-cli fill e2 "password123"
240
+ playwright-cli click e3
241
+
242
+ # Save the authenticated state
243
+ playwright-cli state-save auth.json
244
+
245
+ # Step 2: Later, restore state and skip login
246
+ playwright-cli state-load auth.json
247
+ playwright-cli open https://app.example.com/dashboard
248
+ # Already logged in!
249
+ ```
250
+
251
+ ### Save and Restore Roundtrip
252
+
253
+ ```bash
254
+ # Set up authentication state
255
+ playwright-cli open https://example.com
256
+ playwright-cli eval "() => { document.cookie = 'session=abc123'; localStorage.setItem('user', 'john'); }"
257
+
258
+ # Save state to file
259
+ playwright-cli state-save my-session.json
260
+
261
+ # ... later, in a new session ...
262
+
263
+ # Restore state
264
+ playwright-cli state-load my-session.json
265
+ playwright-cli open https://example.com
266
+ # Cookies and localStorage are restored!
267
+ ```
268
+
269
+ ## Security Notes
270
+
271
+ - Never commit storage state files containing auth tokens
272
+ - Add `*.auth-state.json` to `.gitignore`
273
+ - Delete state files after automation completes
274
+ - Use environment variables for sensitive data
275
+ - By default, sessions run in-memory mode which is safer for sensitive operations
@@ -0,0 +1,433 @@
1
+ # Test generation (plan → generate → heal)
2
+
3
+ End-to-end workflow for authoring and maintaining Playwright tests with `playwright-cli`. Every `playwright-cli` action emits the equivalent Playwright TypeScript, and that generated code is the raw material for every test. The sections below can be used independently:
4
+
5
+ - **How generation works** — the core mechanic everything else relies on: actions become TypeScript, plus how to add assertions.
6
+ - **Plan** — explore the app, produce a spec file describing what to test.
7
+ - **Generate** — turn a spec into Playwright test files. Update the spec if it's vague or stale.
8
+ - **Heal** — diagnose failing tests, fix the code, reconcile the spec with reality.
9
+
10
+ Plan / generate / heal lean on the same mechanic: run `npx playwright test --debug=cli` in the background, then `playwright-cli attach tw-XXXX` to drive the paused page interactively. See [playwright-tests.md](playwright-tests.md) for the debug/attach mechanics.
11
+
12
+ ---
13
+
14
+ ## 0. How generation works
15
+
16
+ Every action you perform with `playwright-cli` generates corresponding Playwright TypeScript code. This code appears in the output and can be copied directly into your test files.
17
+
18
+ ```bash
19
+ # Start a session
20
+ playwright-cli open https://example.com/login
21
+
22
+ # Take a snapshot to see elements
23
+ playwright-cli snapshot
24
+ # Output shows: e1 [textbox "Email"], e2 [textbox "Password"], e3 [button "Sign In"]
25
+
26
+ # Fill form fields - generates code automatically
27
+ playwright-cli fill e1 "user@example.com"
28
+ # Ran Playwright code:
29
+ # await page.getByRole('textbox', { name: 'Email' }).fill('user@example.com');
30
+
31
+ playwright-cli fill e2 "password123"
32
+ # Ran Playwright code:
33
+ # await page.getByRole('textbox', { name: 'Password' }).fill('password123');
34
+
35
+ playwright-cli click e3
36
+ # Ran Playwright code:
37
+ # await page.getByRole('button', { name: 'Sign In' }).click();
38
+ ```
39
+
40
+ ### Building a test file
41
+
42
+ Collect the generated code into a Playwright test:
43
+
44
+ ```typescript
45
+ import { test, expect } from '@playwright/test';
46
+
47
+ test('login flow', async ({ page }) => {
48
+ // Generated code from playwright-cli session:
49
+ await page.goto('https://example.com/login');
50
+ await page.getByRole('textbox', { name: 'Email' }).fill('user@example.com');
51
+ await page.getByRole('textbox', { name: 'Password' }).fill('password123');
52
+ await page.getByRole('button', { name: 'Sign In' }).click();
53
+
54
+ // Add assertions
55
+ await expect(page).toHaveURL(/.*dashboard/);
56
+ });
57
+ ```
58
+
59
+ ### Use semantic locators
60
+
61
+ The generated code uses role-based locators when possible, which are more resilient:
62
+
63
+ ```typescript
64
+ // Generated (good - semantic)
65
+ await page.getByRole('button', { name: 'Submit' }).click();
66
+
67
+ // Avoid (fragile - CSS selectors)
68
+ await page.locator('#submit-btn').click();
69
+ ```
70
+
71
+ ### Explore before recording
72
+
73
+ Take snapshots to understand the page structure before recording actions:
74
+
75
+ ```bash
76
+ playwright-cli open https://example.com
77
+ playwright-cli snapshot
78
+ # Review the element structure
79
+ playwright-cli click e5
80
+ ```
81
+
82
+ ### Add assertions manually
83
+
84
+ Generated code captures actions but not assertions. Add expectations in your test using one of the recommended matchers:
85
+
86
+ - `toBeVisible()` — element is rendered and visible
87
+ - `toHaveText(text)` — element text content matches
88
+ - `toHaveValue(value) / toBeEmpty()` — input/select value matches
89
+ - `toBeChecked() / toBeUnchecked()` — checkbox state matches
90
+ - `toMatchAriaSnapshot(snapshot)` — page (or locator) matches a partial accessibility snapshot
91
+
92
+ Use `playwright-cli generate-locator <target>` to produce the locator expression for the assertion, and the snapshot/eval commands to capture the expected value.
93
+
94
+ When asserting text content, make sure that generated locator does not contain text from the element itself. `getByTestId()` or `getByLabel()` usually work well with asserting text. When locator is text-based, prefer `toBeVisible()` instead.
95
+
96
+ Snapshot to be matched does not have to contain all the information - only capture what's necessary for the assertion. You can use regular expressions for unstable values.
97
+
98
+ ```bash
99
+ # Get a stable locator for an element ref to use in the assertion
100
+ playwright-cli --raw generate-locator e5
101
+ # getByRole('button', { name: 'Submit' })
102
+
103
+ # Capture expected text content for toHaveText
104
+ playwright-cli --raw eval "el => el.textContent" e5
105
+
106
+ # Capture expected input value for toHaveValue/toBeEmpty
107
+ playwright-cli --raw eval "el => el.value" e5
108
+
109
+ # Capture expected aria snapshot for toMatchAriaSnapshot/toBeChecked
110
+ # (whole page, or use a ref to scope to a region)
111
+ playwright-cli --raw snapshot
112
+ playwright-cli --raw snapshot e5
113
+ ```
114
+
115
+ ```typescript
116
+ // Generated action
117
+ await page.getByRole('button', { name: 'Submit' }).click();
118
+
119
+ // Manual assertions using the outputs above:
120
+ await expect(page.getByRole('alert', { name: 'Success' })).toBeVisible();
121
+ await expect(page.getByTestId('main-header')).toHaveText('Welcome, user');
122
+ await expect(page.getByRole('textbox', { name: 'Email' })).toHaveValue('user@example.com');
123
+ await expect(page.getByRole('checkbox', { name: 'Enable notifications' })).toBeChecked();
124
+
125
+ // toMatchAriaSnapshot on the whole page, finds a matching region
126
+ await expect(page).toMatchAriaSnapshot(`
127
+ - heading "Welcome, user"
128
+ - link /\\d+ new messages?/
129
+ - button "Sign out"
130
+ `);
131
+
132
+ // toMatchAriaSnapshot scoped to a region
133
+ await expect(page.getByRole('navigation')).toMatchAriaSnapshot(`
134
+ - link "Home"
135
+ - link /\\d+ new messages?/
136
+ - link "Profile"
137
+ `);
138
+ ```
139
+
140
+ ---
141
+
142
+ ## 1. Planning
143
+
144
+ Goal: produce a spec file (e.g. `specs/<feature>.plan.md`) that enumerates the scenarios to test. **Always** write the spec to a file.
145
+
146
+ ### 1.1 Prerequisite: workspace
147
+
148
+ Check the workspace has Playwright installed before anything else:
149
+
150
+ ```bash
151
+ # Either of these confirms a workspace:
152
+ test -f playwright.config.ts || test -f playwright.config.js
153
+ npx --no-install playwright --version
154
+ ```
155
+
156
+ If there is no Playwright install, bootstrap one and let the user pick the defaults:
157
+
158
+ ```bash
159
+ npm init playwright@latest
160
+ ```
161
+
162
+ ### 1.2 Prerequisite: seed test
163
+
164
+ A **seed test** is a minimal test that lands the page in the state every scenario starts from: navigation to the app, any required login, feature flags, etc. Scenarios assume a fresh start *after* the seed. `--debug=cli` pauses *inside* this test, so the seed is where every planning and generation session begins.
165
+
166
+ Minimum viable seed:
167
+
168
+ ```ts
169
+ // tests/seed.spec.ts
170
+ import { test } from '@playwright/test';
171
+
172
+ test('seed', async ({ page }) => {
173
+ await page.goto('https://example.com/');
174
+ });
175
+ ```
176
+
177
+ Preferred — push navigation into a fixture so scenario tests reuse it:
178
+
179
+ ```ts
180
+ // tests/fixtures.ts
181
+ import { test as baseTest } from '@playwright/test';
182
+ export { expect } from '@playwright/test';
183
+
184
+ export const test = baseTest.extend({
185
+ page: async ({ page }, use) => {
186
+ await page.goto('https://example.com/');
187
+ await use(page);
188
+ },
189
+ });
190
+ ```
191
+
192
+ ```ts
193
+ // tests/seed.spec.ts
194
+ import { test } from './fixtures';
195
+
196
+ test('seed', async ({ page }) => {
197
+ // Fixture already navigates. This empty body tells agents where to start.
198
+ });
199
+ ```
200
+
201
+ If no seed exists, create one that at least navigates to the app.
202
+
203
+ ### 1.3 Explore the app
204
+
205
+ Launch the app via the seed in the background and attach:
206
+
207
+ ```bash
208
+ PLAYWRIGHT_HTML_OPEN=never npx playwright test tests/seed.spec.ts --debug=cli
209
+ # wait for "Debugging Instructions" and the session name tw-XXXX
210
+ playwright-cli attach tw-XXXX
211
+ ```
212
+
213
+ Resume so the seed runs, then probe the app:
214
+
215
+ ```bash
216
+ playwright-cli resume # resume so that seed test runs fully
217
+ playwright-cli snapshot # inventory of interactive elements
218
+ playwright-cli click e5 # follow a flow
219
+ playwright-cli eval "location.href" # read URL / state
220
+ playwright-cli show --annotate # ask the user to point at something
221
+ ```
222
+
223
+ Map out:
224
+
225
+ - Interactive surfaces (forms, buttons, lists, filters, modals).
226
+ - Primary user journeys end-to-end.
227
+ - Edge cases: empty states, validation errors, very long input, boundary values.
228
+ - Persistence: reload, local/session storage, URL fragments.
229
+ - Navigation: which controls change the URL, back/forward behaviour.
230
+
231
+ **Important**: Do not just open the app url with playwright-cli, always go through the test to capture any custom setup done there.
232
+ **Important**: Stop the background test when done exploring.
233
+
234
+ ### 1.4 Write the spec file
235
+
236
+ Save under `specs/<feature>.plan.md`. Use this structure:
237
+
238
+ ```markdown
239
+ # <Feature> Test Plan
240
+
241
+ ## Application Overview
242
+
243
+ <One paragraph describing what the feature does and why it matters.>
244
+
245
+ ## Test Scenarios
246
+
247
+ ### 1. <Group Name>
248
+
249
+ **Seed:** `tests/seed.spec.ts`
250
+
251
+ #### 1.1. <kebab-case-scenario-name>
252
+
253
+ **File:** `tests/<group>/<kebab-case-scenario-name>.spec.ts`
254
+
255
+ **Steps:**
256
+ 1. <Concrete user step>
257
+ - expect: <observable outcome>
258
+ - expect: <another observable outcome>
259
+ 2. <Next step>
260
+ - expect: <outcome>
261
+
262
+ #### 1.2. <next-scenario>
263
+ ...
264
+
265
+ ### 2. <Next Group>
266
+
267
+ **Seed:** `tests/seed.spec.ts`
268
+ ...
269
+ ```
270
+
271
+ Guidelines:
272
+
273
+ - Each scenario is independent and starts from the seed's fresh state — never chain scenarios.
274
+ - Scenario names are kebab-case and match the test file name (`should-add-single-todo` → `should-add-single-todo.spec.ts`).
275
+ - Cover happy path, edge cases, validation, negative flows, persistence.
276
+ - Write steps at the user level ("Type 'Buy milk' into the input"), not the API level ("call `fill`").
277
+ - Put observable outcomes in `- expect:` bullets; each becomes an assertion during generation.
278
+
279
+ ---
280
+
281
+ ## 2. Generate
282
+
283
+ Goal: take a spec file and produce Playwright test files. Optionally update the spec if it has drifted.
284
+
285
+ ### 2.1 Inputs
286
+
287
+ - **Spec file**, e.g. `specs/basic-operations.plan.md`.
288
+ - **Target**: either a single scenario (e.g. `1.2`), a whole group (`1`), or all.
289
+ - **Seed file**, read from the `**Seed:**` line of the scenario's group.
290
+
291
+ ### 2.2 Generate one scenario
292
+
293
+ For each target scenario, in sequence (never in parallel — scenarios share the seed session):
294
+
295
+ ```bash
296
+ PLAYWRIGHT_HTML_OPEN=never npx playwright test <seed-file> --debug=cli # background
297
+ playwright-cli attach tw-XXXX
298
+ # resume
299
+ ```
300
+
301
+ **Do not** just open the app url with playwright-cli, always go through the test to capture any custom setup done there.
302
+
303
+ Walk the scenario's `Steps:` one by one with `playwright-cli`, treating the spec as the plan and the live app as the source of truth. If a step is vague ("click the button" — which button?), references an element that no longer exists, or contradicts the app's actual behaviour, use your judgement: update the spec to match what the app really does, then keep going. Editing the spec mid-generation is expected.
304
+
305
+ Every action prints the equivalent Playwright TypeScript (see [How generation works](#0-how-generation-works)):
306
+
307
+ ```bash
308
+ playwright-cli snapshot # find refs
309
+ playwright-cli fill e3 "John Doe" # -> page.getByRole('textbox', {...}).fill(...)
310
+ playwright-cli press Enter
311
+ playwright-cli click e7
312
+ ```
313
+
314
+ For each `- expect:` bullet, add an explicit assertion. See [How generation works](#0-how-generation-works) for details.
315
+
316
+ Collect the generated code and write the test file at the path given in the spec:
317
+
318
+ ```ts
319
+ // spec: specs/basic-operations.plan.md
320
+ // seed: tests/seed.spec.ts
321
+ import { test, expect } from './fixtures'; // or '@playwright/test' if no fixtures file
322
+
323
+ test.describe('Signing in and out', () => {
324
+ test('should sign in', async ({ page }) => {
325
+ // 1. Navigate to the application
326
+ // (handled by the seed fixture)
327
+
328
+ // 2. Type 'John Doe' into the username field
329
+ await page.getByRole('textbox', { name: 'username' }).fill('John Doe');
330
+
331
+ // 3. Type password
332
+ await page.getByRole('textbox', { name: 'password' }).fill('TestPassword');
333
+
334
+ // 4. Press Enter to submit
335
+ await page.getByRole('textbox', { name: 'password' }).press('Enter');
336
+
337
+ await expect(page.getByRole('heading')).toContainText('Welcome, John Doe!');
338
+ });
339
+ });
340
+ ```
341
+
342
+ Rules:
343
+
344
+ - **One test per file.** File path, describe name, and test name come verbatim from the spec (minus the ordinal).
345
+ - Prefix each numbered step with a `// N. <step text>` comment before its actions.
346
+ - Use the describe group name verbatim from the spec (no `1.` ordinal).
347
+ - Import from `./fixtures` if the project has one; otherwise `@playwright/test`.
348
+ - **Important**: close the CLI session and stop the background test before moving to the next scenario.
349
+
350
+ ### 2.3 Generate multiple scenarios
351
+
352
+ Loop 2.2 over the targeted scenarios one at a time, restarting the seed between each so every test starts from a clean page. Make sure each test run is stopped before starting the next one.
353
+
354
+ ### 2.4 Run generated tests
355
+
356
+ After generation, run the new tests once:
357
+
358
+ ```bash
359
+ PLAYWRIGHT_HTML_OPEN=never npx playwright test tests/<group>/<scenario>.spec.ts
360
+ ```
361
+
362
+ Any failure goes to Section 3.
363
+
364
+ ---
365
+
366
+ ## 3. Heal
367
+
368
+ Goal: fix failing tests, and update the spec if the app's intended behaviour changed.
369
+
370
+ ### 3.1 Find failing tests
371
+
372
+ ```bash
373
+ PLAYWRIGHT_HTML_OPEN=never npx playwright test
374
+ ```
375
+
376
+ Record the list of failing `<file>:<line>` entries and process them one at a time. Do not attempt parallel fixes — shared state and the single CLI session make that fragile.
377
+
378
+ ### 3.2 Debug one failure
379
+
380
+ Run the single failing test in debug mode in the background, then attach:
381
+
382
+ ```bash
383
+ PLAYWRIGHT_HTML_OPEN=never npx playwright test tests/<group>/<scenario>.spec.ts:<line> --debug=cli
384
+ # wait for "Debugging Instructions" and the tw-XXXX session name
385
+ playwright-cli attach tw-XXXX
386
+ ```
387
+
388
+ The test is paused at the start. Step forward or run to until just before the failing action or assertion, then diagnose:
389
+
390
+ ```bash
391
+ playwright-cli snapshot # did the element change / move / rename?
392
+ playwright-cli console # app-side errors?
393
+ playwright-cli requests # failed request? wrong payload?
394
+ playwright-cli show --annotate # ask the user to point somewhere
395
+ ```
396
+
397
+ Common causes: selector drift, new wrapper element, label/ARIA rename, timing (transition, async load), assertion text updated in the app, test data leaking between runs.
398
+
399
+ Rehearse the corrected interaction with `playwright-cli` — the generated code in the output is what you paste back into the test.
400
+
401
+ ### 3.3 Apply the fix
402
+
403
+ Edit the test file: update the locator, assertion, step order, or inputs to match the corrected behaviour. Stop the background debug run. Rerun the single test to confirm green.
404
+
405
+ Never skip hooks or add sleeps as a fix. Never use `networkidle`.
406
+
407
+ ### 3.4 Reconcile with the spec
408
+
409
+ Open the spec referenced by the `// spec:` header in the test file and locate the scenario that matches the test.
410
+
411
+ - **Fix was purely technical** (locator drift, better assertion shape) and the spec's user-level behaviour still matches the app → leave the spec alone.
412
+ - **Fix changed user-visible steps, inputs, order, or expected outcomes** that the spec describes → update the spec to match reality. Keep the scenario id and file path stable; only the step / expect lines change.
413
+ - **Unclear whether the app change is intentional** (spec is stale) **or a regression** (test was right, app is wrong) → **stop and ask the user**. Provide:
414
+ - the scenario id (e.g. `2.3`),
415
+ - the spec lines that no longer match,
416
+ - the observed app behaviour (quote a snapshot excerpt or a concrete outcome).
417
+
418
+ Only after the user answers, either update the spec (intentional change) or file/flag the test as covering a bug (regression).
419
+
420
+ ### 3.5 Iteration and giving up
421
+
422
+ - Fix failures one at a time; rerun after each.
423
+ - If after thorough investigation you are confident the test is correct but the app is wrong *and* the user has confirmed it's a bug: mark the test `test.fixme(...)` with a comment pointing at the user's decision or issue link. Never silently skip.
424
+
425
+ ---
426
+
427
+ ## Cross-references
428
+
429
+ | For... | See |
430
+ |---|---|
431
+ | `--debug=cli` / attach mechanics | [playwright-tests.md](playwright-tests.md) |
432
+ | Mocking requests during exploration/generation | [request-mocking.md](request-mocking.md) |
433
+ | Managing the CLI browser session | [session-management.md](session-management.md) |