@capyclaw/browser-suite 0.1.2 → 0.2.36

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 (383) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +9 -5
  3. package/composition.lock.json +37 -25
  4. package/contract/browser-contract.json +484 -25
  5. package/cordis.patch.yml +3 -9
  6. package/dsh-suite.json +110 -82
  7. package/lib/index.mjs +1 -1
  8. package/node_modules/@capyclaw/asset-service/README.md +48 -0
  9. package/node_modules/@capyclaw/asset-service/cordis.patch.yml +4 -0
  10. package/node_modules/@capyclaw/asset-service/dsh-suite.json +29 -0
  11. package/node_modules/@capyclaw/asset-service/lib/host.mjs +14 -0
  12. package/node_modules/@capyclaw/asset-service/package.json +59 -0
  13. package/node_modules/@capyclaw/asset-service/src/index.mjs +223 -0
  14. package/node_modules/@capyclaw/browser-skill-api/README.md +3 -0
  15. package/node_modules/@capyclaw/browser-skill-api/contract/browser-contract.json +1349 -0
  16. package/node_modules/@capyclaw/browser-skill-api/cordis.patch.yml +4 -0
  17. package/node_modules/@capyclaw/browser-skill-api/package.json +49 -0
  18. package/node_modules/@capyclaw/browser-skill-api/plugin.mjs +15 -0
  19. package/node_modules/@capyclaw/browser-skill-api/skills/browser-api/SKILL.md +85 -0
  20. package/node_modules/@capyclaw/browser-skill-api/skills/browser-api/references/tool-contract.md +692 -0
  21. package/node_modules/@capyclaw/browser-skill-browser/README.md +3 -0
  22. package/node_modules/@capyclaw/browser-skill-browser/contract/browser-contract.json +1349 -0
  23. package/node_modules/@capyclaw/browser-skill-browser/cordis.patch.yml +4 -0
  24. package/node_modules/@capyclaw/browser-skill-browser/package.json +49 -0
  25. package/node_modules/@capyclaw/browser-skill-browser/plugin.mjs +15 -0
  26. package/node_modules/@capyclaw/browser-skill-browser/skills/browser/SKILL.md +27 -0
  27. package/node_modules/@capyclaw/browser-skill-ops/README.md +3 -0
  28. package/node_modules/@capyclaw/browser-skill-ops/contract/browser-contract.json +1349 -0
  29. package/node_modules/@capyclaw/browser-skill-ops/cordis.patch.yml +4 -0
  30. package/node_modules/@capyclaw/browser-skill-ops/package.json +49 -0
  31. package/node_modules/@capyclaw/browser-skill-ops/plugin.mjs +15 -0
  32. package/node_modules/@capyclaw/browser-skill-ops/skills/browser-ops/SKILL.md +63 -0
  33. package/node_modules/@capyclaw/browser-workbench/README.md +89 -0
  34. package/node_modules/@capyclaw/browser-workbench/contract/browser-contract.json +1349 -0
  35. package/node_modules/@capyclaw/browser-workbench/demo/form.html +112 -0
  36. package/node_modules/@capyclaw/browser-workbench/lib/host.mjs +1 -0
  37. package/node_modules/@capyclaw/browser-workbench/package.json +71 -0
  38. package/node_modules/@capyclaw/browser-workbench/plugin.mjs +1 -0
  39. package/node_modules/@capyclaw/browser-workbench/server/constants.mjs +16 -0
  40. package/node_modules/@capyclaw/browser-workbench/server/contract-snapshots.mjs +81 -0
  41. package/node_modules/@capyclaw/browser-workbench/server/contract.mjs +24 -0
  42. package/node_modules/@capyclaw/browser-workbench/server/embedded-host.mjs +247 -0
  43. package/node_modules/@capyclaw/browser-workbench/server/engine.mjs +2466 -0
  44. package/node_modules/@capyclaw/browser-workbench/server/governor.mjs +189 -0
  45. package/node_modules/@capyclaw/browser-workbench/server/http-utils.mjs +2 -0
  46. package/node_modules/@capyclaw/browser-workbench/server/human.mjs +628 -0
  47. package/node_modules/@capyclaw/browser-workbench/server/infra/http.mjs +2 -0
  48. package/node_modules/@capyclaw/browser-workbench/server/infra/tuning.mjs +2 -0
  49. package/node_modules/@capyclaw/browser-workbench/server/input.mjs +154 -0
  50. package/node_modules/@capyclaw/browser-workbench/server/login-vault.mjs +109 -0
  51. package/node_modules/@capyclaw/browser-workbench/server/mcp/handler.mjs +2 -0
  52. package/node_modules/@capyclaw/browser-workbench/server/mcp/instructions.mjs +31 -0
  53. package/node_modules/@capyclaw/browser-workbench/server/orphans.mjs +163 -0
  54. package/node_modules/@capyclaw/browser-workbench/server/relay.mjs +198 -0
  55. package/node_modules/@capyclaw/browser-workbench/server/routes/api.mjs +233 -0
  56. package/node_modules/@capyclaw/browser-workbench/server/routes/assets.mjs +2 -0
  57. package/node_modules/@capyclaw/browser-workbench/server/routes/mcp.mjs +17 -0
  58. package/node_modules/@capyclaw/browser-workbench/server/routes/workbench.mjs +33 -0
  59. package/node_modules/@capyclaw/browser-workbench/server/session-engines.mjs +184 -0
  60. package/node_modules/@capyclaw/browser-workbench/server/shared/SHARED_MANIFEST.json +70 -0
  61. package/node_modules/@capyclaw/browser-workbench/server/shared/asset-service.mjs +2 -0
  62. package/node_modules/@capyclaw/browser-workbench/server/shared/editor-host.mjs +2 -0
  63. package/node_modules/@capyclaw/browser-workbench/server/shared/kit/editor/lease.mjs +2 -0
  64. package/node_modules/@capyclaw/browser-workbench/server/shared/kit/service/api.mjs +2 -0
  65. package/node_modules/@capyclaw/browser-workbench/server/shared/kit/service/http.mjs +2 -0
  66. package/node_modules/@capyclaw/browser-workbench/server/shared/kit/service/mcp-http.mjs +2 -0
  67. package/node_modules/@capyclaw/browser-workbench/server/shared/kit/tools/validate.mjs +2 -0
  68. package/node_modules/@capyclaw/browser-workbench/server/shared/kit/tuning.mjs +2 -0
  69. package/node_modules/@capyclaw/browser-workbench/server/shared/kit/util/fs-lock.mjs +2 -0
  70. package/node_modules/@capyclaw/browser-workbench/server/shared/service-host.mjs +2 -0
  71. package/node_modules/@capyclaw/browser-workbench/server/shared/tool-host.mjs +2 -0
  72. package/node_modules/@capyclaw/browser-workbench/server/shared/tuning.mjs +2 -0
  73. package/node_modules/@capyclaw/browser-workbench/server/tools/capabilities/contract.mjs +55 -0
  74. package/node_modules/@capyclaw/browser-workbench/server/tools/capabilities/evaluate.mjs +36 -0
  75. package/node_modules/@capyclaw/browser-workbench/server/tools/capabilities/index.mjs +26 -0
  76. package/node_modules/@capyclaw/browser-workbench/server/tools/capabilities/interaction.mjs +215 -0
  77. package/node_modules/@capyclaw/browser-workbench/server/tools/capabilities/navigation.mjs +35 -0
  78. package/node_modules/@capyclaw/browser-workbench/server/tools/capabilities/screenshot.mjs +50 -0
  79. package/node_modules/@capyclaw/browser-workbench/server/tools/capabilities/session.mjs +81 -0
  80. package/node_modules/@capyclaw/browser-workbench/server/tools/capabilities/snapshot.mjs +30 -0
  81. package/node_modules/@capyclaw/browser-workbench/server/tools/capabilities/tabs.mjs +35 -0
  82. package/node_modules/@capyclaw/browser-workbench/server/tools/index.mjs +12 -0
  83. package/node_modules/@capyclaw/browser-workbench/server/tools/kernel/define.mjs +5 -0
  84. package/node_modules/@capyclaw/browser-workbench/server/tools/kernel/output.mjs +30 -0
  85. package/node_modules/@capyclaw/browser-workbench/server/tools/kernel/ports.mjs +59 -0
  86. package/node_modules/@capyclaw/browser-workbench/server/tools/kernel/registry.mjs +17 -0
  87. package/node_modules/@capyclaw/browser-workbench/server/tools.mjs +3 -0
  88. package/node_modules/@capyclaw/browser-workbench/server/workbench-framework.mjs +305 -0
  89. package/node_modules/@capyclaw/browser-workbench/ui/app.js +447 -0
  90. package/node_modules/@capyclaw/browser-workbench/ui/index.html +46 -0
  91. package/node_modules/@capyclaw/browser-workbench/ui/style.css +144 -0
  92. package/node_modules/@capyclaw/document-workbench/README.md +125 -0
  93. package/node_modules/@capyclaw/document-workbench/package.json +44 -0
  94. package/node_modules/@capyclaw/document-workbench/src/bridge/index.mjs +321 -0
  95. package/node_modules/@capyclaw/document-workbench/src/client/index.mjs +625 -0
  96. package/node_modules/@capyclaw/document-workbench/src/client/screenshot.mjs +98 -0
  97. package/node_modules/@capyclaw/document-workbench/src/index.mjs +9 -0
  98. package/node_modules/@capyclaw/document-workbench/src/model/audit.mjs +101 -0
  99. package/node_modules/@capyclaw/document-workbench/src/model/conformance.mjs +92 -0
  100. package/node_modules/@capyclaw/document-workbench/src/model/ids.mjs +56 -0
  101. package/node_modules/@capyclaw/document-workbench/src/model/index.mjs +18 -0
  102. package/node_modules/@capyclaw/document-workbench/src/model/locate.mjs +118 -0
  103. package/node_modules/@capyclaw/document-workbench/src/model/manifest.mjs +148 -0
  104. package/node_modules/@capyclaw/document-workbench/src/model/ops.mjs +160 -0
  105. package/node_modules/@capyclaw/document-workbench/src/model/validate.mjs +72 -0
  106. package/node_modules/@capyclaw/document-workbench/src/ops/index.mjs +93 -0
  107. package/node_modules/@capyclaw/document-workbench/src/session/context.mjs +91 -0
  108. package/node_modules/@capyclaw/document-workbench/src/session/index.mjs +394 -0
  109. package/node_modules/@capyclaw/document-workbench/src/session/lease.mjs +105 -0
  110. package/node_modules/@capyclaw/document-workbench/src/session/mode.mjs +80 -0
  111. package/node_modules/@capyclaw/document-workbench/src/session/sanitize.mjs +107 -0
  112. package/node_modules/@capyclaw/document-workbench/src/session/state.mjs +159 -0
  113. package/node_modules/@capyclaw/document-workbench/src/session/watch.mjs +63 -0
  114. package/node_modules/@capyclaw/document-workbench/src/store/file-backend.mjs +158 -0
  115. package/node_modules/@capyclaw/document-workbench/src/testing/index.mjs +75 -0
  116. package/node_modules/@capyclaw/foundation/README.md +51 -0
  117. package/node_modules/@capyclaw/foundation/abi/bridge.mjs +86 -0
  118. package/node_modules/@capyclaw/foundation/abi/errors.mjs +63 -0
  119. package/node_modules/@capyclaw/foundation/abi/index.mjs +35 -0
  120. package/node_modules/@capyclaw/foundation/abi/kinds.mjs +271 -0
  121. package/node_modules/@capyclaw/foundation/abi/loader.mjs +345 -0
  122. package/node_modules/@capyclaw/foundation/abi/schema.mjs +98 -0
  123. package/node_modules/@capyclaw/foundation/abi/spec.mjs +255 -0
  124. package/node_modules/@capyclaw/foundation/abi/validate.mjs +24 -0
  125. package/node_modules/@capyclaw/foundation/abi/version.mjs +82 -0
  126. package/node_modules/@capyclaw/foundation/cordis.patch.yml +5 -0
  127. package/node_modules/@capyclaw/foundation/kit/index.mjs +6 -0
  128. package/node_modules/@capyclaw/foundation/lib/adapters/client-panel.mjs +98 -0
  129. package/node_modules/@capyclaw/foundation/lib/adapters/host-event.mjs +35 -0
  130. package/node_modules/@capyclaw/foundation/lib/adapters/http-router.mjs +69 -0
  131. package/node_modules/@capyclaw/foundation/lib/adapters/lifecycle-hook.mjs +55 -0
  132. package/node_modules/@capyclaw/foundation/lib/adapters/own-server.mjs +113 -0
  133. package/node_modules/@capyclaw/foundation/lib/adapters/raw.mjs +68 -0
  134. package/node_modules/@capyclaw/foundation/lib/adapters/runtime-driver.mjs +113 -0
  135. package/node_modules/@capyclaw/foundation/lib/adapters/service-provider.mjs +77 -0
  136. package/node_modules/@capyclaw/foundation/lib/adapters/skill-provider.mjs +56 -0
  137. package/node_modules/@capyclaw/foundation/lib/adapters/tool-provider.mjs +50 -0
  138. package/node_modules/@capyclaw/foundation/lib/adapters/ui-panel.mjs +64 -0
  139. package/node_modules/@capyclaw/foundation/lib/ctx-service.mjs +42 -0
  140. package/node_modules/@capyclaw/foundation/lib/host/caps.mjs +34 -0
  141. package/node_modules/@capyclaw/foundation/lib/host/contract.mjs +85 -0
  142. package/node_modules/@capyclaw/foundation/lib/host/dsh.mjs +50 -0
  143. package/node_modules/@capyclaw/foundation/lib/host/memory.mjs +160 -0
  144. package/node_modules/@capyclaw/foundation/lib/host.mjs +23 -0
  145. package/node_modules/@capyclaw/foundation/lib/kernel.mjs +185 -0
  146. package/node_modules/@capyclaw/foundation/lib/skill/scan.mjs +87 -0
  147. package/node_modules/@capyclaw/foundation/lib/subsystems/events.mjs +60 -0
  148. package/node_modules/@capyclaw/foundation/lib/subsystems/log.mjs +51 -0
  149. package/node_modules/@capyclaw/foundation/lib/subsystems/net.mjs +188 -0
  150. package/node_modules/@capyclaw/foundation/package.json +53 -0
  151. package/node_modules/@capyclaw/foundation/runtime/index.mjs +20 -0
  152. package/node_modules/@capyclaw/plugin-kit/INTEGRATION.md +100 -0
  153. package/node_modules/@capyclaw/plugin-kit/README.md +70 -0
  154. package/node_modules/@capyclaw/plugin-kit/bin/sync.mjs +103 -0
  155. package/node_modules/@capyclaw/plugin-kit/package.json +69 -0
  156. package/node_modules/@capyclaw/plugin-kit/src/cli.mjs +56 -0
  157. package/node_modules/@capyclaw/plugin-kit/src/config.mjs +142 -0
  158. package/node_modules/@capyclaw/plugin-kit/src/editor/heartbeat-worker.js +129 -0
  159. package/node_modules/@capyclaw/plugin-kit/src/editor/lease.mjs +139 -0
  160. package/node_modules/@capyclaw/plugin-kit/src/editor/shadow.mjs +219 -0
  161. package/node_modules/@capyclaw/plugin-kit/src/editor/transport.js +13 -0
  162. package/node_modules/@capyclaw/plugin-kit/src/index.mjs +13 -0
  163. package/node_modules/@capyclaw/plugin-kit/src/pack.mjs +230 -0
  164. package/node_modules/@capyclaw/plugin-kit/src/runtime/context.mjs +128 -0
  165. package/node_modules/@capyclaw/plugin-kit/src/self-contained.mjs +307 -0
  166. package/node_modules/@capyclaw/plugin-kit/src/service/api.mjs +45 -0
  167. package/node_modules/@capyclaw/plugin-kit/src/service/http.mjs +113 -0
  168. package/node_modules/@capyclaw/plugin-kit/src/service/mcp-http.mjs +143 -0
  169. package/node_modules/@capyclaw/plugin-kit/src/service/server.mjs +131 -0
  170. package/node_modules/@capyclaw/plugin-kit/src/skills/provider.mjs +82 -0
  171. package/node_modules/@capyclaw/plugin-kit/src/store/blob-store.mjs +109 -0
  172. package/node_modules/@capyclaw/plugin-kit/src/store/content-store.mjs +17 -0
  173. package/node_modules/@capyclaw/plugin-kit/src/store/journal-store.mjs +89 -0
  174. package/node_modules/@capyclaw/plugin-kit/src/tools/result.mjs +41 -0
  175. package/node_modules/@capyclaw/plugin-kit/src/tools/validate.mjs +150 -0
  176. package/node_modules/@capyclaw/plugin-kit/src/tuning.mjs +82 -0
  177. package/node_modules/@capyclaw/plugin-kit/src/util/fs-lock.mjs +132 -0
  178. package/node_modules/@capyclaw/plugin-kit/src/util/http.mjs +130 -0
  179. package/node_modules/@capyclaw/plugin-kit/src/workspace/manager.mjs +656 -0
  180. package/node_modules/@capyclaw/plugin-kit/src/zip.mjs +181 -0
  181. package/node_modules/@capyclaw/portal/README.md +70 -0
  182. package/node_modules/@capyclaw/portal/lib/index.mjs +387 -0
  183. package/node_modules/@capyclaw/portal/lib/ledger.mjs +194 -0
  184. package/node_modules/@capyclaw/portal/lib/portal-agent.ps1 +811 -0
  185. package/node_modules/@capyclaw/portal/lib/portal-darwin.mjs +183 -0
  186. package/node_modules/@capyclaw/portal/package.json +40 -0
  187. package/node_modules/@capyclaw/service-broker/README.md +104 -0
  188. package/node_modules/@capyclaw/service-broker/cordis.patch.yml +8 -0
  189. package/node_modules/@capyclaw/service-broker/dsh-suite.json +21 -0
  190. package/node_modules/@capyclaw/service-broker/lib/control.mjs +193 -0
  191. package/node_modules/@capyclaw/service-broker/lib/discovery.mjs +109 -0
  192. package/node_modules/@capyclaw/service-broker/lib/engine.mjs +1236 -0
  193. package/node_modules/@capyclaw/service-broker/lib/host.mjs +182 -0
  194. package/node_modules/@capyclaw/service-broker/lib/manifest.mjs +249 -0
  195. package/node_modules/@capyclaw/service-broker/lib/recovery.mjs +325 -0
  196. package/node_modules/@capyclaw/service-broker/lib/skills-client.mjs +28 -0
  197. package/node_modules/@capyclaw/service-broker/lib/spec.mjs +78 -0
  198. package/node_modules/@capyclaw/service-broker/package.json +65 -0
  199. package/node_modules/@capyclaw/service-broker/server.mjs +81 -0
  200. package/node_modules/@capyclaw/service-broker/service.schema.json +62 -0
  201. package/node_modules/@capyclaw/service-broker/services.json +3 -0
  202. package/node_modules/@capyclaw/service-host/README.md +86 -0
  203. package/node_modules/@capyclaw/service-host/cordis.patch.yml +4 -0
  204. package/node_modules/@capyclaw/service-host/dsh-suite.json +29 -0
  205. package/node_modules/@capyclaw/service-host/lib/host.mjs +22 -0
  206. package/node_modules/@capyclaw/service-host/package.json +60 -0
  207. package/node_modules/@capyclaw/service-host/src/index.mjs +571 -0
  208. package/node_modules/@capyclaw/service-host/src/tuning.mjs +63 -0
  209. package/node_modules/@capyclaw/tool-host/README.md +56 -0
  210. package/node_modules/@capyclaw/tool-host/cordis.patch.yml +4 -0
  211. package/node_modules/@capyclaw/tool-host/dsh-suite.json +30 -0
  212. package/node_modules/@capyclaw/tool-host/lib/host.mjs +16 -0
  213. package/node_modules/@capyclaw/tool-host/package.json +59 -0
  214. package/node_modules/@capyclaw/tool-host/src/descriptors.mjs +142 -0
  215. package/node_modules/@capyclaw/tool-host/src/index.mjs +390 -0
  216. package/node_modules/playwright/LICENSE +202 -0
  217. package/node_modules/playwright/NOTICE +5 -0
  218. package/node_modules/playwright/README.md +318 -0
  219. package/node_modules/playwright/ThirdPartyNotices.txt +14 -0
  220. package/node_modules/playwright/cli.js +19 -0
  221. package/node_modules/playwright/index.d.ts +17 -0
  222. package/node_modules/playwright/index.js +17 -0
  223. package/node_modules/playwright/index.mjs +18 -0
  224. package/node_modules/playwright/lib/agents/agentParser.js +89 -0
  225. package/node_modules/playwright/lib/agents/copilot-setup-steps.yml +34 -0
  226. package/node_modules/playwright/lib/agents/generateAgents.js +395 -0
  227. package/node_modules/playwright/lib/agents/playwright-test-coverage.prompt.md +31 -0
  228. package/node_modules/playwright/lib/agents/playwright-test-generate.prompt.md +8 -0
  229. package/node_modules/playwright/lib/agents/playwright-test-generator.agent.md +88 -0
  230. package/node_modules/playwright/lib/agents/playwright-test-heal.prompt.md +6 -0
  231. package/node_modules/playwright/lib/agents/playwright-test-healer.agent.md +56 -0
  232. package/node_modules/playwright/lib/agents/playwright-test-plan.prompt.md +9 -0
  233. package/node_modules/playwright/lib/agents/playwright-test-planner.agent.md +74 -0
  234. package/node_modules/playwright/lib/cli/reportActions.js +78 -0
  235. package/node_modules/playwright/lib/cli/testActions.js +217 -0
  236. package/node_modules/playwright/lib/common/index.js +2937 -0
  237. package/node_modules/playwright/lib/common/index.js.txt +33 -0
  238. package/node_modules/playwright/lib/errorContext.js +129 -0
  239. package/node_modules/playwright/lib/globals.js +58 -0
  240. package/node_modules/playwright/lib/index.js +827 -0
  241. package/node_modules/playwright/lib/isomorphic.js +260 -0
  242. package/node_modules/playwright/lib/isomorphic.js.txt +9 -0
  243. package/node_modules/playwright/lib/loader/loaderProcessEntry.js +34 -0
  244. package/node_modules/playwright/lib/loader/loaderProcessEntry.js.txt +9 -0
  245. package/node_modules/playwright/lib/matchers/expect.js +13496 -0
  246. package/node_modules/playwright/lib/matchers/expect.js.LICENSE +640 -0
  247. package/node_modules/playwright/lib/matchers/expect.js.txt +67 -0
  248. package/node_modules/playwright/lib/package.js +47 -0
  249. package/node_modules/playwright/lib/program.js +242 -0
  250. package/node_modules/playwright/lib/runner/index.js +8721 -0
  251. package/node_modules/playwright/lib/runner/index.js.txt +62 -0
  252. package/node_modules/playwright/lib/transform/babelBundle.js +72490 -0
  253. package/node_modules/playwright/lib/transform/babelBundle.js.LICENSE +2384 -0
  254. package/node_modules/playwright/lib/transform/babelBundle.js.txt +328 -0
  255. package/node_modules/playwright/lib/transform/esmLoader.js +8066 -0
  256. package/node_modules/playwright/lib/transform/esmLoader.js.LICENSE +355 -0
  257. package/node_modules/playwright/lib/transform/esmLoader.js.txt +60 -0
  258. package/node_modules/playwright/lib/util.js +373 -0
  259. package/node_modules/playwright/lib/worker/workerProcessEntry.js +1860 -0
  260. package/node_modules/playwright/lib/worker/workerProcessEntry.js.txt +19 -0
  261. package/node_modules/playwright/package.json +50 -0
  262. package/node_modules/playwright/test.d.ts +18 -0
  263. package/node_modules/playwright/test.js +24 -0
  264. package/node_modules/playwright/test.mjs +35 -0
  265. package/node_modules/playwright/types/test.d.ts +11191 -0
  266. package/node_modules/playwright/types/testReporter.d.ts +950 -0
  267. package/node_modules/playwright-core/LICENSE +202 -0
  268. package/node_modules/playwright-core/NOTICE +5 -0
  269. package/node_modules/playwright-core/README.md +3 -0
  270. package/node_modules/playwright-core/ThirdPartyNotices.txt +13 -0
  271. package/node_modules/playwright-core/bin/install_media_pack.ps1 +5 -0
  272. package/node_modules/playwright-core/bin/install_webkit_wsl.ps1 +33 -0
  273. package/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh +42 -0
  274. package/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh +13 -0
  275. package/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 +24 -0
  276. package/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh +42 -0
  277. package/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh +12 -0
  278. package/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 +24 -0
  279. package/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh +48 -0
  280. package/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh +11 -0
  281. package/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 +23 -0
  282. package/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh +48 -0
  283. package/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh +11 -0
  284. package/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 +23 -0
  285. package/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh +48 -0
  286. package/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh +11 -0
  287. package/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 +24 -0
  288. package/node_modules/playwright-core/browsers.json +52 -0
  289. package/node_modules/playwright-core/cli.js +22 -0
  290. package/node_modules/playwright-core/index.d.ts +17 -0
  291. package/node_modules/playwright-core/index.js +17 -0
  292. package/node_modules/playwright-core/index.mjs +28 -0
  293. package/node_modules/playwright-core/lib/bootstrap.js +149 -0
  294. package/node_modules/playwright-core/lib/coreBundle.js +78041 -0
  295. package/node_modules/playwright-core/lib/entry/cliDaemon.js +5 -0
  296. package/node_modules/playwright-core/lib/entry/dashboardApp.js +3 -0
  297. package/node_modules/playwright-core/lib/entry/mcp.js +10 -0
  298. package/node_modules/playwright-core/lib/entry/oopBrowserDownload.js +3 -0
  299. package/node_modules/playwright-core/lib/package.js +50 -0
  300. package/node_modules/playwright-core/lib/server/chromium/appIcon.png +0 -0
  301. package/node_modules/playwright-core/lib/server/electron/loader.js +123 -0
  302. package/node_modules/playwright-core/lib/serverRegistry.js +1939 -0
  303. package/node_modules/playwright-core/lib/serverRegistry.js.LICENSE +65 -0
  304. package/node_modules/playwright-core/lib/tools/cli-client/channelSessions.js +141 -0
  305. package/node_modules/playwright-core/lib/tools/cli-client/cli.js +7 -0
  306. package/node_modules/playwright-core/lib/tools/cli-client/help.json +808 -0
  307. package/node_modules/playwright-core/lib/tools/cli-client/minimist.js +128 -0
  308. package/node_modules/playwright-core/lib/tools/cli-client/output.js +352 -0
  309. package/node_modules/playwright-core/lib/tools/cli-client/program.js +422 -0
  310. package/node_modules/playwright-core/lib/tools/cli-client/registry.js +180 -0
  311. package/node_modules/playwright-core/lib/tools/cli-client/session.js +261 -0
  312. package/node_modules/playwright-core/lib/tools/dashboard/appIcon.png +0 -0
  313. package/node_modules/playwright-core/lib/tools/skills/playwright-cli/SKILL.md +493 -0
  314. package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/element-attributes.md +23 -0
  315. package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/playwright-tests.md +39 -0
  316. package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/pr-attachments.md +60 -0
  317. package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/request-mocking.md +87 -0
  318. package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/running-code.md +245 -0
  319. package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/session-management.md +227 -0
  320. package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/storage-state.md +275 -0
  321. package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/test-generation.md +433 -0
  322. package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/tracing.md +139 -0
  323. package/node_modules/playwright-core/lib/tools/skills/playwright-cli/references/video-recording.md +216 -0
  324. package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/SKILL.md +136 -0
  325. package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
  326. package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/migration.md +89 -0
  327. package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/react.md +69 -0
  328. package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/typing.md +173 -0
  329. package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/vue.md +77 -0
  330. package/node_modules/playwright-core/lib/tools/skills/playwright-trace/SKILL.md +174 -0
  331. package/node_modules/playwright-core/lib/tools/utils/extension.js +112 -0
  332. package/node_modules/playwright-core/lib/tools/utils/socketConnection.js +108 -0
  333. package/node_modules/playwright-core/lib/utilsBundle.js +86078 -0
  334. package/node_modules/playwright-core/lib/utilsBundle.js.LICENSE +1890 -0
  335. package/node_modules/playwright-core/lib/vite/dashboard/assets/codeMirrorModule--QdMvsKi.css +1 -0
  336. package/node_modules/playwright-core/lib/vite/dashboard/assets/codeMirrorModule-CQ8RZGBm.js +32 -0
  337. package/node_modules/playwright-core/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
  338. package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
  339. package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
  340. package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
  341. package/node_modules/playwright-core/lib/vite/dashboard/assets/index-AwgwcYie.css +1 -0
  342. package/node_modules/playwright-core/lib/vite/dashboard/assets/index-hRvO4yU2.js +12 -0
  343. package/node_modules/playwright-core/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
  344. package/node_modules/playwright-core/lib/vite/dashboard/index.html +29 -0
  345. package/node_modules/playwright-core/lib/vite/dashboard/playwright-logo.svg +24 -0
  346. package/node_modules/playwright-core/lib/vite/htmlReport/index.html +16 -0
  347. package/node_modules/playwright-core/lib/vite/htmlReport/report.css +2 -0
  348. package/node_modules/playwright-core/lib/vite/htmlReport/report.js +32 -0
  349. package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
  350. package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-DK72OMRi.js +32 -0
  351. package/node_modules/playwright-core/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
  352. package/node_modules/playwright-core/lib/vite/recorder/assets/index-BZpYJZ-P.css +1 -0
  353. package/node_modules/playwright-core/lib/vite/recorder/assets/index-Cn0mmDuv.js +129 -0
  354. package/node_modules/playwright-core/lib/vite/recorder/index.html +29 -0
  355. package/node_modules/playwright-core/lib/vite/recorder/playwright-logo.svg +9 -0
  356. package/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-BEB2e8M3.js +32 -0
  357. package/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-D-g2vrvf.js +184 -0
  358. package/node_modules/playwright-core/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
  359. package/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-B794rD2Z.js +7 -0
  360. package/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
  361. package/node_modules/playwright-core/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
  362. package/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.C8BeHuxd.css +1 -0
  363. package/node_modules/playwright-core/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
  364. package/node_modules/playwright-core/lib/vite/traceViewer/index.html +44 -0
  365. package/node_modules/playwright-core/lib/vite/traceViewer/index.oNry3Hjv.js +1 -0
  366. package/node_modules/playwright-core/lib/vite/traceViewer/manifest.webmanifest +16 -0
  367. package/node_modules/playwright-core/lib/vite/traceViewer/playwright-logo.svg +9 -0
  368. package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
  369. package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.html +10 -0
  370. package/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +4 -0
  371. package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.CYwC_gH1.js +5 -0
  372. package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.CyMfwkXJ.css +1 -0
  373. package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +18 -0
  374. package/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
  375. package/node_modules/playwright-core/lib/webp_codec.LICENSE +173 -0
  376. package/node_modules/playwright-core/lib/webp_codec.wasm +0 -0
  377. package/node_modules/playwright-core/lib/xdg-open +1267 -0
  378. package/node_modules/playwright-core/package.json +34 -0
  379. package/node_modules/playwright-core/types/protocol.d.ts +24776 -0
  380. package/node_modules/playwright-core/types/structs.d.ts +52 -0
  381. package/node_modules/playwright-core/types/types.d.ts +27167 -0
  382. package/package.json +32 -14
  383. package/services.json +1 -21
@@ -0,0 +1,827 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var index_exports = {};
30
+ __export(index_exports, {
31
+ _baseTest: () => _baseTest,
32
+ _utilityTest: () => _utilityTest,
33
+ defineConfig: () => import_common2.defineConfig,
34
+ expect: () => import_expect.expect,
35
+ mergeExpects: () => import_expect2.mergeExpects,
36
+ mergeTests: () => import_common2.mergeTests,
37
+ test: () => test
38
+ });
39
+ module.exports = __toCommonJS(index_exports);
40
+ var import_fs = __toESM(require("fs"));
41
+ var import_path = __toESM(require("path"));
42
+ var playwrightLibrary = __toESM(require("playwright-core"));
43
+ var import_errorContext = require("./errorContext");
44
+ var import_common = require("./common");
45
+ var globals = __toESM(require("./globals"));
46
+ var import_browserBackend = require("./mcp/test/browserBackend");
47
+ var import_expect = require("./matchers/expect");
48
+ var import_common2 = require("./common");
49
+ var import_expect2 = require("./matchers/expect");
50
+ const { getActionGroup, renderParamsForCall, renderSubtitleForCall, renderTitleForCall, truncateParam } = require("playwright-core/lib/coreBundle").iso;
51
+ const { escapeHTML } = require("playwright-core/lib/coreBundle").iso;
52
+ const { jsonStringifyForceASCII } = require("playwright-core/lib/coreBundle").utils;
53
+ const { createGuid } = require("playwright-core/lib/coreBundle").utils;
54
+ const { debugMode } = require("playwright-core/lib/coreBundle").utils;
55
+ const { debugLogger } = require("playwright-core/lib/coreBundle").utils;
56
+ const { currentZone } = require("playwright-core/lib/coreBundle").utils;
57
+ const _baseTest = import_common.testType.rootTestType.test;
58
+ if (process["__pw_initiator__"]) {
59
+ const originalStackTraceLimit = Error.stackTraceLimit;
60
+ Error.stackTraceLimit = 200;
61
+ try {
62
+ throw new Error("Requiring @playwright/test second time, \nFirst:\n" + process["__pw_initiator__"] + "\n\nSecond: ");
63
+ } finally {
64
+ Error.stackTraceLimit = originalStackTraceLimit;
65
+ }
66
+ } else {
67
+ process["__pw_initiator__"] = new Error().stack;
68
+ }
69
+ const utilityFixtures = {
70
+ playwright: [async ({}, use) => {
71
+ await use(require("playwright-core"));
72
+ }, { scope: "worker", box: true }],
73
+ screenshot: ["off", { scope: "worker", option: true, box: true }],
74
+ trace: ["off", { scope: "worker", option: true, box: true }],
75
+ testIdAttribute: ["data-testid", { option: true, box: true }],
76
+ _combinedContextOptions: [{}, { box: true }],
77
+ _setupArtifacts: [async ({ playwright, screenshot, _combinedContextOptions }, use, testInfo) => {
78
+ testInfo.setTimeout(testInfo.project.timeout);
79
+ const artifactsRecorder = new ArtifactsRecorder(playwright, tracing().artifactsDir(), screenshot);
80
+ await artifactsRecorder.willStartTest(testInfo);
81
+ const tracingGroupSteps = [];
82
+ const pausedContexts = /* @__PURE__ */ new Set();
83
+ const csiListener = {
84
+ onApiCallBegin: (data, channel) => {
85
+ const testInfo2 = globals.currentTestInfo();
86
+ if (!testInfo2)
87
+ return;
88
+ if (channel.type === "Tracing" && channel.method === "tracingGroupEnd") {
89
+ data.userData = (error) => tracingGroupSteps.pop()?.complete({ error });
90
+ return;
91
+ }
92
+ const zone = currentZone().data("stepZone");
93
+ const isExpectCall = channel.type === "Frame" && channel.method === "expect" || channel.type === "Page" && channel.method === "expectScreenshot";
94
+ if (zone && zone.category === "expect" && isExpectCall) {
95
+ data.callId = zone.stepId;
96
+ return;
97
+ }
98
+ const params = renderParamsForCall({ type: channel.type, method: channel.method, params: channel.params });
99
+ const step = testInfo2._addStep({
100
+ stack: data.frames,
101
+ category: "pw:api",
102
+ title: renderTitle(channel.type, channel.method, channel.params, data.title),
103
+ subtitle: renderSubtitle(channel.type, channel.method, channel.params),
104
+ params,
105
+ group: getActionGroup({ type: channel.type, method: channel.method })
106
+ }, tracingGroupSteps[tracingGroupSteps.length - 1]);
107
+ data.callId = step.stepId;
108
+ if (channel.type === "Tracing" && channel.method === "tracingGroup") {
109
+ tracingGroupSteps.push(step);
110
+ } else {
111
+ data.userData = (error) => step.complete({ error });
112
+ }
113
+ },
114
+ onApiCallEnd: (data) => {
115
+ const completeStep = data.userData;
116
+ completeStep?.(data.error);
117
+ },
118
+ onWillPause: ({ keepTestTimeout }) => {
119
+ if (!keepTestTimeout)
120
+ globals.currentTestInfo()?._setIgnoreTimeouts(true);
121
+ },
122
+ runBeforeCreateBrowserContext: async (options) => {
123
+ for (const [key, value] of Object.entries(_combinedContextOptions)) {
124
+ if (!(key in options))
125
+ options[key] = value;
126
+ }
127
+ },
128
+ runBeforeCreateRequestContext: async (options) => {
129
+ for (const [key, value] of Object.entries(_combinedContextOptions)) {
130
+ if (!(key in options))
131
+ options[key] = value;
132
+ }
133
+ },
134
+ runAfterCreateBrowserContext: async (context) => {
135
+ context.debugger.on("pausedstatechanged", () => {
136
+ const paused = !!context.debugger.pausedDetails();
137
+ if (pausedContexts.has(context) && !paused) {
138
+ pausedContexts.delete(context);
139
+ testInfo._setIgnoreTimeouts(false);
140
+ } else if (!pausedContexts.has(context) && paused) {
141
+ pausedContexts.add(context);
142
+ testInfo._setIgnoreTimeouts(true);
143
+ }
144
+ });
145
+ await artifactsRecorder.didCreateBrowserContext(context);
146
+ const currentTestInfo = globals.currentTestInfo();
147
+ if (currentTestInfo) {
148
+ attachConnectedHeaderIfNeeded(currentTestInfo, context.browser());
149
+ currentTestInfo._onCustomMessageCallback = (0, import_browserBackend.createCustomMessageHandler)(currentTestInfo, context);
150
+ await (0, import_browserBackend.runDaemonForContext)(currentTestInfo, context);
151
+ }
152
+ },
153
+ runAfterCreateRequestContext: async (context) => {
154
+ await artifactsRecorder.didCreateRequestContext(context);
155
+ },
156
+ runBeforeCloseBrowserContext: async (context) => {
157
+ await artifactsRecorder.willCloseBrowserContext(context);
158
+ },
159
+ runBeforeCloseRequestContext: async (context) => {
160
+ await artifactsRecorder.willCloseRequestContext(context);
161
+ }
162
+ };
163
+ const clientInstrumentation = playwright._instrumentation;
164
+ clientInstrumentation.addListener(csiListener);
165
+ await use();
166
+ clientInstrumentation.removeListener(csiListener);
167
+ await artifactsRecorder.didFinishTest();
168
+ }, { auto: "all-hooks-included", title: "trace recording", box: true, timeout: 0 }],
169
+ request: async ({ playwright }, use) => {
170
+ const request = await playwright.request.newContext();
171
+ await use(request);
172
+ const hook = test.info()._currentHookType();
173
+ if (hook === "beforeAll") {
174
+ await request.dispose({ reason: [
175
+ `Fixture { request } from beforeAll cannot be reused in a test.`,
176
+ ` - Recommended fix: use a separate { request } in the test.`,
177
+ ` - Alternatively, manually create APIRequestContext in beforeAll and dispose it in afterAll.`,
178
+ `See https://playwright.dev/docs/api-testing#sending-api-requests-from-ui-tests for more details.`
179
+ ].join("\n") });
180
+ } else {
181
+ await request.dispose();
182
+ }
183
+ }
184
+ };
185
+ const _utilityTest = _baseTest.extend(utilityFixtures);
186
+ const playwrightFixtures = {
187
+ defaultBrowserType: ["chromium", { scope: "worker", option: true, box: true }],
188
+ browserName: [({ defaultBrowserType }, use) => use(defaultBrowserType), { scope: "worker", option: true, box: true }],
189
+ headless: [({ launchOptions }, use) => use(launchOptions.headless ?? true), { scope: "worker", option: true, box: true }],
190
+ channel: [({ launchOptions }, use) => use(launchOptions.channel), { scope: "worker", option: true, box: true }],
191
+ launchOptions: [{}, { scope: "worker", option: true, box: true }],
192
+ connectOptions: [async ({ _optionConnectOptions }, use) => {
193
+ await use(connectOptionsFromEnv() || _optionConnectOptions);
194
+ }, { scope: "worker", option: true, box: true }],
195
+ video: ["off", { scope: "worker", option: true, box: true }],
196
+ _browserOptions: [async ({ playwright, headless, channel, launchOptions }, use) => {
197
+ const options = {
198
+ handleSIGINT: false,
199
+ ...launchOptions,
200
+ tracesDir: tracing().tracesDir(),
201
+ artifactsDir: tracing().artifactsDir()
202
+ };
203
+ if (headless !== void 0)
204
+ options.headless = headless;
205
+ if (channel !== void 0)
206
+ options.channel = channel;
207
+ playwright._defaultLaunchOptions = options;
208
+ await use(options);
209
+ playwright._defaultLaunchOptions = void 0;
210
+ }, { scope: "worker", auto: true, box: true }],
211
+ browser: [async ({ playwright, browserName, _browserOptions, connectOptions }, use, workerInfo) => {
212
+ if (!["chromium", "firefox", "webkit"].includes(browserName))
213
+ throw new Error(`Unexpected browserName "${browserName}", must be one of "chromium", "firefox" or "webkit"`);
214
+ if (connectOptions) {
215
+ const browser2 = await playwright[browserName].connect(connectOptions.wsEndpoint, {
216
+ ...connectOptions,
217
+ exposeNetwork: connectOptions.exposeNetwork,
218
+ headers: {
219
+ // HTTP headers are ASCII only (not UTF-8).
220
+ "x-playwright-launch-options": jsonStringifyForceASCII(_browserOptions),
221
+ ...connectOptions.headers
222
+ }
223
+ });
224
+ await use(browser2);
225
+ await browser2.close({ reason: "Test ended." });
226
+ return;
227
+ }
228
+ const browser = await playwright[browserName].launch();
229
+ if (process.env.PLAYWRIGHT_DASHBOARD)
230
+ await browser.bind(`worker-${workerInfo.parallelIndex}`);
231
+ await use(browser);
232
+ await browser.close({ reason: "Test ended." });
233
+ }, { scope: "worker", timeout: 0 }],
234
+ acceptDownloads: [({ contextOptions }, use) => use(contextOptions.acceptDownloads ?? true), { option: true, box: true }],
235
+ bypassCSP: [({ contextOptions }, use) => use(contextOptions.bypassCSP ?? false), { option: true, box: true }],
236
+ colorScheme: [({ contextOptions }, use) => use(contextOptions.colorScheme === void 0 ? "light" : contextOptions.colorScheme), { option: true, box: true }],
237
+ contrast: [({ contextOptions }, use) => use(contextOptions.contrast === void 0 ? "no-preference" : contextOptions.contrast), { option: true, box: true }],
238
+ deviceScaleFactor: [({ contextOptions }, use) => use(contextOptions.deviceScaleFactor), { option: true, box: true }],
239
+ extraHTTPHeaders: [({ contextOptions }, use) => use(contextOptions.extraHTTPHeaders), { option: true, box: true }],
240
+ forcedColors: [({ contextOptions }, use) => use(contextOptions.forcedColors === void 0 ? "none" : contextOptions.forcedColors), { option: true, box: true }],
241
+ geolocation: [({ contextOptions }, use) => use(contextOptions.geolocation), { option: true, box: true }],
242
+ hasTouch: [({ contextOptions }, use) => use(contextOptions.hasTouch ?? false), { option: true, box: true }],
243
+ httpCredentials: [({ contextOptions }, use) => use(contextOptions.httpCredentials), { option: true, box: true }],
244
+ ignoreHTTPSErrors: [({ contextOptions }, use) => use(contextOptions.ignoreHTTPSErrors ?? false), { option: true, box: true }],
245
+ isMobile: [({ contextOptions }, use) => use(contextOptions.isMobile ?? false), { option: true, box: true }],
246
+ javaScriptEnabled: [({ contextOptions }, use) => use(contextOptions.javaScriptEnabled ?? true), { option: true, box: true }],
247
+ locale: [({ contextOptions }, use) => use(contextOptions.locale ?? "en-US"), { option: true, box: true }],
248
+ offline: [({ contextOptions }, use) => use(contextOptions.offline ?? false), { option: true, box: true }],
249
+ permissions: [({ contextOptions }, use) => use(contextOptions.permissions), { option: true, box: true }],
250
+ proxy: [({ contextOptions }, use) => use(contextOptions.proxy), { option: true, box: true }],
251
+ reducedMotion: [({ contextOptions }, use) => use(contextOptions.reducedMotion === void 0 ? "no-preference" : contextOptions.reducedMotion), { option: true, box: true }],
252
+ screen: [({ contextOptions }, use) => use(contextOptions.screen), { option: true, box: true }],
253
+ storageState: [({ contextOptions }, use) => use(contextOptions.storageState), { option: true, box: true }],
254
+ clientCertificates: [({ contextOptions }, use) => use(contextOptions.clientCertificates), { option: true, box: true }],
255
+ timezoneId: [({ contextOptions }, use) => use(contextOptions.timezoneId), { option: true, box: true }],
256
+ userAgent: [({ contextOptions }, use) => use(contextOptions.userAgent), { option: true, box: true }],
257
+ viewport: [({ contextOptions }, use) => use(contextOptions.viewport === void 0 ? { width: 1280, height: 720 } : contextOptions.viewport), { option: true, box: true }],
258
+ actionTimeout: [0, { option: true, box: true }],
259
+ navigationTimeout: [0, { option: true, box: true }],
260
+ baseURL: [async ({}, use) => {
261
+ await use(process.env.PLAYWRIGHT_TEST_BASE_URL);
262
+ }, { option: true, box: true }],
263
+ serviceWorkers: [({ contextOptions }, use) => use(contextOptions.serviceWorkers ?? "allow"), { option: true, box: true }],
264
+ contextOptions: [{}, { option: true, box: true }],
265
+ _combinedContextOptions: [async ({
266
+ acceptDownloads,
267
+ bypassCSP,
268
+ clientCertificates,
269
+ colorScheme,
270
+ contrast,
271
+ deviceScaleFactor,
272
+ extraHTTPHeaders,
273
+ forcedColors,
274
+ hasTouch,
275
+ geolocation,
276
+ httpCredentials,
277
+ ignoreHTTPSErrors,
278
+ isMobile,
279
+ javaScriptEnabled,
280
+ locale,
281
+ offline,
282
+ permissions,
283
+ proxy,
284
+ reducedMotion,
285
+ screen,
286
+ storageState,
287
+ viewport,
288
+ timezoneId,
289
+ userAgent,
290
+ baseURL,
291
+ contextOptions,
292
+ serviceWorkers
293
+ }, use, testInfo) => {
294
+ const options = {};
295
+ if (acceptDownloads !== void 0)
296
+ options.acceptDownloads = acceptDownloads;
297
+ if (bypassCSP !== void 0)
298
+ options.bypassCSP = bypassCSP;
299
+ if (colorScheme !== void 0)
300
+ options.colorScheme = colorScheme;
301
+ if (contrast !== void 0)
302
+ options.contrast = contrast;
303
+ if (deviceScaleFactor !== void 0)
304
+ options.deviceScaleFactor = deviceScaleFactor;
305
+ if (extraHTTPHeaders !== void 0)
306
+ options.extraHTTPHeaders = extraHTTPHeaders;
307
+ if (forcedColors !== void 0)
308
+ options.forcedColors = forcedColors;
309
+ if (geolocation !== void 0)
310
+ options.geolocation = geolocation;
311
+ if (hasTouch !== void 0)
312
+ options.hasTouch = hasTouch;
313
+ if (httpCredentials !== void 0)
314
+ options.httpCredentials = httpCredentials;
315
+ if (ignoreHTTPSErrors !== void 0)
316
+ options.ignoreHTTPSErrors = ignoreHTTPSErrors;
317
+ if (isMobile !== void 0)
318
+ options.isMobile = isMobile;
319
+ if (javaScriptEnabled !== void 0)
320
+ options.javaScriptEnabled = javaScriptEnabled;
321
+ if (locale !== void 0)
322
+ options.locale = locale;
323
+ if (offline !== void 0)
324
+ options.offline = offline;
325
+ if (permissions !== void 0)
326
+ options.permissions = permissions;
327
+ if (proxy !== void 0)
328
+ options.proxy = proxy;
329
+ if (reducedMotion !== void 0)
330
+ options.reducedMotion = reducedMotion;
331
+ if (screen !== void 0)
332
+ options.screen = screen;
333
+ if (storageState !== void 0)
334
+ options.storageState = storageState;
335
+ if (clientCertificates?.length)
336
+ options.clientCertificates = resolveClientCerticates(clientCertificates);
337
+ if (timezoneId !== void 0)
338
+ options.timezoneId = timezoneId;
339
+ if (userAgent !== void 0)
340
+ options.userAgent = userAgent;
341
+ if (viewport !== void 0)
342
+ options.viewport = viewport;
343
+ if (baseURL !== void 0)
344
+ options.baseURL = baseURL;
345
+ if (serviceWorkers !== void 0)
346
+ options.serviceWorkers = serviceWorkers;
347
+ await use({
348
+ ...contextOptions,
349
+ ...options
350
+ });
351
+ }, { scope: "test", box: true }],
352
+ _setupContextOptions: [async ({ playwright, actionTimeout, navigationTimeout, testIdAttribute }, use, _testInfo) => {
353
+ const testInfo = _testInfo;
354
+ if (testIdAttribute)
355
+ playwrightLibrary.selectors.setTestIdAttribute(testIdAttribute);
356
+ testInfo.snapshotSuffix = process.platform;
357
+ testInfo._onCustomMessageCallback = () => Promise.reject(new Error("Only tests that use default Playwright context or page fixture support test_debug"));
358
+ if (debugMode() === "inspector")
359
+ testInfo._setIgnoreTimeouts(true);
360
+ playwright._defaultContextTimeout = actionTimeout || 0;
361
+ playwright._defaultContextNavigationTimeout = navigationTimeout || 0;
362
+ await use();
363
+ playwright._defaultContextTimeout = void 0;
364
+ playwright._defaultContextNavigationTimeout = void 0;
365
+ }, { auto: "all-hooks-included", title: "context configuration", box: true }],
366
+ _contextFactory: [async ({
367
+ browser,
368
+ video,
369
+ _reuseContext,
370
+ _combinedContextOptions
371
+ /** mitigate dep-via-auto lack of traceability */
372
+ }, use, testInfo) => {
373
+ const testInfoImpl = testInfo;
374
+ const videoMode = normalizeVideoMode(video);
375
+ const captureVideo = shouldCaptureVideo(videoMode, testInfo) && !_reuseContext;
376
+ const contexts = /* @__PURE__ */ new Map();
377
+ let counter = 0;
378
+ await use(async (options) => {
379
+ const hook = testInfoImpl._currentHookType();
380
+ if (hook === "beforeAll" || hook === "afterAll") {
381
+ throw new Error([
382
+ `"context" and "page" fixtures are not supported in "${hook}" since they are created on a per-test basis.`,
383
+ `If you would like to reuse a single page between tests, create context manually with browser.newContext(). See https://aka.ms/playwright/reuse-page for details.`,
384
+ `If you would like to configure your page before each test, do that in beforeEach hook instead.`
385
+ ].join("\n"));
386
+ }
387
+ const show = typeof video === "string" ? void 0 : video.show;
388
+ const videoOptions = captureVideo ? {
389
+ recordVideo: {
390
+ dir: tracing().artifactsDir(),
391
+ size: typeof video === "string" ? void 0 : video.size,
392
+ fps: typeof video === "string" ? void 0 : video.fps,
393
+ showActions: show?.actions
394
+ }
395
+ } : {};
396
+ const context = await browser.newContext({ ...videoOptions, ...options });
397
+ let closed = false;
398
+ const close = async () => {
399
+ if (closed)
400
+ return;
401
+ closed = true;
402
+ const closeReason = testInfo.status === "timedOut" ? "Test timeout of " + testInfo.timeout + "ms exceeded." : "Test ended.";
403
+ await context.close({ reason: closeReason });
404
+ const preserveVideo = captureVideo && shouldPreserveVideo(videoMode, testInfo);
405
+ if (preserveVideo) {
406
+ const { pagesWithVideo: pagesForVideo } = contexts.get(context);
407
+ const videos = pagesForVideo.map((p) => p.video()).filter((video2) => !!video2);
408
+ await Promise.all(videos.map(async (v) => {
409
+ try {
410
+ const savedPath = testInfo.outputPath(`video${counter ? "-" + counter : ""}.webm`);
411
+ ++counter;
412
+ await v.saveAs(savedPath);
413
+ testInfo.attachments.push({ name: "video", path: savedPath, contentType: "video/webm" });
414
+ } catch (e) {
415
+ }
416
+ }));
417
+ }
418
+ };
419
+ const contextData = { close, pagesWithVideo: [] };
420
+ if (captureVideo)
421
+ context.on("page", (page) => contextData.pagesWithVideo.push(page));
422
+ contexts.set(context, contextData);
423
+ return { context, close };
424
+ });
425
+ await Promise.all([...contexts.values()].map((data) => data.close()));
426
+ }, { scope: "test", title: "context", box: true }],
427
+ _optionContextReuseMode: ["none", { scope: "worker", option: true, box: true }],
428
+ _optionConnectOptions: [void 0, { scope: "worker", option: true, box: true }],
429
+ reuseContext: [false, { scope: "worker", option: true, box: true }],
430
+ _reuseContext: [async ({ video, _optionContextReuseMode, reuseContext }, use) => {
431
+ let mode = _optionContextReuseMode;
432
+ if (process.env.PW_TEST_REUSE_CONTEXT || reuseContext)
433
+ mode = "when-possible";
434
+ const reuse = mode === "when-possible" && normalizeVideoMode(video) === "off";
435
+ await use(reuse);
436
+ }, { scope: "worker", title: "context", box: true }],
437
+ context: async ({ browser, video, _reuseContext, _contextFactory }, use, testInfoPublic) => {
438
+ const browserImpl = browser;
439
+ const testInfo = testInfoPublic;
440
+ const show = typeof video === "string" ? void 0 : video.show;
441
+ attachConnectedHeaderIfNeeded(testInfo, browserImpl);
442
+ if (!_reuseContext) {
443
+ const { context: context2, close } = await _contextFactory();
444
+ await installScreencastTitleUpdater(testInfo, context2, show?.test);
445
+ await use(context2);
446
+ await close();
447
+ return;
448
+ }
449
+ const context = await browserImpl._wrapApiCall(() => browserImpl._newContextForReuse(), { internal: true });
450
+ await installScreencastTitleUpdater(testInfo, context, show?.test);
451
+ await use(context);
452
+ const closeReason = testInfo.status === "timedOut" ? "Test timeout of " + testInfo.timeout + "ms exceeded." : "Test ended.";
453
+ await browserImpl._wrapApiCall(() => browserImpl._disconnectFromReusedContext(closeReason), { internal: true });
454
+ },
455
+ page: async ({ context, _reuseContext }, use) => {
456
+ if (!_reuseContext) {
457
+ await use(await context.newPage());
458
+ return;
459
+ }
460
+ let [page] = context.pages();
461
+ if (!page)
462
+ page = await context.newPage();
463
+ await use(page);
464
+ },
465
+ mount: async ({ page, baseURL }, use) => {
466
+ const callMount = (params) => page.evaluate(async (p) => {
467
+ const w = window;
468
+ if (typeof w.mount !== "function")
469
+ throw new Error("The gallery page does not define window.mount().");
470
+ await w.mount(p);
471
+ }, params, { exposeFunctions: true });
472
+ await use(async (storyId, props) => {
473
+ if (!baseURL)
474
+ throw new Error("mount() requires `baseURL` to point at the component gallery. Set it in your Playwright config.");
475
+ await page.goto(baseURL);
476
+ await callMount({ story: storyId, props });
477
+ return Object.assign(page.locator("#root"), {
478
+ // update() re-renders the same story with new props without navigating; if the gallery
479
+ // reuses its root/instance, the framework reconciles and component state is preserved.
480
+ update: (newProps) => callMount({ story: storyId, props: newProps }),
481
+ unmount: () => page.evaluate(async () => {
482
+ await window.unmount?.();
483
+ })
484
+ });
485
+ });
486
+ }
487
+ };
488
+ function normalizeVideoMode(video) {
489
+ if (!video)
490
+ return "off";
491
+ let videoMode = typeof video === "string" ? video : video.mode;
492
+ if (videoMode === "retry-with-video")
493
+ videoMode = "on-first-retry";
494
+ return videoMode;
495
+ }
496
+ function shouldCaptureVideo(videoMode, testInfo) {
497
+ return videoMode === "on" || videoMode === "retain-on-failure" || videoMode === "retain-on-failure-and-retries" || videoMode === "on-first-retry" && testInfo.retry === 1 || videoMode === "on-all-retries" && testInfo.retry > 0 || videoMode === "retain-on-first-failure" && testInfo.retry === 0;
498
+ }
499
+ function shouldPreserveVideo(videoMode, testInfo) {
500
+ const testFailed = testInfo.status !== testInfo.expectedStatus;
501
+ switch (videoMode) {
502
+ case "on":
503
+ case "on-first-retry":
504
+ case "on-all-retries":
505
+ return true;
506
+ case "retain-on-failure":
507
+ case "retain-on-first-failure":
508
+ return testFailed;
509
+ case "retain-on-failure-and-retries":
510
+ return testFailed || testInfo.retry > 0;
511
+ default:
512
+ return false;
513
+ }
514
+ }
515
+ function normalizeScreenshotMode(screenshot) {
516
+ if (!screenshot)
517
+ return "off";
518
+ return typeof screenshot === "string" ? screenshot : screenshot.mode;
519
+ }
520
+ function attachConnectedHeaderIfNeeded(testInfo, browser) {
521
+ const connectHeaders = browser?._connection.headers;
522
+ if (!connectHeaders)
523
+ return;
524
+ for (const header of connectHeaders) {
525
+ if (header.name !== "x-playwright-attachment")
526
+ continue;
527
+ const [name, value] = header.value.split("=");
528
+ if (!name || !value)
529
+ continue;
530
+ if (testInfo.attachments.some((attachment) => attachment.name === name))
531
+ continue;
532
+ testInfo.attachments.push({ name, contentType: "text/plain", body: Buffer.from(value) });
533
+ }
534
+ }
535
+ function resolveFileToConfig(file) {
536
+ const config2 = test.info().config.configFile;
537
+ if (!config2 || !file)
538
+ return file;
539
+ if (import_path.default.isAbsolute(file))
540
+ return file;
541
+ return import_path.default.resolve(import_path.default.dirname(config2), file);
542
+ }
543
+ function resolveClientCerticates(clientCertificates) {
544
+ for (const cert of clientCertificates) {
545
+ cert.certPath = resolveFileToConfig(cert.certPath);
546
+ cert.keyPath = resolveFileToConfig(cert.keyPath);
547
+ cert.pfxPath = resolveFileToConfig(cert.pfxPath);
548
+ }
549
+ return clientCertificates;
550
+ }
551
+ const kTracingStarted = /* @__PURE__ */ Symbol("kTracingStarted");
552
+ function connectOptionsFromEnv() {
553
+ const wsEndpoint = process.env.PW_TEST_CONNECT_WS_ENDPOINT;
554
+ if (!wsEndpoint)
555
+ return void 0;
556
+ const headers = process.env.PW_TEST_CONNECT_HEADERS ? JSON.parse(process.env.PW_TEST_CONNECT_HEADERS) : void 0;
557
+ return {
558
+ wsEndpoint,
559
+ headers,
560
+ exposeNetwork: process.env.PW_TEST_CONNECT_EXPOSE_NETWORK
561
+ };
562
+ }
563
+ class SnapshotRecorder {
564
+ constructor(_artifactsRecorder, _mode, _name, _contentType, _extension, _doSnapshot) {
565
+ this._artifactsRecorder = _artifactsRecorder;
566
+ this._mode = _mode;
567
+ this._name = _name;
568
+ this._contentType = _contentType;
569
+ this._extension = _extension;
570
+ this._doSnapshot = _doSnapshot;
571
+ this._ordinal = 0;
572
+ this._temporary = [];
573
+ }
574
+ fixOrdinal() {
575
+ this._ordinal = this.testInfo.attachments.filter((a) => a.name === this._name).length;
576
+ }
577
+ shouldCaptureUponFinish() {
578
+ return this._mode === "on" || this._mode === "only-on-failure" && this.testInfo._isFailure() || this._mode === "on-first-failure" && this.testInfo._isFailure() && this.testInfo.retry === 0;
579
+ }
580
+ async maybeCapture() {
581
+ if (!this.shouldCaptureUponFinish())
582
+ return;
583
+ await Promise.all(this._artifactsRecorder._playwright._allPages().map((page) => this._snapshotPage(page, false)));
584
+ }
585
+ async persistTemporary() {
586
+ if (this.shouldCaptureUponFinish()) {
587
+ await Promise.all(this._temporary.map(async (file) => {
588
+ try {
589
+ const path2 = this._createAttachmentPath();
590
+ await import_fs.default.promises.rename(file, path2);
591
+ this._attach(path2);
592
+ } catch {
593
+ }
594
+ }));
595
+ }
596
+ }
597
+ async captureTemporary(context) {
598
+ if (this._mode === "on" || this._mode === "only-on-failure" || this._mode === "on-first-failure" && this.testInfo.retry === 0)
599
+ await Promise.all(context.pages().map((page) => this._snapshotPage(page, true)));
600
+ }
601
+ _attach(screenshotPath) {
602
+ this.testInfo.attachments.push({ name: this._name, path: screenshotPath, contentType: this._contentType });
603
+ }
604
+ _createAttachmentPath() {
605
+ const testFailed = this.testInfo._isFailure();
606
+ const index = this._ordinal + 1;
607
+ ++this._ordinal;
608
+ const path2 = this.testInfo.outputPath(`test-${testFailed ? "failed" : "finished"}-${index}${this._extension}`);
609
+ return path2;
610
+ }
611
+ _createTemporaryArtifact(...name) {
612
+ const file = import_path.default.join(this._artifactsRecorder._artifactsDir, ...name);
613
+ return file;
614
+ }
615
+ async _snapshotPage(page, temporary) {
616
+ if (page[this.testInfo._uniqueSymbol])
617
+ return;
618
+ page[this.testInfo._uniqueSymbol] = true;
619
+ try {
620
+ const path2 = temporary ? this._createTemporaryArtifact(createGuid() + this._extension) : this._createAttachmentPath();
621
+ await this._doSnapshot(page, path2);
622
+ if (temporary)
623
+ this._temporary.push(path2);
624
+ else
625
+ this._attach(path2);
626
+ } catch {
627
+ }
628
+ }
629
+ get testInfo() {
630
+ return this._artifactsRecorder._testInfo;
631
+ }
632
+ }
633
+ class ArtifactsRecorder {
634
+ constructor(playwright, artifactsDir, screenshot) {
635
+ this._playwright = playwright;
636
+ this._artifactsDir = artifactsDir;
637
+ const screenshotOptions = typeof screenshot === "string" ? void 0 : screenshot;
638
+ this._startedCollectingArtifacts = /* @__PURE__ */ Symbol("startedCollectingArtifacts");
639
+ this._screenshotRecorder = new SnapshotRecorder(this, normalizeScreenshotMode(screenshot), "screenshot", "image/png", ".png", async (page, path2) => {
640
+ await page._wrapApiCall(async () => {
641
+ await page.screenshot({ ...screenshotOptions, timeout: 5e3, path: path2, caret: "initial" });
642
+ }, { internal: true });
643
+ });
644
+ }
645
+ async willStartTest(testInfo) {
646
+ this._testInfo = testInfo;
647
+ testInfo._onDidFinishTestFunctionCallbacks.add(() => this.didFinishTestFunction());
648
+ this._screenshotRecorder.fixOrdinal();
649
+ await Promise.all(this._playwright._allContexts().map((context) => this.didCreateBrowserContext(context)));
650
+ const existingApiRequests = Array.from(this._playwright.request._contexts);
651
+ await Promise.all(existingApiRequests.map((c) => this.didCreateRequestContext(c)));
652
+ }
653
+ async didCreateBrowserContext(context) {
654
+ await this._startTraceChunkOnContextCreation(context, context.tracing);
655
+ await this._startTraceChunkOnContextCreation(context.request, context.request.tracing);
656
+ }
657
+ async willCloseBrowserContext(context) {
658
+ await this._stopTracing(context, context.tracing);
659
+ await this._screenshotRecorder.captureTemporary(context);
660
+ await this._takePageSnapshot(context);
661
+ }
662
+ async _takePageSnapshot(context) {
663
+ if (process.env.PLAYWRIGHT_NO_COPY_PROMPT)
664
+ return;
665
+ if (this._testInfo.errors.length === 0)
666
+ return;
667
+ if (this._testInfo.errors.some((e) => e.errorContext))
668
+ return;
669
+ if (this._pageSnapshot)
670
+ return;
671
+ const page = context.pages()[0];
672
+ if (!page)
673
+ return;
674
+ try {
675
+ await page._wrapApiCall(async () => {
676
+ this._pageSnapshot = await page.ariaSnapshot({ mode: "ai", timeout: 5e3 });
677
+ }, { internal: true });
678
+ } catch (error) {
679
+ debugLogger.log("error", `failed to capture aria snapshot: ${error}`);
680
+ }
681
+ }
682
+ async didCreateRequestContext(context) {
683
+ await this._startTraceChunkOnContextCreation(context, context.tracing);
684
+ }
685
+ async willCloseRequestContext(context) {
686
+ await this._stopTracing(context, context.tracing);
687
+ }
688
+ async didFinishTestFunction() {
689
+ await this._screenshotRecorder.maybeCapture();
690
+ }
691
+ async didFinishTest() {
692
+ await this.didFinishTestFunction();
693
+ const leftoverContexts = this._playwright._allContexts();
694
+ const leftoverApiRequests = Array.from(this._playwright.request._contexts);
695
+ await Promise.all(leftoverContexts.map(async (context2) => {
696
+ await this._stopTracing(context2.request, context2.request.tracing);
697
+ await this._stopTracing(context2, context2.tracing);
698
+ }).concat(leftoverApiRequests.map(async (context2) => {
699
+ await this._stopTracing(context2, context2.tracing);
700
+ })));
701
+ await this._screenshotRecorder.persistTemporary();
702
+ const context = leftoverContexts[0];
703
+ if (context)
704
+ await this._takePageSnapshot(context);
705
+ if (this._testInfo.errors.length > 0) {
706
+ const hasMatcherAriaSnapshot = this._testInfo.errors.some((e) => e.errorContext);
707
+ const errorContextContent = (0, import_errorContext.buildErrorContext)({
708
+ titlePath: this._testInfo.titlePath,
709
+ location: { file: this._testInfo.file, line: this._testInfo.line, column: this._testInfo.column },
710
+ errors: this._testInfo.errors,
711
+ pageSnapshot: hasMatcherAriaSnapshot ? void 0 : this._pageSnapshot
712
+ });
713
+ if (errorContextContent) {
714
+ const filePath = this._testInfo.outputPath("error-context.md");
715
+ await import_fs.default.promises.writeFile(filePath, errorContextContent, "utf8");
716
+ this._testInfo._attach({
717
+ name: "error-context",
718
+ contentType: "text/markdown",
719
+ path: filePath
720
+ }, void 0);
721
+ }
722
+ }
723
+ }
724
+ async _startTraceChunkOnContextCreation(channelOwner, tracing2) {
725
+ await channelOwner._wrapApiCall(async () => {
726
+ const options = this._testInfo._tracing.traceOptions();
727
+ if (options) {
728
+ const title = this._testInfo._tracing.traceTitle();
729
+ const name = this._testInfo._tracing.generateNextTraceRecordingName();
730
+ if (!tracing2[kTracingStarted]) {
731
+ await tracing2.start({ ...options, title, name });
732
+ tracing2[kTracingStarted] = true;
733
+ } else {
734
+ await tracing2.startChunk({ title, name });
735
+ }
736
+ } else {
737
+ if (tracing2[kTracingStarted]) {
738
+ tracing2[kTracingStarted] = false;
739
+ await tracing2.stop();
740
+ }
741
+ }
742
+ }, { internal: true });
743
+ }
744
+ async _stopTracing(channelOwner, tracing2) {
745
+ await channelOwner._wrapApiCall(async () => {
746
+ if (tracing2[this._startedCollectingArtifacts])
747
+ return;
748
+ tracing2[this._startedCollectingArtifacts] = true;
749
+ if (this._testInfo._tracing.traceOptions() && tracing2[kTracingStarted])
750
+ await tracing2.stopChunk({ path: this._testInfo._tracing.maybeGenerateNextTraceRecordingPath() });
751
+ }, { internal: true });
752
+ }
753
+ }
754
+ async function installScreencastTitleUpdater(testInfo, context, testAnnotate) {
755
+ if (!testAnnotate)
756
+ return;
757
+ const testTitle = testAnnotate.level === "file" ? [testInfo.titlePath[0]] : testInfo.titlePath;
758
+ const stepStack = [];
759
+ const overlays = /* @__PURE__ */ new Map();
760
+ const position = testAnnotate.position ?? "top-left";
761
+ const fontSize = testAnnotate.fontSize ?? 14;
762
+ const level = testAnnotate.level ?? "step";
763
+ const doUpdateOverlay = async () => {
764
+ const parts = level === "step" ? [...testTitle, ...stepStack] : testTitle;
765
+ const html = createTestOverlay(parts, position, fontSize);
766
+ for (const page of context.pages()) {
767
+ await overlays.get(page)?.dispose();
768
+ overlays.delete(page);
769
+ const disposable = await page.screencast.showOverlay(html);
770
+ overlays.set(page, disposable);
771
+ }
772
+ };
773
+ let lastUpdate = Promise.resolve();
774
+ const updateOverlay = () => {
775
+ const result = lastUpdate.then(doUpdateOverlay);
776
+ lastUpdate = result.catch(() => {
777
+ });
778
+ return result;
779
+ };
780
+ testInfo._onUserStepBegin = async (title) => {
781
+ stepStack.push(title);
782
+ await updateOverlay();
783
+ };
784
+ testInfo._onUserStepEnd = async () => {
785
+ stepStack.pop();
786
+ await updateOverlay();
787
+ };
788
+ context.on("page", async () => {
789
+ void updateOverlay();
790
+ });
791
+ await updateOverlay();
792
+ }
793
+ function createTestOverlay(parts, position, fontSize) {
794
+ const positionStyles = {
795
+ "top-left": "top: 6px; left: 6px;",
796
+ "top": "top: 6px; left: 50%; transform: translateX(-50%);",
797
+ "top-right": "top: 6px; right: 6px;",
798
+ "bottom-left": "bottom: 6px; left: 6px;",
799
+ "bottom": "bottom: 6px; left: 50%; transform: translateX(-50%);",
800
+ "bottom-right": "bottom: 6px; right: 6px;"
801
+ };
802
+ const posStyle = positionStyles[position] ?? positionStyles["top-left"];
803
+ return `<div style="white-space: nowrap; font-size: ${fontSize}px; padding: 3px 6px; background: rgba(0,0,0,0.5); color: white; border-radius: 4px; position: absolute; ${posStyle}">
804
+ ${parts.map((p) => `<div>${escapeHTML(p)}</div>`).join("")}
805
+ </div>`;
806
+ }
807
+ function renderTitle(type, method, params, title) {
808
+ return renderTitleForCall({ title, type, method, params });
809
+ }
810
+ function renderSubtitle(type, method, params) {
811
+ const subtitle = renderSubtitleForCall({ type, method, params });
812
+ return subtitle === void 0 ? void 0 : truncateParam(subtitle);
813
+ }
814
+ function tracing() {
815
+ return test.info()._tracing;
816
+ }
817
+ const test = _utilityTest.extend(playwrightFixtures);
818
+ // Annotate the CommonJS export names for ESM import in node:
819
+ 0 && (module.exports = {
820
+ _baseTest,
821
+ _utilityTest,
822
+ defineConfig,
823
+ expect,
824
+ mergeExpects,
825
+ mergeTests,
826
+ test
827
+ });