spana-test 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (482) hide show
  1. package/.agents/skills/spana-testing/SKILL.md +0 -0
  2. package/LICENSE +0 -0
  3. package/README.md +4 -1
  4. package/dist/{accessibility-audit-YZOPUY3D.js → accessibility-audit-MHQ65DUD.js} +61 -12
  5. package/dist/accessibility-audit-MHQ65DUD.js.map +1 -0
  6. package/dist/agent/index.d.ts +3 -11
  7. package/dist/agent/index.d.ts.map +1 -0
  8. package/dist/agent/index.js +20 -15
  9. package/dist/agent/index.js.map +1 -1
  10. package/dist/{session-uT8xL03K.d.ts → agent/session.d.ts} +14 -46
  11. package/dist/agent/session.d.ts.map +1 -0
  12. package/dist/{agent-fixture-5C4MCWRD.js → agent-fixture-H6GOUHNX.js} +3 -3
  13. package/dist/{agent-fixture-5C4MCWRD.js.map → agent-fixture-H6GOUHNX.js.map} +0 -0
  14. package/dist/{allure-FGVR5LND.js → allure-XOM7BXL5.js} +5 -2
  15. package/dist/{allure-FGVR5LND.js.map → allure-XOM7BXL5.js.map} +1 -1
  16. package/dist/{android-6BOQTMM3.js → android-C2S4B4TH.js} +3 -3
  17. package/dist/{android-6BOQTMM3.js.map → android-C2S4B4TH.js.map} +0 -0
  18. package/dist/api/agent-fixture.d.ts +119 -0
  19. package/dist/api/agent-fixture.d.ts.map +1 -0
  20. package/dist/api/app.d.ts +359 -0
  21. package/dist/api/app.d.ts.map +1 -0
  22. package/dist/api/expect.d.ts +167 -0
  23. package/dist/api/expect.d.ts.map +1 -0
  24. package/dist/api/fixtures.d.ts +165 -0
  25. package/dist/api/fixtures.d.ts.map +1 -0
  26. package/dist/api/flow.d.ts +123 -0
  27. package/dist/api/flow.d.ts.map +1 -0
  28. package/dist/api/index.d.ts +4 -0
  29. package/dist/api/index.d.ts.map +1 -0
  30. package/dist/api/snapshots.d.ts +26 -0
  31. package/dist/api/snapshots.d.ts.map +1 -0
  32. package/dist/api/storybook.d.ts +18 -0
  33. package/dist/api/storybook.d.ts.map +1 -0
  34. package/dist/api/suite.d.ts +46 -0
  35. package/dist/api/suite.d.ts.map +1 -0
  36. package/dist/app-CBHH5GMB.js +10 -0
  37. package/dist/{app-RSDPDTKT.js.map → app-CBHH5GMB.js.map} +0 -0
  38. package/dist/{appium-server-66GVUL24.js → appium-server-M6CWWUWF.js} +5 -2
  39. package/dist/{appium-server-66GVUL24.js.map → appium-server-M6CWWUWF.js.map} +1 -1
  40. package/dist/{baseline-manager-5TIUCNP5.js → baseline-manager-LVUVH2MJ.js} +5 -2
  41. package/dist/{baseline-manager-5TIUCNP5.js.map → baseline-manager-LVUVH2MJ.js.map} +1 -1
  42. package/dist/{cache-command-PANUAEMZ.js → cache-command-OL7HUK2K.js} +3 -3
  43. package/dist/{cache-command-PANUAEMZ.js.map → cache-command-OL7HUK2K.js.map} +0 -0
  44. package/dist/channels/android-cdp.d.ts +71 -0
  45. package/dist/channels/android-cdp.d.ts.map +1 -0
  46. package/dist/channels/apple-webinspector.d.ts +85 -0
  47. package/dist/channels/apple-webinspector.d.ts.map +1 -0
  48. package/dist/channels/bidi-client.d.ts +79 -0
  49. package/dist/channels/bidi-client.d.ts.map +1 -0
  50. package/dist/channels/bridge-server.d.ts +69 -0
  51. package/dist/channels/bridge-server.d.ts.map +1 -0
  52. package/dist/channels/cdp-client.d.ts +102 -0
  53. package/dist/channels/cdp-client.d.ts.map +1 -0
  54. package/dist/channels/dom-channel.d.ts +246 -0
  55. package/dist/channels/dom-channel.d.ts.map +1 -0
  56. package/dist/channels/index.d.ts +8 -0
  57. package/dist/channels/index.d.ts.map +1 -0
  58. package/dist/channels/webkit-inspector.d.ts +85 -0
  59. package/dist/channels/webkit-inspector.d.ts.map +1 -0
  60. package/dist/channels/ws-server.d.ts +21 -0
  61. package/dist/channels/ws-server.d.ts.map +1 -0
  62. package/dist/{chunk-WV3ALL3H.js → chunk-2MA5G2VH.js} +6 -2
  63. package/dist/{chunk-WV3ALL3H.js.map → chunk-2MA5G2VH.js.map} +1 -1
  64. package/dist/{chunk-4SA7JK5D.js → chunk-53TGNQTM.js} +14 -10
  65. package/dist/{chunk-4SA7JK5D.js.map → chunk-53TGNQTM.js.map} +1 -1
  66. package/dist/{chunk-JPZCZHL4.js → chunk-7Q7TSUNL.js} +6 -1
  67. package/dist/{chunk-JPZCZHL4.js.map → chunk-7Q7TSUNL.js.map} +1 -1
  68. package/dist/{chunk-X2TJP7LB.js → chunk-7WHQIQPM.js} +11 -1
  69. package/dist/chunk-7WHQIQPM.js.map +1 -0
  70. package/dist/{chunk-WZAQANN6.js → chunk-AMBU26PB.js} +9 -3
  71. package/dist/{chunk-WZAQANN6.js.map → chunk-AMBU26PB.js.map} +1 -1
  72. package/dist/{chunk-3IZMPNE7.js → chunk-BWEQ4XT2.js} +1216 -101
  73. package/dist/chunk-BWEQ4XT2.js.map +1 -0
  74. package/dist/{chunk-SIJJVN2D.js → chunk-F2YUBD4E.js} +9 -3
  75. package/dist/{chunk-SIJJVN2D.js.map → chunk-F2YUBD4E.js.map} +1 -1
  76. package/dist/chunk-F3AFZ6UX.js +326 -0
  77. package/dist/chunk-F3AFZ6UX.js.map +1 -0
  78. package/dist/{chunk-Z6K4QQAR.js → chunk-FHCOPLYB.js} +36 -7
  79. package/dist/chunk-FHCOPLYB.js.map +1 -0
  80. package/dist/{chunk-3SH5JQF7.js → chunk-FSPMFRJO.js} +6 -1
  81. package/dist/{chunk-3SH5JQF7.js.map → chunk-FSPMFRJO.js.map} +1 -1
  82. package/dist/chunk-FTXUQMGH.js +56 -0
  83. package/dist/chunk-FTXUQMGH.js.map +1 -0
  84. package/dist/{chunk-SGZMO456.js → chunk-GAWJL6Q3.js} +180 -37
  85. package/dist/chunk-GAWJL6Q3.js.map +1 -0
  86. package/dist/{chunk-WS2TVNMY.js → chunk-GDDCZ2PL.js} +168 -43
  87. package/dist/chunk-GDDCZ2PL.js.map +1 -0
  88. package/dist/{chunk-OPTNFLBL.js → chunk-HIGFQRWM.js} +7 -1
  89. package/dist/{chunk-OPTNFLBL.js.map → chunk-HIGFQRWM.js.map} +1 -1
  90. package/dist/{chunk-4KK4E3N3.js → chunk-LQQNE2OE.js} +943 -172
  91. package/dist/chunk-LQQNE2OE.js.map +1 -0
  92. package/dist/{chunk-KJPHH2TW.js → chunk-NHT3XSX3.js} +6 -1
  93. package/dist/{chunk-KJPHH2TW.js.map → chunk-NHT3XSX3.js.map} +1 -1
  94. package/dist/{chunk-3FSZNKEF.js → chunk-NXET4BFJ.js} +7 -1
  95. package/dist/{chunk-3FSZNKEF.js.map → chunk-NXET4BFJ.js.map} +1 -1
  96. package/dist/{chunk-FPQAJNE3.js → chunk-OQRGR542.js} +285 -98
  97. package/dist/chunk-OQRGR542.js.map +1 -0
  98. package/dist/{chunk-FXBWACUT.js → chunk-PPAPRKQU.js} +392 -31
  99. package/dist/chunk-PPAPRKQU.js.map +1 -0
  100. package/dist/{chunk-64UZQP7Z.js → chunk-PRQTAIYA.js} +30 -4
  101. package/dist/chunk-PRQTAIYA.js.map +1 -0
  102. package/dist/{chunk-VUNH4AJD.js → chunk-QOL44BNJ.js} +7 -3
  103. package/dist/{chunk-VUNH4AJD.js.map → chunk-QOL44BNJ.js.map} +1 -1
  104. package/dist/{chunk-CY3DKTBZ.js → chunk-RIXZISMX.js} +6 -1
  105. package/dist/{chunk-CY3DKTBZ.js.map → chunk-RIXZISMX.js.map} +1 -1
  106. package/dist/{chunk-S7MSBZ3F.js → chunk-TFEXYI6N.js} +6 -1
  107. package/dist/{chunk-S7MSBZ3F.js.map → chunk-TFEXYI6N.js.map} +1 -1
  108. package/dist/chunk-U56N5JCJ.js +19842 -0
  109. package/dist/chunk-U56N5JCJ.js.map +1 -0
  110. package/dist/{chunk-IHVZKQQW.js → chunk-UKUXNFQP.js} +6 -1
  111. package/dist/{chunk-IHVZKQQW.js.map → chunk-UKUXNFQP.js.map} +1 -1
  112. package/dist/{chunk-54ASKII6.js → chunk-VOYJQDSI.js} +6 -1
  113. package/dist/{chunk-54ASKII6.js.map → chunk-VOYJQDSI.js.map} +1 -1
  114. package/dist/{chunk-26NJXP55.js → chunk-WJH5K42V.js} +6 -2
  115. package/dist/{chunk-26NJXP55.js.map → chunk-WJH5K42V.js.map} +1 -1
  116. package/dist/{chunk-VP6V4XEJ.js → chunk-XD6A3VXB.js} +10 -5
  117. package/dist/{chunk-VP6V4XEJ.js.map → chunk-XD6A3VXB.js.map} +1 -1
  118. package/dist/{chunk-6PTUVG6A.js → chunk-XQRXQBDQ.js} +7 -1
  119. package/dist/{chunk-6PTUVG6A.js.map → chunk-XQRXQBDQ.js.map} +1 -1
  120. package/dist/{chunk-2AFWVHQK.js → chunk-XVL4FHXA.js} +6 -1
  121. package/dist/{chunk-2AFWVHQK.js.map → chunk-XVL4FHXA.js.map} +1 -1
  122. package/dist/{chunk-LAMTF4LX.js → chunk-ZIETAMAD.js} +6 -1
  123. package/dist/{chunk-LAMTF4LX.js.map → chunk-ZIETAMAD.js.map} +1 -1
  124. package/dist/cli/cache-command.d.ts +29 -0
  125. package/dist/cli/cache-command.d.ts.map +1 -0
  126. package/dist/cli/command-errors.d.ts +7 -0
  127. package/dist/cli/command-errors.d.ts.map +1 -0
  128. package/dist/cli/config-loader.d.ts +11 -0
  129. package/dist/cli/config-loader.d.ts.map +1 -0
  130. package/dist/cli/doctor-command.d.ts +64 -0
  131. package/dist/cli/doctor-command.d.ts.map +1 -0
  132. package/dist/cli/gen-types-command.d.ts +2 -0
  133. package/dist/cli/gen-types-command.d.ts.map +1 -0
  134. package/dist/cli/index.d.ts +2 -0
  135. package/dist/cli/index.d.ts.map +1 -0
  136. package/dist/cli/init-command.d.ts +7 -0
  137. package/dist/cli/init-command.d.ts.map +1 -0
  138. package/dist/cli/init-flow-command.d.ts +11 -0
  139. package/dist/cli/init-flow-command.d.ts.map +1 -0
  140. package/dist/cli/iteration.d.ts +44 -0
  141. package/dist/cli/iteration.d.ts.map +1 -0
  142. package/dist/cli/scaffolds.d.ts +13 -0
  143. package/dist/cli/scaffolds.d.ts.map +1 -0
  144. package/dist/cli/studio-command.d.ts +8 -0
  145. package/dist/cli/studio-command.d.ts.map +1 -0
  146. package/dist/cli/test-command.d.ts +61 -0
  147. package/dist/cli/test-command.d.ts.map +1 -0
  148. package/dist/cli/watch-mode.d.ts +9 -0
  149. package/dist/cli/watch-mode.d.ts.map +1 -0
  150. package/dist/cli.js +84 -28
  151. package/dist/cli.js.map +1 -1
  152. package/dist/cloud/browserstack.d.ts +9 -0
  153. package/dist/cloud/browserstack.d.ts.map +1 -0
  154. package/dist/cloud/common.d.ts +26 -0
  155. package/dist/cloud/common.d.ts.map +1 -0
  156. package/dist/cloud/provider.d.ts +21 -0
  157. package/dist/cloud/provider.d.ts.map +1 -0
  158. package/dist/cloud/saucelabs.d.ts +9 -0
  159. package/dist/cloud/saucelabs.d.ts.map +1 -0
  160. package/dist/{compiler-X6WTFMYF.js → compiler-44UW2FID.js} +7 -3
  161. package/dist/{compiler-X6WTFMYF.js.map → compiler-44UW2FID.js.map} +1 -1
  162. package/dist/config-loader-V26XXHPH.js +10 -0
  163. package/dist/{chunk-DGUM43GV.js.map → config-loader-V26XXHPH.js.map} +0 -0
  164. package/dist/{console-DIYEJSSP.js → console-T6TVZ65G.js} +8 -2
  165. package/dist/console-T6TVZ65G.js.map +1 -0
  166. package/dist/core/accessibility-audit.d.ts +29 -0
  167. package/dist/core/accessibility-audit.d.ts.map +1 -0
  168. package/dist/core/artifacts.d.ts +27 -0
  169. package/dist/core/artifacts.d.ts.map +1 -0
  170. package/dist/core/baseline-manager.d.ts +18 -0
  171. package/dist/core/baseline-manager.d.ts.map +1 -0
  172. package/dist/core/benchmark.d.ts +21 -0
  173. package/dist/core/benchmark.d.ts.map +1 -0
  174. package/dist/core/debug-repl.d.ts +17 -0
  175. package/dist/core/debug-repl.d.ts.map +1 -0
  176. package/dist/core/engine.d.ts +51 -0
  177. package/dist/core/engine.d.ts.map +1 -0
  178. package/dist/core/filters.d.ts +248 -0
  179. package/dist/core/filters.d.ts.map +1 -0
  180. package/dist/core/flow-generator.d.ts +13 -0
  181. package/dist/core/flow-generator.d.ts.map +1 -0
  182. package/dist/core/graphemes.d.ts +2 -0
  183. package/dist/core/graphemes.d.ts.map +1 -0
  184. package/dist/core/index.d.ts +6 -0
  185. package/dist/core/index.d.ts.map +1 -0
  186. package/dist/core/native-accel.d.ts +21 -0
  187. package/dist/core/native-accel.d.ts.map +1 -0
  188. package/dist/core/network-cache.d.ts +68 -0
  189. package/dist/core/network-cache.d.ts.map +1 -0
  190. package/dist/core/orchestrator.d.ts +44 -0
  191. package/dist/core/orchestrator.d.ts.map +1 -0
  192. package/dist/core/parallel.d.ts +42 -0
  193. package/dist/core/parallel.d.ts.map +1 -0
  194. package/dist/core/port-allocator.d.ts +16 -0
  195. package/dist/core/port-allocator.d.ts.map +1 -0
  196. package/dist/core/projects.d.ts +60 -0
  197. package/dist/core/projects.d.ts.map +1 -0
  198. package/dist/core/replay-cache.d.ts +127 -0
  199. package/dist/core/replay-cache.d.ts.map +1 -0
  200. package/dist/core/runner.d.ts +50 -0
  201. package/dist/core/runner.d.ts.map +1 -0
  202. package/dist/core/screenshot-compare.d.ts +50 -0
  203. package/dist/core/screenshot-compare.d.ts.map +1 -0
  204. package/dist/core/session-manager.d.ts +35 -0
  205. package/dist/core/session-manager.d.ts.map +1 -0
  206. package/dist/core/step-recorder.d.ts +20 -0
  207. package/dist/core/step-recorder.d.ts.map +1 -0
  208. package/dist/core/target-matrix.d.ts +29 -0
  209. package/dist/core/target-matrix.d.ts.map +1 -0
  210. package/dist/core/trace-viewer.d.ts +91 -0
  211. package/dist/core/trace-viewer.d.ts.map +1 -0
  212. package/dist/core/validator.d.ts +18 -0
  213. package/dist/core/validator.d.ts.map +1 -0
  214. package/dist/core/video-recorder.d.ts +120 -0
  215. package/dist/core/video-recorder.d.ts.map +1 -0
  216. package/dist/core/worker-pool.d.ts +87 -0
  217. package/dist/core/worker-pool.d.ts.map +1 -0
  218. package/dist/{daemon-manager-2EQDVUVM.js → daemon-manager-2SK5PHJR.js} +3 -3
  219. package/dist/{config-loader-CNGIW2XK.js.map → daemon-manager-2SK5PHJR.js.map} +0 -0
  220. package/dist/device/android.d.ts +66 -0
  221. package/dist/device/android.d.ts.map +1 -0
  222. package/dist/device/discover.d.ts +15 -0
  223. package/dist/device/discover.d.ts.map +1 -0
  224. package/dist/device/index.d.ts +4 -0
  225. package/dist/device/index.d.ts.map +1 -0
  226. package/dist/device/ios.d.ts +126 -0
  227. package/dist/device/ios.d.ts.map +1 -0
  228. package/dist/diagnostics/live-inspector.d.ts +121 -0
  229. package/dist/diagnostics/live-inspector.d.ts.map +1 -0
  230. package/dist/diagnostics/native-logs.d.ts +38 -0
  231. package/dist/diagnostics/native-logs.d.ts.map +1 -0
  232. package/dist/discover-43C3BE7I.js +15 -0
  233. package/dist/{daemon-manager-2EQDVUVM.js.map → discover-43C3BE7I.js.map} +0 -0
  234. package/dist/{doctor-command-6ZVJWCW7.js → doctor-command-CLKEEOAX.js} +14 -11
  235. package/dist/{doctor-command-6ZVJWCW7.js.map → doctor-command-CLKEEOAX.js.map} +1 -1
  236. package/dist/drivers/adapter-registry.d.ts +96 -0
  237. package/dist/drivers/adapter-registry.d.ts.map +1 -0
  238. package/dist/drivers/appium/android.d.ts +22 -0
  239. package/dist/drivers/appium/android.d.ts.map +1 -0
  240. package/dist/drivers/appium/client.d.ts +26 -0
  241. package/dist/drivers/appium/client.d.ts.map +1 -0
  242. package/dist/drivers/appium/ios.d.ts +28 -0
  243. package/dist/drivers/appium/ios.d.ts.map +1 -0
  244. package/dist/drivers/appium/window-size.d.ts +8 -0
  245. package/dist/drivers/appium/window-size.d.ts.map +1 -0
  246. package/dist/drivers/browser-extensions.d.ts +62 -0
  247. package/dist/drivers/browser-extensions.d.ts.map +1 -0
  248. package/dist/drivers/cdp-browser.d.ts +102 -0
  249. package/dist/drivers/cdp-browser.d.ts.map +1 -0
  250. package/dist/drivers/common/xml-tokenizer.d.ts +26 -0
  251. package/dist/drivers/common/xml-tokenizer.d.ts.map +1 -0
  252. package/dist/drivers/device-controls.d.ts +36 -0
  253. package/dist/drivers/device-controls.d.ts.map +1 -0
  254. package/dist/drivers/electrobun.d.ts +47 -0
  255. package/dist/drivers/electrobun.d.ts.map +1 -0
  256. package/dist/drivers/electron.d.ts +36 -0
  257. package/dist/drivers/electron.d.ts.map +1 -0
  258. package/dist/drivers/index.d.ts +2 -0
  259. package/dist/drivers/index.d.ts.map +1 -0
  260. package/dist/drivers/launch-options.d.ts +10 -0
  261. package/dist/drivers/launch-options.d.ts.map +1 -0
  262. package/dist/drivers/network-profiles.d.ts +9 -0
  263. package/dist/drivers/network-profiles.d.ts.map +1 -0
  264. package/dist/drivers/playwright-parser.d.ts +16 -0
  265. package/dist/drivers/playwright-parser.d.ts.map +1 -0
  266. package/dist/drivers/playwright.d.ts +69 -0
  267. package/dist/drivers/playwright.d.ts.map +1 -0
  268. package/dist/drivers/raw-driver.d.ts +399 -0
  269. package/dist/drivers/raw-driver.d.ts.map +1 -0
  270. package/dist/drivers/uiautomator2/client.d.ts +77 -0
  271. package/dist/drivers/uiautomator2/client.d.ts.map +1 -0
  272. package/dist/drivers/uiautomator2/driver.d.ts +20 -0
  273. package/dist/drivers/uiautomator2/driver.d.ts.map +1 -0
  274. package/dist/drivers/uiautomator2/index.d.ts +5 -0
  275. package/dist/drivers/uiautomator2/index.d.ts.map +1 -0
  276. package/dist/drivers/uiautomator2/installer.d.ts +20 -0
  277. package/dist/drivers/uiautomator2/installer.d.ts.map +1 -0
  278. package/dist/drivers/uiautomator2/pagesource.d.ts +12 -0
  279. package/dist/drivers/uiautomator2/pagesource.d.ts.map +1 -0
  280. package/dist/drivers/wda/client.d.ts +116 -0
  281. package/dist/drivers/wda/client.d.ts.map +1 -0
  282. package/dist/drivers/wda/driver.d.ts +26 -0
  283. package/dist/drivers/wda/driver.d.ts.map +1 -0
  284. package/dist/drivers/wda/index.d.ts +5 -0
  285. package/dist/drivers/wda/index.d.ts.map +1 -0
  286. package/dist/drivers/wda/installer.d.ts +51 -0
  287. package/dist/drivers/wda/installer.d.ts.map +1 -0
  288. package/dist/drivers/wda/pagesource.d.ts +12 -0
  289. package/dist/drivers/wda/pagesource.d.ts.map +1 -0
  290. package/dist/errors.d.ts +82 -0
  291. package/dist/errors.d.ts.map +1 -0
  292. package/dist/{filters-MQG2RMPX.js → filters-5DCGGJRN.js} +3 -3
  293. package/dist/{discover-NKDMB4UI.js.map → filters-5DCGGJRN.js.map} +0 -0
  294. package/dist/gherkin/compiler.d.ts +3 -0
  295. package/dist/gherkin/compiler.d.ts.map +1 -0
  296. package/dist/gherkin/index.d.ts +7 -0
  297. package/dist/gherkin/index.d.ts.map +1 -0
  298. package/dist/gherkin/matcher.d.ts +9 -0
  299. package/dist/gherkin/matcher.d.ts.map +1 -0
  300. package/dist/gherkin/registry.d.ts +28 -0
  301. package/dist/gherkin/registry.d.ts.map +1 -0
  302. package/dist/gherkin/steps.d.ts +13 -31
  303. package/dist/gherkin/steps.d.ts.map +1 -0
  304. package/dist/gherkin/steps.js +5 -2
  305. package/dist/gherkin/steps.js.map +1 -1
  306. package/dist/gherkin/world.d.ts +15 -0
  307. package/dist/gherkin/world.d.ts.map +1 -0
  308. package/dist/{github-pr-YMWIPCCZ.js → github-pr-RYO6IAKD.js} +3 -3
  309. package/dist/{filters-MQG2RMPX.js.map → github-pr-RYO6IAKD.js.map} +0 -0
  310. package/dist/{html-FLMWPFQD.js → html-KJ2QAGF4.js} +6 -3
  311. package/dist/{html-FLMWPFQD.js.map → html-KJ2QAGF4.js.map} +1 -1
  312. package/dist/index.d.ts +54 -2267
  313. package/dist/index.d.ts.map +1 -0
  314. package/dist/index.js +74 -30
  315. package/dist/index.js.map +1 -1
  316. package/dist/{init-command-Z3QREABL.js → init-command-V5VGN3IS.js} +5 -2
  317. package/dist/{init-command-Z3QREABL.js.map → init-command-V5VGN3IS.js.map} +1 -1
  318. package/dist/{init-flow-command-4EKRVTNT.js → init-flow-command-INYUCC6N.js} +6 -3
  319. package/dist/{init-flow-command-4EKRVTNT.js.map → init-flow-command-INYUCC6N.js.map} +1 -1
  320. package/dist/{installer-5UHTYQTB.js → installer-DMTY47SI.js} +5 -5
  321. package/dist/{github-pr-YMWIPCCZ.js.map → installer-DMTY47SI.js.map} +0 -0
  322. package/dist/{ios-Y4TO5MBR.js → ios-SZ4RBI7Q.js} +4 -4
  323. package/dist/{installer-5UHTYQTB.js.map → ios-SZ4RBI7Q.js.map} +0 -0
  324. package/dist/json-57Z2YSES.js +39 -0
  325. package/dist/json-57Z2YSES.js.map +1 -0
  326. package/dist/{junit-CGB3LKHD.js → junit-MHD5AXBU.js} +26 -6
  327. package/dist/junit-MHD5AXBU.js.map +1 -0
  328. package/dist/{local-DM3YBSV5.js → local-RH5EFGYF.js} +12 -12
  329. package/dist/{ios-Y4TO5MBR.js.map → local-RH5EFGYF.js.map} +0 -0
  330. package/dist/{machine-6H25TRTU.js → machine-NOOFRT45.js} +3 -3
  331. package/dist/{local-DM3YBSV5.js.map → machine-NOOFRT45.js.map} +0 -0
  332. package/dist/machine.d.ts +20 -0
  333. package/dist/machine.d.ts.map +1 -0
  334. package/dist/mcp/server.d.ts +73 -0
  335. package/dist/mcp/server.d.ts.map +1 -0
  336. package/dist/{provider-YIPU5K42.js → provider-CBAXZ2VA.js} +3 -3
  337. package/dist/{machine-6H25TRTU.js.map → provider-CBAXZ2VA.js.map} +0 -0
  338. package/dist/{redact-U72BUBBR.js → redact-OG4M3IEU.js} +5 -2
  339. package/dist/{redact-U72BUBBR.js.map → redact-OG4M3IEU.js.map} +1 -1
  340. package/dist/report/allure.d.ts +3 -0
  341. package/dist/report/allure.d.ts.map +1 -0
  342. package/dist/report/classify-error.d.ts +7 -0
  343. package/dist/report/classify-error.d.ts.map +1 -0
  344. package/dist/report/code-frame.d.ts +16 -0
  345. package/dist/report/code-frame.d.ts.map +1 -0
  346. package/dist/report/console.d.ts +7 -0
  347. package/dist/report/console.d.ts.map +1 -0
  348. package/dist/report/failure-bundle.d.ts +66 -0
  349. package/dist/report/failure-bundle.d.ts.map +1 -0
  350. package/dist/report/failure-diagnostics.d.ts +11 -0
  351. package/dist/report/failure-diagnostics.d.ts.map +1 -0
  352. package/dist/report/github-pr.d.ts +20 -0
  353. package/dist/report/github-pr.d.ts.map +1 -0
  354. package/dist/report/html.d.ts +3 -0
  355. package/dist/report/html.d.ts.map +1 -0
  356. package/dist/report/index.d.ts +8 -0
  357. package/dist/report/index.d.ts.map +1 -0
  358. package/dist/report/json.d.ts +3 -0
  359. package/dist/report/json.d.ts.map +1 -0
  360. package/dist/report/junit.d.ts +3 -0
  361. package/dist/report/junit.d.ts.map +1 -0
  362. package/dist/report/redact.d.ts +29 -0
  363. package/dist/report/redact.d.ts.map +1 -0
  364. package/dist/report/selector-guardrails.d.ts +12 -0
  365. package/dist/report/selector-guardrails.d.ts.map +1 -0
  366. package/dist/report/types.d.ts +164 -0
  367. package/dist/report/types.d.ts.map +1 -0
  368. package/dist/{runner-WOVZWUQR.js → runner-ABGUVOJG.js} +5 -3
  369. package/dist/{provider-YIPU5K42.js.map → runner-ABGUVOJG.js.map} +0 -0
  370. package/dist/runtime/appium-server.d.ts +34 -0
  371. package/dist/runtime/appium-server.d.ts.map +1 -0
  372. package/dist/runtime/appium.d.ts +5 -0
  373. package/dist/runtime/appium.d.ts.map +1 -0
  374. package/dist/runtime/capabilities.d.ts +19 -0
  375. package/dist/runtime/capabilities.d.ts.map +1 -0
  376. package/dist/runtime/daemon-manager.d.ts +83 -0
  377. package/dist/runtime/daemon-manager.d.ts.map +1 -0
  378. package/dist/runtime/local.d.ts +38 -0
  379. package/dist/runtime/local.d.ts.map +1 -0
  380. package/dist/runtime/types.d.ts +21 -0
  381. package/dist/runtime/types.d.ts.map +1 -0
  382. package/dist/runtime/web-server.d.ts +57 -0
  383. package/dist/runtime/web-server.d.ts.map +1 -0
  384. package/dist/schemas/config.d.ts +780 -0
  385. package/dist/schemas/config.d.ts.map +1 -0
  386. package/dist/schemas/device.d.ts +12 -0
  387. package/dist/schemas/device.d.ts.map +1 -0
  388. package/dist/schemas/element.d.ts +66 -0
  389. package/dist/schemas/element.d.ts.map +1 -0
  390. package/dist/schemas/index.d.ts +5 -0
  391. package/dist/schemas/index.d.ts.map +1 -0
  392. package/dist/schemas/selector.d.ts +193 -0
  393. package/dist/schemas/selector.d.ts.map +1 -0
  394. package/dist/screenshot-compare-V4JQG73R.js +2410 -0
  395. package/dist/screenshot-compare-V4JQG73R.js.map +1 -0
  396. package/dist/server-D45AO34E.js +6731 -0
  397. package/dist/server-D45AO34E.js.map +1 -0
  398. package/dist/{server-ING5D5ZJ.js → server-KLZBJOMQ.js} +3 -3
  399. package/dist/{runner-WOVZWUQR.js.map → server-KLZBJOMQ.js.map} +0 -0
  400. package/dist/session-N6DEYVPM.js +21 -0
  401. package/dist/{server-ING5D5ZJ.js.map → session-N6DEYVPM.js.map} +0 -0
  402. package/dist/smart/auto-wait.d.ts +38 -0
  403. package/dist/smart/auto-wait.d.ts.map +1 -0
  404. package/dist/smart/channel-resolver.d.ts +90 -0
  405. package/dist/smart/channel-resolver.d.ts.map +1 -0
  406. package/dist/smart/coordinator.d.ts +162 -0
  407. package/dist/smart/coordinator.d.ts.map +1 -0
  408. package/dist/smart/diagnostics.d.ts +15 -0
  409. package/dist/smart/diagnostics.d.ts.map +1 -0
  410. package/dist/smart/element-matcher.d.ts +24 -0
  411. package/dist/smart/element-matcher.d.ts.map +1 -0
  412. package/dist/smart/hierarchy-cache.d.ts +16 -0
  413. package/dist/smart/hierarchy-cache.d.ts.map +1 -0
  414. package/dist/smart/index.d.ts +4 -0
  415. package/dist/smart/index.d.ts.map +1 -0
  416. package/dist/studio/api.d.ts +317 -0
  417. package/dist/studio/api.d.ts.map +1 -0
  418. package/dist/studio/context.d.ts +7 -0
  419. package/dist/studio/context.d.ts.map +1 -0
  420. package/dist/studio/core/element-tree.d.ts +15 -0
  421. package/dist/studio/core/element-tree.d.ts.map +1 -0
  422. package/dist/studio/effect-handler.d.ts +3 -0
  423. package/dist/studio/effect-handler.d.ts.map +1 -0
  424. package/dist/studio/procedures.d.ts +4 -0
  425. package/dist/studio/procedures.d.ts.map +1 -0
  426. package/dist/studio/recording-session.d.ts +31 -0
  427. package/dist/studio/recording-session.d.ts.map +1 -0
  428. package/dist/studio/routers/devices.d.ts +11 -0
  429. package/dist/studio/routers/devices.d.ts.map +1 -0
  430. package/dist/studio/routers/inspector.d.ts +104 -0
  431. package/dist/studio/routers/inspector.d.ts.map +1 -0
  432. package/dist/studio/routers/recording.d.ts +130 -0
  433. package/dist/studio/routers/recording.d.ts.map +1 -0
  434. package/dist/studio/routers/tests.d.ts +93 -0
  435. package/dist/studio/routers/tests.d.ts.map +1 -0
  436. package/dist/studio/server.d.ts +12 -0
  437. package/dist/studio/server.d.ts.map +1 -0
  438. package/dist/{studio-command-KK7A3KN6.js → studio-command-TNSJGTFA.js} +6 -3
  439. package/dist/{studio-command-KK7A3KN6.js.map → studio-command-TNSJGTFA.js.map} +1 -1
  440. package/dist/{test-command-QGIJBRH7.js → test-command-EXPYFDTF.js} +283 -74
  441. package/dist/test-command-EXPYFDTF.js.map +1 -0
  442. package/dist/{validator-WO5IL7IY.js → validator-AJNOFBQM.js} +4 -4
  443. package/dist/{session-5TNWVGQQ.js.map → validator-AJNOFBQM.js.map} +0 -0
  444. package/native/darwin-arm64/libspana_native.dylib +0 -0
  445. package/native/darwin-x64/libspana_native.dylib +0 -0
  446. package/native/linux-arm64/libspana_native.so +0 -0
  447. package/native/linux-x64/libspana_native.so +0 -0
  448. package/native/win32-x64/spana_native.dll +0 -0
  449. package/package.json +15 -18
  450. package/studio-dist/assets/index-CHLA4F7b.css +2 -0
  451. package/studio-dist/assets/index-DXGUfzm3.js +23 -0
  452. package/studio-dist/index.html +2 -2
  453. package/dist/accessibility-audit-YZOPUY3D.js.map +0 -1
  454. package/dist/app-RSDPDTKT.js +0 -10
  455. package/dist/chunk-3IZMPNE7.js.map +0 -1
  456. package/dist/chunk-4KK4E3N3.js.map +0 -1
  457. package/dist/chunk-64UZQP7Z.js.map +0 -1
  458. package/dist/chunk-DGUM43GV.js +0 -11
  459. package/dist/chunk-FPQAJNE3.js.map +0 -1
  460. package/dist/chunk-FXBWACUT.js.map +0 -1
  461. package/dist/chunk-SGZMO456.js.map +0 -1
  462. package/dist/chunk-WS2TVNMY.js.map +0 -1
  463. package/dist/chunk-X2TJP7LB.js.map +0 -1
  464. package/dist/chunk-XA6LWLZQ.js +0 -310
  465. package/dist/chunk-XA6LWLZQ.js.map +0 -1
  466. package/dist/chunk-Z6K4QQAR.js.map +0 -1
  467. package/dist/config-loader-CNGIW2XK.js +0 -9
  468. package/dist/console-DIYEJSSP.js.map +0 -1
  469. package/dist/discover-NKDMB4UI.js +0 -15
  470. package/dist/flow-DddAj1xv.d.ts +0 -1913
  471. package/dist/json-JMRPUVY2.js +0 -20
  472. package/dist/json-JMRPUVY2.js.map +0 -1
  473. package/dist/junit-CGB3LKHD.js.map +0 -1
  474. package/dist/screenshot-compare-POTXVUTL.js +0 -136
  475. package/dist/screenshot-compare-POTXVUTL.js.map +0 -1
  476. package/dist/server-JNQ2PLCC.js +0 -855
  477. package/dist/server-JNQ2PLCC.js.map +0 -1
  478. package/dist/session-5TNWVGQQ.js +0 -21
  479. package/dist/test-command-QGIJBRH7.js.map +0 -1
  480. package/dist/validator-WO5IL7IY.js.map +0 -1
  481. package/studio-dist/assets/index-CBFsOh-9.js +0 -193
  482. package/studio-dist/assets/index-DH_18EyL.css +0 -1
@@ -1,1913 +0,0 @@
1
- import { Schema, Effect } from 'effect';
2
-
3
- type Platform = "android" | "ios" | "web" | "electron" | "electrobun";
4
- type TapMode = "native" | "dom";
5
- /**
6
- * Composable narrowing / scoping modifiers supported on any object selector.
7
- * Mirrors Playwright's locator composition (`locator(a).locator(b)`, `.nth()`, `.first()`,
8
- * `.filter({ hasText })`, `frameLocator(...)`) in plain serializable selector objects.
9
- */
10
- interface SelectorModifiers<T extends string = string> {
11
- /** Scope search inside elements matching this parent selector (`locator(parent).locator(child)`). */
12
- within?: Selector<T>;
13
- /** Scope search inside an `<iframe>` matching this selector (`frameLocator(frame)`). */
14
- frame?: Selector<T>;
15
- /** Keep only matches whose text contains this string or matches this RegExp (`.filter({ hasText })`). */
16
- hasText?: string | RegExp;
17
- /** Exclude matches whose text contains this string or matches this RegExp (`.filter({ hasNotText })`). */
18
- hasNotText?: string | RegExp;
19
- /** Keep only matches containing a descendant matching this selector (`.filter({ has })`). */
20
- has?: Selector<T>;
21
- /** Exclude matches containing a descendant matching this selector (`.filter({ hasNot })`). */
22
- hasNot?: Selector<T>;
23
- /** Select the 0-based Nth match (negative values count from the end, e.g. `-1` for last). */
24
- nth?: number;
25
- /** Shorthand for `nth: 0` (`.first()`). */
26
- first?: boolean;
27
- /** Shorthand for `nth: -1` (`.last()`). */
28
- last?: boolean;
29
- }
30
- type ObjectSelector<T extends string = string> = ({
31
- testID: T;
32
- } & SelectorModifiers<T>) | ({
33
- text: string;
34
- systemUI?: boolean;
35
- exact?: boolean;
36
- } & SelectorModifiers<T>) | ({
37
- accessibilityLabel: string;
38
- systemUI?: boolean;
39
- } & SelectorModifiers<T>) | ({
40
- role: string;
41
- name?: string | RegExp;
42
- exact?: boolean;
43
- level?: number;
44
- includeHidden?: boolean;
45
- } & SelectorModifiers<T>) | ({
46
- css: string;
47
- } & SelectorModifiers<T>) | ({
48
- anyOf: Selector<T>[];
49
- } & SelectorModifiers<T>) | {
50
- point: {
51
- x: number;
52
- y: number;
53
- };
54
- };
55
- /**
56
- * Selector types. Generic parameter `T` lets projects pin a union of known
57
- * testIDs so `{ testID: "bogus-id" }` becomes a type error.
58
- *
59
- * Supports composable Playwright-grade locators:
60
- * - `{ testID: "submit" }`
61
- * - `{ role: "button", name: /save/i }`
62
- * - `{ css: "form.checkout input[name='email']" }`
63
- * - `{ text: "Continue" }` / `{ accessibilityLabel: "Close" }`
64
- * - Modifiers: `within`, `frame`, `hasText`, `hasNotText`, `nth`, `first`, `last`
65
- * - Helpers: `byRole()`, `byCss()`, `within()`, `inFrame()`, `nth()`, `first()`, `last()`, `filterSelector()`
66
- *
67
- * Use `systemUI: true` (or the `systemUI(...)` helper) on `{ text }` /
68
- * `{ accessibilityLabel }` selectors that intentionally target out-of-process
69
- * OS UI (SFSafariViewController, ASWebAuthenticationSession, Chrome Custom Tabs,
70
- * permission dialogs) where DOM `data-testid` cannot reach.
71
- */
72
- type Selector<T extends string = string> = T | ObjectSelector<T>;
73
- /** Relative selector — find element relative to an anchor element's position. */
74
- interface RelativeSelector<T extends string = string> {
75
- selector: Selector<T>;
76
- below?: Selector<T>;
77
- above?: Selector<T>;
78
- leftOf?: Selector<T>;
79
- rightOf?: Selector<T>;
80
- childOf?: Selector<T>;
81
- }
82
- /** Extended selector that supports both simple and relative selectors. */
83
- type ExtendedSelector<T extends string = string> = Selector<T> | RelativeSelector<T>;
84
- /** Build an ARIA role selector (`getByRole(role, { name, exact, level, includeHidden })` or shorthand `byRole(role, name, opts)`). */
85
- declare function byRole<T extends string = string>(role: string, opts?: {
86
- name?: string | RegExp;
87
- exact?: boolean;
88
- level?: number;
89
- includeHidden?: boolean;
90
- } & SelectorModifiers<T>): ObjectSelector<T>;
91
- declare function byRole<T extends string = string>(role: string, name: string | RegExp, opts?: {
92
- exact?: boolean;
93
- level?: number;
94
- includeHidden?: boolean;
95
- } & SelectorModifiers<T>): ObjectSelector<T>;
96
- /** Build a CSS selector (`locator(css)`), piercing Shadow DOM and same-origin iframes. */
97
- declare function byCss<T extends string = string>(css: string, opts?: SelectorModifiers<T>): ObjectSelector<T>;
98
- /** Match elements satisfying ANY of the provided selectors (Playwright `locatorA.or(locatorB)`). */
99
- declare function or<T extends string = string>(...selectors: Selector<T>[]): ObjectSelector<T>;
100
- /** Scope `child` inside elements matching `parent` (`locator(parent).locator(child)`). */
101
- declare function within<T extends string = string>(parent: Selector<T>, child: Selector<T>): ObjectSelector<T>;
102
- /** Scope `child` inside an `<iframe>` matching `frame` (`frameLocator(frame).locator(child)`). */
103
- declare function inFrame<T extends string = string>(frame: Selector<T>, child: Selector<T>): ObjectSelector<T>;
104
- /** Narrow a selector to the 0-based `index`-th match (negative counts from the end). */
105
- declare function nth<T extends string = string>(sel: Selector<T>, index: number): ObjectSelector<T>;
106
- /** Narrow a selector to its first match (`.first()`). */
107
- declare function first<T extends string = string>(sel: Selector<T>): ObjectSelector<T>;
108
- /** Narrow a selector to its last match (`.last()`). */
109
- declare function last<T extends string = string>(sel: Selector<T>): ObjectSelector<T>;
110
- /** Filter a selector's matches by text or descendant selector (`locator.filter({ hasText, hasNotText, has, hasNot })`). */
111
- declare function filterSelector<T extends string = string>(sel: Selector<T>, filter: {
112
- hasText?: string | RegExp;
113
- hasNotText?: string | RegExp;
114
- has?: Selector<NoInfer<T>>;
115
- hasNot?: Selector<NoInfer<T>>;
116
- }): ObjectSelector<T>;
117
- /**
118
- * Marks a label/text selector as targeting out-of-process system UI
119
- * (e.g. SFSafariViewController, ASWebAuthenticationSession, Chrome Custom Tabs,
120
- * OS permission alerts). Skips the DOM channel and suppresses brittle-text warnings.
121
- */
122
- declare function systemUI(selector: {
123
- text: string;
124
- } | {
125
- accessibilityLabel: string;
126
- }): {
127
- text: string;
128
- systemUI: true;
129
- } | {
130
- accessibilityLabel: string;
131
- systemUI: true;
132
- };
133
- declare function isSystemUISelector<T extends string = string>(sel: ExtendedSelector<T>): boolean;
134
- declare function isTestIDSelector<T extends string = string>(sel: ExtendedSelector<T>): sel is {
135
- testID: T;
136
- };
137
- /** True when a selector uses web/DOM-specific composition (role, css, anyOf, within, frame, nth, filter). */
138
- declare function isComposableDomSelector<T extends string = string>(sel: ExtendedSelector<T>): boolean;
139
-
140
- declare const DriverError_base: Schema.TaggedErrorClass<DriverError, "DriverError", {
141
- readonly _tag: Schema.tag<"DriverError">;
142
- } & {
143
- message: typeof Schema.String;
144
- command: Schema.optional<typeof Schema.String>;
145
- exitCode: Schema.optional<typeof Schema.Number>;
146
- stdout: Schema.optional<typeof Schema.String>;
147
- stderr: Schema.optional<typeof Schema.String>;
148
- }>;
149
- declare class DriverError extends DriverError_base {
150
- }
151
-
152
- declare const DeviceInfo: Schema.Struct<{
153
- platform: Schema.Literal<["android", "ios", "web", "electron", "electrobun"]>;
154
- deviceId: typeof Schema.String;
155
- name: typeof Schema.String;
156
- isEmulator: typeof Schema.Boolean;
157
- screenWidth: typeof Schema.Number;
158
- screenHeight: typeof Schema.Number;
159
- driverType: Schema.Literal<["playwright", "uiautomator2", "wda", "appium", "electron", "electrobun"]>;
160
- }>;
161
- type DeviceInfo = typeof DeviceInfo.Type;
162
-
163
- type DomChannelKind = "bridge" | "cdp" | "webkit-inspector" | "playwright" | "bidi";
164
- interface DomRect {
165
- x: number;
166
- y: number;
167
- width: number;
168
- height: number;
169
- }
170
- interface DomElementMatch {
171
- id?: string;
172
- tag?: string;
173
- role?: string;
174
- text?: string;
175
- /** Whitespace-normalized `el.textContent` (immune to CSS `text-transform`, Playwright parity). */
176
- textContent?: string;
177
- value?: string;
178
- accessibilityLabel?: string;
179
- accessibleName?: string;
180
- accessibleDescription?: string;
181
- rect: DomRect;
182
- scrollX: number;
183
- scrollY: number;
184
- devicePixelRatio: number;
185
- viewportWidth: number;
186
- viewportHeight: number;
187
- visible: boolean;
188
- enabled: boolean;
189
- clickable: boolean;
190
- focused?: boolean;
191
- checked?: boolean;
192
- editable?: boolean;
193
- empty?: boolean;
194
- className?: string;
195
- attributes?: Record<string, string>;
196
- /** True when the matched element lives inside a ShadowRoot */
197
- inShadowDom?: boolean;
198
- /** True when the matched element lives inside a same-origin iframe */
199
- inIframe?: boolean;
200
- }
201
- interface DomIdleOptions {
202
- /** Max time to wait for idle in ms. Default: 5000. */
203
- timeout?: number;
204
- /** Quiet window after network/DOM/animations settle in ms. Default: 50. */
205
- quietPeriodMs?: number;
206
- }
207
- interface DomWaitForSelectorOptions {
208
- /** Max time to wait in ms. Default: 5000. */
209
- timeoutMs?: number;
210
- /** Require the matched element to be visible, enabled, unobstructed, and stable for pointer actions. */
211
- forAction?: boolean;
212
- /** Fail early once the DOM stays quiet and document.readyState === "complete". */
213
- failFastWhenIdle?: boolean;
214
- /** Quiet window in ms before failFastWhenIdle resolves empty. Default: 250. */
215
- idleQuietMs?: number;
216
- /** Consecutive requestAnimationFrame frames the bounding box must remain stable (≤ 1px) when `forAction: true`. Default: 2 (0 when instantAnimations active). */
217
- stableFrames?: number;
218
- /** Verify center point via deep `elementFromPoint` (piercing Shadow DOM & iframes) when `forAction: true`. Default: true. */
219
- checkHitTest?: boolean;
220
- /** Respect app-owned `window.__SPANA_APP_READY__` signal when defined. Default: true. */
221
- waitForAppReady?: boolean;
222
- }
223
- interface DomWaitForHiddenOptions {
224
- /** Max time to wait in ms. Default: 5000. */
225
- timeoutMs?: number;
226
- }
227
- interface DomWaitForMatchOptions {
228
- /** Max time to wait in ms. Default: 5000. */
229
- timeoutMs?: number;
230
- /** Assertion kind evaluated reactively inside the page via MutationObserver. */
231
- kind: "text" | "containsText" | "matchesText" | "value" | "attribute" | "accessibilityLabel" | "accessibleName" | "accessibleDescription" | "focused" | "checked" | "class" | "css" | "editable" | "empty" | "count" | "url" | "title";
232
- /** Expected value/substring (optional when `kind === "attribute"` or `"accessibilityLabel"` checks presence). */
233
- expected?: string;
234
- /** Expected element count when `kind === "count"`. */
235
- expectedCount?: number;
236
- /** Attribute name when `kind === "attribute"`. */
237
- attributeName?: string;
238
- /** CSS property name when `kind === "css"`. */
239
- cssProperty?: string;
240
- /** RegExp source when `kind === "matchesText" | "accessibleName" | "accessibleDescription" | "class" | "css" | "url" | "title"`. */
241
- patternSource?: string;
242
- /** RegExp flags when `kind === "matchesText" | "accessibleName" | "accessibleDescription" | "class" | "css" | "url" | "title"`. */
243
- patternFlags?: string;
244
- /** Invert the match condition (`expect(...).not.*`). */
245
- negate?: boolean;
246
- }
247
- interface DomFillOptions {
248
- /** Max time to wait for an editable actionable target in ms. Default: 5000. */
249
- timeoutMs?: number;
250
- /** Verify center point via deep `elementFromPoint` before filling. Default: true. */
251
- checkHitTest?: boolean;
252
- }
253
- interface DomWaitForMatchResult {
254
- matched: boolean;
255
- actual?: string;
256
- }
257
- interface DomStorageEntries {
258
- localStorage?: Record<string, string>;
259
- sessionStorage?: Record<string, string>;
260
- cookies?: Array<{
261
- name: string;
262
- value: string;
263
- path?: string;
264
- domain?: string;
265
- }>;
266
- capacitorPreferences?: Record<string, string>;
267
- }
268
- interface DomClearStorageOptions {
269
- localStorage?: boolean;
270
- sessionStorage?: boolean;
271
- cookies?: boolean;
272
- indexedDB?: boolean;
273
- capacitorPreferences?: boolean;
274
- }
275
- interface DomTargetInfo {
276
- id: string;
277
- title?: string;
278
- url?: string;
279
- type?: string;
280
- }
281
- /**
282
- * Unified DOM channel interface shared across:
283
- * - `spana-bridge` (in-app WebSocket bridge, same JS on all 5 targets)
284
- * - Android WebView CDP (`adb forward localabstract:webview_devtools_remote_<pid>`)
285
- * - iOS WKWebView WebKit Remote Inspector (`isInspectable = true`)
286
- * - Electron / Electrobun CDP or WebKit Inspector
287
- */
288
- interface DomChannel {
289
- readonly kind: DomChannelKind;
290
- isConnected(): boolean;
291
- connect(): Promise<void>;
292
- disconnect(): Promise<void>;
293
- evaluate<T = unknown>(script: string | ((...args: any[]) => T), ...args: any[]): Promise<T>;
294
- query(selector: Selector): Promise<DomElementMatch[]>;
295
- /** MutationObserver-reactive DOM wait: resolves immediately when a matching visible element mounts & is actionable. */
296
- waitForSelector?(selector: Selector, opts?: DomWaitForSelectorOptions): Promise<DomElementMatch[]>;
297
- /** MutationObserver-reactive wait until no matching visible element remains. */
298
- waitForHidden?(selector: Selector, opts?: DomWaitForHiddenOptions): Promise<boolean>;
299
- /** MutationObserver-reactive wait until text/value/attribute matches (zero runner-side polling). */
300
- waitForMatch?(selector: Selector, opts: DomWaitForMatchOptions): Promise<DomWaitForMatchResult>;
301
- /** Atomic 1-round-trip actionability wait + focus + React/Vue-safe value fill + input/change dispatch. */
302
- fillDom?(selector: Selector, value: string, opts?: DomFillOptions): Promise<boolean>;
303
- tapDom(selector: Selector): Promise<boolean>;
304
- /** Scroll a DOM element into the viewport center and return its updated bounding rect. */
305
- scrollIntoView?(selector: Selector): Promise<DomElementMatch | null>;
306
- dispatch?(selector: Selector, eventType: string, eventInit?: Record<string, unknown>): Promise<boolean>;
307
- waitForIdle?(opts?: DomIdleOptions): Promise<void>;
308
- setStorage?(entries: DomStorageEntries): Promise<void>;
309
- clearStorage?(opts?: DomClearStorageOptions): Promise<void>;
310
- reload?(): Promise<void>;
311
- mockNetwork?(matcher: BrowserRouteMatcher, response: BrowserMockResponse): Promise<void>;
312
- blockNetwork?(matcher: BrowserRouteMatcher): Promise<void>;
313
- clearNetworkMocks?(): Promise<void>;
314
- getConsoleLogs?(): Promise<BrowserConsoleLog[]>;
315
- getJSErrors?(): Promise<BrowserJSError[]>;
316
- listTargets?(): Promise<DomTargetInfo[]>;
317
- selectTarget?(targetId: string): Promise<void>;
318
- }
319
- declare function buildDomWaitForSelectorScript(selector: Selector, opts?: DomWaitForSelectorOptions): string;
320
- /**
321
- * Self-contained MutationObserver-reactive script that resolves `true` as soon as
322
- * no visible matching element exists in the DOM (zero runner-side polling).
323
- */
324
- declare function buildDomWaitForHiddenScript(selector: Selector, opts?: DomWaitForHiddenOptions): string;
325
- /**
326
- * Self-contained MutationObserver-reactive assertion wait script for text,
327
- * substring text, input value, and DOM attribute assertions — runs completely
328
- * in-page with zero runner-side polling ticks.
329
- */
330
- declare function buildDomWaitForMatchScript(selector: Selector, opts: DomWaitForMatchOptions): string;
331
- /**
332
- * Atomic 1-round-trip in-page fill script: waits for an editable target to be visible,
333
- * enabled, in-viewport, and unobstructed, then focuses it, sets the value via the native
334
- * HTMLInputElement/HTMLTextAreaElement prototype setter (React/Vue/Svelte compatible),
335
- * and dispatches `input` + `change` events.
336
- */
337
- declare function buildDomFillScript(selector: Selector, value: string, opts?: DomFillOptions): string;
338
- /**
339
- * Persistent in-page Spana DOM runtime installed ONCE per document via
340
- * `Page.addScriptToEvaluateOnNewDocument` (or lazily on first call).
341
- * Cuts per-action CDP `Runtime.evaluate` payload by ~100× (~8 KB → ~70 bytes)
342
- * and lets V8 TurboFan JIT-compile the selector & actionability helpers once.
343
- */
344
- declare const SPANA_INJECTED_RUNTIME_SCRIPT = "(function() {\n if (typeof window === \"undefined\" || window.__spanaRt) return true;\n \n function matchSpec(actual, spec, exact) {\n var str = String(actual || \"\");\n if (spec && typeof spec === \"object\" && typeof spec.__spanaRegex === \"string\") {\n try { return new RegExp(spec.__spanaRegex, spec.flags || \"\").test(str); } catch (e) { return false; }\n }\n var needle = String(spec == null ? \"\" : spec);\n if (exact) return str.trim() === needle.trim();\n return str.toLowerCase().indexOf(needle.toLowerCase()) !== -1;\n }\n function getImplicitRole(el) {\n if (!el || !el.getAttribute) return \"\";\n var explicit = (el.getAttribute(\"role\") || \"\").trim().toLowerCase();\n if (explicit) return explicit.split(/\\s+/)[0] || \"\";\n var tag = el.tagName ? el.tagName.toUpperCase() : \"\";\n if (tag === \"BUTTON\") return \"button\";\n if (tag === \"A\") return el.hasAttribute(\"href\") ? \"link\" : \"\";\n if (tag === \"TEXTAREA\") return \"textbox\";\n if (tag === \"SELECT\") return (el.hasAttribute(\"multiple\") || Number(el.getAttribute(\"size\") || 0) > 1) ? \"listbox\" : \"combobox\";\n if (tag === \"OPTION\") return \"option\";\n if (tag === \"IMG\") return el.getAttribute(\"alt\") === \"\" ? \"presentation\" : \"img\";\n if (tag === \"DIALOG\") return \"dialog\";\n if (tag === \"NAV\") return \"navigation\";\n if (tag === \"MAIN\") return \"main\";\n if (tag === \"HEADER\") return \"banner\";\n if (tag === \"FOOTER\") return \"contentinfo\";\n if (tag === \"ASIDE\") return \"complementary\";\n if (tag === \"UL\" || tag === \"OL\") return \"list\";\n if (tag === \"LI\") return \"listitem\";\n if (tag === \"TABLE\") return \"table\";\n if (tag === \"TR\") return \"row\";\n if (tag === \"TD\") return \"cell\";\n if (tag === \"TH\") return \"columnheader\";\n if (tag === \"ARTICLE\") return \"article\";\n if (tag === \"FORM\") return \"form\";\n if (tag === \"PROGRESS\") return \"progressbar\";\n if (tag === \"HR\") return \"separator\";\n if (tag === \"SECTION\") return (el.hasAttribute(\"aria-label\") || el.hasAttribute(\"aria-labelledby\")) ? \"region\" : \"\";\n if (/^H[1-6]$/.test(tag)) return \"heading\";\n if (tag === \"INPUT\") {\n var t = (el.getAttribute(\"type\") || \"text\").toLowerCase();\n if (t === \"button\" || t === \"submit\" || t === \"reset\" || t === \"image\") return \"button\";\n if (t === \"checkbox\") return \"checkbox\";\n if (t === \"radio\") return \"radio\";\n if (t === \"search\") return \"searchbox\";\n if (t === \"number\") return \"spinbutton\";\n if (t === \"range\") return \"slider\";\n if (t === \"hidden\") return \"\";\n return \"textbox\";\n }\n return \"\";\n }\n function visibleTextOf(node, allowHiddenRoot, skipControl) {\n if (!node) return \"\";\n if (node.nodeType === 3) return node.nodeValue || \"\";\n if (node.nodeType !== 1 && node.nodeType !== 11) return \"\";\n if (node.nodeType === 1) {\n if (skipControl && node === skipControl) return \"\";\n var t = node.tagName ? node.tagName.toUpperCase() : \"\";\n if (t === \"SCRIPT\" || t === \"STYLE\" || t === \"NOSCRIPT\" || t === \"TEMPLATE\") return \"\";\n if (skipControl && (t === \"SELECT\" || t === \"TEXTAREA\" || t === \"INPUT\")) return \"\";\n if (!allowHiddenRoot) {\n if (node.getAttribute && node.getAttribute(\"aria-hidden\") === \"true\") return \"\";\n var win = (node.ownerDocument && node.ownerDocument.defaultView) || window;\n if (win && win.getComputedStyle) {\n var st = win.getComputedStyle(node);\n if (st && (st.display === \"none\" || st.visibility === \"hidden\" || st.visibility === \"collapse\")) {\n return \"\";\n }\n }\n }\n }\n var out = [];\n if (node.shadowRoot) {\n var stxt = visibleTextOf(node.shadowRoot, false, skipControl);\n if (stxt) out.push(stxt);\n }\n var kids = node.childNodes || [];\n for (var i = 0; i < kids.length; i++) {\n var k = visibleTextOf(kids[i], false, skipControl);\n if (k) out.push(k);\n }\n return out.join(\" \").replace(/\\s+/g, \" \").trim();\n }\n function isAriaHidden(el) {\n if (!el) return true;\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var cur = el;\n var guard = 0;\n while (cur && guard++ < 32) {\n if (cur.getAttribute) {\n if (cur.getAttribute(\"aria-hidden\") === \"true\") return true;\n if (cur.hasAttribute && cur.hasAttribute(\"inert\")) return true;\n }\n if (cur.nodeType === 1 && win && win.getComputedStyle) {\n var cs = win.getComputedStyle(cur);\n if (cs && cs.display === \"none\") return true;\n }\n var root = typeof cur.getRootNode === \"function\" ? cur.getRootNode() : null;\n cur = cur.parentElement || (root && root.host) || null;\n }\n if (typeof el.checkVisibility === \"function\") {\n try {\n if (!el.checkVisibility({ visibilityProperty: true })) return true;\n } catch (e) {}\n } else if (win && win.getComputedStyle) {\n var selfCs = win.getComputedStyle(el);\n if (selfCs && (selfCs.visibility === \"hidden\" || selfCs.visibility === \"collapse\")) return true;\n }\n return false;\n }\n function headingLevelOf(el) {\n if (!el) return null;\n var explicit = el.getAttribute && el.getAttribute(\"aria-level\");\n if (explicit) {\n var parsed = parseInt(explicit, 10);\n if (!isNaN(parsed)) return parsed;\n }\n var tag = el.tagName ? el.tagName.toUpperCase() : \"\";\n var m = /^H([1-6])$/.exec(tag);\n return m ? parseInt(m[1], 10) : null;\n }\n function getAccessibleName(el) {\n if (!el) return \"\";\n var doc = el.ownerDocument || document;\n var labelledBy = el.getAttribute && el.getAttribute(\"aria-labelledby\");\n if (labelledBy) {\n var parts = [];\n var ids = labelledBy.trim().split(/\\s+/);\n for (var i = 0; i < ids.length; i++) {\n var ref = doc.getElementById ? doc.getElementById(ids[i]) : null;\n if (ref) {\n var rt = visibleTextOf(ref, true, null);\n if (rt) parts.push(rt);\n }\n }\n if (parts.length > 0) return parts.join(\" \").replace(/\\s+/g, \" \").trim();\n }\n var ariaLabel = el.getAttribute && el.getAttribute(\"aria-label\");\n if (ariaLabel && ariaLabel.trim()) return ariaLabel.trim();\n var tag = el.tagName ? el.tagName.toUpperCase() : \"\";\n if (tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\") {\n if (el.id && doc.querySelector) {\n try {\n var escId = typeof CSS !== \"undefined\" && CSS.escape ? CSS.escape(el.id) : el.id;\n var forLbl = doc.querySelector('label[for=\"' + escId + '\"]');\n if (forLbl) {\n var ft = visibleTextOf(forLbl, false, el);\n if (ft) return ft;\n }\n } catch (e) {}\n }\n if (el.closest) {\n var wrapLbl = el.closest(\"label\");\n if (wrapLbl) {\n var wt = visibleTextOf(wrapLbl, false, el);\n if (wt) return wt;\n }\n }\n var itype = tag === \"INPUT\" ? (el.getAttribute(\"type\") || \"text\").toLowerCase() : \"\";\n if ((itype === \"button\" || itype === \"submit\" || itype === \"reset\") && el.value) {\n return String(el.value).trim();\n }\n var ph = el.getAttribute && el.getAttribute(\"placeholder\");\n if (ph && ph.trim()) return ph.trim();\n }\n if (tag === \"IMG\") {\n var alt = el.getAttribute && el.getAttribute(\"alt\");\n if (alt && alt.trim()) return alt.trim();\n }\n var txt = visibleTextOf(el, false, null);\n if (txt) return txt;\n var title = el.getAttribute && el.getAttribute(\"title\");\n return title ? title.trim() : \"\";\n }\n function getAccessibleDescription(el) {\n if (!el) return \"\";\n var doc = el.ownerDocument || document;\n var describedBy = el.getAttribute && el.getAttribute(\"aria-describedby\");\n if (describedBy) {\n var parts = [];\n var ids = describedBy.trim().split(/\\s+/);\n for (var i = 0; i < ids.length; i++) {\n var ref = doc.getElementById ? doc.getElementById(ids[i]) : null;\n if (ref) {\n var rt = visibleTextOf(ref, true, null);\n if (rt) parts.push(rt);\n }\n }\n if (parts.length > 0) return parts.join(\" \").replace(/\\s+/g, \" \").trim();\n }\n var ariaDesc = el.getAttribute && el.getAttribute(\"aria-description\");\n if (ariaDesc && ariaDesc.trim()) return ariaDesc.trim();\n var title = el.getAttribute && el.getAttribute(\"title\");\n if (title && title.trim()) {\n var accName = getAccessibleName(el);\n if (accName && accName !== title.trim()) return title.trim();\n }\n return \"\";\n }\n function collectRoots(root, offsetX, offsetY, inShadow, inIframe, out) {\n if (!root) return;\n out.push({ root: root, offsetX: offsetX, offsetY: offsetY, inShadow: inShadow, inIframe: inIframe });\n if (root.shadowRoot) {\n collectRoots(root.shadowRoot, offsetX, offsetY, true, inIframe, out);\n }\n var nodes = root.querySelectorAll ? root.querySelectorAll(\"*\") : [];\n for (var i = 0; i < nodes.length; i++) {\n var el = nodes[i];\n if (el.shadowRoot) {\n collectRoots(el.shadowRoot, offsetX, offsetY, true, inIframe, out);\n }\n if (el.tagName === \"IFRAME\") {\n try {\n var frameDoc = el.contentDocument;\n if (frameDoc) {\n var frameRect = el.getBoundingClientRect();\n collectRoots(frameDoc, offsetX + frameRect.left, offsetY + frameRect.top, inShadow, true, out);\n }\n } catch (e) {}\n }\n }\n }\n function findTextInRoot(root, needle, exact, ctx, pushHit) {\n var doc = root.ownerDocument || (root.nodeType === 9 ? root : document);\n if (doc && typeof doc.createTreeWalker === \"function\" && typeof NodeFilter !== \"undefined\") {\n var walker = doc.createTreeWalker(root, NodeFilter.SHOW_TEXT);\n var txtNode;\n while ((txtNode = walker.nextNode())) {\n var rawVal = (txtNode.nodeValue || \"\").trim();\n var val = rawVal.toLowerCase();\n var ok = exact ? rawVal === needle : (val && val.indexOf(needle.toLowerCase()) !== -1);\n if (ok && txtNode.parentElement) {\n pushHit(txtNode.parentElement, ctx);\n }\n }\n if (typeof root.querySelectorAll === \"function\") {\n var inputs = root.querySelectorAll(\"input, button\");\n for (var ii = 0; ii < inputs.length; ii++) {\n var inp = inputs[ii];\n var rawInp = String(inp.value || \"\").trim();\n var inpOk = exact ? rawInp === needle : (rawInp && rawInp.toLowerCase().indexOf(needle.toLowerCase()) !== -1);\n if (inpOk) {\n pushHit(inp, ctx);\n }\n }\n }\n return;\n }\n var all = root.querySelectorAll ? root.querySelectorAll(\"*\") : [];\n for (var k = 0; k < all.length; k++) {\n var node = all[k];\n var directText = \"\";\n for (var c = 0; c < node.childNodes.length; c++) {\n if (node.childNodes[c].nodeType === 3) directText += node.childNodes[c].textContent || \"\";\n }\n var trimmedDirect = directText.trim();\n var inpVal = (node.tagName === \"INPUT\" || node.tagName === \"BUTTON\") ? String(node.value || \"\").trim() : \"\";\n var directOk = exact ? trimmedDirect === needle : (trimmedDirect && trimmedDirect.toLowerCase().indexOf(needle.toLowerCase()) !== -1);\n var inputOk = exact ? inpVal === needle : (inpVal && inpVal.toLowerCase().indexOf(needle.toLowerCase()) !== -1);\n if (directOk || inputOk) {\n pushHit(node, ctx);\n }\n }\n }\n function findRoleInRoot(root, roleLower, nameSpec, exact, ctx, pushHit, includeHidden, level) {\n if (!root || !root.querySelectorAll) return;\n var candidates = root.querySelectorAll(\"*\");\n for (var i = 0; i < candidates.length; i++) {\n var el = candidates[i];\n if (getImplicitRole(el) !== roleLower) continue;\n if (!includeHidden && isAriaHidden(el)) continue;\n if (level !== undefined && level !== null && headingLevelOf(el) !== Number(level)) continue;\n if (nameSpec !== undefined && nameSpec !== null) {\n var accName = getAccessibleName(el);\n if (!matchSpec(accName, nameSpec, Boolean(exact))) continue;\n }\n pushHit(el, ctx);\n }\n }\n function applyModifiersAndSlice(hits, sel) {\n if (!sel || typeof sel !== \"object\" || \"point\" in sel) return hits;\n var filtered = hits;\n if (sel.hasText !== undefined) {\n filtered = filtered.filter(function(h) {\n var txt = (h.el.innerText || h.el.textContent || h.el.value || getAccessibleName(h.el) || \"\");\n return matchSpec(txt, sel.hasText, false);\n });\n }\n if (sel.hasNotText !== undefined) {\n filtered = filtered.filter(function(h) {\n var txt = (h.el.innerText || h.el.textContent || h.el.value || getAccessibleName(h.el) || \"\");\n return !matchSpec(txt, sel.hasNotText, false);\n });\n }\n if (sel.has !== undefined) {\n filtered = filtered.filter(function(h) {\n return findInScope(sel.has, h.el, h.offsetX, h.offsetY, h.inShadow, h.inIframe).length > 0;\n });\n }\n if (sel.hasNot !== undefined) {\n filtered = filtered.filter(function(h) {\n return findInScope(sel.hasNot, h.el, h.offsetX, h.offsetY, h.inShadow, h.inIframe).length === 0;\n });\n }\n if (sel.first) return filtered.length > 0 ? [filtered[0]] : [];\n if (sel.last) return filtered.length > 0 ? [filtered[filtered.length - 1]] : [];\n if (typeof sel.nth === \"number\") {\n var idx = sel.nth < 0 ? filtered.length + sel.nth : sel.nth;\n return idx >= 0 && idx < filtered.length ? [filtered[idx]] : [];\n }\n return filtered;\n }\n function findInScope(sel, scopeRoot, baseOffsetX, baseOffsetY, baseInShadow, baseInIframe) {\n var hits = [];\n var seen = typeof Set !== \"undefined\" ? new Set() : null;\n function pushHit(el, ctx) {\n if (seen) {\n if (seen.has(el)) return;\n seen.add(el);\n }\n hits.push({ el: el, offsetX: ctx.offsetX, offsetY: ctx.offsetY, inShadow: ctx.inShadow, inIframe: ctx.inIframe });\n }\n if (typeof sel === \"object\" && sel !== null && \"point\" in sel) {\n var atPt = document.elementFromPoint(sel.point.x, sel.point.y);\n if (atPt) pushHit(atPt, { offsetX: 0, offsetY: 0, inShadow: false, inIframe: false });\n return hits;\n }\n // Frame scoping: find matching <iframe> first, then search inside its contentDocument\n if (typeof sel === \"object\" && sel !== null && sel.frame) {\n var frameHits = findInScope(sel.frame, scopeRoot, baseOffsetX, baseOffsetY, baseInShadow, baseInIframe);\n var innerSel = Object.assign({}, sel);\n delete innerSel.frame;\n for (var fi = 0; fi < frameHits.length; fi++) {\n var fEl = frameHits[fi].el;\n if (fEl && fEl.tagName === \"IFRAME\") {\n try {\n var fDoc = fEl.contentDocument;\n if (fDoc) {\n var fRect = fEl.getBoundingClientRect();\n var sub = findInScope(innerSel, fDoc, frameHits[fi].offsetX + fRect.left, frameHits[fi].offsetY + fRect.top, frameHits[fi].inShadow, true);\n for (var si = 0; si < sub.length; si++) pushHit(sub[si].el, sub[si]);\n }\n } catch (e) {}\n }\n }\n return hits;\n }\n // Parent scoping: resolve 'within' first, then search inside each matched container\n if (typeof sel === \"object\" && sel !== null && sel.within) {\n var parentHits = findInScope(sel.within, scopeRoot, baseOffsetX, baseOffsetY, baseInShadow, baseInIframe);\n var childSel = Object.assign({}, sel);\n delete childSel.within;\n delete childSel.hasText;\n delete childSel.hasNotText;\n delete childSel.has;\n delete childSel.hasNot;\n delete childSel.first;\n delete childSel.last;\n delete childSel.nth;\n var combined = [];\n var cSeen = typeof Set !== \"undefined\" ? new Set() : null;\n for (var pi = 0; pi < parentHits.length; pi++) {\n var ph = parentHits[pi];\n var subHits = findInScope(childSel, ph.el, ph.offsetX, ph.offsetY, ph.inShadow, ph.inIframe);\n for (var ci = 0; ci < subHits.length; ci++) {\n if (cSeen && cSeen.has(subHits[ci].el)) continue;\n if (cSeen) cSeen.add(subHits[ci].el);\n combined.push(subHits[ci]);\n }\n }\n return applyModifiersAndSlice(combined, sel);\n }\n // Logical OR composition (anyOf): union deduplicated hits across branches\n if (typeof sel === \"object\" && sel !== null && Array.isArray(sel.anyOf)) {\n for (var bi = 0; bi < sel.anyOf.length; bi++) {\n var branchHits = findInScope(sel.anyOf[bi], scopeRoot, baseOffsetX, baseOffsetY, baseInShadow, baseInIframe);\n for (var bh = 0; bh < branchHits.length; bh++) {\n pushHit(branchHits[bh].el, branchHits[bh]);\n }\n }\n return applyModifiersAndSlice(hits, sel);\n }\n\n var esc = function(v) {\n return typeof CSS !== \"undefined\" && CSS.escape ? CSS.escape(v) : String(v).replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"');\n };\n var mainCtx = { root: scopeRoot, offsetX: baseOffsetX, offsetY: baseOffsetY, inShadow: baseInShadow, inIframe: baseInIframe };\n var hasModifiers = typeof sel === \"object\" && sel !== null && (sel.hasText !== undefined || sel.hasNotText !== undefined || sel.has !== undefined || sel.hasNot !== undefined || sel.first || sel.last || typeof sel.nth === \"number\");\n\n // O(1)-ish Light-DOM fast path: avoids scanning thousands of nodes with querySelectorAll(\"*\")\n // unless Shadow DOM / iframe piercing is needed or no Light-DOM match exists.\n if (scopeRoot && scopeRoot.querySelectorAll && !hasModifiers) {\n if (typeof sel === \"object\" && sel !== null && \"testID\" in sel) {\n var fastTid = esc(sel.testID);\n var fastFound = scopeRoot.querySelectorAll('[data-testid=\"' + fastTid + '\"], [testID=\"' + fastTid + '\"]');\n if (fastFound.length > 0) {\n for (var fi2 = 0; fi2 < fastFound.length; fi2++) pushHit(fastFound[fi2], mainCtx);\n return hits;\n }\n } else if (typeof sel === \"object\" && sel !== null && \"css\" in sel) {\n try {\n var fastCss = scopeRoot.querySelectorAll(sel.css);\n if (fastCss.length > 0) {\n for (var fc = 0; fc < fastCss.length; fc++) pushHit(fastCss[fc], mainCtx);\n return hits;\n }\n } catch (e) {}\n } else if (typeof sel === \"object\" && sel !== null && \"accessibilityLabel\" in sel) {\n var fastLbl = esc(sel.accessibilityLabel);\n var fastFoundLbl = scopeRoot.querySelectorAll('[aria-label=\"' + fastLbl + '\"]');\n if (fastFoundLbl.length > 0) {\n for (var fj = 0; fj < fastFoundLbl.length; fj++) pushHit(fastFoundLbl[fj], mainCtx);\n return hits;\n }\n } else if (typeof sel === \"object\" && sel !== null && \"role\" in sel) {\n findRoleInRoot(scopeRoot, String(sel.role).toLowerCase(), sel.name, sel.exact, mainCtx, pushHit, sel.includeHidden, sel.level);\n if (hits.length > 0) return hits;\n } else if (typeof sel === \"string\" || (typeof sel === \"object\" && sel !== null && \"text\" in sel)) {\n var fastNeedle = typeof sel === \"string\" ? sel : sel.text;\n var fastExact = typeof sel === \"object\" && sel !== null && Boolean(sel.exact);\n findTextInRoot(scopeRoot, fastNeedle, fastExact, mainCtx, pushHit);\n if (hits.length > 0) return hits;\n }\n }\n\n var roots = [];\n collectRoots(scopeRoot, baseOffsetX, baseOffsetY, baseInShadow, baseInIframe, roots);\n for (var r = 0; r < roots.length; r++) {\n var ctx = roots[r];\n var root = ctx.root;\n if (!root || !root.querySelectorAll) continue;\n if (typeof sel === \"object\" && sel !== null && \"testID\" in sel) {\n var tid = esc(sel.testID);\n var found = root.querySelectorAll('[data-testid=\"' + tid + '\"], [testID=\"' + tid + '\"]');\n for (var i = 0; i < found.length; i++) pushHit(found[i], ctx);\n } else if (typeof sel === \"object\" && sel !== null && \"css\" in sel) {\n try {\n var foundCss = root.querySelectorAll(sel.css);\n for (var ci2 = 0; ci2 < foundCss.length; ci2++) pushHit(foundCss[ci2], ctx);\n } catch (e) {}\n } else if (typeof sel === \"object\" && sel !== null && \"accessibilityLabel\" in sel) {\n var lbl = esc(sel.accessibilityLabel);\n var foundLbl = root.querySelectorAll('[aria-label=\"' + lbl + '\"]');\n for (var j = 0; j < foundLbl.length; j++) pushHit(foundLbl[j], ctx);\n } else if (typeof sel === \"object\" && sel !== null && \"role\" in sel) {\n findRoleInRoot(root, String(sel.role).toLowerCase(), sel.name, sel.exact, ctx, pushHit, sel.includeHidden, sel.level);\n } else if (typeof sel === \"string\" || (typeof sel === \"object\" && sel !== null && \"text\" in sel)) {\n var needle = typeof sel === \"string\" ? sel : sel.text;\n var isExact = typeof sel === \"object\" && sel !== null && Boolean(sel.exact);\n findTextInRoot(root, needle, isExact, ctx, pushHit);\n }\n }\n return applyModifiersAndSlice(hits, sel);\n }\n function findAcrossRoots(sel) {\n return findInScope(sel, document, 0, 0, false, false);\n }\n function isClickable(el) {\n var tag = el.tagName;\n if (tag === \"BUTTON\" || tag === \"A\" || tag === \"INPUT\" || tag === \"SELECT\" || tag === \"TEXTAREA\") return true;\n var role = el.getAttribute && el.getAttribute(\"role\");\n if (role === \"button\" || role === \"link\" || role === \"tab\" || role === \"checkbox\" || role === \"switch\") return true;\n if (typeof el.onclick === \"function\") return true;\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var cursor = win.getComputedStyle(el).cursor;\n return cursor === \"pointer\";\n }\n function isAppReady() {\n var sig = typeof window !== \"undefined\" ? window.__SPANA_APP_READY__ : undefined;\n if (typeof sig === \"function\") {\n try { return Boolean(sig()); } catch (e) { return false; }\n }\n if (typeof sig === \"boolean\") return sig;\n return true;\n }\n function deepElementFromPoint(rootDoc, x, y) {\n if (!rootDoc || typeof rootDoc.elementFromPoint !== \"function\") return null;\n var el = rootDoc.elementFromPoint(x, y);\n var guard = 0;\n while (el && guard++ < 16) {\n if (el.shadowRoot && typeof el.shadowRoot.elementFromPoint === \"function\") {\n var inner = el.shadowRoot.elementFromPoint(x, y);\n if (inner && inner !== el) { el = inner; continue; }\n }\n if (el.tagName === \"IFRAME\") {\n try {\n var fdoc = el.contentDocument;\n if (fdoc && typeof fdoc.elementFromPoint === \"function\") {\n var fr = el.getBoundingClientRect();\n var fx = x - fr.left;\n var fy = y - fr.top;\n var fEl = fdoc.elementFromPoint(fx, fy);\n if (fEl && fEl !== el) { el = fEl; x = fx; y = fy; continue; }\n }\n } catch (e) {}\n }\n break;\n }\n return el;\n }\n function labelControlOf(node) {\n var cur = node;\n var guard = 0;\n while (cur && guard++ < 8) {\n if (cur.tagName === \"LABEL\") return cur.control || null;\n cur = cur.parentElement;\n }\n return null;\n }\n function isSameOrDescendant(target, candidate) {\n if (!target || !candidate) return false;\n if (target === candidate) return true;\n try {\n if (typeof target.contains === \"function\" && target.contains(candidate)) return true;\n } catch (e) {}\n if (labelControlOf(candidate) === target) return true;\n var cur = candidate;\n var guard = 0;\n while (cur && guard++ < 24) {\n if (cur === target) return true;\n var root = typeof cur.getRootNode === \"function\" ? cur.getRootNode() : null;\n if (root && root.host) {\n cur = root.host;\n } else {\n cur = cur.parentElement;\n }\n }\n return false;\n }\n function describeEl(el) {\n if (!el) return \"(unknown)\";\n var tag = el.tagName ? el.tagName.toLowerCase() : \"element\";\n var idPart = el.id ? \"#\" + el.id : \"\";\n var cls = typeof el.className === \"string\" ? el.className.trim().split(/\\s+/).filter(Boolean).slice(0, 3).join(\".\") : \"\";\n var clsPart = cls ? \".\" + cls : \"\";\n var txt = (el.innerText || el.textContent || \"\").replace(/\\s+/g, \" \").trim();\n if (txt.length > 40) txt = txt.slice(0, 37) + \"...\";\n return \"<\" + tag + idPart + clsPart + (txt ? \">\" + txt + \"</\" + tag + \">\" : \">\");\n }\n function getHitTestBlocker(hit) {\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var vw = (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0;\n var vh = (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0;\n var cx = rect.left + hit.offsetX + rect.width / 2;\n var cy = rect.top + hit.offsetY + rect.height / 2;\n if (vw > 0 && vh > 0 && (cx < 0 || cy < 0 || cx > vw || cy > vh)) {\n return \"outside viewport\";\n }\n var topEl = deepElementFromPoint(document, cx, cy);\n if (!topEl) return null;\n if (isSameOrDescendant(el, topEl)) return null;\n return describeEl(topEl);\n }\n function isHitTestClear(hit) {\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var vw = (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0;\n var vh = (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0;\n var cx = rect.left + hit.offsetX + rect.width / 2;\n var cy = rect.top + hit.offsetY + rect.height / 2;\n if (vw > 0 && vh > 0 && (cx < 0 || cy < 0 || cx > vw || cy > vh)) {\n return false;\n }\n var topEl = deepElementFromPoint(document, cx, cy);\n if (!topEl) return true;\n return isSameOrDescendant(el, topEl);\n }\n function ensureInViewport(hit) {\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var vw = (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0;\n var vh = (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0;\n var cx = rect.left + hit.offsetX + rect.width / 2;\n var cy = rect.top + hit.offsetY + rect.height / 2;\n if (vw > 0 && vh > 0 && (cx < 1 || cy < 1 || cx > vw - 1 || cy > vh - 1)) {\n if (typeof el.scrollIntoView === \"function\") {\n try { el.scrollIntoView({ block: \"center\", inline: \"center\", behavior: \"instant\" }); }\n catch (e) { try { el.scrollIntoView(true); } catch (e2) {} }\n }\n return true;\n }\n return false;\n }\n function scrollToUnobscure(hit) {\n var el = hit.el;\n if (typeof el.scrollIntoView !== \"function\") return false;\n var blocks = [\"center\", \"end\", \"start\", \"nearest\"];\n for (var i = 0; i < blocks.length; i++) {\n try {\n el.scrollIntoView({ block: blocks[i], inline: \"center\", behavior: \"instant\" });\n } catch (e) {\n try { el.scrollIntoView(true); } catch (e2) {}\n }\n if (isHitTestClear(hit)) return true;\n }\n return false;\n }\n function hasActiveAnimation(el) {\n var cur = el;\n var depth = 0;\n while (cur && depth++ < 8) {\n if (typeof cur.getAnimations === \"function\") {\n try {\n var anims = cur.getAnimations();\n for (var i = 0; i < anims.length; i++) {\n if (anims[i] && anims[i].playState === \"running\") return true;\n }\n } catch (e) {}\n }\n cur = cur.parentElement;\n }\n return false;\n }\n function isVisible(el, rect) {\n if (rect.width <= 0 || rect.height <= 0) return false;\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var style = win.getComputedStyle(el);\n if (style.display === \"none\" || style.visibility === \"hidden\" || parseFloat(style.opacity || \"1\") === 0) return false;\n return true;\n }\n function toMatch(hit) {\n var el = hit.el;\n var rect = el.getBoundingClientRect();\n var attrs = {};\n if (el.attributes) {\n for (var i = 0; i < el.attributes.length; i++) {\n attrs[el.attributes[i].name] = el.attributes[i].value;\n }\n }\n var tag = el.tagName ? el.tagName.toLowerCase() : undefined;\n var val = (el.tagName === \"INPUT\" || el.tagName === \"TEXTAREA\" || el.tagName === \"SELECT\")\n ? String(el.value ?? \"\")\n : undefined;\n var text = (el.innerText || el.textContent || \"\").trim() || undefined;\n var normTextContent = (el.textContent || \"\").replace(/\\s+/g, \" \").trim() || undefined;\n var accName = getAccessibleName(el) || undefined;\n var accDesc = getAccessibleDescription(el) || undefined;\n var role = getImplicitRole(el) || undefined;\n var isChecked =\n el.tagName === \"INPUT\" && (el.type === \"checkbox\" || el.type === \"radio\")\n ? Boolean(el.checked)\n : el.getAttribute(\"aria-checked\") === \"true\"\n ? true\n : el.getAttribute(\"aria-checked\") === \"false\"\n ? false\n : undefined;\n var isEditable = Boolean(\n !el.hasAttribute(\"disabled\") &&\n el.getAttribute(\"aria-disabled\") !== \"true\" &&\n !el.hasAttribute(\"readonly\") &&\n el.getAttribute(\"aria-readonly\") !== \"true\" &&\n (el.isContentEditable ||\n el.tagName === \"TEXTAREA\" ||\n el.tagName === \"SELECT\" ||\n (el.tagName === \"INPUT\" &&\n [\"button\", \"submit\", \"reset\", \"image\", \"hidden\", \"checkbox\", \"radio\"].indexOf(\n String(el.type || \"text\").toLowerCase(),\n ) === -1)),\n );\n var isEmpty =\n el.tagName === \"INPUT\" || el.tagName === \"TEXTAREA\"\n ? String(el.value || \"\").length === 0\n : (el.textContent || \"\").trim().length === 0;\n var clsName = typeof el.className === \"string\" ? el.className : (el.getAttribute(\"class\") || \"\");\n return {\n id: el.getAttribute(\"data-testid\") || el.getAttribute(\"testID\") || undefined,\n tag: tag,\n role: role,\n text: text,\n textContent: normTextContent,\n value: val,\n accessibilityLabel: el.getAttribute(\"aria-label\") || undefined,\n accessibleName: accName,\n accessibleDescription: accDesc,\n rect: { x: rect.x + hit.offsetX, y: rect.y + hit.offsetY, width: rect.width, height: rect.height },\n scrollX: window.scrollX || window.pageXOffset || 0,\n scrollY: window.scrollY || window.pageYOffset || 0,\n devicePixelRatio: window.devicePixelRatio || 1,\n viewportWidth: (window.visualViewport && window.visualViewport.width) || window.innerWidth || document.documentElement.clientWidth || 0,\n viewportHeight: (window.visualViewport && window.visualViewport.height) || window.innerHeight || document.documentElement.clientHeight || 0,\n visible: isVisible(el, rect),\n enabled: !el.hasAttribute(\"disabled\") && el.getAttribute(\"aria-disabled\") !== \"true\",\n clickable: isClickable(el),\n focused: document.activeElement === el,\n checked: isChecked,\n editable: isEditable,\n empty: isEmpty,\n className: clsName || undefined,\n attributes: attrs,\n inShadowDom: hit.inShadow || undefined,\n inIframe: hit.inIframe || undefined\n };\n }\n\n\n function query(sel) {\n return findAcrossRoots(sel).map(toMatch);\n }\n\n function scrollIntoView(sel) {\n var hits = findAcrossRoots(sel);\n if (hits.length === 0) return null;\n var hit = hits[hits.length - 1];\n if (typeof hit.el.scrollIntoView === \"function\") {\n try { hit.el.scrollIntoView({ block: \"center\", inline: \"center\", behavior: \"instant\" }); }\n catch (e) { try { hit.el.scrollIntoView(true); } catch (e2) {} }\n }\n return toMatch(hit);\n }\n\n function tap(sel) {\n var hits = findAcrossRoots(sel);\n if (hits.length === 0) return false;\n var hit = hits[hits.length - 1];\n var el = hit.el;\n if (typeof el.scrollIntoView === \"function\") {\n try { el.scrollIntoView({ block: \"center\", inline: \"center\", behavior: \"instant\" }); } catch (e) {}\n }\n var rect = el.getBoundingClientRect();\n var cx = rect.left + rect.width / 2;\n var cy = rect.top + rect.height / 2;\n var init = { bubbles: true, cancelable: true, composed: true, clientX: cx, clientY: cy };\n try { el.dispatchEvent(new PointerEvent(\"pointerdown\", init)); } catch (e) {}\n try { el.dispatchEvent(new MouseEvent(\"mousedown\", init)); } catch (e) {}\n if (typeof el.focus === \"function\") { try { el.focus(); } catch (e) {} }\n try { el.dispatchEvent(new PointerEvent(\"pointerup\", init)); } catch (e) {}\n try { el.dispatchEvent(new MouseEvent(\"mouseup\", init)); } catch (e) {}\n if (typeof el.click === \"function\") { el.click(); }\n else { el.dispatchEvent(new MouseEvent(\"click\", init)); }\n return true;\n }\n\n function waitForSelector(sel, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n var forAction = Boolean(opts.forAction);\n var failFastWhenIdle = Boolean(opts.failFastWhenIdle);\n var idleQuietMs = Math.max(50, Math.round(opts.idleQuietMs != null ? opts.idleQuietMs : 250));\n var reqStableFrames = opts.stableFrames !== undefined ? Math.max(0, Math.round(opts.stableFrames)) : (forAction ? 2 : 0);\n var checkHitTest = opts.checkHitTest !== undefined ? Boolean(opts.checkHitTest) : forAction;\n var waitForAppReady = opts.waitForAppReady !== undefined ? Boolean(opts.waitForAppReady) : true;\n var instantAnim = Boolean(typeof document !== \"undefined\" && document.getElementById && document.getElementById(\"__spana_instant_anim\"));\n var explicitStableFrames = instantAnim ? 0 : reqStableFrames;\n\n function findCandidates() {\n if (waitForAppReady && !isAppReady()) return null;\n var rawHits = findAcrossRoots(sel);\n var ready = [];\n for (var i = 0; i < rawHits.length; i++) {\n var h = rawHits[i];\n var m = toMatch(h);\n if (!m.visible) continue;\n if (forAction && !m.enabled) continue;\n ready.push({ hit: h, match: m });\n }\n return ready.length > 0 ? ready : null;\n }\n\n function checkActionableNow() {\n var ready = findCandidates();\n if (!ready) return null;\n if (!forAction) return ready.map(function(r) { return r.match; });\n var target = ready[ready.length - 1];\n var didScroll = ensureInViewport(target.hit);\n if (checkHitTest && !isHitTestClear(target.hit)) {\n if (scrollToUnobscure(target.hit)) {\n didScroll = true;\n }\n if (!isHitTestClear(target.hit)) return null;\n }\n var updated = toMatch(target.hit);\n if (!updated.visible || !updated.enabled) return null;\n return { hits: ready, target: target, match: updated, didScroll: didScroll };\n }\n\n function neededStableFrames(candidate) {\n if (!forAction || typeof requestAnimationFrame !== \"function\") return 0;\n if (explicitStableFrames >= 0) return explicitStableFrames;\n if (hasActiveAnimation(candidate.target.hit.el)) return 2;\n if (candidate.didScroll) return 1;\n return 0;\n }\n\n var imm = checkActionableNow();\n if (imm) {\n if (!forAction) return imm;\n if (neededStableFrames(imm) <= 0) return [imm.match];\n }\n\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n var idleTimer = null;\n var rafId = null;\n var checkingStability = false;\n\n function finish(result) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n if (idleTimer) clearTimeout(idleTimer);\n if (rafId !== null && typeof cancelAnimationFrame === \"function\") {\n try { cancelAnimationFrame(rafId); } catch (e) {}\n }\n resolve(result);\n }\n\n function armIdleTimer() {\n if (!failFastWhenIdle) return;\n if (idleTimer) clearTimeout(idleTimer);\n idleTimer = setTimeout(function() {\n if (document.readyState === \"complete\" && (!waitForAppReady || isAppReady())) {\n var hit = checkActionableNow();\n finish(hit ? (forAction ? [hit.match] : hit) : []);\n } else {\n armIdleTimer();\n }\n }, idleQuietMs);\n }\n\n function verifyStability(candidate) {\n if (done || checkingStability) return;\n var framesToWait = neededStableFrames(candidate);\n if (!forAction || framesToWait <= 0 || typeof requestAnimationFrame !== \"function\") {\n finish(forAction ? [candidate.match] : candidate);\n return;\n }\n checkingStability = true;\n var el = candidate.target.hit.el;\n var lastRect = candidate.match.rect;\n var remainingFrames = framesToWait;\n\n function step() {\n if (done) return;\n if (!el.isConnected) { checkingStability = false; return; }\n if (checkHitTest && !isHitTestClear(candidate.target.hit)) { checkingStability = false; return; }\n var cur = toMatch(candidate.target.hit);\n if (!cur.visible || !cur.enabled) { checkingStability = false; return; }\n var dx = Math.abs(cur.rect.x - lastRect.x);\n var dy = Math.abs(cur.rect.y - lastRect.y);\n var dw = Math.abs(cur.rect.width - lastRect.width);\n var dh = Math.abs(cur.rect.height - lastRect.height);\n if (dx <= 1 && dy <= 1 && dw <= 1 && dh <= 1) {\n remainingFrames -= 1;\n if (remainingFrames <= 0) { finish([cur]); return; }\n } else {\n remainingFrames = framesToWait;\n lastRect = cur.rect;\n }\n rafId = requestAnimationFrame(step);\n }\n rafId = requestAnimationFrame(step);\n }\n\n function attempt() {\n if (done || checkingStability) return;\n var hit = checkActionableNow();\n if (hit) {\n if (forAction) verifyStability(hit);\n else finish(hit);\n return;\n }\n armIdleTimer();\n }\n\n var scheduled = false;\n function scheduleAttempt() {\n if (done || scheduled || checkingStability) return;\n scheduled = true;\n Promise.resolve().then(function() { scheduled = false; attempt(); });\n }\n\n timeoutTimer = setTimeout(function() {\n var finalHit = checkActionableNow();\n finish(finalHit ? (forAction ? [finalHit.match] : finalHit) : []);\n }, timeoutMs);\n fallbackInterval = setInterval(attempt, forAction ? 40 : 120);\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(scheduleAttempt);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n attempt();\n });\n }\n\n function waitForHidden(sel, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n function isHiddenNow() {\n var hits = findAcrossRoots(sel);\n for (var i = 0; i < hits.length; i++) {\n if (toMatch(hits[i]).visible) return false;\n }\n return true;\n }\n if (isHiddenNow()) return true;\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n function finish(val) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n resolve(val);\n }\n function onChange() { if (isHiddenNow()) finish(true); }\n timeoutTimer = setTimeout(function() { finish(isHiddenNow()); }, timeoutMs);\n fallbackInterval = setInterval(onChange, 120);\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(onChange);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n });\n }\n\n function waitForMatch(sel, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n var kind = opts.kind;\n var expected = opts.expected !== undefined ? opts.expected : null;\n var expectedCount = opts.expectedCount !== undefined ? opts.expectedCount : null;\n var attributeName = opts.attributeName !== undefined ? opts.attributeName : null;\n var cssProperty = opts.cssProperty !== undefined ? opts.cssProperty : null;\n var patternSource = opts.patternSource !== undefined ? opts.patternSource : null;\n var patternFlags = opts.patternFlags || \"\";\n var negate = Boolean(opts.negate);\n var lastActual = undefined;\n var regex = patternSource !== null ? new RegExp(patternSource, patternFlags) : null;\n\n function evaluateMatch() {\n if (kind === \"url\") {\n var href = typeof window !== \"undefined\" && window.location ? String(window.location.href || \"\") : \"\";\n lastActual = href;\n var urlOk = regex\n ? regex.test(href)\n : (expected !== null && (href === expected || href.indexOf(String(expected)) !== -1));\n if (negate ? !urlOk : urlOk) return { matched: true, actual: href };\n return null;\n }\n if (kind === \"title\") {\n var docTitle = String(typeof document !== \"undefined\" ? (document.title || \"\") : \"\");\n lastActual = docTitle;\n var titleOk = regex ? regex.test(docTitle) : (expected !== null && docTitle === String(expected));\n if (negate ? !titleOk : titleOk) return { matched: true, actual: docTitle };\n return null;\n }\n\n var hits = findAcrossRoots(sel);\n\n if (kind === \"count\") {\n var visibleCount = 0;\n for (var ci = 0; ci < hits.length; ci++) {\n if (toMatch(hits[ci]).visible) visibleCount++;\n }\n lastActual = String(visibleCount);\n var countOk = expectedCount !== null && visibleCount === expectedCount;\n if (negate ? !countOk : countOk) {\n return { matched: true, actual: String(visibleCount) };\n }\n return null;\n }\n\n for (var i = hits.length - 1; i >= 0; i--) {\n var m = toMatch(hits[i]);\n if (!m.visible) continue;\n var matched = false;\n var actualVal = undefined;\n if (kind === \"text\") {\n var normTxt = m.textContent !== undefined ? m.textContent : (m.text || \"\");\n actualVal = normTxt;\n matched = normTxt === (expected !== null ? String(expected).replace(/\\s+/g, \" \").trim() : expected);\n } else if (kind === \"containsText\") {\n var actual = m.textContent !== undefined ? m.textContent : (m.text || \"\");\n actualVal = actual;\n matched = expected !== null && actual.toLowerCase().indexOf(String(expected).replace(/\\s+/g, \" \").trim().toLowerCase()) !== -1;\n } else if (kind === \"matchesText\") {\n var actualRe = m.textContent !== undefined ? m.textContent : (m.text || \"\");\n actualVal = actualRe;\n matched = Boolean(regex && regex.test(actualRe));\n } else if (kind === \"value\") {\n var val = m.value !== undefined ? m.value : \"\";\n actualVal = val;\n matched = val === expected;\n } else if (kind === \"attribute\" && attributeName !== null) {\n var attrVal = m.attributes ? m.attributes[attributeName] : undefined;\n actualVal = attrVal;\n matched = expected === null ? attrVal !== undefined : attrVal === expected;\n } else if (kind === \"accessibilityLabel\") {\n var lbl = m.accessibilityLabel;\n actualVal = lbl;\n matched = expected === null ? (lbl !== undefined && lbl.length > 0) : lbl === expected;\n } else if (kind === \"accessibleName\") {\n var accName = m.accessibleName || m.accessibilityLabel || m.text || \"\";\n actualVal = accName;\n matched = regex ? regex.test(accName) : (expected === null ? accName.length > 0 : accName.trim() === String(expected).trim());\n } else if (kind === \"accessibleDescription\") {\n var accDesc = m.accessibleDescription || \"\";\n actualVal = accDesc;\n matched = regex ? regex.test(accDesc) : (expected === null ? accDesc.length > 0 : accDesc.trim() === String(expected).trim());\n } else if (kind === \"focused\") {\n actualVal = m.focused ? \"focused\" : \"not focused\";\n matched = Boolean(m.focused);\n } else if (kind === \"checked\") {\n actualVal = m.checked ? \"checked\" : \"unchecked\";\n matched = Boolean(m.checked);\n } else if (kind === \"editable\") {\n actualVal = m.editable ? \"editable\" : \"not editable\";\n matched = Boolean(m.editable);\n } else if (kind === \"empty\") {\n actualVal = m.empty ? \"empty\" : (m.value || m.textContent || \"non-empty\");\n matched = Boolean(m.empty);\n } else if (kind === \"class\") {\n var cls = m.className || \"\";\n actualVal = cls;\n if (regex) {\n matched = regex.test(cls);\n } else if (expected !== null) {\n var tokens = cls.trim().split(/\\s+/).filter(Boolean);\n var expectedTokens = String(expected).trim().split(/\\s+/).filter(Boolean);\n matched = expectedTokens.length > 0 && expectedTokens.every(function(tok) { return tokens.indexOf(tok) !== -1; });\n }\n } else if (kind === \"css\" && cssProperty !== null) {\n var elNode = hits[i].el;\n var winObj = (elNode.ownerDocument && elNode.ownerDocument.defaultView) || window;\n var cssVal = winObj && winObj.getComputedStyle ? winObj.getComputedStyle(elNode).getPropertyValue(cssProperty).trim() : \"\";\n actualVal = cssVal;\n matched = regex ? regex.test(cssVal) : (expected !== null && cssVal === String(expected).trim());\n }\n lastActual = actualVal;\n if (negate ? !matched : matched) return { matched: true, actual: actualVal };\n }\n return null;\n }\n\n var immediate = evaluateMatch();\n if (immediate) return immediate;\n\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n var scheduled = false;\n function finish(res) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n if (typeof document !== \"undefined\") {\n document.removeEventListener(\"input\", onChange, true);\n document.removeEventListener(\"change\", onChange, true);\n document.removeEventListener(\"focusin\", onChange, true);\n document.removeEventListener(\"focusout\", onChange, true);\n }\n if (typeof window !== \"undefined\") {\n window.removeEventListener(\"popstate\", onChange);\n window.removeEventListener(\"hashchange\", onChange);\n }\n resolve(res);\n }\n function onChange() {\n if (done || scheduled) return;\n scheduled = true;\n Promise.resolve().then(function() {\n scheduled = false;\n if (done) return;\n var res = evaluateMatch();\n if (res) finish(res);\n });\n }\n timeoutTimer = setTimeout(function() {\n var finalRes = evaluateMatch();\n finish(finalRes || { matched: false, actual: lastActual });\n }, timeoutMs);\n fallbackInterval = setInterval(onChange, kind === \"url\" ? 50 : 120);\n if (typeof document !== \"undefined\") {\n document.addEventListener(\"input\", onChange, true);\n document.addEventListener(\"change\", onChange, true);\n document.addEventListener(\"focusin\", onChange, true);\n document.addEventListener(\"focusout\", onChange, true);\n }\n if (typeof window !== \"undefined\") {\n window.addEventListener(\"popstate\", onChange);\n window.addEventListener(\"hashchange\", onChange);\n }\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(onChange);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n });\n }\n\n function fill(sel, val, opts) {\n opts = opts || {};\n var timeoutMs = Math.max(10, Math.round(opts.timeoutMs != null ? opts.timeoutMs : 5000));\n var checkHitTest = opts.checkHitTest !== undefined ? Boolean(opts.checkHitTest) : true;\n function writeValue(el) {\n if (el.isContentEditable) return false;\n if (typeof el.focus === \"function\") { try { el.focus(); } catch (e) {} }\n var tag = el.tagName;\n if (tag === \"INPUT\" || tag === \"TEXTAREA\") {\n var win = (el.ownerDocument && el.ownerDocument.defaultView) || window;\n var proto = tag === \"TEXTAREA\"\n ? (win.HTMLTextAreaElement && win.HTMLTextAreaElement.prototype)\n : (win.HTMLInputElement && win.HTMLInputElement.prototype);\n var desc = proto ? Object.getOwnPropertyDescriptor(proto, \"value\") : null;\n if (desc && typeof desc.set === \"function\") desc.set.call(el, val);\n else el.value = val;\n if (el._valueTracker && typeof el._valueTracker.setValue === \"function\") {\n try { el._valueTracker.setValue(val === \"\" ? \" \" : \"\"); } catch (e) {}\n }\n } else if (tag === \"SELECT\") {\n el.value = val;\n } else {\n el.value = val;\n }\n try { el.dispatchEvent(new InputEvent(\"input\", { bubbles: true, cancelable: true, data: val, inputType: \"insertText\" })); }\n catch (e) { el.dispatchEvent(new Event(\"input\", { bubbles: true, cancelable: true })); }\n el.dispatchEvent(new Event(\"change\", { bubbles: true, cancelable: true }));\n return true;\n }\n function findEditableNow() {\n if (!isAppReady()) return null;\n var hits = findAcrossRoots(sel);\n for (var i = hits.length - 1; i >= 0; i--) {\n var h = hits[i];\n var m = toMatch(h);\n if (!m.visible || !m.enabled) continue;\n ensureInViewport(h);\n if (checkHitTest && !isHitTestClear(h)) {\n scrollToUnobscure(h);\n if (!isHitTestClear(h)) continue;\n }\n return h.el;\n }\n return null;\n }\n function verifyAndRetryFill(attemptsLeft) {\n var el = findEditableNow();\n if (!el || el.isContentEditable) return Promise.resolve(false);\n if (!writeValue(el)) return Promise.resolve(false);\n return new Promise(function(resolve) {\n setTimeout(function() {\n var latest = findEditableNow() || el;\n if (latest && latest.isConnected && String(latest.value == null ? \"\" : latest.value) === val) {\n resolve(true);\n return;\n }\n if (attemptsLeft > 1) {\n verifyAndRetryFill(attemptsLeft - 1).then(resolve);\n } else {\n resolve(false);\n }\n }, 12);\n });\n }\n var immEl = findEditableNow();\n if (immEl) {\n if (immEl.isContentEditable) return false;\n return verifyAndRetryFill(3);\n }\n return new Promise(function(resolve) {\n var done = false;\n var observer = null;\n var timeoutTimer = null;\n var fallbackInterval = null;\n var scheduled = false;\n var filling = false;\n function finish(ok) {\n if (done) return;\n done = true;\n if (observer) { try { observer.disconnect(); } catch (e) {} }\n if (timeoutTimer) clearTimeout(timeoutTimer);\n if (fallbackInterval) clearInterval(fallbackInterval);\n resolve(ok);\n }\n function onChange() {\n if (done || scheduled || filling) return;\n scheduled = true;\n Promise.resolve().then(function() {\n scheduled = false;\n if (done || filling) return;\n var target = findEditableNow();\n if (!target) return;\n if (target.isContentEditable) { finish(false); return; }\n filling = true;\n verifyAndRetryFill(3).then(function(ok) { finish(ok); });\n });\n }\n timeoutTimer = setTimeout(function() {\n if (filling) return;\n var target = findEditableNow();\n if (!target || target.isContentEditable) { finish(false); return; }\n filling = true;\n verifyAndRetryFill(2).then(function(ok) { finish(ok); });\n }, timeoutMs);\n fallbackInterval = setInterval(onChange, 40);\n if (typeof MutationObserver !== \"undefined\") {\n var root = document.documentElement || document.body || document;\n if (root) {\n observer = new MutationObserver(onChange);\n observer.observe(root, { childList: true, subtree: true, attributes: true, characterData: true });\n }\n }\n });\n }\n\n window.__spanaRt = {\n query: query,\n scrollIntoView: scrollIntoView,\n tap: tap,\n waitForSelector: waitForSelector,\n waitForHidden: waitForHidden,\n waitForMatch: waitForMatch,\n fill: fill\n };\n return true;\n})();";
345
- type InjectedRuntimeMethod = "query" | "scrollIntoView" | "tap" | "waitForSelector" | "waitForHidden" | "waitForMatch" | "fill";
346
- type SelectOptionInput = string | string[] | {
347
- value?: string;
348
- label?: string;
349
- index?: number;
350
- } | Array<{
351
- value?: string;
352
- label?: string;
353
- index?: number;
354
- }>;
355
- /** Build an in-page diagnostic script reporting why an existing element failed actionability (covered/disabled/hidden). */
356
- declare function buildDomActionabilityDiagScript(selector: Selector): string;
357
- /** Build a ~70-byte call to the pre-injected `window.__spanaRt` runtime. */
358
- declare function buildInjectedCallScript(method: InjectedRuntimeMethod, ...args: unknown[]): string;
359
-
360
- interface Geolocation {
361
- latitude: number;
362
- longitude: number;
363
- accuracy?: number;
364
- }
365
- type Orientation = "portrait" | "landscape";
366
- interface PermissionOptions {
367
- origin?: string;
368
- }
369
- type BiometricOptions = {
370
- type: "faceId" | "touchId";
371
- match?: boolean;
372
- } | {
373
- type: "fingerprint";
374
- fingerId: number;
375
- };
376
- type PushPayload = Record<string, unknown>;
377
-
378
- type RawHierarchy = string;
379
- /**
380
- * Per-launch device state overrides (language/locale/timeZone) applied at app
381
- * launch time. Maps to the `appium:language` / `appium:locale` /
382
- * `appium:timeZone` capabilities on Appium providers; used to drive Expo /
383
- * React Native localization for the duration of a flow.
384
- */
385
- interface DeviceStateConfig {
386
- language?: string;
387
- locale?: string;
388
- timeZone?: string;
389
- }
390
- interface LaunchOptions<R extends string = string> {
391
- clearState?: boolean;
392
- clearKeychain?: boolean;
393
- /** Native deep link URL (e.g. `spana://playground`). `R` lets projects type it. */
394
- deepLink?: R;
395
- launchArguments?: Record<string, unknown>;
396
- deviceState?: DeviceStateConfig;
397
- }
398
- type BrowserRouteMatcher = string | RegExp;
399
- interface BrowserMockResponse {
400
- status?: number;
401
- body?: string;
402
- json?: unknown;
403
- headers?: Record<string, string>;
404
- contentType?: string;
405
- }
406
- type NetworkProfile = "wifi" | "4g" | "3g" | "2g" | "edge" | "offline";
407
- interface NetworkConditions {
408
- profile?: NetworkProfile;
409
- offline?: boolean;
410
- latencyMs?: number;
411
- downloadThroughputKbps?: number;
412
- uploadThroughputKbps?: number;
413
- }
414
- /** @deprecated Use `NetworkConditions` instead. */
415
- type BrowserNetworkConditions = NetworkConditions;
416
- interface BrowserConsoleLogLocation {
417
- url?: string;
418
- lineNumber?: number;
419
- columnNumber?: number;
420
- }
421
- interface BrowserConsoleLog {
422
- type: string;
423
- text: string;
424
- location?: BrowserConsoleLogLocation;
425
- }
426
- interface BrowserJSError {
427
- name?: string;
428
- message: string;
429
- stack?: string;
430
- }
431
- interface BrowserHARHeader {
432
- name: string;
433
- value: string;
434
- }
435
- interface BrowserHAREntry {
436
- pageref: string;
437
- startedDateTime: string;
438
- time: number;
439
- request: {
440
- method: string;
441
- url: string;
442
- httpVersion: string;
443
- headers: BrowserHARHeader[];
444
- queryString: BrowserHARHeader[];
445
- headersSize: number;
446
- bodySize: number;
447
- postData?: {
448
- mimeType: string;
449
- text?: string;
450
- };
451
- };
452
- response: {
453
- status: number;
454
- statusText: string;
455
- httpVersion: string;
456
- headers: BrowserHARHeader[];
457
- redirectURL: string;
458
- headersSize: number;
459
- bodySize: number;
460
- content: {
461
- size: number;
462
- mimeType: string;
463
- };
464
- };
465
- cache: Record<string, never>;
466
- timings: {
467
- blocked: number;
468
- dns: number;
469
- connect: number;
470
- ssl: number;
471
- send: number;
472
- wait: number;
473
- receive: number;
474
- };
475
- serverIPAddress?: string;
476
- _resourceType?: string;
477
- _failureText?: string;
478
- }
479
- interface BrowserHARPage {
480
- id: string;
481
- title: string;
482
- startedDateTime: string;
483
- pageTimings: {
484
- onContentLoad: number;
485
- onLoad: number;
486
- };
487
- }
488
- interface BrowserHAR {
489
- log: {
490
- version: "1.2";
491
- creator: {
492
- name: "spana";
493
- version: string;
494
- };
495
- browser: {
496
- name: string;
497
- };
498
- pages: BrowserHARPage[];
499
- entries: BrowserHAREntry[];
500
- };
501
- }
502
- type TouchAction = {
503
- type: "move";
504
- x: number;
505
- y: number;
506
- duration?: number;
507
- } | {
508
- type: "down";
509
- } | {
510
- type: "up";
511
- } | {
512
- type: "pause";
513
- duration: number;
514
- };
515
- interface TouchSequence {
516
- id: number;
517
- actions: TouchAction[];
518
- }
519
- interface VirtualAuthenticatorOptions {
520
- /** WebAuthn protocol. Default: "ctap2". */
521
- protocol?: "ctap2" | "u2f";
522
- /** Authenticator transport. Default: "internal" (platform passkey). */
523
- transport?: "usb" | "nfc" | "ble" | "cable" | "internal";
524
- /** Support discoverable resident keys (passkeys). Default: true. */
525
- hasResidentKey?: boolean;
526
- /** Support user verification (Touch ID / Face ID / PIN). Default: true. */
527
- hasUserVerification?: boolean;
528
- /** Automatically pass user verification. Default: true. */
529
- isUserVerified?: boolean;
530
- /** Automatically simulate user presence on prompts. Default: true. */
531
- automaticPresenceSimulation?: boolean;
532
- }
533
- interface VirtualCredential {
534
- credentialId: string;
535
- isResidentCredential: boolean;
536
- rpId?: string;
537
- /** Base64-encoded PKCS#8 EC/RSA private key returned by CDP `WebAuthn.getCredentials`. */
538
- privateKey?: string;
539
- userHandle?: string;
540
- userName?: string;
541
- signCount: number;
542
- }
543
- interface VirtualCredentialInput {
544
- credentialId: string;
545
- isResidentCredential: boolean;
546
- rpId?: string;
547
- /** Base64-encoded PKCS#8 private key (as returned by `getVirtualCredentials()`). */
548
- privateKey: string;
549
- userHandle?: string;
550
- userName?: string;
551
- signCount?: number;
552
- }
553
- interface BrowserCookie {
554
- name: string;
555
- value: string;
556
- domain?: string;
557
- path?: string;
558
- url?: string;
559
- expires?: number;
560
- httpOnly?: boolean;
561
- secure?: boolean;
562
- sameSite?: "Strict" | "Lax" | "None";
563
- }
564
- interface BrowserResponseInfo {
565
- url: string;
566
- status: number;
567
- statusText: string;
568
- headers: Record<string, string>;
569
- method?: string;
570
- body?: () => Promise<string>;
571
- json?: <T = unknown>() => Promise<T>;
572
- }
573
- /** Raw Chrome DevTools Protocol session handle (available on both Direct CDP and Chromium Playwright engines). */
574
- interface CdpSessionHandle {
575
- /** Send any CDP command (e.g. `WebAuthn.addCredential`, `Network.setExtraHTTPHeaders`). */
576
- send<T = Record<string, unknown>>(method: string, params?: Record<string, unknown>): Promise<T>;
577
- /** Subscribe to a CDP event. Returns an unsubscribe function. */
578
- on(event: string, listener: (params: Record<string, unknown>) => void): () => void;
579
- /** Target session ID when attached to a flat CDP target session. */
580
- readonly sessionId?: string;
581
- /** Browser context ID when running in an isolated CDP Target.createBrowserContext. */
582
- readonly browserContextId?: string;
583
- }
584
- interface BrowserDialogInfo {
585
- type: "alert" | "confirm" | "prompt" | "beforeunload";
586
- message: string;
587
- defaultValue?: string;
588
- accept(promptText?: string): Promise<void>;
589
- dismiss(): Promise<void>;
590
- }
591
- type BrowserDialogHandler = (dialog: BrowserDialogInfo) => void | Promise<void>;
592
- interface BrowserEmulationOptions {
593
- colorScheme?: "light" | "dark" | "no-preference";
594
- reducedMotion?: "reduce" | "no-preference";
595
- locale?: string;
596
- timezoneId?: string;
597
- }
598
- interface BrowserDownloadInfo {
599
- suggestedFilename: string;
600
- path: string;
601
- url?: string;
602
- text(): Promise<string>;
603
- bytes(): Promise<Uint8Array>;
604
- saveAs(destPath: string): Promise<void>;
605
- }
606
- interface RawDriverService<_T extends string = string, R extends string = string> {
607
- readonly beginFlow?: (flowName: string) => Effect.Effect<void, DriverError>;
608
- readonly getDriverLogs?: () => Effect.Effect<string[], DriverError>;
609
- readonly dumpHierarchy: () => Effect.Effect<RawHierarchy, DriverError>;
610
- readonly tapAtCoordinate: (x: number, y: number) => Effect.Effect<void, DriverError>;
611
- readonly doubleTapAtCoordinate: (x: number, y: number) => Effect.Effect<void, DriverError>;
612
- readonly longPressAtCoordinate: (x: number, y: number, duration: number) => Effect.Effect<void, DriverError>;
613
- readonly swipe: (startX: number, startY: number, endX: number, endY: number, duration: number) => Effect.Effect<void, DriverError>;
614
- readonly pinch?: (cx: number, cy: number, scale: number, duration: number) => Effect.Effect<void, DriverError>;
615
- readonly zoom?: (cx: number, cy: number, scale: number, duration: number) => Effect.Effect<void, DriverError>;
616
- readonly multiTouch?: (sequences: TouchSequence[]) => Effect.Effect<void, DriverError>;
617
- readonly inputText: (text: string) => Effect.Effect<void, DriverError>;
618
- readonly pressKey: (key: string) => Effect.Effect<void, DriverError>;
619
- readonly hideKeyboard: () => Effect.Effect<void, DriverError>;
620
- readonly takeScreenshot: () => Effect.Effect<Uint8Array, DriverError>;
621
- readonly getDeviceInfo: () => Effect.Effect<DeviceInfo, DriverError>;
622
- readonly setGeolocation?: (point: Geolocation) => Effect.Effect<void, DriverError>;
623
- readonly setSystemTime?: (time: Date | number | string) => Effect.Effect<void, DriverError>;
624
- readonly setPermission?: (appId: string, permission: string, state: "grant" | "deny", options?: PermissionOptions) => Effect.Effect<void, DriverError>;
625
- readonly setOrientation?: (orientation: Orientation) => Effect.Effect<void, DriverError>;
626
- readonly setViewport?: (size: {
627
- width: number;
628
- height: number;
629
- deviceScaleFactor?: number;
630
- mobile?: boolean;
631
- }) => Effect.Effect<void, DriverError>;
632
- readonly setEmulation?: (opts: BrowserEmulationOptions) => Effect.Effect<void, DriverError>;
633
- readonly setDialogHandler?: (handler: BrowserDialogHandler | null) => Effect.Effect<void, DriverError>;
634
- readonly dragAndDrop?: (startX: number, startY: number, endX: number, endY: number, steps?: number) => Effect.Effect<void, DriverError>;
635
- readonly getClipboard?: () => Effect.Effect<string, DriverError>;
636
- readonly setClipboard?: (text: string) => Effect.Effect<void, DriverError>;
637
- readonly waitForDownload?: (trigger: () => Promise<unknown>, opts?: {
638
- timeout?: number;
639
- }) => Effect.Effect<BrowserDownloadInfo, DriverError>;
640
- readonly setBiometricEnrollment?: (enabled: boolean) => Effect.Effect<void, DriverError>;
641
- readonly simulateBiometric?: (options: BiometricOptions) => Effect.Effect<void, DriverError>;
642
- readonly sendPushNotification?: (appId: string, payload: PushPayload) => Effect.Effect<void, DriverError>;
643
- readonly launchApp: (bundleId: string, opts?: LaunchOptions<R>) => Effect.Effect<void, DriverError>;
644
- readonly stopApp: (bundleId: string) => Effect.Effect<void, DriverError>;
645
- readonly killApp: (bundleId: string) => Effect.Effect<void, DriverError>;
646
- readonly clearAppState: (bundleId: string) => Effect.Effect<void, DriverError>;
647
- readonly openLink: (url: string) => Effect.Effect<void, DriverError>;
648
- readonly back: () => Effect.Effect<void, DriverError>;
649
- readonly reload?: (opts?: {
650
- waitUntil?: "load" | "domcontentloaded" | "networkidle";
651
- }) => Effect.Effect<void, DriverError>;
652
- readonly hoverAtCoordinate?: (x: number, y: number) => Effect.Effect<void, DriverError>;
653
- readonly getUrl?: () => Effect.Effect<string, DriverError>;
654
- readonly evaluate: <T = unknown>(script: string | ((...args: any[]) => T), ...args: unknown[]) => Effect.Effect<T, DriverError>;
655
- readonly getContexts?: () => Effect.Effect<string[], DriverError>;
656
- readonly getCurrentContext?: () => Effect.Effect<string, DriverError>;
657
- readonly setContext?: (contextId: string) => Effect.Effect<void, DriverError>;
658
- readonly domChannel?: DomChannel;
659
- /** Fast reset via bridge storage clear + reload (avoids uninstall/reinstall) */
660
- readonly resetFast?: () => Effect.Effect<void, DriverError>;
661
- readonly mockNetwork?: (matcher: BrowserRouteMatcher, response: BrowserMockResponse) => Effect.Effect<void, DriverError>;
662
- readonly blockNetwork?: (matcher: BrowserRouteMatcher) => Effect.Effect<void, DriverError>;
663
- readonly clearNetworkMocks?: () => Effect.Effect<void, DriverError>;
664
- readonly setNetworkConditions?: (conditions: NetworkConditions) => Effect.Effect<void, DriverError>;
665
- readonly saveCookies?: (path: string) => Effect.Effect<void, DriverError>;
666
- readonly loadCookies?: (path: string) => Effect.Effect<void, DriverError>;
667
- readonly getCookies?: (urls?: string[]) => Effect.Effect<BrowserCookie[], DriverError>;
668
- readonly setCookies?: (cookies: BrowserCookie[]) => Effect.Effect<void, DriverError>;
669
- readonly clearCookies?: () => Effect.Effect<void, DriverError>;
670
- readonly saveAuthState?: (path: string) => Effect.Effect<void, DriverError>;
671
- readonly loadAuthState?: (path: string) => Effect.Effect<void, DriverError>;
672
- readonly downloadFile?: (path: string) => Effect.Effect<void, DriverError>;
673
- readonly uploadFile?: (selector: Selector, path: string | string[]) => Effect.Effect<void, DriverError>;
674
- readonly waitForResponse?: (matcher: BrowserRouteMatcher | ((res: BrowserResponseInfo) => boolean), opts?: {
675
- timeout?: number;
676
- }) => Effect.Effect<BrowserResponseInfo, DriverError>;
677
- readonly createIsolatedContext?: (opts?: {
678
- url?: string;
679
- }) => Effect.Effect<{
680
- driver: RawDriverService;
681
- close: () => Promise<void>;
682
- }, DriverError>;
683
- readonly newTab?: (url?: string) => Effect.Effect<string, DriverError>;
684
- readonly switchToTab?: (index: number) => Effect.Effect<void, DriverError>;
685
- readonly closeTab?: () => Effect.Effect<void, DriverError>;
686
- readonly getTabIds?: () => Effect.Effect<string[], DriverError>;
687
- readonly getConsoleLogs?: () => Effect.Effect<BrowserConsoleLog[], DriverError>;
688
- readonly getJSErrors?: () => Effect.Effect<BrowserJSError[], DriverError>;
689
- readonly getHAR?: () => Effect.Effect<BrowserHAR, DriverError>;
690
- readonly getRawPage?: () => unknown;
691
- readonly getAriaSnapshot?: (selector: Selector, timeout?: number) => Effect.Effect<string, DriverError>;
692
- readonly startJSCoverage?: () => Effect.Effect<void, DriverError>;
693
- readonly stopJSCoverage?: () => Effect.Effect<unknown[], DriverError>;
694
- readonly getCdpSession?: () => CdpSessionHandle | undefined;
695
- readonly enableVirtualAuthenticator?: (opts?: VirtualAuthenticatorOptions) => Effect.Effect<string, DriverError>;
696
- readonly removeVirtualAuthenticator?: (authenticatorId?: string) => Effect.Effect<void, DriverError>;
697
- readonly getVirtualCredentials?: (authenticatorId?: string) => Effect.Effect<VirtualCredential[], DriverError>;
698
- readonly addVirtualCredential?: (credential: VirtualCredentialInput, authenticatorId?: string) => Effect.Effect<void, DriverError>;
699
- readonly clearVirtualCredentials?: (authenticatorId?: string) => Effect.Effect<void, DriverError>;
700
- }
701
-
702
- interface WebServerConfig {
703
- /** Shell command to boot the dev/preview server (e.g. `"bun run dev"` or `"npm start"`). */
704
- command: string;
705
- /** HTTP(S) URL to poll until a response is received (e.g. `"http://127.0.0.1:3000/health"`). */
706
- url?: string;
707
- /** TCP port to poll on localhost when `url` is omitted. */
708
- port?: number;
709
- /** Working directory for the spawned server process (defaults to `process.cwd()`). */
710
- cwd?: string;
711
- /** Extra environment variables merged into `process.env`. */
712
- env?: Record<string, string>;
713
- /** Maximum ms to wait for the server to become ready (default: 60_000). */
714
- timeout?: number;
715
- /** If true (default when not in CI), skip spawning if `url`/`port` is already reachable. */
716
- reuseExistingServer?: boolean;
717
- /** Pipe server stdout (`"pipe"` captures silently, `"inherit"` streams to console). Default: `"pipe"`. */
718
- stdout?: "pipe" | "ignore" | "inherit";
719
- /** Pipe server stderr. Default: `"pipe"`. */
720
- stderr?: "pipe" | "ignore" | "inherit";
721
- /** Accept any HTTP status < 500 as ready instead of only 2xx-3xx (default: false). */
722
- ignoreHTTPSErrors?: boolean;
723
- /** Graceful shutdown timeout in ms before escalating to SIGKILL (default: 3_000). */
724
- gracefulShutdownMs?: number;
725
- }
726
- interface RunningWebServer {
727
- config: WebServerConfig;
728
- url?: string;
729
- port?: number;
730
- reused: boolean;
731
- pid?: number;
732
- /** Stop the spawned server cleanly (no-op when reused). */
733
- stop(): Promise<void>;
734
- }
735
- interface StartWebServersOptions {
736
- cwd?: string;
737
- /** Override `process.env.CI` detection for `reuseExistingServer`. */
738
- isCI?: boolean;
739
- /** Poll interval in ms (default: 150). */
740
- pollIntervalMs?: number;
741
- }
742
- declare function isTcpPortOpen(port: number, host?: string, timeoutMs?: number): Promise<boolean>;
743
- declare function isHttpUrlReady(url: string, timeoutMs?: number): Promise<boolean>;
744
- declare function checkServerReady(config: WebServerConfig): Promise<boolean>;
745
- /**
746
- * Start a single configured dev server, waiting until `url` or `port` becomes reachable.
747
- * Respects `reuseExistingServer` (defaults to `!isCI`).
748
- */
749
- declare function startWebServer(config: WebServerConfig, opts?: StartWebServersOptions): Promise<RunningWebServer>;
750
- /**
751
- * Start one or more configured web servers in sequence, rolling back already-started
752
- * servers if a later one fails to become ready.
753
- */
754
- declare function startWebServers(input: WebServerConfig | WebServerConfig[] | undefined, opts?: StartWebServersOptions): Promise<{
755
- servers: RunningWebServer[];
756
- stopAll(): Promise<void>;
757
- }>;
758
-
759
- interface ProjectConfig {
760
- /** Unique project identifier (e.g. `"setup"`, `"chromium"`, `"mobile-safari"`, `"api"`). */
761
- name: string;
762
- /** Optional target platform override for this project. */
763
- platform?: Platform;
764
- /** Optional browser override when running on `"web"`. */
765
- browser?: BrowserName;
766
- /** Optional base URL override for web flows in this project. */
767
- baseUrl?: string;
768
- /** Optional storageState JSON file path loaded by flows in this project. */
769
- storageState?: string;
770
- /** Optional flow directory override relative to config file. */
771
- flowDir?: string;
772
- /** Only include flow files matching any of these substrings/globs/RegExps. */
773
- testMatch?: Array<string | RegExp>;
774
- /** Exclude flow files matching any of these substrings/globs/RegExps. */
775
- testIgnore?: Array<string | RegExp>;
776
- /** Only include flows carrying at least one of these tags. */
777
- tags?: string[];
778
- /** Optional substring filter against flow names. */
779
- grep?: string;
780
- /** Project names that must complete successfully before this project starts. */
781
- dependencies?: string[];
782
- /** Optional project name to run after this project completes (teardown). */
783
- teardown?: string;
784
- /** Per-project retry override. */
785
- retries?: number;
786
- /** Optional web execution overrides (e.g. headless, engine, colorScheme). */
787
- use?: Partial<WebExecutionConfig> & {
788
- viewport?: {
789
- width: number;
790
- height: number;
791
- };
792
- locale?: string;
793
- timezoneId?: string;
794
- };
795
- }
796
- interface ProjectExecutionPlan {
797
- /** Projects grouped into topological waves; projects in the same wave can run in parallel. */
798
- waves: ProjectConfig[][];
799
- /** Flat execution order respecting all `dependencies`. */
800
- ordered: ProjectConfig[];
801
- /** Teardown projects paired with the projects that declared them. */
802
- teardowns: ProjectConfig[];
803
- }
804
- /**
805
- * Filter a list of loaded flows according to a `ProjectConfig`'s `testMatch`, `testIgnore`,
806
- * `tags`, `grep`, and `platform` constraints.
807
- */
808
- declare function filterFlowsForProject(flows: FlowDefinition[], project: ProjectConfig): FlowDefinition[];
809
- /**
810
- * Resolve named projects into topological execution waves, expanding `--project` selections
811
- * to include all transitive `dependencies` and collecting any declared `teardown` projects.
812
- * Throws a clear error on duplicate project names, missing dependencies, or dependency cycles.
813
- */
814
- declare function resolveProjectExecutionPlan(projects: ProjectConfig[], selectedNames?: string[]): ProjectExecutionPlan;
815
-
816
- interface WaitOptions {
817
- timeout?: number;
818
- pollInterval?: number;
819
- settleTimeout?: number;
820
- /** Starting poll interval for adaptive polling. Default: 50ms. Set equal to pollInterval to disable adaptive backoff. */
821
- initialPollInterval?: number;
822
- /** Tap dispatch mode when resolved via DOM channel: "native" (default, real touch) or "dom" (fast synthetic click). */
823
- tapMode?: TapMode;
824
- /** Platform hint for coordinate scaling (android physical px vs ios logical pt). */
825
- platform?: Platform;
826
- /** Fail early on web when DOM stays idle and document is complete instead of waiting full timeout. */
827
- failFastWhenIdle?: boolean;
828
- /** Quiet window in ms before failFastWhenIdle resolves empty. Default: 250. */
829
- idleQuietMs?: number;
830
- /** Consecutive stable animation frames required before pointer actions on web. Default: 2. */
831
- actionStableFrames?: number;
832
- }
833
-
834
- type Direction = "up" | "down" | "left" | "right";
835
- interface ScrollUntilVisibleOptions<_T extends string = string> extends WaitOptions {
836
- /** Where the target is relative to the current viewport. Default: "down". */
837
- direction?: Direction;
838
- /** Max number of scroll gestures to attempt before failing. Default: 5. */
839
- maxScrolls?: number;
840
- }
841
- type KeyboardDismissStrategy = "auto" | "driver" | "back";
842
- interface DismissKeyboardOptions {
843
- /** Default: "auto" (driver hideKeyboard, then Android back fallback). */
844
- strategy?: KeyboardDismissStrategy;
845
- }
846
- interface BackUntilVisibleOptions<_T extends string = string> extends WaitOptions {
847
- /** Max number of back actions to attempt before failing. Default: 3. */
848
- maxBacks?: number;
849
- }
850
-
851
- interface StorybookOpenOptions {
852
- /** Override the Storybook base URL for this call. */
853
- baseUrl?: string;
854
- /** Storybook view mode. Defaults to "story". */
855
- viewMode?: "story" | "docs";
856
- /** Story args encoded into the Storybook iframe query string. */
857
- args?: Record<string, StorybookValue>;
858
- /** Story globals encoded into the Storybook iframe query string. */
859
- globals?: Record<string, StorybookValue>;
860
- }
861
-
862
- interface DataSnapshotOptions {
863
- /** Directory storing snapshot files (default: `.spana/snapshots`). */
864
- snapshotsDir?: string;
865
- /** Create or overwrite the snapshot baseline instead of failing on mismatch. */
866
- updateBaselines?: boolean;
867
- /** File extension override (auto-selects `.json` for non-string values and `.txt` for strings). */
868
- extension?: string;
869
- }
870
- interface DataSnapshotResult {
871
- matched: boolean;
872
- created: boolean;
873
- updated: boolean;
874
- snapshotPath: string;
875
- expected?: string;
876
- actual: string;
877
- diff?: string;
878
- }
879
- /**
880
- * Compare an arbitrary string or JSON-serializable object against a disk snapshot baseline.
881
- */
882
- declare function matchDataSnapshot(actualValue: unknown, name: string, options?: DataSnapshotOptions): DataSnapshotResult;
883
- /**
884
- * Assert that `actualValue` matches the persisted snapshot `name` (throws with line diff on mismatch).
885
- */
886
- declare function assertDataSnapshot(actualValue: unknown, name: string, options?: DataSnapshotOptions): DataSnapshotResult;
887
-
888
- interface NegatedPromiseExpectation {
889
- toBeVisible(opts?: WaitOptions): Promise<void>;
890
- toBeHidden(opts?: WaitOptions): Promise<void>;
891
- toHaveText(expected: string, opts?: WaitOptions): Promise<void>;
892
- toMatchText(pattern: RegExp, opts?: WaitOptions): Promise<void>;
893
- toHaveValue(expected: string | number, opts?: WaitOptions): Promise<void>;
894
- toHaveAttribute(name: string, value?: string, opts?: WaitOptions): Promise<void>;
895
- toBeEnabled(opts?: WaitOptions): Promise<void>;
896
- toBeDisabled(opts?: WaitOptions): Promise<void>;
897
- toContainText(expected: string, opts?: WaitOptions): Promise<void>;
898
- toHaveCount(expected: number, opts?: WaitOptions): Promise<void>;
899
- toBeFocused(opts?: WaitOptions): Promise<void>;
900
- toBeChecked(opts?: WaitOptions): Promise<void>;
901
- toBeEditable(opts?: WaitOptions): Promise<void>;
902
- toBeEmpty(opts?: WaitOptions): Promise<void>;
903
- toHaveClass(expected: string | RegExp, opts?: WaitOptions): Promise<void>;
904
- toHaveCSS(property: string, expected: string | RegExp, opts?: WaitOptions): Promise<void>;
905
- toHaveAccessibleName(expected: string | RegExp, opts?: WaitOptions): Promise<void>;
906
- toHaveAccessibleDescription(expected: string | RegExp, opts?: WaitOptions): Promise<void>;
907
- }
908
- interface PromiseExpectation<T extends string = string> {
909
- toBeVisible(opts?: WaitOptions): Promise<void>;
910
- toBeHidden(opts?: WaitOptions): Promise<void>;
911
- toHaveText(expected: string, opts?: WaitOptions): Promise<void>;
912
- toMatchText(pattern: RegExp, opts?: WaitOptions): Promise<void>;
913
- toHaveValue(expected: string | number, opts?: WaitOptions): Promise<void>;
914
- toHaveAttribute(name: string, value?: string, opts?: WaitOptions): Promise<void>;
915
- toBeEnabled(opts?: WaitOptions): Promise<void>;
916
- toBeDisabled(opts?: WaitOptions): Promise<void>;
917
- toContainText(expected: string, opts?: WaitOptions): Promise<void>;
918
- /** Assert that the number of visible matching elements equals `expected`. */
919
- toHaveCount(expected: number, opts?: WaitOptions): Promise<void>;
920
- /** Assert that the matched element currently has focus (`document.activeElement`). */
921
- toBeFocused(opts?: WaitOptions): Promise<void>;
922
- /** Assert that a checkbox/radio/switch element is checked. */
923
- toBeChecked(opts?: WaitOptions): Promise<void>;
924
- /** Assert that the matched element is enabled and editable. */
925
- toBeEditable(opts?: WaitOptions): Promise<void>;
926
- /** Assert that the matched input/container has empty value/text. */
927
- toBeEmpty(opts?: WaitOptions): Promise<void>;
928
- /** Assert that the matched element has the expected CSS class token(s) or matches a RegExp. */
929
- toHaveClass(expected: string | RegExp, opts?: WaitOptions): Promise<void>;
930
- /** Assert that the matched element's computed CSS property matches expected value or RegExp. */
931
- toHaveCSS(property: string, expected: string | RegExp, opts?: WaitOptions): Promise<void>;
932
- /** Assert that the matched element's computed accessible name matches string or RegExp. */
933
- toHaveAccessibleName(expected: string | RegExp, opts?: WaitOptions): Promise<void>;
934
- /** Assert that the matched element's computed accessible description matches string or RegExp. */
935
- toHaveAccessibleDescription(expected: string | RegExp, opts?: WaitOptions): Promise<void>;
936
- /** Negated assertion chain (`expect(selector).not.*`). */
937
- readonly not: NegatedPromiseExpectation;
938
- toMatchAriaSnapshot(expected: string | {
939
- path: string;
940
- }, opts?: RetryAssertionOptions): Promise<void>;
941
- toMatchScreenshot(name: string, options?: {
942
- threshold?: number;
943
- maxDiffPixelRatio?: number;
944
- mask?: ExtendedSelector<T>[];
945
- }): Promise<void>;
946
- toPassAccessibilityAudit(options?: {
947
- severity?: "critical" | "serious" | "moderate" | "minor";
948
- rules?: string[];
949
- exclude?: ExtendedSelector<T>[];
950
- }): Promise<void>;
951
- toHaveAccessibilityLabel(expected?: string): Promise<void>;
952
- toBeFocusable(): Promise<void>;
953
- toHaveRole(expected: string): Promise<void>;
954
- toHaveMinTouchTarget(size?: number): Promise<void>;
955
- }
956
- interface RetryAssertionOptions {
957
- /** Total timeout in ms before failing. Default: 5000. */
958
- timeout?: number;
959
- /** Backoff intervals in ms between retries. Default: [50, 100, 250, 500]. */
960
- intervals?: number[];
961
- }
962
- interface ToPassExpectation {
963
- /** Retry the callback until it completes without throwing (Playwright `expect(fn).toPass()`). */
964
- toPass(opts?: RetryAssertionOptions): Promise<void>;
965
- }
966
- interface PollMatchers<V> {
967
- toBe(expected: V): Promise<void>;
968
- toEqual(expected: V): Promise<void>;
969
- toContain(expected: unknown): Promise<void>;
970
- toMatch(pattern: string | RegExp): Promise<void>;
971
- toBeGreaterThan(expected: number): Promise<void>;
972
- toBeLessThan(expected: number): Promise<void>;
973
- toBeGreaterThanOrEqual(expected: number): Promise<void>;
974
- toBeLessThanOrEqual(expected: number): Promise<void>;
975
- toBeTruthy(): Promise<void>;
976
- toBeFalsy(): Promise<void>;
977
- toBeDefined(): Promise<void>;
978
- toBeUndefined(): Promise<void>;
979
- toHaveLength(expected: number): Promise<void>;
980
- }
981
- interface PollExpectation<V> extends PollMatchers<V> {
982
- readonly not: PollMatchers<V>;
983
- }
984
- /** Callable `expect(selector)` / `expect(fn).toPass()` helper with `expect.poll(...)` and `expect.toHaveURL(...)`. */
985
- interface PromiseExpectFn<T extends string = string> {
986
- (selector: ExtendedSelector<T>): PromiseExpectation<T>;
987
- (fn: () => unknown | Promise<unknown>): ToPassExpectation;
988
- soft: ((selector: ExtendedSelector<T>) => PromiseExpectation<T>) & {
989
- toHaveURL(expected: string | RegExp, opts?: WaitOptions): Promise<void>;
990
- toHaveTitle(expected: string | RegExp, opts?: WaitOptions): Promise<void>;
991
- };
992
- /** Assert that the current page URL matches a substring/exact string or RegExp. */
993
- toHaveURL(expected: string | RegExp, opts?: WaitOptions): Promise<void>;
994
- /** Assert that the current document title matches exact string or RegExp. */
995
- toHaveTitle(expected: string | RegExp, opts?: WaitOptions): Promise<void>;
996
- /** Negated page-level matchers (`expect.not.toHaveURL(...)`, `expect.not.toHaveTitle(...)`). */
997
- readonly not: {
998
- toHaveURL(expected: string | RegExp, opts?: WaitOptions): Promise<void>;
999
- toHaveTitle(expected: string | RegExp, opts?: WaitOptions): Promise<void>;
1000
- };
1001
- /** Poll an async/sync getter until the chained matcher passes (Playwright `expect.poll(fn)`). */
1002
- poll<V>(fn: () => V | Promise<V>, opts?: RetryAssertionOptions): PollExpectation<V>;
1003
- /** Assert that a string or JSON-serializable object matches a persisted disk snapshot. */
1004
- toMatchSnapshot(actual: unknown, name: string, opts?: DataSnapshotOptions): Promise<void>;
1005
- }
1006
-
1007
- interface BrowserRequestOptions {
1008
- headers?: Record<string, string>;
1009
- query?: Record<string, string | number | boolean | undefined>;
1010
- body?: unknown;
1011
- signal?: AbortSignal;
1012
- }
1013
- interface BrowserRequestResponse<T = unknown> {
1014
- status: number;
1015
- statusText: string;
1016
- ok: boolean;
1017
- url: string;
1018
- headers: Headers;
1019
- data: T;
1020
- text(): Promise<string>;
1021
- json<U = T>(): Promise<U>;
1022
- }
1023
- /**
1024
- * Cookie-sharing HTTP API client attached to `app.request` (Playwright `context.request` equivalent).
1025
- * Automatically sends the browser context's cookies and syncs `Set-Cookie` headers back into the browser.
1026
- */
1027
- interface BrowserRequestClient {
1028
- fetch<T = unknown>(url: string, init?: BrowserRequestOptions & {
1029
- method?: string;
1030
- }): Promise<BrowserRequestResponse<T>>;
1031
- get<T = unknown>(url: string, opts?: BrowserRequestOptions): Promise<BrowserRequestResponse<T>>;
1032
- post<T = unknown>(url: string, body?: unknown, opts?: BrowserRequestOptions): Promise<BrowserRequestResponse<T>>;
1033
- put<T = unknown>(url: string, body?: unknown, opts?: BrowserRequestOptions): Promise<BrowserRequestResponse<T>>;
1034
- patch<T = unknown>(url: string, body?: unknown, opts?: BrowserRequestOptions): Promise<BrowserRequestResponse<T>>;
1035
- delete<T = unknown>(url: string, opts?: BrowserRequestOptions): Promise<BrowserRequestResponse<T>>;
1036
- }
1037
- /** A second isolated browser context spawned inside a flow via `app.newContext()`. Auto-closed on flow exit. */
1038
- interface IsolatedBrowserContext<T extends string = string, R extends string = string> {
1039
- app: PromiseApp<T, R>;
1040
- expect: PromiseExpectFn<T>;
1041
- close(): Promise<void>;
1042
- }
1043
- /** Frame-scoped helper returned by `app.frame(frameSelector)` (Playwright `frameLocator` equivalent). */
1044
- interface FrameScope<T extends string = string> {
1045
- tap(selector: Selector<T>, opts?: WaitOptions): Promise<void>;
1046
- doubleTap(selector: Selector<T>, opts?: WaitOptions): Promise<void>;
1047
- longPress(selector: Selector<T>, opts?: {
1048
- duration?: number;
1049
- } & WaitOptions): Promise<void>;
1050
- hover(selector: Selector<T>, opts?: WaitOptions): Promise<void>;
1051
- fill(selector: Selector<T>, value: string, opts?: WaitOptions): Promise<void>;
1052
- clear(selector: Selector<T>, opts?: WaitOptions): Promise<void>;
1053
- check(selector: Selector<T>, opts?: WaitOptions): Promise<void>;
1054
- uncheck(selector: Selector<T>, opts?: WaitOptions): Promise<void>;
1055
- selectOption(selector: Selector<T>, option: SelectOptionInput, opts?: WaitOptions): Promise<string[]>;
1056
- focus(selector: Selector<T>, opts?: WaitOptions): Promise<void>;
1057
- dragTo(source: Selector<T>, target: Selector<T>, opts?: WaitOptions): Promise<void>;
1058
- uploadFile(selector: Selector<T>, path: string | string[]): Promise<void>;
1059
- getText(selector: Selector<T>, opts?: WaitOptions): Promise<string>;
1060
- getAttribute(selector: Selector<T>, name: string, opts?: WaitOptions): Promise<string | undefined>;
1061
- isVisible(selector: Selector<T>, opts?: {
1062
- timeout?: number;
1063
- }): Promise<boolean>;
1064
- isEnabled(selector: Selector<T>, opts?: WaitOptions): Promise<boolean>;
1065
- /** Count visible elements matching `selector` inside this frame (returns `0` when none exist). */
1066
- count(selector: Selector<T>, opts?: WaitOptions): Promise<number>;
1067
- expect(selector: Selector<T>): PromiseExpectation<T>;
1068
- }
1069
- interface PromiseApp<T extends string = string, R extends string = string> {
1070
- tap(selector: ExtendedSelector<T>, opts?: WaitOptions): Promise<void>;
1071
- tapXY(x: number, y: number): Promise<void>;
1072
- doubleTap(selector: ExtendedSelector<T>, opts?: WaitOptions): Promise<void>;
1073
- longPress(selector: ExtendedSelector<T>, opts?: {
1074
- duration?: number;
1075
- } & WaitOptions): Promise<void>;
1076
- longPressXY(x: number, y: number, opts?: {
1077
- duration?: number;
1078
- }): Promise<void>;
1079
- /** Move pointer over an actionable element (triggers hover tooltips/menus). */
1080
- hover(selector: ExtendedSelector<T>, opts?: WaitOptions): Promise<void>;
1081
- inputText(text: string): Promise<void>;
1082
- /** Atomic 1-round-trip form fill: waits for actionability, focuses, replaces value, and dispatches input/change. */
1083
- fill(selector: ExtendedSelector<T>, value: string, opts?: WaitOptions): Promise<void>;
1084
- /** Clear the text value of an input, textarea, or contenteditable element. */
1085
- clear(selector: ExtendedSelector<T>, opts?: WaitOptions): Promise<void>;
1086
- /** Ensure a checkbox, radio button, or ARIA switch is checked (idempotent). */
1087
- check(selector: ExtendedSelector<T>, opts?: WaitOptions): Promise<void>;
1088
- /** Ensure a checkbox or ARIA switch is unchecked (idempotent). */
1089
- uncheck(selector: ExtendedSelector<T>, opts?: WaitOptions): Promise<void>;
1090
- /** Select one or more options in a `<select>` element by value, label, or index. Returns selected option values. */
1091
- selectOption(selector: ExtendedSelector<T>, option: SelectOptionInput, opts?: WaitOptions): Promise<string[]>;
1092
- /** Focus an element. */
1093
- focus(selector: ExtendedSelector<T>, opts?: WaitOptions): Promise<void>;
1094
- /** Drag a source element onto a target element. */
1095
- dragTo(source: ExtendedSelector<T>, target: ExtendedSelector<T>, opts?: WaitOptions): Promise<void>;
1096
- /** Resize the active browser viewport dynamically mid-flow. */
1097
- setViewport(viewport: {
1098
- width: number;
1099
- height: number;
1100
- deviceScaleFactor?: number;
1101
- mobile?: boolean;
1102
- }): Promise<void>;
1103
- /** Emulate CSS media (`colorScheme`, `reducedMotion`), locale, or timezone dynamically mid-flow. */
1104
- setEmulation(options: BrowserEmulationOptions): Promise<void>;
1105
- /** Register a custom handler for JS alert/confirm/prompt/beforeunload dialogs (pass `null` to restore auto-handling). */
1106
- onDialog(handler: BrowserDialogHandler | null): Promise<void>;
1107
- /** Accept the next JS dialog (optionally passing prompt text) and resolve with the dialog metadata. */
1108
- acceptNextDialog(promptText?: string): Promise<void>;
1109
- /** Dismiss the next JS dialog. */
1110
- dismissNextDialog(): Promise<void>;
1111
- /** Read plain text from the browser clipboard. */
1112
- getClipboard(): Promise<string>;
1113
- /** Write plain text to the browser clipboard. */
1114
- setClipboard(text: string): Promise<void>;
1115
- /** Wait for a file download triggered by `triggerFn` and return rich download metadata & helpers. */
1116
- waitForDownload(triggerFn: () => Promise<unknown>, opts?: {
1117
- timeout?: number;
1118
- }): Promise<BrowserDownloadInfo>;
1119
- pressKey(key: string): Promise<void>;
1120
- hideKeyboard(): Promise<void>;
1121
- dismissKeyboard(opts?: DismissKeyboardOptions): Promise<void>;
1122
- swipe(direction: Direction, opts?: {
1123
- duration?: number;
1124
- }): Promise<void>;
1125
- scroll(direction: Direction): Promise<void>;
1126
- scrollUntilVisible(selector: ExtendedSelector<T>, opts?: ScrollUntilVisibleOptions<T>): Promise<void>;
1127
- backUntilVisible(selector: ExtendedSelector<T>, opts?: BackUntilVisibleOptions<T>): Promise<void>;
1128
- launch(opts?: LaunchOptions<R>): Promise<void>;
1129
- stop(): Promise<void>;
1130
- kill(): Promise<void>;
1131
- clearState(): Promise<void>;
1132
- openLink(url: R): Promise<void>;
1133
- openStory(storyId: string, opts?: StorybookOpenOptions): Promise<void>;
1134
- back(): Promise<void>;
1135
- /** Reload the current page and wait for navigation readiness. */
1136
- reload(opts?: {
1137
- waitUntil?: "load" | "domcontentloaded" | "networkidle";
1138
- }): Promise<void>;
1139
- /** Return the current page URL. */
1140
- url(): Promise<string>;
1141
- /** Wait until the current page URL matches a substring/exact string or RegExp. */
1142
- waitForURL(expected: string | RegExp, opts?: WaitOptions): Promise<void>;
1143
- /** Wait for an HTTP response matching a URL substring, RegExp, or predicate. */
1144
- waitForResponse(matcher: BrowserRouteMatcher | ((res: BrowserResponseInfo) => boolean), opts?: {
1145
- timeout?: number;
1146
- }): Promise<BrowserResponseInfo>;
1147
- takeScreenshot(name?: string): Promise<Uint8Array>;
1148
- evaluate<Result = unknown>(fn: ((...args: any[]) => Result) | string, ...args: any[]): Promise<Result>;
1149
- mockNetwork(matcher: BrowserRouteMatcher, response: BrowserMockResponse): Promise<void>;
1150
- setGeolocation(point: Geolocation): Promise<void>;
1151
- setSystemTime(time: Date | number | string): Promise<void>;
1152
- grantPermission(permission: string, options?: PermissionOptions): Promise<void>;
1153
- denyPermission(permission: string, options?: PermissionOptions): Promise<void>;
1154
- setOrientation(orientation: Orientation): Promise<void>;
1155
- setBiometricEnrollment(enabled: boolean): Promise<void>;
1156
- simulateBiometric(options: BiometricOptions): Promise<void>;
1157
- sendPushNotification(payload: PushPayload): Promise<void>;
1158
- blockNetwork(matcher: BrowserRouteMatcher): Promise<void>;
1159
- clearNetworkMocks(): Promise<void>;
1160
- setNetworkConditions(conditions: BrowserNetworkConditions): Promise<void>;
1161
- /** Convenience toggle for browser offline mode (works on Chromium, Firefox, and WebKit). */
1162
- setOffline(offline: boolean): Promise<void>;
1163
- saveCookies(path: string): Promise<void>;
1164
- loadCookies(path: string): Promise<void>;
1165
- /** Read cookies from the active browser context (optionally filtered by URLs). */
1166
- getCookies(urls?: string[]): Promise<BrowserCookie[]>;
1167
- /** Add or update cookies in the active browser context. */
1168
- setCookies(cookies: BrowserCookie[]): Promise<void>;
1169
- /** Clear all cookies in the active browser context. */
1170
- clearCookies(): Promise<void>;
1171
- saveAuthState(path: string): Promise<void>;
1172
- loadAuthState(path: string): Promise<void>;
1173
- downloadFile(path: string): Promise<void>;
1174
- uploadFile(selector: Selector<T>, path: string | string[]): Promise<void>;
1175
- newTab(url?: R): Promise<string>;
1176
- switchToTab(index: number): Promise<void>;
1177
- closeTab(): Promise<void>;
1178
- getTabIds(): Promise<string[]>;
1179
- getConsoleLogs(): Promise<BrowserConsoleLog[]>;
1180
- getJSErrors(): Promise<BrowserJSError[]>;
1181
- getHAR(): Promise<BrowserHAR>;
1182
- /** Cookie-sharing API request client (Playwright `context.request` equivalent). */
1183
- readonly request: BrowserRequestClient;
1184
- /** Spawn a second isolated browser context inside this flow (auto-closed when flow ends). */
1185
- newContext(opts?: {
1186
- url?: string;
1187
- }): Promise<IsolatedBrowserContext<T, R>>;
1188
- /** Scope all subsequent selectors/actions/assertions inside a matching iframe (`frameLocator` equivalent). */
1189
- frame(frameSelector: Selector<T>): FrameScope<T>;
1190
- /** Escape hatch: access the underlying Playwright `Page` (or CDP session) on web runs. */
1191
- getPage<PageType = unknown>(): PageType;
1192
- /** Raw Chrome DevTools Protocol session handle (available on both Direct CDP and Playwright Chromium). */
1193
- cdp(): CdpSessionHandle;
1194
- /** Enable a CDP WebAuthn virtual authenticator (passkey / platform authenticator) for this context. */
1195
- enableVirtualAuthenticator(opts?: VirtualAuthenticatorOptions): Promise<string>;
1196
- /** Remove an active virtual WebAuthn authenticator (defaults to the latest enabled one). */
1197
- removeVirtualAuthenticator(authenticatorId?: string): Promise<void>;
1198
- /** List credentials stored inside the active virtual WebAuthn authenticator. */
1199
- getVirtualCredentials(authenticatorId?: string): Promise<VirtualCredential[]>;
1200
- /** Import an existing WebAuthn passkey credential into the active virtual authenticator (CDP `WebAuthn.addCredential`). */
1201
- addVirtualCredential(credential: VirtualCredentialInput, authenticatorId?: string): Promise<void>;
1202
- /** Clear all credentials stored inside the active virtual WebAuthn authenticator. */
1203
- clearVirtualCredentials(authenticatorId?: string): Promise<void>;
1204
- pinch(selector: ExtendedSelector<T>, opts?: {
1205
- scale?: number;
1206
- duration?: number;
1207
- } & WaitOptions): Promise<void>;
1208
- zoom(selector: ExtendedSelector<T>, opts?: {
1209
- scale?: number;
1210
- duration?: number;
1211
- } & WaitOptions): Promise<void>;
1212
- multiTouch(sequences: TouchSequence[]): Promise<void>;
1213
- getText(selector: ExtendedSelector<T>, opts?: WaitOptions): Promise<string>;
1214
- getAttribute(selector: ExtendedSelector<T>, name: string, opts?: WaitOptions): Promise<string | undefined>;
1215
- isVisible(selector: ExtendedSelector<T>, opts?: {
1216
- timeout?: number;
1217
- }): Promise<boolean>;
1218
- isEnabled(selector: ExtendedSelector<T>, opts?: WaitOptions): Promise<boolean>;
1219
- /** Return the number of currently visible elements matching `selector` (returns `0` without throwing when none exist). */
1220
- count(selector: ExtendedSelector<T>, opts?: WaitOptions): Promise<number>;
1221
- /** Wait for in-flight fetch/XHR, animations, and framework renders to settle via spana-bridge. */
1222
- waitForIdle(opts?: DomIdleOptions): Promise<void>;
1223
- /** Inject storage/auth state directly through the DOM bridge (avoids slow UI login flows). */
1224
- setStorage(entries: DomStorageEntries): Promise<void>;
1225
- /** Clear localStorage, sessionStorage, cookies, IndexedDB, and Capacitor Preferences. */
1226
- clearStorage(opts?: DomClearStorageOptions): Promise<void>;
1227
- /** Fast reset: clear storage via bridge and reload in milliseconds (avoids uninstall/reinstall). */
1228
- resetFast(): Promise<void>;
1229
- /** @internal Low-level escape hatch: list available contexts (e.g. ["NATIVE_APP", "WEBVIEW_..."]). */
1230
- getContexts(): Promise<string[]>;
1231
- /** @internal Low-level escape hatch: get the current context ID. */
1232
- getCurrentContext(): Promise<string>;
1233
- /** @internal Low-level escape hatch: switch to a specific context by ID. */
1234
- switchToContext(contextId: string): Promise<void>;
1235
- /** @internal Low-level escape hatch: switch to the first available WebView context. */
1236
- switchToWebView(): Promise<void>;
1237
- /** @internal Low-level escape hatch: switch back to the native app context. */
1238
- switchToNativeApp(): Promise<void>;
1239
- }
1240
-
1241
- /** A deterministic action recorded from an `agent.act(goal)` execution. */
1242
- type RecordedAction = {
1243
- kind: "tap";
1244
- selector: ExtendedSelector;
1245
- } | {
1246
- kind: "doubleTap";
1247
- selector: ExtendedSelector;
1248
- } | {
1249
- kind: "longPress";
1250
- selector: ExtendedSelector;
1251
- } | {
1252
- kind: "inputText";
1253
- text: string;
1254
- } | {
1255
- kind: "pressKey";
1256
- key: string;
1257
- } | {
1258
- kind: "scroll";
1259
- direction: "up" | "down" | "left" | "right";
1260
- } | {
1261
- kind: "scrollUntilVisible";
1262
- selector: ExtendedSelector;
1263
- } | {
1264
- kind: "openLink";
1265
- url: string;
1266
- };
1267
- interface ReplayCacheEntry {
1268
- schemaVersion: 1;
1269
- key: string;
1270
- goal: string;
1271
- flowName: string;
1272
- platform: string;
1273
- actions: RecordedAction[];
1274
- recordedAt: string;
1275
- verifiedBy: string;
1276
- }
1277
- type ReplayCacheMode = "read-write" | "strict" | "off";
1278
- type CacheWriteStatus = "saved" | "kept" | "unconfirmed" | "evicted" | "skipped";
1279
- interface ReplayStepOutcome {
1280
- goal: string;
1281
- key: string;
1282
- status: "replayed" | "handed-off" | "missed" | "live";
1283
- writeStatus?: CacheWriteStatus;
1284
- actionCount: number;
1285
- error?: string;
1286
- }
1287
- interface ReplayCacheSummary {
1288
- replayed: number;
1289
- handedOff: number;
1290
- missed: number;
1291
- saved: number;
1292
- evicted: number;
1293
- unconfirmed: number;
1294
- }
1295
- /**
1296
- * Pluggable agent executor called ONLY on cache miss or self-healing handoff.
1297
- * Returns the deterministic list of actions it executed to achieve `goal`.
1298
- */
1299
- interface AgentActExecutor {
1300
- act(input: {
1301
- goal: string;
1302
- app: PromiseApp;
1303
- handoffReason?: string;
1304
- }): Promise<{
1305
- actions: RecordedAction[];
1306
- }>;
1307
- }
1308
- /** Compute a stable cache key for a `(flowName, platform, goal)` tuple. */
1309
- declare function buildReplayCacheKey(flowName: string, platform: string, goal: string): string;
1310
- /** Disk-backed replay cache store (default directory: `.spana/cache`). */
1311
- declare class ReplayCacheStore {
1312
- readonly cacheDir: string;
1313
- constructor(cacheDir?: string);
1314
- private filePath;
1315
- get(key: string): ReplayCacheEntry | null;
1316
- set(entry: ReplayCacheEntry): void;
1317
- delete(key: string): boolean;
1318
- }
1319
- /** Execute a single recorded deterministic action against `PromiseApp`. */
1320
- declare function replayRecordedAction(app: PromiseApp, action: RecordedAction): Promise<void>;
1321
- interface ReplaySessionOptions {
1322
- flowName: string;
1323
- platform: string;
1324
- app: PromiseApp;
1325
- store?: ReplayCacheStore;
1326
- mode?: ReplayCacheMode;
1327
- executor?: AgentActExecutor;
1328
- }
1329
- /**
1330
- * Verified Replay Cache session inspired by `e2e-inc/e2e`:
1331
- *
1332
- * - On cache hit: replays deterministic `{ testID }` / `systemUI()` actions with ZERO LLM calls.
1333
- * - In `strict` mode (`--strict-cache`): fails deterministically if a recording is missing or no longer matches.
1334
- * - In `read-write` mode: hands off to `executor` on miss or mismatch (self-healing), and ONLY commits
1335
- * new/healed recordings to `.spana/cache/` after `markVerified(verifierName)` is called by a real assertion!
1336
- */
1337
- declare class ReplaySession {
1338
- private readonly flowName;
1339
- private readonly platform;
1340
- private readonly app;
1341
- private readonly store;
1342
- private readonly mode;
1343
- private readonly executor?;
1344
- private pendingWrites;
1345
- private replayedKeys;
1346
- private outcomes;
1347
- constructor(options: ReplaySessionOptions);
1348
- /** Execute a natural-language goal using replay cache first, falling back to `executor`. */
1349
- act(goal: string): Promise<ReplayStepOutcome>;
1350
- private runLiveAndQueue;
1351
- /**
1352
- * Call when a real post-action assertion (`expect(...).toBeVisible()`, `toHaveText()`, etc.)
1353
- * succeeds. Flushes all preceding pending recordings to disk in `read-write` mode.
1354
- */
1355
- markVerified(verifierName: string): number;
1356
- /**
1357
- * Call when the flow attempt fails: evicts any replayed recordings involved in the
1358
- * failure (in `read-write` mode) and discards unconfirmed recordings so broken paths
1359
- * are never persisted.
1360
- */
1361
- markFailed(): number;
1362
- getOutcomes(): ReplayStepOutcome[];
1363
- getSummary(): ReplayCacheSummary;
1364
- }
1365
-
1366
- /** Opaque handle representing a sensitive value that should never be printed in logs or cache files. */
1367
- interface SecretValue {
1368
- readonly __spanaSecret: true;
1369
- readonly envVar?: string;
1370
- reveal(): string;
1371
- toString(): string;
1372
- toJSON(): string;
1373
- }
1374
- /**
1375
- * Wrap a sensitive value (or read it from `process.env[name]`) so it is automatically masked
1376
- * in step logs, error messages, and agent prompts (`***REDACTED***`).
1377
- */
1378
- declare function secret(valueOrEnvName: string, opts?: {
1379
- fromEnv?: boolean;
1380
- }): SecretValue;
1381
- declare function isSecretValue(value: unknown): value is SecretValue;
1382
- /** Generate a collision-resistant unique identifier or email for isolated test runs. */
1383
- declare function unique(prefix?: string, opts?: {
1384
- domain?: string;
1385
- }): string;
1386
- interface AgentProviderConfig {
1387
- /** Model ID (e.g. `"gpt-4o-mini"`, `"claude-3-5-sonnet-latest"`, `"gemini-2.5-flash"`). */
1388
- model?: string;
1389
- /** OpenAI-compatible Chat Completions endpoint base URL (default: `https://api.openai.com/v1`). */
1390
- baseUrl?: string;
1391
- /** Explicit API key (or read from `apiKeyEnv` / `SPANA_AGENT_API_KEY` / `OPENAI_API_KEY`). */
1392
- apiKey?: string;
1393
- /** Env var name holding the API key. */
1394
- apiKeyEnv?: string;
1395
- /** Maximum LLM planning turns per `act()` call (default: 6). */
1396
- maxSteps?: number;
1397
- /** Optional custom fetch implementation (handy for tests). */
1398
- fetchFn?: typeof fetch;
1399
- }
1400
- interface FlowAgent {
1401
- /**
1402
- * Perform a natural-language goal using Spana's verified replay cache first (0 LLM calls on hit),
1403
- * falling back to the configured LLM executor on cache miss or UI drift.
1404
- */
1405
- act(goal: string, opts?: {
1406
- secrets?: Record<string, SecretValue | string>;
1407
- }): Promise<ReplayStepOutcome>;
1408
- /**
1409
- * Ask the agent to evaluate a natural-language assertion about the current screen.
1410
- * Throws an Error if the assertion evaluates to false.
1411
- */
1412
- verify(assertion: string): Promise<{
1413
- passed: boolean;
1414
- reason: string;
1415
- }>;
1416
- /**
1417
- * Extract structured data from the current screen using a natural-language prompt.
1418
- */
1419
- extract<T = Record<string, unknown>>(instruction: string): Promise<T>;
1420
- /** Flush pending replay-cache writes once a real assertion succeeds. */
1421
- markVerified(verifierName?: string): number;
1422
- /** Called automatically by Spana's engine at the end of a flow run. */
1423
- finalize(passed: boolean): void;
1424
- /** Return replay cache hit/miss/save/evict counters for reporting. */
1425
- getSummary(): ReplayCacheSummary;
1426
- /** Return the list of step outcomes executed through this agent. */
1427
- getOutcomes(): ReplayStepOutcome[];
1428
- }
1429
- interface CreateFlowAgentOptions {
1430
- flowName: string;
1431
- platform: string;
1432
- app: PromiseApp;
1433
- cacheDir?: string;
1434
- cacheMode?: ReplayCacheMode;
1435
- store?: ReplayCacheStore;
1436
- executor?: AgentActExecutor;
1437
- provider?: AgentProviderConfig;
1438
- /** Optional custom verify/extract runner (for tests or custom LLM adapters). */
1439
- askFn?: (input: {
1440
- kind: "verify" | "extract";
1441
- prompt: string;
1442
- screenSummary: string;
1443
- }) => Promise<unknown>;
1444
- }
1445
- /**
1446
- * Create an OpenAI-compatible Chat Completions `AgentActExecutor` + verify/extract adapter.
1447
- * Works with OpenAI, Anthropic OpenAI-compat proxies, OpenRouter, Gemini OpenAI-compat, and Ollama.
1448
- */
1449
- declare function createOpenAICompatibleAgentProvider(config?: AgentProviderConfig): {
1450
- executor: AgentActExecutor;
1451
- ask: (input: {
1452
- kind: "verify" | "extract";
1453
- prompt: string;
1454
- screenSummary: string;
1455
- }) => Promise<unknown>;
1456
- };
1457
- /**
1458
- * Create a first-class `FlowAgent` fixture backed by Spana's deterministic `ReplaySession`.
1459
- */
1460
- declare function createFlowAgent(options: CreateFlowAgentOptions): FlowAgent;
1461
- interface ExploreSessionResult {
1462
- goal: string;
1463
- actions: RecordedAction[];
1464
- flowCode: string;
1465
- }
1466
- /**
1467
- * Format recorded agent actions into a clean, deterministic TypeScript `.flow.ts` file
1468
- * (used by `spana explore "<goal>"`).
1469
- */
1470
- declare function formatActionsAsFlowCode(flowName: string, actions: RecordedAction[]): string;
1471
- /**
1472
- * Run an autonomous exploration session against a live `PromiseApp` and return both the
1473
- * executed deterministic actions and a ready-to-commit `.flow.ts` source string.
1474
- */
1475
- declare function runExploreSession(options: {
1476
- goal: string;
1477
- app: PromiseApp;
1478
- flowName?: string;
1479
- executor?: AgentActExecutor;
1480
- provider?: AgentProviderConfig;
1481
- }): Promise<ExploreSessionResult>;
1482
-
1483
- interface IOSSigningConfig {
1484
- /** Apple Development Team ID (from developer.apple.com or Xcode) */
1485
- teamId: string;
1486
- /** Code signing identity (default: "Apple Development") */
1487
- signingIdentity?: string;
1488
- }
1489
- interface BridgeConfig {
1490
- /** Enable the in-app spana-bridge WebSocket server. Default: auto-detected when port/url is set. */
1491
- enabled?: boolean;
1492
- /** Port for the runner's spana-bridge WebSocket server (default: 9333). */
1493
- port?: number;
1494
- /** Host to bind the bridge server on (default: "127.0.0.1"). */
1495
- host?: string;
1496
- /** Explicit external bridge URL if already running (e.g. ws://127.0.0.1:9333). */
1497
- url?: string;
1498
- /** Connection timeout in ms when waiting for the app bridge to connect (default: 5000). */
1499
- connectTimeout?: number;
1500
- }
1501
- interface WarmDaemonConfig {
1502
- /** Keep WDA / UiAutomator2 daemons alive across test runs and reuse them. Default: false. */
1503
- enabled?: boolean;
1504
- /** Reuse a single browser process across flows with fresh BrowserContexts. Default: true. */
1505
- reuseBrowserProcess?: boolean;
1506
- /** Reuse an active WDA/UiAutomator2 session across flows instead of recreating. Default: true when warm daemons enabled. */
1507
- reuseSession?: boolean;
1508
- /** Optional path to store warm daemon metadata. */
1509
- stateFile?: string;
1510
- }
1511
- interface AppConfig {
1512
- url?: string;
1513
- packageName?: string;
1514
- bundleId?: string;
1515
- /** Path to .app or .ipa for auto-install on device/simulator */
1516
- appPath?: string;
1517
- /** iOS code signing config for physical devices */
1518
- signing?: IOSSigningConfig;
1519
- /** Explicit WebKit Inspector URL or port for iOS WKWebView direct DOM access */
1520
- webkitInspectorUrl?: string;
1521
- webkitInspectorPort?: number;
1522
- /** Explicit CDP port for Android WebView or desktop targets */
1523
- cdpPort?: number;
1524
- /** Pin device locale (e.g. "en_US", "sv_SE") for predictable system UI labels */
1525
- locale?: string;
1526
- /** Optional spana-bridge override for this app target */
1527
- bridge?: BridgeConfig;
1528
- }
1529
- interface ElectronAppConfig {
1530
- /** Path to Electron main entry file or app directory (passed to Playwright _electron.launch) */
1531
- entry?: string;
1532
- /** Path to a packaged Electron executable */
1533
- executablePath?: string;
1534
- /** Extra CLI arguments passed to Electron */
1535
- args?: string[];
1536
- /** Working directory for Electron launch */
1537
- cwd?: string;
1538
- /** Additional environment variables for Electron */
1539
- env?: Record<string, string>;
1540
- /** Attach to an already-running Electron app over CDP instead of launching */
1541
- cdpUrl?: string;
1542
- /** Remote debugging port when launching or attaching over CDP */
1543
- cdpPort?: number;
1544
- /** Optional URL to navigate to after launch */
1545
- url?: string;
1546
- /** Optional spana-bridge config */
1547
- bridge?: BridgeConfig;
1548
- }
1549
- type ElectrobunRenderer = "native" | "cef";
1550
- interface ElectrobunAppConfig {
1551
- /** Path to Electrobun binary or packaged .app/.exe */
1552
- executablePath?: string;
1553
- /** Path to Electrobun project root (containing electrobun.config.ts) */
1554
- appDir?: string;
1555
- /** Extra CLI arguments passed to the Electrobun process */
1556
- args?: string[];
1557
- /** Working directory for launch */
1558
- cwd?: string;
1559
- /** Additional environment variables */
1560
- env?: Record<string, string>;
1561
- /** Renderer engine used by the Electrobun build: "native" (WKWebView/WebView2/WebKitGTK) or "cef" */
1562
- renderer?: ElectrobunRenderer;
1563
- /** Attach to an already-running Electrobun CEF/WebView2 app over CDP */
1564
- cdpUrl?: string;
1565
- /** Remote debugging port (ELECTROBUN_CDP_PORT / WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS) */
1566
- cdpPort?: number;
1567
- /** WebKit Inspector port for macOS WKWebView or Linux WebKitGTK */
1568
- webkitInspectorPort?: number;
1569
- /** Optional URL to navigate to after launch */
1570
- url?: string;
1571
- /** Optional spana-bridge config */
1572
- bridge?: BridgeConfig;
1573
- }
1574
- type BrowserName = "chromium" | "firefox" | "webkit";
1575
- type WebBrowserEngine = "auto" | "playwright" | "cdp" | "lightpanda";
1576
- type WebContextIsolation = "fresh" | "hot-cache";
1577
- type WebResourceBlockType = "image" | "font" | "media" | "stylesheet";
1578
- type VideoRecordingMode = "off" | "on" | "retain-on-failure";
1579
- type StorybookValue = string | number | boolean | null;
1580
- interface StorybookConfig {
1581
- /** Optional dedicated Storybook URL (falls back to apps.web.url when omitted) */
1582
- url?: string;
1583
- /** Preview iframe path used to render isolated stories (default: /iframe.html) */
1584
- iframePath?: string;
1585
- }
1586
- interface WebExecutionConfig {
1587
- browser?: BrowserName;
1588
- /** Browser engine backend: "playwright" (default), "cdp" (direct CDP WebSocket — zero Playwright pipe), or "lightpanda". */
1589
- engine?: WebBrowserEngine;
1590
- /** Connect to an existing CDP browser / Lightpanda endpoint (e.g. "http://127.0.0.1:9222"). */
1591
- cdpUrl?: string;
1592
- /** Connect to a remote Playwright server WebSocket (e.g. BrowserStack Automate Web `wss://cdp.browserstack.com/playwright?...`). */
1593
- wsEndpoint?: string;
1594
- /** Explicit browser executable path (e.g. system Chrome or custom Chromium binary). */
1595
- executablePath?: string;
1596
- /** Browser release channel (e.g. "chrome", "chrome-beta", "msedge"). */
1597
- channel?: string;
1598
- headless?: boolean;
1599
- /** Navigation readiness event for launchApp/openLink (default: "load"). */
1600
- waitUntil?: "domcontentloaded" | "load" | "networkidle" | "commit";
1601
- /** Collapse CSS transitions & animations to 0.001ms for faster deterministic runs. */
1602
- instantAnimations?: boolean;
1603
- /** Abort heavy asset requests ("image" | "font" | "media" | "stylesheet") during web runs. */
1604
- blockResources?: WebResourceBlockType[];
1605
- /** Reuse a persistent warm Chromium daemon across runs via CDP (chromium only). */
1606
- warmBrowser?: boolean;
1607
- /** Scope key for isolating warm Chromium daemons across concurrent repos/runs (defaults to cwd hash). */
1608
- warmBrowserScope?: string;
1609
- /** Create a fresh isolated BrowserContext per flow using pre-warmed context pooling + background teardown. */
1610
- freshContextPerFlow?: boolean;
1611
- /**
1612
- * Context isolation strategy when `freshContextPerFlow` is enabled (Direct CDP):
1613
- * - `"fresh"` (default): new `Target.createBrowserContext` per flow (strictest isolation).
1614
- * - `"hot-cache"`: keeps Chromium's HTTP & V8 bytecode cache hot while wiping cookies, localStorage,
1615
- * sessionStorage, IndexedDB, CacheStorage, and service workers between flows (~4 ms reset!).
1616
- */
1617
- contextIsolation?: WebContextIsolation;
1618
- /** Max worker contexts sharing one Chromium browser process under `--parallel` (default: 2 to avoid CDP/IO contention). */
1619
- maxContextsPerBrowser?: number;
1620
- /** Automatically attach a CDP WebAuthn virtual authenticator (passkey) to every fresh context. */
1621
- virtualAuthenticator?: boolean | VirtualAuthenticatorOptions;
1622
- /** Optional Playwright storage state JSON file to preload for web runs */
1623
- storageState?: string;
1624
- /** Print verbose Playwright runtime events to stdout for local web debugging */
1625
- verboseLogging?: boolean;
1626
- /** Optional Storybook config for isolated component/story flows in the browser runtime */
1627
- storybook?: StorybookConfig;
1628
- /** Unpacked Chromium browser extension directories to load at launch. */
1629
- extensions?: string[];
1630
- /** Emulate `prefers-color-scheme` on web launch (`"dark"` | `"light"` | `"no-preference"`). */
1631
- colorScheme?: "dark" | "light" | "no-preference";
1632
- /** Emulate `prefers-reduced-motion` on web launch (`"reduce"` | `"no-preference"`). */
1633
- reducedMotion?: "reduce" | "no-preference";
1634
- /** Emulate IANA timezone ID on Chromium launch (e.g. `"America/New_York"`). */
1635
- timezoneId?: string;
1636
- }
1637
- interface CloudAppReferenceConfig {
1638
- /** Existing remote app reference, e.g. bs://... or storage:... */
1639
- id?: string;
1640
- /** Local file path to upload when the provider supports managed upload */
1641
- path?: string;
1642
- /** Override the uploaded file name when the provider supports it */
1643
- name?: string;
1644
- }
1645
- interface BrowserStackAppConfig extends CloudAppReferenceConfig {
1646
- /** Stable BrowserStack app alias */
1647
- customId?: string;
1648
- }
1649
- interface BrowserStackLocalConfig {
1650
- enabled?: boolean;
1651
- binary?: string;
1652
- identifier?: string;
1653
- args?: string[];
1654
- }
1655
- interface BrowserStackHelperConfig {
1656
- app?: BrowserStackAppConfig;
1657
- local?: BrowserStackLocalConfig;
1658
- options?: Record<string, unknown>;
1659
- }
1660
- interface SauceConnectConfig {
1661
- enabled?: boolean;
1662
- binary?: string;
1663
- tunnelName?: string;
1664
- args?: string[];
1665
- }
1666
- interface SauceLabsHelperConfig {
1667
- app?: CloudAppReferenceConfig;
1668
- connect?: SauceConnectConfig;
1669
- options?: Record<string, unknown>;
1670
- }
1671
- interface AppiumExecutionConfig {
1672
- serverUrl?: string;
1673
- capabilities?: Record<string, unknown>;
1674
- /**
1675
- * Platform-specific capabilities merged on top of `capabilities` when the
1676
- * matching platform runs. Useful when you want different `appium:deviceName`
1677
- * or `appium:platformVersion` for Android vs iOS.
1678
- */
1679
- platformCapabilities?: {
1680
- android?: Record<string, unknown>;
1681
- ios?: Record<string, unknown>;
1682
- };
1683
- capabilitiesFile?: string;
1684
- reportToProvider?: boolean;
1685
- browserstack?: BrowserStackHelperConfig;
1686
- saucelabs?: SauceLabsHelperConfig;
1687
- /** Path to a custom cloud provider module (default export must conform to CloudProvider interface). */
1688
- cloudProvider?: string;
1689
- /**
1690
- * Opt in to having spana spawn a local `appium` subprocess for the
1691
- * duration of the test run. Requires `appium` to be on PATH. When true,
1692
- * `serverUrl` (if set) is ignored and a URL is assigned to the
1693
- * auto-started server instead. Off by default — spana never spawns
1694
- * background processes unless you ask.
1695
- */
1696
- autoStart?: boolean;
1697
- /** Override the `appium` binary name. Default: "appium". */
1698
- autoStartBinary?: string;
1699
- /** Extra CLI args to forward to the spawned Appium process. */
1700
- autoStartArgs?: readonly string[];
1701
- }
1702
- interface ExecutionConfig {
1703
- mode?: "local" | "appium";
1704
- web?: WebExecutionConfig;
1705
- appium?: AppiumExecutionConfig;
1706
- /** In-app spana-bridge configuration shared across webview targets */
1707
- bridge?: BridgeConfig;
1708
- /** Warm daemon & process reuse settings for fast repeated runs */
1709
- warmDaemons?: WarmDaemonConfig;
1710
- }
1711
- interface ArtifactConfig {
1712
- outputDir?: string;
1713
- captureOnFailure?: boolean;
1714
- captureOnSuccess?: boolean;
1715
- captureSteps?: boolean;
1716
- screenshot?: boolean;
1717
- uiHierarchy?: boolean;
1718
- consoleLogs?: boolean;
1719
- jsErrors?: boolean;
1720
- har?: boolean;
1721
- jsCoverage?: boolean;
1722
- /** Video / screencast recording mode: "off" (default), "on", or "retain-on-failure". */
1723
- video?: VideoRecordingMode;
1724
- /** Embed interactive step-by-step visual playback timeline inside report.html (auto-enabled when video !== "off"). */
1725
- playback?: boolean;
1726
- /** Write Playwright-style interactive `trace.json` + `trace-viewer.html` bundle per flow. */
1727
- trace?: boolean;
1728
- /** Automatically attach Android `adb logcat` / iOS Simulator crash logs on native failure (default: true). */
1729
- nativeLogs?: boolean;
1730
- }
1731
- interface HookContext {
1732
- app: unknown;
1733
- expect?: unknown;
1734
- platform?: Platform;
1735
- result?: unknown;
1736
- summary?: unknown;
1737
- }
1738
- interface ProvConfig {
1739
- apps?: {
1740
- web?: AppConfig;
1741
- android?: AppConfig;
1742
- ios?: AppConfig;
1743
- electron?: ElectronAppConfig;
1744
- electrobun?: ElectrobunAppConfig;
1745
- };
1746
- defaults?: {
1747
- waitTimeout?: number;
1748
- pollInterval?: number;
1749
- settleTimeout?: number;
1750
- retries?: number;
1751
- /** Pause after each action (tap, scroll) to let the UI settle. Default: 0 (disabled). */
1752
- waitForIdleTimeout?: number;
1753
- /** Delay between each character when typing. Default: 0 (instant). */
1754
- typingDelay?: number;
1755
- /** Starting poll interval for adaptive backoff. Default: 50ms. Set equal to pollInterval to disable adaptive backoff. */
1756
- initialPollInterval?: number;
1757
- /** Max age in ms before cached hierarchy is stale. Default: 100. Set to 0 to disable. */
1758
- hierarchyCacheTtl?: number;
1759
- /** Max depth for UI hierarchy snapshots on iOS. Default: 100. */
1760
- snapshotMaxDepth?: number;
1761
- /** Delay in ms between retry attempts of a failed flow. Default: 0 (immediate). */
1762
- retryDelay?: number;
1763
- /** Max workers per platform when using --parallel. */
1764
- workers?: number;
1765
- /** Number of isolated OS worker processes sharing a dynamic longest-first flow queue (`--processes M`). */
1766
- processes?: number;
1767
- /** Max in-process workers before automatically sharding across multiple OS processes (default: 8). */
1768
- maxWorkersPerProcess?: number;
1769
- /** Default tap mode when a DOM channel resolves an element: "native" (real touch, default) or "dom" (fast synthetic click). */
1770
- tapMode?: TapMode;
1771
- /** Pin device locale across targets so system UI sheet labels stay deterministic. */
1772
- locale?: string;
1773
- /** Fail web element waits early when the page is idle & readyState === "complete" instead of waiting full waitTimeout. */
1774
- failFastWhenIdle?: boolean;
1775
- /** Consecutive stable animation frames required before pointer actions on web. Default: 2. Set 0 to disable. */
1776
- actionStableFrames?: number;
1777
- };
1778
- platforms?: Platform[];
1779
- /** Run platforms concurrently when they use independent resources. Default: false (serial). */
1780
- parallelPlatforms?: boolean;
1781
- flowDir?: string;
1782
- launchOptions?: LaunchOptions;
1783
- /**
1784
- * Reporter names or module paths. Built-in: "console", "json", "junit", "html", "allure".
1785
- * Custom reporters: provide a relative path (e.g., "./reporters/slack.ts") that default-exports
1786
- * a Reporter object or a `(options: { outputDir: string }) => Reporter` factory function.
1787
- */
1788
- reporters?: string[];
1789
- hooks?: {
1790
- beforeAll?: (ctx: HookContext) => Promise<void>;
1791
- beforeEach?: (ctx: HookContext) => Promise<void>;
1792
- afterEach?: (ctx: HookContext) => Promise<void>;
1793
- afterAll?: (ctx: HookContext) => Promise<void>;
1794
- };
1795
- artifacts?: ArtifactConfig;
1796
- execution?: ExecutionConfig;
1797
- visualRegression?: {
1798
- threshold?: number;
1799
- maxDiffPixelRatio?: number;
1800
- baselinesDir?: string;
1801
- mode?: "pixel" | "layout-tolerant";
1802
- };
1803
- /** Pluggable CI filters evaluated when `--changed-since <ref>` is passed. */
1804
- filters?: Array<{
1805
- name: string;
1806
- filter: (flows: any[], context: any) => Promise<any> | any;
1807
- }>;
1808
- /** Verified replay cache settings for optional agentic steps (`.spana/cache/`). */
1809
- replayCache?: {
1810
- mode?: "read-write" | "strict" | "off";
1811
- dir?: string;
1812
- };
1813
- /** Auto-boot one or more dev servers before tests run and tear them down cleanly afterwards. */
1814
- webServer?: WebServerConfig | WebServerConfig[];
1815
- /** Named test projects with dependency DAG (`dependencies`, `teardown`, per-project `storageState` / `browser` / `testMatch`). */
1816
- projects?: ProjectConfig[];
1817
- /** Optional LLM provider configuration for `agent.act()` / `agent.verify()` / `agent.extract()` and `spana explore`. */
1818
- agent?: Omit<AgentProviderConfig, "fetchFn">;
1819
- }
1820
- declare function defineConfig(config: ProvConfig): ProvConfig;
1821
-
1822
- interface SecondarySessionOptions {
1823
- name: string;
1824
- platform: "web";
1825
- baseUrl?: string;
1826
- headless?: boolean;
1827
- browser?: BrowserName;
1828
- storageState?: string;
1829
- verboseLogging?: boolean;
1830
- storybook?: StorybookConfig;
1831
- }
1832
- interface SecondarySession {
1833
- readonly name: string;
1834
- readonly platform: "web";
1835
- readonly app: PromiseApp;
1836
- readonly expect: PromiseExpectFn;
1837
- disconnect(): Promise<void>;
1838
- }
1839
- interface Sessions {
1840
- open(opts: SecondarySessionOptions): Promise<SecondarySession>;
1841
- }
1842
-
1843
- interface WhenCondition {
1844
- /** Only run on these platforms */
1845
- platform?: Platform | Platform[];
1846
- /** Only run when this environment variable is set */
1847
- env?: string;
1848
- }
1849
- type FlowSkipCondition = boolean | (WhenCondition & {
1850
- reason?: string;
1851
- });
1852
- interface FlowDefaults {
1853
- waitTimeout?: number;
1854
- pollInterval?: number;
1855
- settleTimeout?: number;
1856
- waitForIdleTimeout?: number;
1857
- typingDelay?: number;
1858
- /** Starting poll interval for adaptive backoff. Default: 50ms. */
1859
- initialPollInterval?: number;
1860
- /** Hierarchy cache TTL in ms. Default: 100. Set to 0 to disable. */
1861
- hierarchyCacheTtl?: number;
1862
- }
1863
- interface FlowConfig<R extends string = string> {
1864
- tags?: string[];
1865
- platforms?: Platform[];
1866
- timeout?: number;
1867
- autoLaunch?: boolean;
1868
- /** Per-flow launch defaults. Merged with project launchOptions and manual app.launch() calls. */
1869
- launchOptions?: LaunchOptions<R>;
1870
- artifacts?: ArtifactConfig;
1871
- when?: WhenCondition;
1872
- skip?: FlowSkipCondition;
1873
- fixme?: FlowSkipCondition;
1874
- only?: boolean;
1875
- retries?: number;
1876
- /** Per-flow overrides for timing defaults. Merged with global defaults. */
1877
- defaults?: FlowDefaults;
1878
- }
1879
- interface FlowContext<T extends string = string, R extends string = string> {
1880
- app: PromiseApp<T, R>;
1881
- expect: PromiseExpectFn<T>;
1882
- platform: Platform;
1883
- sessions: Sessions;
1884
- /** First-class verified replay-cache AI agent fixture (`agent.act()`, `agent.verify()`, `agent.extract()`). */
1885
- agent?: FlowAgent;
1886
- /** Group related actions into a named nested step in reports and Trace Viewer. */
1887
- step?: <A>(name: string, fn: () => Promise<A>) => Promise<A>;
1888
- }
1889
- type FlowFn<T extends string = string, R extends string = string> = (ctx: FlowContext<T, R>) => Promise<void>;
1890
- interface FlowDefinition<T extends string = string, R extends string = string> {
1891
- name: string;
1892
- fn: FlowFn<T, R>;
1893
- config: FlowConfig<R>;
1894
- sourcePath?: string;
1895
- }
1896
- declare function flow<T extends string = string, R extends string = string>(name: string, fn: FlowFn<T, R>): FlowDefinition<T, R>;
1897
- declare function flow<T extends string = string, R extends string = string>(name: string, config: FlowConfig<R>, fn: FlowFn<T, R>): FlowDefinition<T, R>;
1898
- declare namespace flow {
1899
- const skip: {
1900
- <T extends string = string, R extends string = string>(name: string, fn: FlowFn<T, R>): FlowDefinition<T, R>;
1901
- <T extends string = string, R extends string = string>(name: string, config: FlowConfig<R>, fn: FlowFn<T, R>): FlowDefinition<T, R>;
1902
- };
1903
- const fixme: {
1904
- <T extends string = string, R extends string = string>(name: string, fn: FlowFn<T, R>): FlowDefinition<T, R>;
1905
- <T extends string = string, R extends string = string>(name: string, config: FlowConfig<R>, fn: FlowFn<T, R>): FlowDefinition<T, R>;
1906
- };
1907
- const only: {
1908
- <T extends string = string, R extends string = string>(name: string, fn: FlowFn<T, R>): FlowDefinition<T, R>;
1909
- <T extends string = string, R extends string = string>(name: string, config: FlowConfig<R>, fn: FlowFn<T, R>): FlowDefinition<T, R>;
1910
- };
1911
- }
1912
-
1913
- export { type CdpSessionHandle as $, type AppiumExecutionConfig as A, type BrowserRouteMatcher as B, type BrowserHAR as C, DriverError as D, type ExtendedSelector as E, type FlowContext as F, type AgentActExecutor as G, type AgentProviderConfig as H, type ArtifactConfig as I, type BackUntilVisibleOptions as J, type BiometricOptions as K, type BridgeConfig as L, type BrowserCookie as M, type BrowserDialogHandler as N, type BrowserDialogInfo as O, type Platform as P, type BrowserDownloadInfo as Q, type RawDriverService as R, type Selector as S, type TapMode as T, type BrowserNetworkConditions as U, type VirtualAuthenticatorOptions as V, type BrowserRequestClient as W, type BrowserRequestOptions as X, type BrowserRequestResponse as Y, type BrowserResponseInfo as Z, type CacheWriteStatus as _, type DomElementMatch as a, buildDomFillScript as a$, type CreateFlowAgentOptions as a0, type DataSnapshotOptions as a1, type DataSnapshotResult as a2, DeviceInfo as a3, type DeviceStateConfig as a4, type DismissKeyboardOptions as a5, type DomChannelKind as a6, type DomRect as a7, type ElectronAppConfig as a8, type ExploreSessionResult as a9, type ReplayStepOutcome as aA, type RetryAssertionOptions as aB, type RunningWebServer as aC, SPANA_INJECTED_RUNTIME_SCRIPT as aD, type ScrollUntilVisibleOptions as aE, type SecondarySession as aF, type SecondarySessionOptions as aG, type SecretValue as aH, type SelectOptionInput as aI, type SelectorModifiers as aJ, type Sessions as aK, type StartWebServersOptions as aL, type StorybookConfig as aM, type StorybookOpenOptions as aN, type StorybookValue as aO, type ToPassExpectation as aP, type TouchAction as aQ, type TouchSequence as aR, type VideoRecordingMode as aS, type WarmDaemonConfig as aT, type WebBrowserEngine as aU, type WebContextIsolation as aV, type WebExecutionConfig as aW, type WebResourceBlockType as aX, type WebServerConfig as aY, assertDataSnapshot as aZ, buildDomActionabilityDiagScript as a_, type FlowAgent as aa, type FlowSkipCondition as ab, type FrameScope as ac, type Geolocation as ad, type InjectedRuntimeMethod as ae, type IsolatedBrowserContext as af, type LaunchOptions as ag, type NegatedPromiseExpectation as ah, type ObjectSelector as ai, type Orientation as aj, type PermissionOptions as ak, type PollExpectation as al, type PollMatchers as am, type ProjectConfig as an, type ProjectExecutionPlan as ao, type PromiseExpectFn as ap, type PromiseExpectation as aq, type PushPayload as ar, type RecordedAction as as, type RelativeSelector as at, type ReplayCacheEntry as au, type ReplayCacheMode as av, ReplayCacheStore as aw, type ReplayCacheSummary as ax, ReplaySession as ay, type ReplaySessionOptions as az, type ProvConfig as b, buildDomWaitForHiddenScript as b0, buildDomWaitForMatchScript as b1, buildDomWaitForSelectorScript as b2, buildInjectedCallScript as b3, buildReplayCacheKey as b4, byCss as b5, byRole as b6, checkServerReady as b7, createFlowAgent as b8, createOpenAICompatibleAgentProvider as b9, defineConfig as ba, filterFlowsForProject as bb, filterSelector as bc, first as bd, flow as be, formatActionsAsFlowCode as bf, inFrame as bg, isComposableDomSelector as bh, isHttpUrlReady as bi, isSecretValue as bj, isSystemUISelector as bk, isTcpPortOpen as bl, isTestIDSelector as bm, last as bn, matchDataSnapshot as bo, nth as bp, or as bq, replayRecordedAction as br, resolveProjectExecutionPlan as bs, runExploreSession as bt, secret as bu, startWebServer as bv, startWebServers as bw, systemUI as bx, unique as by, within as bz, type DomChannel as c, type DomTargetInfo as d, type DomWaitForSelectorOptions as e, type DomWaitForHiddenOptions as f, type DomWaitForMatchOptions as g, type DomWaitForMatchResult as h, type DomFillOptions as i, type BrowserMockResponse as j, type DomIdleOptions as k, type DomStorageEntries as l, type DomClearStorageOptions as m, type BrowserConsoleLog as n, type BrowserJSError as o, type BrowserName as p, type BrowserEmulationOptions as q, type FlowDefinition as r, type ElectrobunAppConfig as s, type ElectrobunRenderer as t, type AppConfig as u, type VirtualCredential as v, type FlowConfig as w, type VirtualCredentialInput as x, type PromiseApp as y, type FlowFn as z };