spana-test 0.11.0 → 0.13.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.
- package/.agents/skills/spana-testing/SKILL.md +0 -0
- package/LICENSE +0 -0
- package/README.md +5 -2
- package/dist/{accessibility-audit-YZOPUY3D.js → accessibility-audit-MHQ65DUD.js} +61 -12
- package/dist/accessibility-audit-MHQ65DUD.js.map +1 -0
- package/dist/agent/index.d.ts +3 -11
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +38 -15
- package/dist/agent/index.js.map +1 -1
- package/dist/{session-uT8xL03K.d.ts → agent/session.d.ts} +14 -46
- package/dist/agent/session.d.ts.map +1 -0
- package/dist/{agent-fixture-5C4MCWRD.js → agent-fixture-H6GOUHNX.js} +3 -3
- package/dist/{agent-fixture-5C4MCWRD.js.map → agent-fixture-H6GOUHNX.js.map} +0 -0
- package/dist/{allure-FGVR5LND.js → allure-XOM7BXL5.js} +5 -2
- package/dist/{allure-FGVR5LND.js.map → allure-XOM7BXL5.js.map} +1 -1
- package/dist/{android-6BOQTMM3.js → android-C2S4B4TH.js} +3 -3
- package/dist/{android-6BOQTMM3.js.map → android-C2S4B4TH.js.map} +0 -0
- package/dist/api/agent-fixture.d.ts +119 -0
- package/dist/api/agent-fixture.d.ts.map +1 -0
- package/dist/api/app.d.ts +399 -0
- package/dist/api/app.d.ts.map +1 -0
- package/dist/api/expect.d.ts +180 -0
- package/dist/api/expect.d.ts.map +1 -0
- package/dist/api/fixtures.d.ts +165 -0
- package/dist/api/fixtures.d.ts.map +1 -0
- package/dist/api/flow.d.ts +123 -0
- package/dist/api/flow.d.ts.map +1 -0
- package/dist/api/index.d.ts +4 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/snapshots.d.ts +26 -0
- package/dist/api/snapshots.d.ts.map +1 -0
- package/dist/api/storybook.d.ts +18 -0
- package/dist/api/storybook.d.ts.map +1 -0
- package/dist/api/suite.d.ts +46 -0
- package/dist/api/suite.d.ts.map +1 -0
- package/dist/app-W6PRRBMD.js +13 -0
- package/dist/{app-RSDPDTKT.js.map → app-W6PRRBMD.js.map} +0 -0
- package/dist/appium-CC77BJNK.js +935 -0
- package/dist/appium-CC77BJNK.js.map +1 -0
- package/dist/{appium-server-66GVUL24.js → appium-server-M6CWWUWF.js} +5 -2
- package/dist/{appium-server-66GVUL24.js.map → appium-server-M6CWWUWF.js.map} +1 -1
- package/dist/{baseline-manager-5TIUCNP5.js → baseline-manager-LVUVH2MJ.js} +5 -2
- package/dist/{baseline-manager-5TIUCNP5.js.map → baseline-manager-LVUVH2MJ.js.map} +1 -1
- package/dist/bridge-server-S3DHK7XE.js +12 -0
- package/dist/{cache-command-PANUAEMZ.js.map → bridge-server-S3DHK7XE.js.map} +0 -0
- package/dist/{cache-command-PANUAEMZ.js → cache-command-OL7HUK2K.js} +3 -3
- package/dist/{chunk-DGUM43GV.js.map → cache-command-OL7HUK2K.js.map} +0 -0
- package/dist/channels/android-cdp.d.ts +71 -0
- package/dist/channels/android-cdp.d.ts.map +1 -0
- package/dist/channels/apple-webinspector.d.ts +85 -0
- package/dist/channels/apple-webinspector.d.ts.map +1 -0
- package/dist/channels/bidi-client.d.ts +79 -0
- package/dist/channels/bidi-client.d.ts.map +1 -0
- package/dist/channels/bridge-server.d.ts +69 -0
- package/dist/channels/bridge-server.d.ts.map +1 -0
- package/dist/channels/cdp-client.d.ts +115 -0
- package/dist/channels/cdp-client.d.ts.map +1 -0
- package/dist/channels/dom-channel.d.ts +246 -0
- package/dist/channels/dom-channel.d.ts.map +1 -0
- package/dist/channels/index.d.ts +8 -0
- package/dist/channels/index.d.ts.map +1 -0
- package/dist/channels/webkit-inspector.d.ts +85 -0
- package/dist/channels/webkit-inspector.d.ts.map +1 -0
- package/dist/channels/ws-server.d.ts +21 -0
- package/dist/channels/ws-server.d.ts.map +1 -0
- package/dist/chunk-27H6NDA5.js +845 -0
- package/dist/chunk-27H6NDA5.js.map +1 -0
- package/dist/{chunk-WV3ALL3H.js → chunk-2MA5G2VH.js} +6 -2
- package/dist/{chunk-WV3ALL3H.js.map → chunk-2MA5G2VH.js.map} +1 -1
- package/dist/chunk-4LJ3KYCX.js +94 -0
- package/dist/chunk-4LJ3KYCX.js.map +1 -0
- package/dist/chunk-5SDVP53E.js +1046 -0
- package/dist/chunk-5SDVP53E.js.map +1 -0
- package/dist/{chunk-FPQAJNE3.js → chunk-5T7LSBDM.js} +288 -101
- package/dist/chunk-5T7LSBDM.js.map +1 -0
- package/dist/chunk-6C2EILMC.js +2589 -0
- package/dist/chunk-6C2EILMC.js.map +1 -0
- package/dist/{chunk-3IZMPNE7.js → chunk-7IUD55GY.js} +1333 -941
- package/dist/chunk-7IUD55GY.js.map +1 -0
- package/dist/{chunk-JPZCZHL4.js → chunk-7Q7TSUNL.js} +6 -1
- package/dist/{chunk-JPZCZHL4.js.map → chunk-7Q7TSUNL.js.map} +1 -1
- package/dist/{chunk-X2TJP7LB.js → chunk-7WHQIQPM.js} +11 -1
- package/dist/chunk-7WHQIQPM.js.map +1 -0
- package/dist/chunk-A7Z52TDQ.js +97 -0
- package/dist/chunk-A7Z52TDQ.js.map +1 -0
- package/dist/{chunk-WZAQANN6.js → chunk-BUNMIMGA.js} +9 -3
- package/dist/{chunk-WZAQANN6.js.map → chunk-BUNMIMGA.js.map} +1 -1
- package/dist/chunk-DMF2BPPA.js +547 -0
- package/dist/chunk-DMF2BPPA.js.map +1 -0
- package/dist/{chunk-Z6K4QQAR.js → chunk-FHCOPLYB.js} +36 -7
- package/dist/chunk-FHCOPLYB.js.map +1 -0
- package/dist/{chunk-3SH5JQF7.js → chunk-FSPMFRJO.js} +6 -1
- package/dist/{chunk-3SH5JQF7.js.map → chunk-FSPMFRJO.js.map} +1 -1
- package/dist/chunk-FTXUQMGH.js +56 -0
- package/dist/chunk-FTXUQMGH.js.map +1 -0
- package/dist/chunk-FUXFXFBM.js +1962 -0
- package/dist/chunk-FUXFXFBM.js.map +1 -0
- package/dist/{chunk-SIJJVN2D.js → chunk-FV7ONGQ7.js} +9 -3
- package/dist/{chunk-SIJJVN2D.js.map → chunk-FV7ONGQ7.js.map} +1 -1
- package/dist/{chunk-VUNH4AJD.js → chunk-GDVHJBR2.js} +9 -5
- package/dist/{chunk-VUNH4AJD.js.map → chunk-GDVHJBR2.js.map} +1 -1
- package/dist/chunk-GLNTGHR6.js +330 -0
- package/dist/chunk-GLNTGHR6.js.map +1 -0
- package/dist/{chunk-OPTNFLBL.js → chunk-HIGFQRWM.js} +7 -1
- package/dist/{chunk-OPTNFLBL.js.map → chunk-HIGFQRWM.js.map} +1 -1
- package/dist/chunk-HJY5YN4N.js +272 -0
- package/dist/chunk-HJY5YN4N.js.map +1 -0
- package/dist/chunk-HNQLWFHL.js +40 -0
- package/dist/chunk-HNQLWFHL.js.map +1 -0
- package/dist/chunk-HUYC4OAL.js +72 -0
- package/dist/chunk-HUYC4OAL.js.map +1 -0
- package/dist/chunk-HWS3XUEF.js +109 -0
- package/dist/chunk-HWS3XUEF.js.map +1 -0
- package/dist/chunk-IDIHDVGC.js +328 -0
- package/dist/chunk-IDIHDVGC.js.map +1 -0
- package/dist/{chunk-4SA7JK5D.js → chunk-IUK3RJ6W.js} +38 -20
- package/dist/{chunk-4SA7JK5D.js.map → chunk-IUK3RJ6W.js.map} +1 -1
- package/dist/chunk-K4K2ACT2.js +179 -0
- package/dist/chunk-K4K2ACT2.js.map +1 -0
- package/dist/chunk-LKGF75QJ.js +654 -0
- package/dist/chunk-LKGF75QJ.js.map +1 -0
- package/dist/chunk-MAKZK7GY.js +935 -0
- package/dist/chunk-MAKZK7GY.js.map +1 -0
- package/dist/chunk-MPJCUL2B.js +154 -0
- package/dist/chunk-MPJCUL2B.js.map +1 -0
- package/dist/chunk-MUMIMDRJ.js +24 -0
- package/dist/chunk-MUMIMDRJ.js.map +1 -0
- package/dist/{chunk-KJPHH2TW.js → chunk-NHT3XSX3.js} +6 -1
- package/dist/{chunk-KJPHH2TW.js.map → chunk-NHT3XSX3.js.map} +1 -1
- package/dist/{chunk-6PTUVG6A.js → chunk-NWGA3R2E.js} +7 -18
- package/dist/chunk-NWGA3R2E.js.map +1 -0
- package/dist/{chunk-3FSZNKEF.js → chunk-NXET4BFJ.js} +7 -1
- package/dist/{chunk-3FSZNKEF.js.map → chunk-NXET4BFJ.js.map} +1 -1
- package/dist/chunk-PPRNCRTS.js +1104 -0
- package/dist/chunk-PPRNCRTS.js.map +1 -0
- package/dist/{chunk-64UZQP7Z.js → chunk-PRQTAIYA.js} +30 -4
- package/dist/chunk-PRQTAIYA.js.map +1 -0
- package/dist/{chunk-4KK4E3N3.js → chunk-RHQJSPOS.js} +1289 -187
- package/dist/chunk-RHQJSPOS.js.map +1 -0
- package/dist/{chunk-CY3DKTBZ.js → chunk-RIXZISMX.js} +6 -1
- package/dist/{chunk-CY3DKTBZ.js.map → chunk-RIXZISMX.js.map} +1 -1
- package/dist/{chunk-S7MSBZ3F.js → chunk-TFEXYI6N.js} +6 -1
- package/dist/{chunk-S7MSBZ3F.js.map → chunk-TFEXYI6N.js.map} +1 -1
- package/dist/chunk-U56N5JCJ.js +19842 -0
- package/dist/chunk-U56N5JCJ.js.map +1 -0
- package/dist/{chunk-IHVZKQQW.js → chunk-UKUXNFQP.js} +6 -1
- package/dist/{chunk-IHVZKQQW.js.map → chunk-UKUXNFQP.js.map} +1 -1
- package/dist/{chunk-SGZMO456.js → chunk-VWJNINPX.js} +667 -123
- package/dist/chunk-VWJNINPX.js.map +1 -0
- package/dist/chunk-WFC4DCFF.js +529 -0
- package/dist/chunk-WFC4DCFF.js.map +1 -0
- package/dist/{chunk-26NJXP55.js → chunk-WJH5K42V.js} +6 -2
- package/dist/{chunk-26NJXP55.js.map → chunk-WJH5K42V.js.map} +1 -1
- package/dist/chunk-X5FRYDZ3.js +91 -0
- package/dist/chunk-X5FRYDZ3.js.map +1 -0
- package/dist/{chunk-VP6V4XEJ.js → chunk-XD6A3VXB.js} +10 -5
- package/dist/{chunk-VP6V4XEJ.js.map → chunk-XD6A3VXB.js.map} +1 -1
- package/dist/{chunk-2AFWVHQK.js → chunk-XVL4FHXA.js} +6 -1
- package/dist/{chunk-2AFWVHQK.js.map → chunk-XVL4FHXA.js.map} +1 -1
- package/dist/chunk-YFTHJRDO.js +37 -0
- package/dist/chunk-YFTHJRDO.js.map +1 -0
- package/dist/{chunk-LAMTF4LX.js → chunk-ZIETAMAD.js} +6 -1
- package/dist/{chunk-LAMTF4LX.js.map → chunk-ZIETAMAD.js.map} +1 -1
- package/dist/cli/cache-command.d.ts +29 -0
- package/dist/cli/cache-command.d.ts.map +1 -0
- package/dist/cli/command-errors.d.ts +7 -0
- package/dist/cli/command-errors.d.ts.map +1 -0
- package/dist/cli/config-loader.d.ts +11 -0
- package/dist/cli/config-loader.d.ts.map +1 -0
- package/dist/cli/doctor-command.d.ts +64 -0
- package/dist/cli/doctor-command.d.ts.map +1 -0
- package/dist/cli/gen-types-command.d.ts +2 -0
- package/dist/cli/gen-types-command.d.ts.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/init-command.d.ts +7 -0
- package/dist/cli/init-command.d.ts.map +1 -0
- package/dist/cli/init-flow-command.d.ts +11 -0
- package/dist/cli/init-flow-command.d.ts.map +1 -0
- package/dist/cli/iteration.d.ts +44 -0
- package/dist/cli/iteration.d.ts.map +1 -0
- package/dist/cli/scaffolds.d.ts +13 -0
- package/dist/cli/scaffolds.d.ts.map +1 -0
- package/dist/cli/studio-command.d.ts +8 -0
- package/dist/cli/studio-command.d.ts.map +1 -0
- package/dist/cli/test-command.d.ts +61 -0
- package/dist/cli/test-command.d.ts.map +1 -0
- package/dist/cli/watch-mode.d.ts +9 -0
- package/dist/cli/watch-mode.d.ts.map +1 -0
- package/dist/cli.js +86 -30
- package/dist/cli.js.map +1 -1
- package/dist/cloud/browserstack.d.ts +9 -0
- package/dist/cloud/browserstack.d.ts.map +1 -0
- package/dist/cloud/common.d.ts +26 -0
- package/dist/cloud/common.d.ts.map +1 -0
- package/dist/cloud/provider.d.ts +21 -0
- package/dist/cloud/provider.d.ts.map +1 -0
- package/dist/cloud/saucelabs.d.ts +9 -0
- package/dist/cloud/saucelabs.d.ts.map +1 -0
- package/dist/{compiler-X6WTFMYF.js → compiler-44UW2FID.js} +7 -3
- package/dist/{compiler-X6WTFMYF.js.map → compiler-44UW2FID.js.map} +1 -1
- package/dist/config-loader-7W7OEWRG.js +10 -0
- package/dist/{config-loader-CNGIW2XK.js.map → config-loader-7W7OEWRG.js.map} +0 -0
- package/dist/{console-DIYEJSSP.js → console-T6TVZ65G.js} +8 -2
- package/dist/console-T6TVZ65G.js.map +1 -0
- package/dist/core/accessibility-audit.d.ts +29 -0
- package/dist/core/accessibility-audit.d.ts.map +1 -0
- package/dist/core/artifacts.d.ts +27 -0
- package/dist/core/artifacts.d.ts.map +1 -0
- package/dist/core/baseline-manager.d.ts +18 -0
- package/dist/core/baseline-manager.d.ts.map +1 -0
- package/dist/core/benchmark.d.ts +21 -0
- package/dist/core/benchmark.d.ts.map +1 -0
- package/dist/core/debug-repl.d.ts +17 -0
- package/dist/core/debug-repl.d.ts.map +1 -0
- package/dist/core/engine.d.ts +51 -0
- package/dist/core/engine.d.ts.map +1 -0
- package/dist/core/filters.d.ts +248 -0
- package/dist/core/filters.d.ts.map +1 -0
- package/dist/core/flow-generator.d.ts +13 -0
- package/dist/core/flow-generator.d.ts.map +1 -0
- package/dist/core/graphemes.d.ts +2 -0
- package/dist/core/graphemes.d.ts.map +1 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/native-accel.d.ts +21 -0
- package/dist/core/native-accel.d.ts.map +1 -0
- package/dist/core/network-cache.d.ts +68 -0
- package/dist/core/network-cache.d.ts.map +1 -0
- package/dist/core/orchestrator.d.ts +44 -0
- package/dist/core/orchestrator.d.ts.map +1 -0
- package/dist/core/parallel.d.ts +42 -0
- package/dist/core/parallel.d.ts.map +1 -0
- package/dist/core/port-allocator.d.ts +16 -0
- package/dist/core/port-allocator.d.ts.map +1 -0
- package/dist/core/projects.d.ts +60 -0
- package/dist/core/projects.d.ts.map +1 -0
- package/dist/core/replay-cache.d.ts +127 -0
- package/dist/core/replay-cache.d.ts.map +1 -0
- package/dist/core/runner.d.ts +50 -0
- package/dist/core/runner.d.ts.map +1 -0
- package/dist/core/screenshot-compare.d.ts +50 -0
- package/dist/core/screenshot-compare.d.ts.map +1 -0
- package/dist/core/session-manager.d.ts +35 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/step-recorder.d.ts +20 -0
- package/dist/core/step-recorder.d.ts.map +1 -0
- package/dist/core/target-matrix.d.ts +29 -0
- package/dist/core/target-matrix.d.ts.map +1 -0
- package/dist/core/trace-viewer.d.ts +91 -0
- package/dist/core/trace-viewer.d.ts.map +1 -0
- package/dist/core/validator.d.ts +18 -0
- package/dist/core/validator.d.ts.map +1 -0
- package/dist/core/video-recorder.d.ts +120 -0
- package/dist/core/video-recorder.d.ts.map +1 -0
- package/dist/core/worker-pool.d.ts +87 -0
- package/dist/core/worker-pool.d.ts.map +1 -0
- package/dist/{daemon-manager-2EQDVUVM.js → daemon-manager-2SK5PHJR.js} +3 -3
- package/dist/{daemon-manager-2EQDVUVM.js.map → daemon-manager-2SK5PHJR.js.map} +0 -0
- package/dist/device/android.d.ts +66 -0
- package/dist/device/android.d.ts.map +1 -0
- package/dist/device/discover.d.ts +15 -0
- package/dist/device/discover.d.ts.map +1 -0
- package/dist/device/index.d.ts +4 -0
- package/dist/device/index.d.ts.map +1 -0
- package/dist/device/ios.d.ts +126 -0
- package/dist/device/ios.d.ts.map +1 -0
- package/dist/diagnostics/live-inspector.d.ts +121 -0
- package/dist/diagnostics/live-inspector.d.ts.map +1 -0
- package/dist/diagnostics/native-logs.d.ts +38 -0
- package/dist/diagnostics/native-logs.d.ts.map +1 -0
- package/dist/discover-6ULCTB5T.js +15 -0
- package/dist/{discover-NKDMB4UI.js.map → discover-6ULCTB5T.js.map} +0 -0
- package/dist/{doctor-command-6ZVJWCW7.js → doctor-command-4CQQLB7M.js} +24 -14
- package/dist/{doctor-command-6ZVJWCW7.js.map → doctor-command-4CQQLB7M.js.map} +1 -1
- package/dist/driver-3MEIFYST.js +19 -0
- package/dist/{filters-MQG2RMPX.js.map → driver-3MEIFYST.js.map} +0 -0
- package/dist/driver-QTIAADUZ.js +19 -0
- package/dist/{github-pr-YMWIPCCZ.js.map → driver-QTIAADUZ.js.map} +0 -0
- package/dist/drivers/adapter-registry.d.ts +96 -0
- package/dist/drivers/adapter-registry.d.ts.map +1 -0
- package/dist/drivers/appium/android.d.ts +22 -0
- package/dist/drivers/appium/android.d.ts.map +1 -0
- package/dist/drivers/appium/client.d.ts +26 -0
- package/dist/drivers/appium/client.d.ts.map +1 -0
- package/dist/drivers/appium/ios.d.ts +28 -0
- package/dist/drivers/appium/ios.d.ts.map +1 -0
- package/dist/drivers/appium/window-size.d.ts +8 -0
- package/dist/drivers/appium/window-size.d.ts.map +1 -0
- package/dist/drivers/browser-extensions.d.ts +62 -0
- package/dist/drivers/browser-extensions.d.ts.map +1 -0
- package/dist/drivers/cdp-browser.d.ts +129 -0
- package/dist/drivers/cdp-browser.d.ts.map +1 -0
- package/dist/drivers/common/xml-tokenizer.d.ts +26 -0
- package/dist/drivers/common/xml-tokenizer.d.ts.map +1 -0
- package/dist/drivers/device-controls.d.ts +36 -0
- package/dist/drivers/device-controls.d.ts.map +1 -0
- package/dist/drivers/electrobun.d.ts +47 -0
- package/dist/drivers/electrobun.d.ts.map +1 -0
- package/dist/drivers/electron.d.ts +36 -0
- package/dist/drivers/electron.d.ts.map +1 -0
- package/dist/drivers/index.d.ts +2 -0
- package/dist/drivers/index.d.ts.map +1 -0
- package/dist/drivers/launch-options.d.ts +10 -0
- package/dist/drivers/launch-options.d.ts.map +1 -0
- package/dist/drivers/network-profiles.d.ts +9 -0
- package/dist/drivers/network-profiles.d.ts.map +1 -0
- package/dist/drivers/playwright-parser.d.ts +16 -0
- package/dist/drivers/playwright-parser.d.ts.map +1 -0
- package/dist/drivers/playwright.d.ts +65 -0
- package/dist/drivers/playwright.d.ts.map +1 -0
- package/dist/drivers/raw-driver.d.ts +403 -0
- package/dist/drivers/raw-driver.d.ts.map +1 -0
- package/dist/drivers/uiautomator2/client.d.ts +77 -0
- package/dist/drivers/uiautomator2/client.d.ts.map +1 -0
- package/dist/drivers/uiautomator2/driver.d.ts +20 -0
- package/dist/drivers/uiautomator2/driver.d.ts.map +1 -0
- package/dist/drivers/uiautomator2/index.d.ts +5 -0
- package/dist/drivers/uiautomator2/index.d.ts.map +1 -0
- package/dist/drivers/uiautomator2/installer.d.ts +20 -0
- package/dist/drivers/uiautomator2/installer.d.ts.map +1 -0
- package/dist/drivers/uiautomator2/pagesource.d.ts +12 -0
- package/dist/drivers/uiautomator2/pagesource.d.ts.map +1 -0
- package/dist/drivers/wasm-utils.d.ts +100 -0
- package/dist/drivers/wasm-utils.d.ts.map +1 -0
- package/dist/drivers/wasm.d.ts +57 -0
- package/dist/drivers/wasm.d.ts.map +1 -0
- package/dist/drivers/wda/client.d.ts +116 -0
- package/dist/drivers/wda/client.d.ts.map +1 -0
- package/dist/drivers/wda/driver.d.ts +26 -0
- package/dist/drivers/wda/driver.d.ts.map +1 -0
- package/dist/drivers/wda/index.d.ts +5 -0
- package/dist/drivers/wda/index.d.ts.map +1 -0
- package/dist/drivers/wda/installer.d.ts +51 -0
- package/dist/drivers/wda/installer.d.ts.map +1 -0
- package/dist/drivers/wda/pagesource.d.ts +12 -0
- package/dist/drivers/wda/pagesource.d.ts.map +1 -0
- package/dist/electrobun-MPAHMSI2.js +15 -0
- package/dist/{installer-5UHTYQTB.js.map → electrobun-MPAHMSI2.js.map} +0 -0
- package/dist/electron-SQACDON3.js +9 -0
- package/dist/{ios-Y4TO5MBR.js.map → electron-SQACDON3.js.map} +0 -0
- package/dist/errors.d.ts +82 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/{filters-MQG2RMPX.js → filters-5DCGGJRN.js} +3 -3
- package/dist/{local-DM3YBSV5.js.map → filters-5DCGGJRN.js.map} +0 -0
- package/dist/gherkin/compiler.d.ts +3 -0
- package/dist/gherkin/compiler.d.ts.map +1 -0
- package/dist/gherkin/index.d.ts +7 -0
- package/dist/gherkin/index.d.ts.map +1 -0
- package/dist/gherkin/matcher.d.ts +9 -0
- package/dist/gherkin/matcher.d.ts.map +1 -0
- package/dist/gherkin/registry.d.ts +28 -0
- package/dist/gherkin/registry.d.ts.map +1 -0
- package/dist/gherkin/steps.d.ts +13 -31
- package/dist/gherkin/steps.d.ts.map +1 -0
- package/dist/gherkin/steps.js +5 -2
- package/dist/gherkin/steps.js.map +1 -1
- package/dist/gherkin/world.d.ts +15 -0
- package/dist/gherkin/world.d.ts.map +1 -0
- package/dist/{github-pr-YMWIPCCZ.js → github-pr-RYO6IAKD.js} +3 -3
- package/dist/{machine-6H25TRTU.js.map → github-pr-RYO6IAKD.js.map} +0 -0
- package/dist/{html-FLMWPFQD.js → html-KJ2QAGF4.js} +6 -3
- package/dist/{html-FLMWPFQD.js.map → html-KJ2QAGF4.js.map} +1 -1
- package/dist/index.d.ts +57 -2267
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +460 -69
- package/dist/index.js.map +1 -1
- package/dist/{init-command-Z3QREABL.js → init-command-V5VGN3IS.js} +5 -2
- package/dist/{init-command-Z3QREABL.js.map → init-command-V5VGN3IS.js.map} +1 -1
- package/dist/{init-flow-command-4EKRVTNT.js → init-flow-command-INYUCC6N.js} +6 -3
- package/dist/{init-flow-command-4EKRVTNT.js.map → init-flow-command-INYUCC6N.js.map} +1 -1
- package/dist/{installer-5UHTYQTB.js → installer-DMTY47SI.js} +5 -5
- package/dist/{provider-YIPU5K42.js.map → installer-DMTY47SI.js.map} +0 -0
- package/dist/installer-KL2NCILK.js +17 -0
- package/dist/{runner-WOVZWUQR.js.map → installer-KL2NCILK.js.map} +0 -0
- package/dist/{ios-Y4TO5MBR.js → ios-SZ4RBI7Q.js} +4 -4
- package/dist/{server-ING5D5ZJ.js.map → ios-SZ4RBI7Q.js.map} +0 -0
- package/dist/json-57Z2YSES.js +39 -0
- package/dist/json-57Z2YSES.js.map +1 -0
- package/dist/{junit-CGB3LKHD.js → junit-MHD5AXBU.js} +26 -6
- package/dist/junit-MHD5AXBU.js.map +1 -0
- package/dist/{local-DM3YBSV5.js → local-SWHWINSA.js} +11 -12
- package/dist/{session-5TNWVGQQ.js.map → local-SWHWINSA.js.map} +0 -0
- package/dist/{machine-6H25TRTU.js → machine-NOOFRT45.js} +3 -3
- package/dist/{validator-WO5IL7IY.js.map → machine-NOOFRT45.js.map} +0 -0
- package/dist/machine.d.ts +20 -0
- package/dist/machine.d.ts.map +1 -0
- package/dist/mcp/server.d.ts +73 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/pagesource-KIQ5T5MA.js +9 -0
- package/dist/pagesource-KIQ5T5MA.js.map +1 -0
- package/dist/pagesource-KKG7WMFJ.js +9 -0
- package/dist/pagesource-KKG7WMFJ.js.map +1 -0
- package/dist/playwright-42QYIZEE.js +28 -0
- package/dist/playwright-42QYIZEE.js.map +1 -0
- package/dist/{provider-YIPU5K42.js → provider-CBAXZ2VA.js} +3 -3
- package/dist/provider-CBAXZ2VA.js.map +1 -0
- package/dist/{redact-U72BUBBR.js → redact-OG4M3IEU.js} +5 -2
- package/dist/{redact-U72BUBBR.js.map → redact-OG4M3IEU.js.map} +1 -1
- package/dist/report/allure.d.ts +3 -0
- package/dist/report/allure.d.ts.map +1 -0
- package/dist/report/classify-error.d.ts +7 -0
- package/dist/report/classify-error.d.ts.map +1 -0
- package/dist/report/code-frame.d.ts +16 -0
- package/dist/report/code-frame.d.ts.map +1 -0
- package/dist/report/console.d.ts +7 -0
- package/dist/report/console.d.ts.map +1 -0
- package/dist/report/failure-bundle.d.ts +66 -0
- package/dist/report/failure-bundle.d.ts.map +1 -0
- package/dist/report/failure-diagnostics.d.ts +11 -0
- package/dist/report/failure-diagnostics.d.ts.map +1 -0
- package/dist/report/github-pr.d.ts +20 -0
- package/dist/report/github-pr.d.ts.map +1 -0
- package/dist/report/html.d.ts +3 -0
- package/dist/report/html.d.ts.map +1 -0
- package/dist/report/index.d.ts +8 -0
- package/dist/report/index.d.ts.map +1 -0
- package/dist/report/json.d.ts +3 -0
- package/dist/report/json.d.ts.map +1 -0
- package/dist/report/junit.d.ts +3 -0
- package/dist/report/junit.d.ts.map +1 -0
- package/dist/report/redact.d.ts +29 -0
- package/dist/report/redact.d.ts.map +1 -0
- package/dist/report/selector-guardrails.d.ts +12 -0
- package/dist/report/selector-guardrails.d.ts.map +1 -0
- package/dist/report/types.d.ts +164 -0
- package/dist/report/types.d.ts.map +1 -0
- package/dist/{runner-WOVZWUQR.js → runner-ABGUVOJG.js} +5 -3
- package/dist/runner-ABGUVOJG.js.map +1 -0
- package/dist/runtime/appium-server.d.ts +34 -0
- package/dist/runtime/appium-server.d.ts.map +1 -0
- package/dist/runtime/appium.d.ts +5 -0
- package/dist/runtime/appium.d.ts.map +1 -0
- package/dist/runtime/capabilities.d.ts +19 -0
- package/dist/runtime/capabilities.d.ts.map +1 -0
- package/dist/runtime/daemon-manager.d.ts +83 -0
- package/dist/runtime/daemon-manager.d.ts.map +1 -0
- package/dist/runtime/local.d.ts +38 -0
- package/dist/runtime/local.d.ts.map +1 -0
- package/dist/runtime/types.d.ts +21 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/web-server.d.ts +57 -0
- package/dist/runtime/web-server.d.ts.map +1 -0
- package/dist/schemas/config.d.ts +812 -0
- package/dist/schemas/config.d.ts.map +1 -0
- package/dist/schemas/device.d.ts +12 -0
- package/dist/schemas/device.d.ts.map +1 -0
- package/dist/schemas/element.d.ts +66 -0
- package/dist/schemas/element.d.ts.map +1 -0
- package/dist/schemas/index.d.ts +5 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/selector.d.ts +193 -0
- package/dist/schemas/selector.d.ts.map +1 -0
- package/dist/screenshot-compare-BJRJHKNQ.js +12 -0
- package/dist/screenshot-compare-BJRJHKNQ.js.map +1 -0
- package/dist/server-2Y46CDVB.js +6749 -0
- package/dist/server-2Y46CDVB.js.map +1 -0
- package/dist/{server-ING5D5ZJ.js → server-ZCBZ4UYF.js} +3 -3
- package/dist/server-ZCBZ4UYF.js.map +1 -0
- package/dist/session-5XW6TKF4.js +39 -0
- package/dist/session-5XW6TKF4.js.map +1 -0
- package/dist/smart/auto-wait.d.ts +38 -0
- package/dist/smart/auto-wait.d.ts.map +1 -0
- package/dist/smart/channel-resolver.d.ts +90 -0
- package/dist/smart/channel-resolver.d.ts.map +1 -0
- package/dist/smart/coordinator.d.ts +162 -0
- package/dist/smart/coordinator.d.ts.map +1 -0
- package/dist/smart/diagnostics.d.ts +15 -0
- package/dist/smart/diagnostics.d.ts.map +1 -0
- package/dist/smart/element-matcher.d.ts +24 -0
- package/dist/smart/element-matcher.d.ts.map +1 -0
- package/dist/smart/hierarchy-cache.d.ts +16 -0
- package/dist/smart/hierarchy-cache.d.ts.map +1 -0
- package/dist/smart/index.d.ts +4 -0
- package/dist/smart/index.d.ts.map +1 -0
- package/dist/studio/api.d.ts +317 -0
- package/dist/studio/api.d.ts.map +1 -0
- package/dist/studio/context.d.ts +7 -0
- package/dist/studio/context.d.ts.map +1 -0
- package/dist/studio/core/element-tree.d.ts +15 -0
- package/dist/studio/core/element-tree.d.ts.map +1 -0
- package/dist/studio/effect-handler.d.ts +3 -0
- package/dist/studio/effect-handler.d.ts.map +1 -0
- package/dist/studio/procedures.d.ts +4 -0
- package/dist/studio/procedures.d.ts.map +1 -0
- package/dist/studio/recording-session.d.ts +31 -0
- package/dist/studio/recording-session.d.ts.map +1 -0
- package/dist/studio/routers/devices.d.ts +11 -0
- package/dist/studio/routers/devices.d.ts.map +1 -0
- package/dist/studio/routers/inspector.d.ts +104 -0
- package/dist/studio/routers/inspector.d.ts.map +1 -0
- package/dist/studio/routers/recording.d.ts +130 -0
- package/dist/studio/routers/recording.d.ts.map +1 -0
- package/dist/studio/routers/tests.d.ts +93 -0
- package/dist/studio/routers/tests.d.ts.map +1 -0
- package/dist/studio/server.d.ts +12 -0
- package/dist/studio/server.d.ts.map +1 -0
- package/dist/{studio-command-KK7A3KN6.js → studio-command-BNBOL424.js} +6 -3
- package/dist/{studio-command-KK7A3KN6.js.map → studio-command-BNBOL424.js.map} +1 -1
- package/dist/{test-command-QGIJBRH7.js → test-command-T4PLAZXU.js} +311 -1080
- package/dist/test-command-T4PLAZXU.js.map +1 -0
- package/dist/{validator-WO5IL7IY.js → validator-AJNOFBQM.js} +4 -4
- package/dist/validator-AJNOFBQM.js.map +1 -0
- package/dist/watch-mode-NR5MHNNL.js +10 -0
- package/dist/watch-mode-NR5MHNNL.js.map +1 -0
- package/native/darwin-arm64/libspana_native.dylib +0 -0
- package/native/darwin-x64/libspana_native.dylib +0 -0
- package/native/linux-arm64/libspana_native.so +0 -0
- package/native/linux-x64/libspana_native.so +0 -0
- package/native/win32-x64/spana_native.dll +0 -0
- package/package.json +16 -19
- package/studio-dist/assets/index-CHLA4F7b.css +2 -0
- package/studio-dist/assets/index-DXGUfzm3.js +23 -0
- package/studio-dist/index.html +2 -2
- package/dist/accessibility-audit-YZOPUY3D.js.map +0 -1
- package/dist/app-RSDPDTKT.js +0 -10
- package/dist/chunk-3IZMPNE7.js.map +0 -1
- package/dist/chunk-4KK4E3N3.js.map +0 -1
- package/dist/chunk-54ASKII6.js +0 -183
- package/dist/chunk-54ASKII6.js.map +0 -1
- package/dist/chunk-64UZQP7Z.js.map +0 -1
- package/dist/chunk-6PTUVG6A.js.map +0 -1
- package/dist/chunk-DGUM43GV.js +0 -11
- package/dist/chunk-FPQAJNE3.js.map +0 -1
- package/dist/chunk-FXBWACUT.js +0 -4378
- package/dist/chunk-FXBWACUT.js.map +0 -1
- package/dist/chunk-SGZMO456.js.map +0 -1
- package/dist/chunk-WS2TVNMY.js +0 -2494
- package/dist/chunk-WS2TVNMY.js.map +0 -1
- package/dist/chunk-X2TJP7LB.js.map +0 -1
- package/dist/chunk-XA6LWLZQ.js +0 -310
- package/dist/chunk-XA6LWLZQ.js.map +0 -1
- package/dist/chunk-Z6K4QQAR.js.map +0 -1
- package/dist/config-loader-CNGIW2XK.js +0 -9
- package/dist/console-DIYEJSSP.js.map +0 -1
- package/dist/discover-NKDMB4UI.js +0 -15
- package/dist/flow-DddAj1xv.d.ts +0 -1913
- package/dist/json-JMRPUVY2.js +0 -20
- package/dist/json-JMRPUVY2.js.map +0 -1
- package/dist/junit-CGB3LKHD.js.map +0 -1
- package/dist/screenshot-compare-POTXVUTL.js +0 -136
- package/dist/screenshot-compare-POTXVUTL.js.map +0 -1
- package/dist/server-JNQ2PLCC.js +0 -855
- package/dist/server-JNQ2PLCC.js.map +0 -1
- package/dist/session-5TNWVGQQ.js +0 -21
- package/dist/test-command-QGIJBRH7.js.map +0 -1
- package/studio-dist/assets/index-CBFsOh-9.js +0 -193
- package/studio-dist/assets/index-DH_18EyL.css +0 -1
|
@@ -0,0 +1,845 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createAndroidWebViewCdpChannel
|
|
3
|
+
} from "./chunk-HJY5YN4N.js";
|
|
4
|
+
import {
|
|
5
|
+
androidDeviceControls,
|
|
6
|
+
deviceEffect
|
|
7
|
+
} from "./chunk-HWS3XUEF.js";
|
|
8
|
+
import {
|
|
9
|
+
resolveNetworkConditions
|
|
10
|
+
} from "./chunk-HNQLWFHL.js";
|
|
11
|
+
import {
|
|
12
|
+
adbClearApp,
|
|
13
|
+
adbForceStop,
|
|
14
|
+
adbLaunchApp,
|
|
15
|
+
adbOpenLink,
|
|
16
|
+
adbResetNetwork,
|
|
17
|
+
adbSetAirplaneMode,
|
|
18
|
+
adbSetCustomNetwork,
|
|
19
|
+
adbSetData,
|
|
20
|
+
adbSetNetworkProfile,
|
|
21
|
+
adbSetWifi
|
|
22
|
+
} from "./chunk-XVL4FHXA.js";
|
|
23
|
+
import {
|
|
24
|
+
createCompositeDomChannel
|
|
25
|
+
} from "./chunk-DMF2BPPA.js";
|
|
26
|
+
import {
|
|
27
|
+
splitGraphemes
|
|
28
|
+
} from "./chunk-MUMIMDRJ.js";
|
|
29
|
+
import {
|
|
30
|
+
hasLaunchDeviceState
|
|
31
|
+
} from "./chunk-NWGA3R2E.js";
|
|
32
|
+
import {
|
|
33
|
+
DriverError
|
|
34
|
+
} from "./chunk-A7Z52TDQ.js";
|
|
35
|
+
import {
|
|
36
|
+
init_esm_shims
|
|
37
|
+
} from "./chunk-FTXUQMGH.js";
|
|
38
|
+
|
|
39
|
+
// src/drivers/uiautomator2/driver.ts
|
|
40
|
+
init_esm_shims();
|
|
41
|
+
import { Effect } from "effect";
|
|
42
|
+
|
|
43
|
+
// src/drivers/uiautomator2/client.ts
|
|
44
|
+
init_esm_shims();
|
|
45
|
+
var UiAutomator2Client = class {
|
|
46
|
+
baseUrl;
|
|
47
|
+
sessionId = null;
|
|
48
|
+
constructor(host, port) {
|
|
49
|
+
this.baseUrl = `http://${host}:${port}`;
|
|
50
|
+
}
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
// HTTP helpers
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
async request(method, path, body) {
|
|
55
|
+
const url = `${this.baseUrl}${path}`;
|
|
56
|
+
const init = {
|
|
57
|
+
method,
|
|
58
|
+
headers: { "Content-Type": "application/json" }
|
|
59
|
+
};
|
|
60
|
+
if (body !== void 0) {
|
|
61
|
+
init.body = JSON.stringify(body);
|
|
62
|
+
}
|
|
63
|
+
const res = await fetch(url, init);
|
|
64
|
+
const text = await res.text();
|
|
65
|
+
let parsed;
|
|
66
|
+
try {
|
|
67
|
+
parsed = JSON.parse(text);
|
|
68
|
+
} catch {
|
|
69
|
+
throw new Error(`UiAutomator2: failed to parse response: ${text}`);
|
|
70
|
+
}
|
|
71
|
+
if (!res.ok) {
|
|
72
|
+
const val = parsed.value;
|
|
73
|
+
const msg = val?.message ?? val?.error ?? text;
|
|
74
|
+
throw new Error(`UiAutomator2 ${method} ${path} \u2192 ${res.status}: ${msg}`);
|
|
75
|
+
}
|
|
76
|
+
if (parsed.value !== null && typeof parsed.value === "object" && "error" in parsed.value) {
|
|
77
|
+
const val = parsed.value;
|
|
78
|
+
throw new Error(`UiAutomator2 error: ${val.message ?? val.error}`);
|
|
79
|
+
}
|
|
80
|
+
return parsed.value;
|
|
81
|
+
}
|
|
82
|
+
sessionPath(path) {
|
|
83
|
+
if (this.sessionId === null) {
|
|
84
|
+
throw new Error("UiAutomator2: no active session");
|
|
85
|
+
}
|
|
86
|
+
return `/session/${this.sessionId}${path}`;
|
|
87
|
+
}
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
// Session management
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
async createSession(appPackage) {
|
|
92
|
+
const capabilities = {
|
|
93
|
+
platformName: "Android"
|
|
94
|
+
};
|
|
95
|
+
if (appPackage) {
|
|
96
|
+
capabilities["appium:appPackage"] = appPackage;
|
|
97
|
+
}
|
|
98
|
+
const body = { capabilities };
|
|
99
|
+
const res = await fetch(`${this.baseUrl}/session`, {
|
|
100
|
+
method: "POST",
|
|
101
|
+
headers: { "Content-Type": "application/json" },
|
|
102
|
+
body: JSON.stringify(body)
|
|
103
|
+
});
|
|
104
|
+
const text = await res.text();
|
|
105
|
+
let parsed;
|
|
106
|
+
try {
|
|
107
|
+
parsed = JSON.parse(text);
|
|
108
|
+
} catch {
|
|
109
|
+
throw new Error(`UiAutomator2: failed to parse session response: ${text}`);
|
|
110
|
+
}
|
|
111
|
+
if (!res.ok) {
|
|
112
|
+
const val = parsed["value"];
|
|
113
|
+
throw new Error(`UiAutomator2: failed to create session: ${val?.message ?? text}`);
|
|
114
|
+
}
|
|
115
|
+
let sessionId = parsed["sessionId"] ?? parsed["value"]?.["sessionId"];
|
|
116
|
+
if (!sessionId) {
|
|
117
|
+
throw new Error("UiAutomator2: no sessionId in session response");
|
|
118
|
+
}
|
|
119
|
+
this.sessionId = sessionId;
|
|
120
|
+
return sessionId;
|
|
121
|
+
}
|
|
122
|
+
async deleteSession() {
|
|
123
|
+
if (this.sessionId === null) return;
|
|
124
|
+
const path = `/session/${this.sessionId}`;
|
|
125
|
+
this.sessionId = null;
|
|
126
|
+
await fetch(`${this.baseUrl}${path}`, { method: "DELETE" });
|
|
127
|
+
}
|
|
128
|
+
// ---------------------------------------------------------------------------
|
|
129
|
+
// Screen queries
|
|
130
|
+
// ---------------------------------------------------------------------------
|
|
131
|
+
async getSource() {
|
|
132
|
+
const value = await this.request("GET", this.sessionPath("/source"));
|
|
133
|
+
return value;
|
|
134
|
+
}
|
|
135
|
+
async getScreenshot() {
|
|
136
|
+
const value = await this.request("GET", this.sessionPath("/screenshot"));
|
|
137
|
+
return value;
|
|
138
|
+
}
|
|
139
|
+
async getWindowSize() {
|
|
140
|
+
try {
|
|
141
|
+
return await this.request(
|
|
142
|
+
"GET",
|
|
143
|
+
this.sessionPath("/window/current/size")
|
|
144
|
+
);
|
|
145
|
+
} catch {
|
|
146
|
+
try {
|
|
147
|
+
return await this.request(
|
|
148
|
+
"GET",
|
|
149
|
+
this.sessionPath("/window/size")
|
|
150
|
+
);
|
|
151
|
+
} catch {
|
|
152
|
+
return { width: 1080, height: 1920 };
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
async setOrientation(orientation) {
|
|
157
|
+
await this.request("POST", this.sessionPath("/orientation"), { orientation });
|
|
158
|
+
}
|
|
159
|
+
// ---------------------------------------------------------------------------
|
|
160
|
+
// Gestures — Appium gesture extensions
|
|
161
|
+
// These match the endpoints used by maestro-runner's uiautomator2 client.
|
|
162
|
+
// ---------------------------------------------------------------------------
|
|
163
|
+
async performTap(x, y) {
|
|
164
|
+
await this.request("POST", this.sessionPath("/appium/gestures/click"), {
|
|
165
|
+
offset: { x, y }
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
async performDoubleTap(x, y) {
|
|
169
|
+
await this.request("POST", this.sessionPath("/appium/gestures/double_click"), {
|
|
170
|
+
offset: { x, y }
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
async performLongPress(x, y, duration) {
|
|
174
|
+
await this.request("POST", this.sessionPath("/appium/gestures/long_click"), {
|
|
175
|
+
offset: { x, y },
|
|
176
|
+
duration
|
|
177
|
+
// milliseconds
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Coordinate-based swipe from (startX, startY) to (endX, endY).
|
|
182
|
+
*
|
|
183
|
+
* The Appium swipe extension only accepts direction + percent; for arbitrary
|
|
184
|
+
* from/to coordinates we use the W3C Actions API instead.
|
|
185
|
+
*
|
|
186
|
+
* @param duration - gesture duration in milliseconds
|
|
187
|
+
*/
|
|
188
|
+
async performSwipe(startX, startY, endX, endY, duration) {
|
|
189
|
+
await this.request("POST", this.sessionPath("/actions"), {
|
|
190
|
+
actions: [
|
|
191
|
+
{
|
|
192
|
+
type: "pointer",
|
|
193
|
+
id: "finger1",
|
|
194
|
+
parameters: { pointerType: "touch" },
|
|
195
|
+
actions: [
|
|
196
|
+
{ type: "pointerMove", duration: 0, x: startX, y: startY },
|
|
197
|
+
{ type: "pointerDown", button: 0 },
|
|
198
|
+
{ type: "pointerMove", duration, x: endX, y: endY },
|
|
199
|
+
{ type: "pointerUp", button: 0 }
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Pinch gesture (zoom out) — two fingers move toward center.
|
|
207
|
+
*
|
|
208
|
+
* @param cx - center X coordinate
|
|
209
|
+
* @param cy - center Y coordinate
|
|
210
|
+
* @param scale - 0..1 representing how far fingers start from center (as fraction of 200px)
|
|
211
|
+
* @param duration - gesture duration in milliseconds
|
|
212
|
+
*/
|
|
213
|
+
async performPinch(cx, cy, scale, duration) {
|
|
214
|
+
const dist = 200 * scale;
|
|
215
|
+
await this.request("POST", this.sessionPath("/actions"), {
|
|
216
|
+
actions: [
|
|
217
|
+
{
|
|
218
|
+
type: "pointer",
|
|
219
|
+
id: "finger1",
|
|
220
|
+
parameters: { pointerType: "touch" },
|
|
221
|
+
actions: [
|
|
222
|
+
{ type: "pointerMove", duration: 0, x: Math.round(cx - dist), y: Math.round(cy) },
|
|
223
|
+
{ type: "pointerDown", button: 0 },
|
|
224
|
+
{ type: "pointerMove", duration, x: Math.round(cx - 10), y: Math.round(cy) },
|
|
225
|
+
{ type: "pointerUp", button: 0 }
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
type: "pointer",
|
|
230
|
+
id: "finger2",
|
|
231
|
+
parameters: { pointerType: "touch" },
|
|
232
|
+
actions: [
|
|
233
|
+
{ type: "pointerMove", duration: 0, x: Math.round(cx + dist), y: Math.round(cy) },
|
|
234
|
+
{ type: "pointerDown", button: 0 },
|
|
235
|
+
{ type: "pointerMove", duration, x: Math.round(cx + 10), y: Math.round(cy) },
|
|
236
|
+
{ type: "pointerUp", button: 0 }
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
]
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Zoom gesture (zoom in) — two fingers move away from center.
|
|
244
|
+
*
|
|
245
|
+
* @param cx - center X coordinate
|
|
246
|
+
* @param cy - center Y coordinate
|
|
247
|
+
* @param scale - 0..1 representing how far fingers end from center (as fraction of 200px)
|
|
248
|
+
* @param duration - gesture duration in milliseconds
|
|
249
|
+
*/
|
|
250
|
+
async performZoom(cx, cy, scale, duration) {
|
|
251
|
+
const dist = 200 * scale;
|
|
252
|
+
await this.request("POST", this.sessionPath("/actions"), {
|
|
253
|
+
actions: [
|
|
254
|
+
{
|
|
255
|
+
type: "pointer",
|
|
256
|
+
id: "finger1",
|
|
257
|
+
parameters: { pointerType: "touch" },
|
|
258
|
+
actions: [
|
|
259
|
+
{ type: "pointerMove", duration: 0, x: Math.round(cx - 10), y: Math.round(cy) },
|
|
260
|
+
{ type: "pointerDown", button: 0 },
|
|
261
|
+
{ type: "pointerMove", duration, x: Math.round(cx - dist), y: Math.round(cy) },
|
|
262
|
+
{ type: "pointerUp", button: 0 }
|
|
263
|
+
]
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
type: "pointer",
|
|
267
|
+
id: "finger2",
|
|
268
|
+
parameters: { pointerType: "touch" },
|
|
269
|
+
actions: [
|
|
270
|
+
{ type: "pointerMove", duration: 0, x: Math.round(cx + 10), y: Math.round(cy) },
|
|
271
|
+
{ type: "pointerDown", button: 0 },
|
|
272
|
+
{ type: "pointerMove", duration, x: Math.round(cx + dist), y: Math.round(cy) },
|
|
273
|
+
{ type: "pointerUp", button: 0 }
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
]
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Arbitrary multi-touch gesture using W3C Actions.
|
|
281
|
+
* Each sequence represents one finger with a series of actions.
|
|
282
|
+
*/
|
|
283
|
+
async performMultiTouch(sequences) {
|
|
284
|
+
const actions = sequences.map((seq) => ({
|
|
285
|
+
type: "pointer",
|
|
286
|
+
id: `finger${seq.id}`,
|
|
287
|
+
parameters: { pointerType: "touch" },
|
|
288
|
+
actions: seq.actions.map((a) => {
|
|
289
|
+
switch (a.type) {
|
|
290
|
+
case "move":
|
|
291
|
+
return {
|
|
292
|
+
type: "pointerMove",
|
|
293
|
+
duration: a.duration ?? 0,
|
|
294
|
+
x: Math.round(a.x),
|
|
295
|
+
y: Math.round(a.y)
|
|
296
|
+
};
|
|
297
|
+
case "down":
|
|
298
|
+
return { type: "pointerDown", button: 0 };
|
|
299
|
+
case "up":
|
|
300
|
+
return { type: "pointerUp", button: 0 };
|
|
301
|
+
case "pause":
|
|
302
|
+
return { type: "pause", duration: a.duration };
|
|
303
|
+
}
|
|
304
|
+
})
|
|
305
|
+
}));
|
|
306
|
+
await this.request("POST", this.sessionPath("/actions"), { actions });
|
|
307
|
+
}
|
|
308
|
+
// ---------------------------------------------------------------------------
|
|
309
|
+
// Text / keyboard
|
|
310
|
+
// ---------------------------------------------------------------------------
|
|
311
|
+
async sendKeys(text) {
|
|
312
|
+
const hasComplexChars = /[\u{10000}-\u{10FFFF}]|\u200D/u.test(text);
|
|
313
|
+
if (hasComplexChars) {
|
|
314
|
+
const segments = splitGraphemes(text);
|
|
315
|
+
let simpleBatch = "";
|
|
316
|
+
for (const segment of segments) {
|
|
317
|
+
if (/[\u{10000}-\u{10FFFF}]|\u200D/u.test(segment)) {
|
|
318
|
+
if (simpleBatch) {
|
|
319
|
+
await this.sendKeysViaActions(simpleBatch);
|
|
320
|
+
simpleBatch = "";
|
|
321
|
+
}
|
|
322
|
+
} else {
|
|
323
|
+
simpleBatch += segment;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
if (simpleBatch) {
|
|
327
|
+
await this.sendKeysViaActions(simpleBatch);
|
|
328
|
+
}
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
await this.sendKeysViaActions(text);
|
|
332
|
+
}
|
|
333
|
+
async sendKeysViaActions(text) {
|
|
334
|
+
const keyActions = [];
|
|
335
|
+
for (const segment of splitGraphemes(text)) {
|
|
336
|
+
keyActions.push({ type: "keyDown", value: segment });
|
|
337
|
+
keyActions.push({ type: "keyUp", value: segment });
|
|
338
|
+
}
|
|
339
|
+
await this.request("POST", this.sessionPath("/actions"), {
|
|
340
|
+
actions: [
|
|
341
|
+
{
|
|
342
|
+
type: "key",
|
|
343
|
+
id: "keyboard",
|
|
344
|
+
actions: keyActions
|
|
345
|
+
}
|
|
346
|
+
]
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
async pressKeyCode(keyCode) {
|
|
350
|
+
await this.request("POST", this.sessionPath("/appium/device/press_keycode"), {
|
|
351
|
+
keycode: keyCode
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
async hideKeyboard() {
|
|
355
|
+
await this.request("POST", this.sessionPath("/appium/device/hide_keyboard"), void 0);
|
|
356
|
+
}
|
|
357
|
+
// ---------------------------------------------------------------------------
|
|
358
|
+
// App lifecycle
|
|
359
|
+
// ---------------------------------------------------------------------------
|
|
360
|
+
async activateApp(appPackage) {
|
|
361
|
+
await this.request("POST", this.sessionPath("/appium/device/activate_app"), {
|
|
362
|
+
appId: appPackage
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
async terminateApp(appPackage) {
|
|
366
|
+
await this.request("POST", this.sessionPath("/appium/device/terminate_app"), {
|
|
367
|
+
appId: appPackage
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
// ---------------------------------------------------------------------------
|
|
371
|
+
// WebView / hybrid context switching
|
|
372
|
+
// ---------------------------------------------------------------------------
|
|
373
|
+
async getContexts() {
|
|
374
|
+
return this.request("GET", this.sessionPath("/contexts"));
|
|
375
|
+
}
|
|
376
|
+
async getCurrentContext() {
|
|
377
|
+
return this.request("GET", this.sessionPath("/context"));
|
|
378
|
+
}
|
|
379
|
+
async setContext(contextId) {
|
|
380
|
+
await this.request("POST", this.sessionPath("/context"), { name: contextId });
|
|
381
|
+
}
|
|
382
|
+
async executeScript(script, args = []) {
|
|
383
|
+
return this.request("POST", this.sessionPath("/execute/sync"), { script, args });
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
// src/drivers/uiautomator2/driver.ts
|
|
388
|
+
function createUiAutomator2Driver(host, port, serial, packageName, driverOptions) {
|
|
389
|
+
return Effect.gen(function* () {
|
|
390
|
+
const client = new UiAutomator2Client(host, port);
|
|
391
|
+
let currentContext = "NATIVE_APP";
|
|
392
|
+
let hasLaunchedOnce = false;
|
|
393
|
+
const waitForAndroidReady = async (maxMs) => {
|
|
394
|
+
const deadline = Date.now() + maxMs;
|
|
395
|
+
while (Date.now() < deadline) {
|
|
396
|
+
try {
|
|
397
|
+
await client.getWindowSize();
|
|
398
|
+
return;
|
|
399
|
+
} catch {
|
|
400
|
+
await new Promise((resolve) => setTimeout(resolve, 40));
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
const cdpChannel = driverOptions?.enableWebViewCdp === false ? void 0 : createAndroidWebViewCdpChannel({
|
|
405
|
+
serial,
|
|
406
|
+
packageName: packageName || void 0,
|
|
407
|
+
localPort: driverOptions?.cdpPort
|
|
408
|
+
});
|
|
409
|
+
const channels = [];
|
|
410
|
+
if (driverOptions?.domChannel) channels.push(driverOptions.domChannel);
|
|
411
|
+
if (cdpChannel) channels.push(cdpChannel);
|
|
412
|
+
const domChannel = channels.length === 0 ? void 0 : channels.length === 1 ? channels[0] : createCompositeDomChannel(channels);
|
|
413
|
+
yield* Effect.tryPromise({
|
|
414
|
+
try: () => client.createSession(packageName),
|
|
415
|
+
catch: (e) => new DriverError({
|
|
416
|
+
message: `Failed to create UiAutomator2 session: ${e}`
|
|
417
|
+
})
|
|
418
|
+
});
|
|
419
|
+
const service = {
|
|
420
|
+
domChannel,
|
|
421
|
+
...androidDeviceControls(serial),
|
|
422
|
+
setOrientation: (orientation) => deviceEffect(
|
|
423
|
+
"setOrientation",
|
|
424
|
+
() => client.setOrientation(orientation === "portrait" ? "PORTRAIT" : "LANDSCAPE")
|
|
425
|
+
),
|
|
426
|
+
// -----------------------------------------------------------------------
|
|
427
|
+
// Hierarchy
|
|
428
|
+
// -----------------------------------------------------------------------
|
|
429
|
+
dumpHierarchy: () => Effect.tryPromise({
|
|
430
|
+
try: () => client.getSource(),
|
|
431
|
+
catch: (e) => new DriverError({ message: `Failed to get page source: ${e}` })
|
|
432
|
+
}),
|
|
433
|
+
// -----------------------------------------------------------------------
|
|
434
|
+
// Coordinate-level actions
|
|
435
|
+
// -----------------------------------------------------------------------
|
|
436
|
+
tapAtCoordinate: (x, y) => Effect.tryPromise({
|
|
437
|
+
try: () => client.performTap(x, y),
|
|
438
|
+
catch: (e) => new DriverError({ message: `Tap failed: ${e}` })
|
|
439
|
+
}),
|
|
440
|
+
doubleTapAtCoordinate: (x, y) => Effect.tryPromise({
|
|
441
|
+
try: async () => {
|
|
442
|
+
await client.performTap(x, y);
|
|
443
|
+
await client.performTap(x, y);
|
|
444
|
+
},
|
|
445
|
+
catch: (e) => new DriverError({ message: `Double tap failed: ${e}` })
|
|
446
|
+
}),
|
|
447
|
+
longPressAtCoordinate: (x, y, duration) => Effect.tryPromise({
|
|
448
|
+
try: () => client.performLongPress(x, y, duration),
|
|
449
|
+
catch: (e) => new DriverError({ message: `Long press failed: ${e}` })
|
|
450
|
+
}),
|
|
451
|
+
swipe: (sx, sy, ex, ey, dur) => Effect.tryPromise({
|
|
452
|
+
try: () => client.performSwipe(sx, sy, ex, ey, dur),
|
|
453
|
+
catch: (e) => new DriverError({ message: `Swipe failed: ${e}` })
|
|
454
|
+
}),
|
|
455
|
+
pinch: (cx, cy, scale, duration) => Effect.tryPromise({
|
|
456
|
+
try: () => client.performPinch(cx, cy, scale, duration),
|
|
457
|
+
catch: (e) => new DriverError({ message: `Pinch failed: ${e}` })
|
|
458
|
+
}),
|
|
459
|
+
zoom: (cx, cy, scale, duration) => Effect.tryPromise({
|
|
460
|
+
try: () => client.performZoom(cx, cy, scale, duration),
|
|
461
|
+
catch: (e) => new DriverError({ message: `Zoom failed: ${e}` })
|
|
462
|
+
}),
|
|
463
|
+
multiTouch: (sequences) => Effect.tryPromise({
|
|
464
|
+
try: () => client.performMultiTouch(sequences),
|
|
465
|
+
catch: (e) => new DriverError({ message: `Multi-touch failed: ${e}` })
|
|
466
|
+
}),
|
|
467
|
+
// -----------------------------------------------------------------------
|
|
468
|
+
// Text input
|
|
469
|
+
// -----------------------------------------------------------------------
|
|
470
|
+
inputText: (text) => Effect.tryPromise({
|
|
471
|
+
try: () => client.sendKeys(text),
|
|
472
|
+
catch: (e) => new DriverError({ message: `Input text failed: ${e}` })
|
|
473
|
+
}),
|
|
474
|
+
pressKey: (key) => Effect.tryPromise({
|
|
475
|
+
try: () => client.pressKeyCode(parseInt(key, 10) || 0),
|
|
476
|
+
catch: (e) => new DriverError({ message: `Press key failed: ${e}` })
|
|
477
|
+
}),
|
|
478
|
+
hideKeyboard: () => Effect.tryPromise({
|
|
479
|
+
try: () => client.hideKeyboard(),
|
|
480
|
+
catch: (e) => new DriverError({ message: `Hide keyboard failed: ${e}` })
|
|
481
|
+
}),
|
|
482
|
+
// -----------------------------------------------------------------------
|
|
483
|
+
// Queries
|
|
484
|
+
// -----------------------------------------------------------------------
|
|
485
|
+
takeScreenshot: () => Effect.tryPromise({
|
|
486
|
+
try: async () => {
|
|
487
|
+
const base64 = await client.getScreenshot();
|
|
488
|
+
return new Uint8Array(Buffer.from(base64, "base64"));
|
|
489
|
+
},
|
|
490
|
+
catch: (e) => new DriverError({ message: `Screenshot failed: ${e}` })
|
|
491
|
+
}),
|
|
492
|
+
getDeviceInfo: () => Effect.tryPromise({
|
|
493
|
+
try: async () => {
|
|
494
|
+
const size = await client.getWindowSize();
|
|
495
|
+
return {
|
|
496
|
+
platform: "android",
|
|
497
|
+
deviceId: `${host}:${port}`,
|
|
498
|
+
name: "Android Device",
|
|
499
|
+
isEmulator: host === "localhost" || host === "127.0.0.1",
|
|
500
|
+
screenWidth: size.width,
|
|
501
|
+
screenHeight: size.height,
|
|
502
|
+
driverType: "uiautomator2"
|
|
503
|
+
};
|
|
504
|
+
},
|
|
505
|
+
catch: (e) => new DriverError({ message: `Get device info failed: ${e}` })
|
|
506
|
+
}),
|
|
507
|
+
// -----------------------------------------------------------------------
|
|
508
|
+
// App lifecycle
|
|
509
|
+
// -----------------------------------------------------------------------
|
|
510
|
+
launchApp: (bundleId, opts) => Effect.tryPromise({
|
|
511
|
+
try: async () => {
|
|
512
|
+
const canFastReset = hasLaunchedOnce && driverOptions?.fastWebViewReset !== false && domChannel?.isConnected() && !opts?.deepLink && !opts?.clearKeychain && !hasLaunchDeviceState(opts?.deviceState) && !(opts?.launchArguments && Object.keys(opts.launchArguments).length > 0);
|
|
513
|
+
if (canFastReset) {
|
|
514
|
+
try {
|
|
515
|
+
if (opts?.clearState && domChannel.clearStorage) {
|
|
516
|
+
await domChannel.clearStorage({
|
|
517
|
+
localStorage: true,
|
|
518
|
+
sessionStorage: true,
|
|
519
|
+
cookies: true,
|
|
520
|
+
indexedDB: true,
|
|
521
|
+
capacitorPreferences: true
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
if (domChannel.reload) {
|
|
525
|
+
await domChannel.reload();
|
|
526
|
+
} else {
|
|
527
|
+
await domChannel.evaluate("window.location.reload()");
|
|
528
|
+
}
|
|
529
|
+
return;
|
|
530
|
+
} catch {
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
if (opts?.clearState) {
|
|
534
|
+
adbClearApp(serial, bundleId);
|
|
535
|
+
}
|
|
536
|
+
if (opts?.clearKeychain) {
|
|
537
|
+
console.warn("clearKeychain is not supported on Android, skipping.");
|
|
538
|
+
}
|
|
539
|
+
if (hasLaunchDeviceState(opts?.deviceState)) {
|
|
540
|
+
console.warn(
|
|
541
|
+
"deviceState launch overrides are not supported in local Android mode yet. Use Appium Android mode for language/locale/timeZone session defaults."
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
if (opts?.deepLink) {
|
|
545
|
+
adbOpenLink(serial, opts.deepLink, bundleId);
|
|
546
|
+
await waitForAndroidReady(500);
|
|
547
|
+
} else {
|
|
548
|
+
adbForceStop(serial, bundleId);
|
|
549
|
+
if (opts?.launchArguments && Object.keys(opts.launchArguments).length > 0) {
|
|
550
|
+
const { execFileSync } = await import("child_process");
|
|
551
|
+
const { findADB } = await import("./android-C2S4B4TH.js");
|
|
552
|
+
const adb = findADB();
|
|
553
|
+
if (!adb) throw new Error("adb not found");
|
|
554
|
+
const startArgs = [
|
|
555
|
+
"-s",
|
|
556
|
+
serial,
|
|
557
|
+
"shell",
|
|
558
|
+
"am",
|
|
559
|
+
"start",
|
|
560
|
+
"-a",
|
|
561
|
+
"android.intent.action.MAIN",
|
|
562
|
+
"-c",
|
|
563
|
+
"android.intent.category.LAUNCHER",
|
|
564
|
+
bundleId
|
|
565
|
+
];
|
|
566
|
+
for (const [k, v] of Object.entries(opts.launchArguments)) {
|
|
567
|
+
startArgs.push("--es", k, String(v));
|
|
568
|
+
}
|
|
569
|
+
execFileSync(adb, startArgs, { stdio: "ignore" });
|
|
570
|
+
} else {
|
|
571
|
+
adbLaunchApp(serial, bundleId);
|
|
572
|
+
}
|
|
573
|
+
await waitForAndroidReady(800);
|
|
574
|
+
}
|
|
575
|
+
hasLaunchedOnce = true;
|
|
576
|
+
},
|
|
577
|
+
catch: (e) => new DriverError({ message: `Launch app failed: ${e}` })
|
|
578
|
+
}),
|
|
579
|
+
stopApp: (bundleId) => Effect.tryPromise({
|
|
580
|
+
try: async () => {
|
|
581
|
+
adbForceStop(serial, bundleId);
|
|
582
|
+
},
|
|
583
|
+
catch: (e) => new DriverError({ message: `Stop app failed: ${e}` })
|
|
584
|
+
}),
|
|
585
|
+
killApp: (bundleId) => Effect.tryPromise({
|
|
586
|
+
try: async () => {
|
|
587
|
+
await domChannel?.disconnect().catch(() => {
|
|
588
|
+
});
|
|
589
|
+
if (!bundleId) return;
|
|
590
|
+
adbForceStop(serial, bundleId);
|
|
591
|
+
},
|
|
592
|
+
catch: (e) => new DriverError({ message: `Kill app failed: ${e}` })
|
|
593
|
+
}),
|
|
594
|
+
clearAppState: (bundleId) => Effect.tryPromise({
|
|
595
|
+
try: async () => {
|
|
596
|
+
if (domChannel?.isConnected() && domChannel.clearStorage) {
|
|
597
|
+
await domChannel.clearStorage({
|
|
598
|
+
localStorage: true,
|
|
599
|
+
sessionStorage: true,
|
|
600
|
+
cookies: true,
|
|
601
|
+
indexedDB: true,
|
|
602
|
+
capacitorPreferences: true
|
|
603
|
+
});
|
|
604
|
+
if (domChannel.reload) {
|
|
605
|
+
await domChannel.reload();
|
|
606
|
+
}
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
adbForceStop(serial, bundleId);
|
|
610
|
+
adbClearApp(serial, bundleId);
|
|
611
|
+
},
|
|
612
|
+
catch: (e) => new DriverError({ message: `Clear app state failed: ${e}` })
|
|
613
|
+
}),
|
|
614
|
+
resetFast: () => Effect.tryPromise({
|
|
615
|
+
try: async () => {
|
|
616
|
+
if (!domChannel) {
|
|
617
|
+
throw new Error("resetFast() requires a connected DOM channel (spana-bridge or CDP)");
|
|
618
|
+
}
|
|
619
|
+
if (domChannel.clearStorage) {
|
|
620
|
+
await domChannel.clearStorage({
|
|
621
|
+
localStorage: true,
|
|
622
|
+
sessionStorage: true,
|
|
623
|
+
cookies: true,
|
|
624
|
+
indexedDB: true,
|
|
625
|
+
capacitorPreferences: true
|
|
626
|
+
});
|
|
627
|
+
} else {
|
|
628
|
+
await domChannel.evaluate(`(() => {
|
|
629
|
+
try { localStorage.clear(); } catch {}
|
|
630
|
+
try { sessionStorage.clear(); } catch {}
|
|
631
|
+
})()`);
|
|
632
|
+
}
|
|
633
|
+
if (domChannel.reload) {
|
|
634
|
+
await domChannel.reload();
|
|
635
|
+
} else {
|
|
636
|
+
await domChannel.evaluate("window.location.reload()");
|
|
637
|
+
}
|
|
638
|
+
},
|
|
639
|
+
catch: (e) => new DriverError({ message: `Fast reset failed: ${e}` })
|
|
640
|
+
}),
|
|
641
|
+
// -----------------------------------------------------------------------
|
|
642
|
+
// Navigation
|
|
643
|
+
// -----------------------------------------------------------------------
|
|
644
|
+
openLink: (url) => Effect.tryPromise({
|
|
645
|
+
try: async () => {
|
|
646
|
+
adbOpenLink(serial, url, packageName);
|
|
647
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
648
|
+
},
|
|
649
|
+
catch: (e) => new DriverError({ message: `Open link failed: ${e}` })
|
|
650
|
+
}),
|
|
651
|
+
back: () => Effect.tryPromise({
|
|
652
|
+
// KEYCODE_BACK = 4
|
|
653
|
+
try: () => client.pressKeyCode(4),
|
|
654
|
+
catch: (e) => new DriverError({ message: `Back failed: ${e}` })
|
|
655
|
+
}),
|
|
656
|
+
// -----------------------------------------------------------------------
|
|
657
|
+
// Direct DOM evaluation via spana-bridge or Android WebView CDP,
|
|
658
|
+
// falling back to UiAutomator2 /execute/sync when no DOM channel attaches.
|
|
659
|
+
// -----------------------------------------------------------------------
|
|
660
|
+
evaluate: (script, ...args) => Effect.tryPromise({
|
|
661
|
+
try: async () => {
|
|
662
|
+
if (domChannel) {
|
|
663
|
+
try {
|
|
664
|
+
return await domChannel.evaluate(script, ...args);
|
|
665
|
+
} catch (domErr) {
|
|
666
|
+
if (typeof client.executeScript === "function") {
|
|
667
|
+
try {
|
|
668
|
+
return await client.executeScript(
|
|
669
|
+
typeof script === "function" ? `return (${script})(...arguments)` : script,
|
|
670
|
+
args
|
|
671
|
+
);
|
|
672
|
+
} catch {
|
|
673
|
+
throw domErr;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
throw domErr;
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
return await client.executeScript(
|
|
680
|
+
typeof script === "function" ? `return (${script})(...arguments)` : script,
|
|
681
|
+
args
|
|
682
|
+
);
|
|
683
|
+
},
|
|
684
|
+
catch: (e) => new DriverError({ message: `evaluate() failed: ${e}` })
|
|
685
|
+
}),
|
|
686
|
+
getContexts: () => Effect.tryPromise({
|
|
687
|
+
try: async () => {
|
|
688
|
+
const contexts = /* @__PURE__ */ new Set(["NATIVE_APP"]);
|
|
689
|
+
if (domChannel?.listTargets) {
|
|
690
|
+
try {
|
|
691
|
+
const targets = await domChannel.listTargets();
|
|
692
|
+
for (const target of targets) {
|
|
693
|
+
contexts.add(`WEBVIEW_${target.id}`);
|
|
694
|
+
}
|
|
695
|
+
} catch {
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
if (typeof client.getContexts === "function") {
|
|
699
|
+
try {
|
|
700
|
+
const uaContexts = await client.getContexts();
|
|
701
|
+
for (const ctx of uaContexts) contexts.add(ctx);
|
|
702
|
+
} catch {
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
return Array.from(contexts);
|
|
706
|
+
},
|
|
707
|
+
catch: (e) => new DriverError({ message: `getContexts failed: ${e}` })
|
|
708
|
+
}),
|
|
709
|
+
getCurrentContext: () => Effect.tryPromise({
|
|
710
|
+
try: async () => {
|
|
711
|
+
if (currentContext !== "NATIVE_APP") return currentContext;
|
|
712
|
+
if (typeof client.getCurrentContext === "function") {
|
|
713
|
+
try {
|
|
714
|
+
return await client.getCurrentContext();
|
|
715
|
+
} catch {
|
|
716
|
+
return currentContext;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
return currentContext;
|
|
720
|
+
},
|
|
721
|
+
catch: (e) => new DriverError({ message: `getCurrentContext failed: ${e}` })
|
|
722
|
+
}),
|
|
723
|
+
setContext: (contextId) => Effect.tryPromise({
|
|
724
|
+
try: async () => {
|
|
725
|
+
if (contextId === "NATIVE_APP") {
|
|
726
|
+
currentContext = "NATIVE_APP";
|
|
727
|
+
if (typeof client.setContext === "function") {
|
|
728
|
+
await client.setContext("NATIVE_APP").catch(() => {
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
return;
|
|
732
|
+
}
|
|
733
|
+
if (contextId.startsWith("WEBVIEW_") && domChannel) {
|
|
734
|
+
const targetId = contextId.slice("WEBVIEW_".length);
|
|
735
|
+
if (domChannel.selectTarget) {
|
|
736
|
+
try {
|
|
737
|
+
await domChannel.selectTarget(targetId);
|
|
738
|
+
currentContext = contextId;
|
|
739
|
+
return;
|
|
740
|
+
} catch {
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
await client.setContext(contextId);
|
|
745
|
+
currentContext = contextId;
|
|
746
|
+
},
|
|
747
|
+
catch: (e) => new DriverError({ message: `setContext failed: ${e}` })
|
|
748
|
+
}),
|
|
749
|
+
mockNetwork: (matcher, response) => Effect.tryPromise({
|
|
750
|
+
try: async () => {
|
|
751
|
+
if (!domChannel?.mockNetwork) {
|
|
752
|
+
throw new Error(
|
|
753
|
+
"mockNetwork() is not supported on native Android traffic; enable WebView debugging or install spana-bridge for WebView requests"
|
|
754
|
+
);
|
|
755
|
+
}
|
|
756
|
+
await domChannel.mockNetwork(matcher, response);
|
|
757
|
+
},
|
|
758
|
+
catch: (e) => new DriverError({ message: `mockNetwork failed: ${e}` })
|
|
759
|
+
}),
|
|
760
|
+
blockNetwork: (matcher) => Effect.tryPromise({
|
|
761
|
+
try: async () => {
|
|
762
|
+
if (!domChannel?.blockNetwork) {
|
|
763
|
+
throw new Error(
|
|
764
|
+
"blockNetwork() is not supported on native Android traffic; enable WebView debugging or install spana-bridge for WebView requests"
|
|
765
|
+
);
|
|
766
|
+
}
|
|
767
|
+
await domChannel.blockNetwork(matcher);
|
|
768
|
+
},
|
|
769
|
+
catch: (e) => new DriverError({ message: `blockNetwork failed: ${e}` })
|
|
770
|
+
}),
|
|
771
|
+
clearNetworkMocks: () => Effect.tryPromise({
|
|
772
|
+
try: async () => {
|
|
773
|
+
if (domChannel?.clearNetworkMocks) {
|
|
774
|
+
await domChannel.clearNetworkMocks();
|
|
775
|
+
}
|
|
776
|
+
},
|
|
777
|
+
catch: (e) => new DriverError({ message: `clearNetworkMocks failed: ${e}` })
|
|
778
|
+
}),
|
|
779
|
+
getConsoleLogs: () => Effect.tryPromise({
|
|
780
|
+
try: async () => domChannel?.getConsoleLogs ? domChannel.getConsoleLogs() : [],
|
|
781
|
+
catch: (e) => new DriverError({ message: `getConsoleLogs failed: ${e}` })
|
|
782
|
+
}),
|
|
783
|
+
getJSErrors: () => Effect.tryPromise({
|
|
784
|
+
try: async () => domChannel?.getJSErrors ? domChannel.getJSErrors() : [],
|
|
785
|
+
catch: (e) => new DriverError({ message: `getJSErrors failed: ${e}` })
|
|
786
|
+
}),
|
|
787
|
+
// -----------------------------------------------------------------------
|
|
788
|
+
// Network conditions
|
|
789
|
+
// -----------------------------------------------------------------------
|
|
790
|
+
setNetworkConditions: (conditions) => Effect.tryPromise({
|
|
791
|
+
try: async () => {
|
|
792
|
+
const isEmulator = serial.startsWith("emulator-");
|
|
793
|
+
const resolved = resolveNetworkConditions(conditions);
|
|
794
|
+
const hasThrottling = conditions.profile !== void 0 || conditions.latencyMs !== void 0 || conditions.downloadThroughputKbps !== void 0 || conditions.uploadThroughputKbps !== void 0;
|
|
795
|
+
if (!resolved.offline && !hasThrottling) {
|
|
796
|
+
if (isEmulator) {
|
|
797
|
+
adbResetNetwork(serial);
|
|
798
|
+
} else {
|
|
799
|
+
adbSetAirplaneMode(serial, false);
|
|
800
|
+
}
|
|
801
|
+
return;
|
|
802
|
+
}
|
|
803
|
+
if (resolved.offline) {
|
|
804
|
+
if (isEmulator) {
|
|
805
|
+
adbSetWifi(serial, false);
|
|
806
|
+
adbSetData(serial, false);
|
|
807
|
+
} else {
|
|
808
|
+
adbSetAirplaneMode(serial, true);
|
|
809
|
+
}
|
|
810
|
+
return;
|
|
811
|
+
}
|
|
812
|
+
if (hasThrottling) {
|
|
813
|
+
if (!isEmulator) {
|
|
814
|
+
throw new DriverError({
|
|
815
|
+
message: "Network throttling is not supported on physical Android devices. Use an emulator or a cloud provider."
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
adbSetWifi(serial, true);
|
|
819
|
+
adbSetData(serial, true);
|
|
820
|
+
if (conditions.profile) {
|
|
821
|
+
adbSetNetworkProfile(serial, conditions.profile);
|
|
822
|
+
} else {
|
|
823
|
+
adbSetCustomNetwork(
|
|
824
|
+
serial,
|
|
825
|
+
resolved.downloadThroughputKbps,
|
|
826
|
+
resolved.uploadThroughputKbps,
|
|
827
|
+
resolved.latencyMs
|
|
828
|
+
);
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
},
|
|
832
|
+
catch: (e) => {
|
|
833
|
+
if (e instanceof DriverError) return e;
|
|
834
|
+
return new DriverError({ message: `setNetworkConditions failed: ${e}` });
|
|
835
|
+
}
|
|
836
|
+
})
|
|
837
|
+
};
|
|
838
|
+
return service;
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
export {
|
|
843
|
+
createUiAutomator2Driver
|
|
844
|
+
};
|
|
845
|
+
//# sourceMappingURL=chunk-27H6NDA5.js.map
|