@autifyhq/aximo-cli 0.6.0 → 0.8.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/README.md +88 -70
- package/dist/client.js +16 -1
- package/dist/commands/mobile/connect-core.d.ts +2 -1
- package/dist/commands/mobile/connect-core.js +112 -9
- package/dist/commands/mobile/connect.js +6 -3
- package/dist/commands/mobile/connect.test.js +7 -1
- package/dist/commands/mobile/doctor.d.ts +4 -0
- package/dist/commands/mobile/doctor.js +62 -16
- package/dist/commands/mobile/doctor.test.d.ts +1 -0
- package/dist/commands/mobile/doctor.test.js +28 -0
- package/dist/commands/mobile/install.d.ts +10 -2
- package/dist/commands/mobile/install.js +57 -15
- package/dist/commands/mobile/install.test.js +44 -6
- package/dist/commands/mobile/list.d.ts +3 -0
- package/dist/commands/mobile/list.js +40 -14
- package/dist/commands/mobile/list.test.d.ts +1 -0
- package/dist/commands/mobile/list.test.js +24 -0
- package/dist/commands/mobile/output.d.ts +13 -0
- package/dist/commands/mobile/output.js +21 -0
- package/dist/commands/mobile/output.test.d.ts +1 -0
- package/dist/commands/mobile/output.test.js +54 -0
- package/dist/commands/mobile/register.d.ts +1 -0
- package/dist/commands/mobile/register.js +11 -3
- package/dist/commands/mobile/setup.d.ts +1 -0
- package/dist/commands/mobile/setup.js +7 -2
- package/dist/commands/mobile/unregister.d.ts +7 -3
- package/dist/commands/mobile/unregister.js +20 -9
- package/dist/mobile-control/app-install.d.ts +18 -5
- package/dist/mobile-control/app-install.js +33 -6
- package/dist/mobile-control/app-install.test.js +42 -7
- package/dist/mobile-control/appium-controller.d.ts +8 -0
- package/dist/mobile-control/appium-controller.js +19 -4
- package/dist/mobile-control/bundle-id-map.d.ts +9 -0
- package/dist/mobile-control/bundle-id-map.js +27 -0
- package/dist/mobile-control/devices.d.ts +6 -3
- package/dist/mobile-control/devices.js +26 -4
- package/dist/mobile-control/env-flags.d.ts +5 -0
- package/dist/mobile-control/env-flags.js +10 -0
- package/dist/mobile-control/env-flags.test.d.ts +1 -0
- package/dist/mobile-control/env-flags.test.js +21 -0
- package/dist/mobile-control/exec.d.ts +5 -1
- package/dist/mobile-control/exec.js +2 -2
- package/dist/mobile-control/ios-auto-resign.d.ts +45 -0
- package/dist/mobile-control/ios-auto-resign.js +108 -0
- package/dist/mobile-control/ios-auto-resign.test.d.ts +1 -0
- package/dist/mobile-control/ios-auto-resign.test.js +150 -0
- package/dist/mobile-control/ios-devicectl.d.ts +39 -0
- package/dist/mobile-control/ios-devicectl.js +87 -0
- package/dist/mobile-control/ios-devicectl.test.d.ts +1 -0
- package/dist/mobile-control/ios-devicectl.test.js +110 -0
- package/dist/mobile-control/ios-identity.d.ts +27 -0
- package/dist/mobile-control/ios-identity.js +49 -0
- package/dist/mobile-control/ios-identity.test.d.ts +1 -0
- package/dist/mobile-control/ios-identity.test.js +102 -0
- package/dist/mobile-control/ios-mint.d.ts +39 -0
- package/dist/mobile-control/ios-mint.js +78 -0
- package/dist/mobile-control/ios-mint.test.d.ts +1 -0
- package/dist/mobile-control/ios-mint.test.js +94 -0
- package/dist/mobile-control/ios-profiles.d.ts +46 -0
- package/dist/mobile-control/ios-profiles.js +106 -0
- package/dist/mobile-control/ios-profiles.test.d.ts +1 -0
- package/dist/mobile-control/ios-profiles.test.js +154 -0
- package/dist/mobile-control/ios-resign.d.ts +37 -0
- package/dist/mobile-control/ios-resign.js +101 -0
- package/dist/mobile-control/ios-resign.test.d.ts +1 -0
- package/dist/mobile-control/ios-resign.test.js +84 -0
- package/dist/mobile-control/ios-session-error.d.ts +10 -0
- package/dist/mobile-control/ios-session-error.js +34 -0
- package/dist/mobile-control/ios-session-error.test.d.ts +1 -0
- package/dist/mobile-control/ios-session-error.test.js +30 -0
- package/dist/mobile-control/ios-signing.d.ts +33 -5
- package/dist/mobile-control/ios-signing.js +56 -0
- package/dist/mobile-control/ios-signing.test.js +87 -0
- package/dist/mobile-control/ios-tunnel.d.ts +57 -0
- package/dist/mobile-control/ios-tunnel.js +150 -0
- package/dist/mobile-control/ios-tunnel.test.d.ts +1 -0
- package/dist/mobile-control/ios-tunnel.test.js +120 -0
- package/dist/mobile-control/ios-wda-cache.d.ts +39 -0
- package/dist/mobile-control/ios-wda-cache.js +157 -0
- package/dist/mobile-control/ios-wda-cache.test.d.ts +1 -0
- package/dist/mobile-control/ios-wda-cache.test.js +128 -0
- package/dist/mobile-control/ios-wda-diagnostics.d.ts +14 -0
- package/dist/mobile-control/ios-wda-diagnostics.js +138 -0
- package/dist/mobile-control/ios-wda-diagnostics.test.d.ts +1 -0
- package/dist/mobile-control/ios-wda-diagnostics.test.js +77 -0
- package/dist/mobile-control/ios-wda-preinstall.d.ts +64 -0
- package/dist/mobile-control/ios-wda-preinstall.js +165 -0
- package/dist/mobile-control/ios-wda-preinstall.test.d.ts +1 -0
- package/dist/mobile-control/ios-wda-preinstall.test.js +111 -0
- package/dist/mobile-control/mobile-errors.d.ts +12 -0
- package/dist/mobile-control/mobile-errors.js +91 -0
- package/dist/mobile-control/mobile-errors.test.d.ts +1 -0
- package/dist/mobile-control/mobile-errors.test.js +48 -0
- package/dist/mobile-control/tunnel.js +79 -2
- package/dist/mobile-control/tunnel.test.js +82 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -34,6 +34,8 @@ aximo session get SESSION_ID
|
|
|
34
34
|
|
|
35
35
|
Get your API key from **Settings → API Keys** in the [Aximo dashboard](https://aximo.autify.com).
|
|
36
36
|
|
|
37
|
+
Want to run tests on **your own hardware** instead of the cloud? See [Device (BYOD)](#device-byod--bring-your-own-device) to register this desktop (Windows/macOS/Linux), or [Mobile](#mobile-local-android-phone-or-iphone) to drive a USB-connected Android phone or iPhone — each section starts with the exact prerequisites for a fresh machine.
|
|
38
|
+
|
|
37
39
|
## Configuration
|
|
38
40
|
|
|
39
41
|
Each credential resolves independently: the value in `$AXIMO_HOME/config.json` (written by `aximo configure`) wins, then the environment variable, then the default.
|
|
@@ -64,47 +66,47 @@ Credentials and device registrations are **per-environment** — to switch betwe
|
|
|
64
66
|
|
|
65
67
|
Run `aximo <command> --help` for detailed usage. `aximo schema [command.path]` returns machine-readable argument introspection (e.g. `aximo schema session.create`).
|
|
66
68
|
|
|
67
|
-
| Command | Description
|
|
68
|
-
| ---------------------------- |
|
|
69
|
-
| `aximo configure` | Save credentials to `$AXIMO_HOME/config.json`
|
|
70
|
-
| `aximo health check` | Check API reachability
|
|
71
|
-
| `aximo project list` | List organization projects
|
|
72
|
-
| `aximo session create` | Create and queue a test session
|
|
73
|
-
| `aximo session get` | Get session status
|
|
74
|
-
| `aximo session save-as-case` | Save a finished session as a reusable test case
|
|
75
|
-
| `aximo case create` | Create a test case
|
|
76
|
-
| `aximo case delete` | Delete a test case
|
|
77
|
-
| `aximo plan create` | Create a test plan
|
|
78
|
-
| `aximo plan add-case` | Add a case to a plan
|
|
79
|
-
| `aximo plan remove-case` | Remove a case from a plan
|
|
80
|
-
| `aximo trigger case run` | Trigger a dashboard-created test case
|
|
81
|
-
| `aximo trigger case get` | Get triggered case status
|
|
82
|
-
| `aximo trigger plan run` | Trigger a test plan
|
|
83
|
-
| `aximo trigger plan get` | Get plan run status
|
|
84
|
-
| `aximo upload create` | Create an upload slot for an APK/IPA
|
|
85
|
-
| `aximo upload list` | List previously uploaded apps
|
|
86
|
-
| `aximo upload get` | Poll upload processing status
|
|
87
|
-
| `aximo upload put` | Upload binary file to the slot
|
|
88
|
-
| `aximo upload submit` | Finalize upload and trigger processing
|
|
89
|
-
| `aximo device list` | List mobile devices from Device Farm
|
|
90
|
-
| `aximo device setup` | First-time BYOD onboarding (API + Python + register)
|
|
91
|
-
| `aximo device register` | Register this machine as a BYOD device
|
|
92
|
-
| `aximo device connect` | Start the BYOD agent and connect to the relay
|
|
93
|
-
| `aximo device status` | List your organization's BYOD devices
|
|
94
|
-
| `aximo device ping` | Check your BYOD device's server-side status
|
|
95
|
-
| `aximo device doctor` | Diagnose BYOD setup (env, Python, relay, status)
|
|
96
|
-
| `aximo device logs` | Show the BYOD agent log
|
|
97
|
-
| `aximo device unregister` | Remove a BYOD device server-side + clear local creds
|
|
98
|
-
| `aximo device reset` | Remove BYOD local state (Python, deps, credentials)
|
|
99
|
-
| `aximo mobile list` | List physically-connected phones (Android adb, iOS
|
|
100
|
-
| `aximo mobile setup` | Install the Appium drivers used to drive phones
|
|
101
|
-
| `aximo mobile doctor` | Diagnose prerequisites (adb/
|
|
102
|
-
| `aximo mobile register` | Register a connected Android phone or iPhone
|
|
103
|
-
| `aximo mobile install` | Install an app (.apk via adb, .ipa
|
|
104
|
-
| `aximo mobile connect` | Start managed Appium + open the tunnel for the phone
|
|
105
|
-
| `aximo mobile unregister` | Remove a local mobile device server-side + local creds
|
|
106
|
-
| `aximo schema` | Show CLI surface as JSON
|
|
107
|
-
| `aximo mcp` | Run a stdio MCP server for agents (see below)
|
|
69
|
+
| Command | Description |
|
|
70
|
+
| ---------------------------- | -------------------------------------------------------------- |
|
|
71
|
+
| `aximo configure` | Save credentials to `$AXIMO_HOME/config.json` |
|
|
72
|
+
| `aximo health check` | Check API reachability |
|
|
73
|
+
| `aximo project list` | List organization projects |
|
|
74
|
+
| `aximo session create` | Create and queue a test session |
|
|
75
|
+
| `aximo session get` | Get session status |
|
|
76
|
+
| `aximo session save-as-case` | Save a finished session as a reusable test case |
|
|
77
|
+
| `aximo case create` | Create a test case |
|
|
78
|
+
| `aximo case delete` | Delete a test case |
|
|
79
|
+
| `aximo plan create` | Create a test plan |
|
|
80
|
+
| `aximo plan add-case` | Add a case to a plan |
|
|
81
|
+
| `aximo plan remove-case` | Remove a case from a plan |
|
|
82
|
+
| `aximo trigger case run` | Trigger a dashboard-created test case |
|
|
83
|
+
| `aximo trigger case get` | Get triggered case status |
|
|
84
|
+
| `aximo trigger plan run` | Trigger a test plan |
|
|
85
|
+
| `aximo trigger plan get` | Get plan run status |
|
|
86
|
+
| `aximo upload create` | Create an upload slot for an APK/IPA |
|
|
87
|
+
| `aximo upload list` | List previously uploaded apps |
|
|
88
|
+
| `aximo upload get` | Poll upload processing status |
|
|
89
|
+
| `aximo upload put` | Upload binary file to the slot |
|
|
90
|
+
| `aximo upload submit` | Finalize upload and trigger processing |
|
|
91
|
+
| `aximo device list` | List mobile devices from Device Farm |
|
|
92
|
+
| `aximo device setup` | First-time BYOD onboarding (API + Python + register) |
|
|
93
|
+
| `aximo device register` | Register this machine as a BYOD device |
|
|
94
|
+
| `aximo device connect` | Start the BYOD agent and connect to the relay |
|
|
95
|
+
| `aximo device status` | List your organization's BYOD devices |
|
|
96
|
+
| `aximo device ping` | Check your BYOD device's server-side status |
|
|
97
|
+
| `aximo device doctor` | Diagnose BYOD setup (env, Python, relay, status) |
|
|
98
|
+
| `aximo device logs` | Show the BYOD agent log |
|
|
99
|
+
| `aximo device unregister` | Remove a BYOD device server-side + clear local creds |
|
|
100
|
+
| `aximo device reset` | Remove BYOD local state (Python, deps, credentials) |
|
|
101
|
+
| `aximo mobile list` | List physically-connected phones (Android adb, iOS devicectl) |
|
|
102
|
+
| `aximo mobile setup` | Install the Appium drivers used to drive phones |
|
|
103
|
+
| `aximo mobile doctor` | Diagnose prerequisites (adb/Xcode/devicectl, signing, driver) |
|
|
104
|
+
| `aximo mobile register` | Register a connected Android phone or iPhone |
|
|
105
|
+
| `aximo mobile install` | Install an app (.apk via adb, .ipa auto-re-signed + devicectl) |
|
|
106
|
+
| `aximo mobile connect` | Start managed Appium + open the tunnel for the phone |
|
|
107
|
+
| `aximo mobile unregister` | Remove a local mobile device server-side + local creds |
|
|
108
|
+
| `aximo schema` | Show CLI surface as JSON |
|
|
109
|
+
| `aximo mcp` | Run a stdio MCP server for agents (see below) |
|
|
108
110
|
|
|
109
111
|
Mutating commands support `--json '<raw body>'` for direct OpenAPI payloads and `--dry-run` to preview requests without executing.
|
|
110
112
|
|
|
@@ -208,9 +210,9 @@ Terminology note: **`aximo device list` returns mobile devices** from Device Far
|
|
|
208
210
|
|
|
209
211
|
### Prerequisites
|
|
210
212
|
|
|
211
|
-
- **Node.js 20+**, plus `aximo-cli` installed globally (see [Install](#install)).
|
|
213
|
+
- **Node.js 20.18+**, plus `aximo-cli` installed globally (see [Install](#install)).
|
|
212
214
|
- **An Aximo API key**, configured via `aximo configure` or env vars.
|
|
213
|
-
- **Active desktop session** — the agent uses `pyautogui` for screenshots and input, so the screen must be unlocked and awake while tests run.
|
|
215
|
+
- **Active desktop session** — the agent uses `pyautogui` for screenshots and input, so the screen must be unlocked and awake while tests run. On **macOS**, grant the terminal **Accessibility** and **Screen Recording** permissions (System Settings → Privacy & Security) — without them actions silently do nothing.
|
|
214
216
|
- **Outbound WebSocket to port 443** — most corporate firewalls allow this; if yours doesn't, see [Troubleshooting](#byod-troubleshooting).
|
|
215
217
|
|
|
216
218
|
> Python is **not** a prerequisite. On first `connect` (or via `device setup`), the CLI downloads a self-contained CPython build into `$AXIMO_HOME/python/` (~35 MB download, ~130 MB installed) and installs the required packages. Your system Python is untouched.
|
|
@@ -405,20 +407,20 @@ Default `$AXIMO_HOME` is `~/.aximo` on macOS/Linux, `%USERPROFILE%\.aximo` on Wi
|
|
|
405
407
|
|
|
406
408
|
The `mobile` commands let you register a **physically-connected Android phone or iPhone** as an Aximo device and drive it locally, over the same gateway tunnel as desktop BYOD. Aximo's agent controls the phone through a CLI-managed [Appium](https://appium.io) server — UiAutomator2 for Android, XCUITest for iOS — useful for running mobile tests against your own handset instead of a Device Farm device.
|
|
407
409
|
|
|
408
|
-
> **iOS is macOS-only and needs Xcode + an Apple
|
|
410
|
+
> **iOS is macOS-only and needs Xcode + an Apple ID.** Driving a physical iPhone requires a development-signed WebDriverAgent (WDA) runner on the device — an Apple platform rule, not an Aximo one. The CLI is **zero-config about it**: it discovers your signing identity and Team ID from the keychain, finds or mints provisioning profiles via Xcode automatic signing, and (on iOS 17+) preinstalls a prebuilt WDA with no Xcode build. A free/personal Apple ID works. Android has no signing requirement, so iOS setup is heavier; everything after setup (`register` → `connect` → run) works the same on both platforms.
|
|
409
411
|
|
|
410
412
|
Terminology note: **`aximo mobile list`** shows phones plugged into _this_ machine; **`aximo device list`** (under [Device / BYOD](#device-byod--bring-your-own-device)) returns mobile devices from AWS Device Farm. Don't confuse the two.
|
|
411
413
|
|
|
412
414
|
### Prerequisites
|
|
413
415
|
|
|
414
|
-
- **Node.js 20+**, plus `aximo-cli` installed globally (see [Install](#install)).
|
|
416
|
+
- **Node.js 20.18+**, plus `aximo-cli` installed globally (see [Install](#install)).
|
|
415
417
|
- **An Aximo API key**, configured via `aximo configure` or env vars.
|
|
416
418
|
- **A USB-connected phone**:
|
|
417
419
|
- **Android** — **USB debugging** enabled and authorized — see [Enable USB debugging on the phone](#enable-usb-debugging-on-the-phone).
|
|
418
420
|
- **iOS** — **Developer Mode** enabled (Settings → Privacy & Security) and the computer trusted.
|
|
419
421
|
- **On the machine that runs `aximo mobile connect`**:
|
|
420
422
|
- **Android** — `adb` and the Android SDK, with `ANDROID_HOME` set — see [Set up your computer (Android)](#set-up-your-computer-android).
|
|
421
|
-
- **iOS** — macOS with **Xcode**
|
|
423
|
+
- **iOS** — macOS with **Xcode** and an Apple ID signed into it — see [Set up your computer (iOS)](#set-up-your-computer-ios).
|
|
422
424
|
|
|
423
425
|
> The Appium server is bundled with the CLI; `aximo mobile setup` installs the UiAutomator2 (Android) and/or XCUITest (iOS) driver — you don't install or manage Appium yourself.
|
|
424
426
|
|
|
@@ -429,12 +431,13 @@ You only need **`adb`** and the **Android SDK** on the machine running `aximo mo
|
|
|
429
431
|
**macOS**
|
|
430
432
|
|
|
431
433
|
```bash
|
|
432
|
-
# Option A — standalone
|
|
433
|
-
|
|
434
|
+
# Option A — standalone SDK Platform-Tools (no Android Studio): download the zip from
|
|
435
|
+
# https://developer.android.com/tools/releases/platform-tools and unzip it so adb ends up at
|
|
436
|
+
# ~/Library/Android/sdk/platform-tools/adb (the driver needs this SDK layout, not just adb on PATH)
|
|
434
437
|
# Option B — full Android Studio (also installs the SDK):
|
|
435
438
|
brew install --cask android-studio
|
|
436
439
|
|
|
437
|
-
# Point ANDROID_HOME at the SDK (
|
|
440
|
+
# Point ANDROID_HOME at the SDK (both options above use this location):
|
|
438
441
|
echo 'export ANDROID_HOME="$HOME/Library/Android/sdk"' >> ~/.zshrc
|
|
439
442
|
echo 'export PATH="$PATH:$ANDROID_HOME/platform-tools"' >> ~/.zshrc
|
|
440
443
|
source ~/.zshrc
|
|
@@ -460,30 +463,43 @@ source ~/.bashrc
|
|
|
460
463
|
|
|
461
464
|
### Set up your computer (iOS)
|
|
462
465
|
|
|
463
|
-
iOS local devices are **macOS-only** (
|
|
466
|
+
iOS local devices are **macOS-only** (device control delegates to Xcode's toolchain). Setup is two steps — no env vars:
|
|
464
467
|
|
|
465
468
|
```bash
|
|
466
|
-
# 1. Xcode
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
# 2. idb — discovers connected iPhones and installs .ipa builds:
|
|
470
|
-
brew tap facebook/fb && brew install idb-companion
|
|
471
|
-
pipx install fb-idb # or: pip install fb-idb
|
|
469
|
+
# 1. Xcode (full app, from the App Store) + accept the license:
|
|
470
|
+
sudo xcodebuild -license accept
|
|
472
471
|
|
|
473
|
-
#
|
|
474
|
-
|
|
475
|
-
#
|
|
476
|
-
export AXIMO_IOS_SIGNING_ID="Apple Development"
|
|
477
|
-
export AXIMO_IOS_WDA_BUNDLE_ID="com.facebook.WebDriverAgentRunner"
|
|
478
|
-
# Optional: reuse a prebuilt WDA to skip per-session rebuilds:
|
|
479
|
-
# export AXIMO_IOS_DERIVED_DATA_PATH="$HOME/Library/Developer/Xcode/DerivedData/WebDriverAgent-xxxx"
|
|
472
|
+
# 2. Sign into Xcode with your Apple ID and create a development certificate:
|
|
473
|
+
# Xcode → Settings → Accounts → + (your Apple ID)
|
|
474
|
+
# → Manage Certificates… → + → Apple Development
|
|
480
475
|
```
|
|
481
476
|
|
|
482
|
-
|
|
477
|
+
Everything else is discovered automatically at `connect`/`install` time:
|
|
478
|
+
|
|
479
|
+
- **Signing identity & Team ID** — read from the keychain (`security find-identity`); no `AXIMO_IOS_TEAM_ID` needed. On a machine with several teams, set `AXIMO_IOS_TEAM_ID` (or MobileLink's `XCODE_TEAM_ID`) to pick one.
|
|
480
|
+
- **Provisioning profiles** — scanned from disk and matched against the device; when none fits, the CLI **mints one via Xcode automatic signing** (first run takes a minute or two; requires the Apple ID signed into Xcode).
|
|
481
|
+
- **WebDriverAgent** — on **iOS 17+**, a prebuilt WDA matching the bundled driver is downloaded, re-signed with your identity, and **preinstalled — no Xcode build, no iOS platform download**. Older devices fall back to the classic Xcode build (cached per device under `$AXIMO_HOME/ios-wda/<udid>/`). A WDA bundle id is derived per team (existing `*.WebDriverAgentRunner` profiles are reused); override with `AXIMO_IOS_WDA_BUNDLE_ID`.
|
|
482
|
+
- **App installs** — `.ipa` files that aren't signed for your device are **re-signed automatically** (see `aximo mobile install` below).
|
|
483
|
+
- **Device discovery** — via Xcode's `devicectl`; `idb` is only an optional fallback (`brew install idb-companion && pipx install fb-idb`).
|
|
484
|
+
|
|
485
|
+
Optional overrides / opt-outs:
|
|
483
486
|
|
|
484
|
-
|
|
487
|
+
```bash
|
|
488
|
+
# export AXIMO_IOS_TEAM_ID="ABCDE12345" # pick a team on multi-team machines (else auto-detected)
|
|
489
|
+
# export AXIMO_IOS_SIGNING_ID="Apple Development"
|
|
490
|
+
# export AXIMO_IOS_WDA_BUNDLE_ID="com.<you>.WebDriverAgentRunner" # else derived/reused automatically
|
|
491
|
+
# export AXIMO_IOS_NO_RESIGN=1 # never re-sign the app under test
|
|
492
|
+
# export AXIMO_IOS_NO_PREINSTALLED_WDA=1 # force the classic Xcode build flow for WDA
|
|
493
|
+
# export AXIMO_IOS_DERIVED_DATA_PATH=... # pin a prebuilt WDA DerivedData (build flow)
|
|
494
|
+
# export AXIMO_IOS_NO_WDA_CACHE=1 # disable the WDA build cache (build flow)
|
|
495
|
+
# export AXIMO_IOS_SKIP_TUNNEL=1 # don't auto-start the RemoteXPC device tunnel (you manage it)
|
|
496
|
+
```
|
|
485
497
|
|
|
486
|
-
|
|
498
|
+
Run `aximo mobile doctor --platform ios` to see what was discovered (identity, team, WDA id) and what's missing; failed commands include a `hint` naming the exact fix.
|
|
499
|
+
|
|
500
|
+
> **On-device steps you can't skip** (Apple requires them once per phone): enable **Developer Mode** (Settings → Privacy & Security → Developer Mode; the phone restarts), tap **Trust This Computer**, and — after the first install of an app signed by your team — **trust the developer certificate** (Settings → General → VPN & Device Management → your "Apple Development" profile → Trust; the phone needs internet). On **free/personal teams** profiles expire every ~7 days; the CLI re-mints them automatically, but a re-mint **resets the certificate trust**, so expect that trust tap to recur weekly. Free teams are also capped at 10 App IDs per week.
|
|
501
|
+
>
|
|
502
|
+
> On **iOS 17+**, `aximo mobile connect` also starts a small **device tunnel that needs admin rights** — it prompts once for your macOS password / Touch ID (reused on later runs, so at most once per boot). The tunnel deliberately keeps running after `connect` exits; stop it anytime with `sudo pkill -f tunnel-creation`. Devices below iOS 17 skip the tunnel entirely, and Android never uses it. If anything mentions "iOS X is not installed", run `xcodebuild -downloadPlatform iOS` (only the classic build flow needs it).
|
|
487
503
|
|
|
488
504
|
### Enable USB debugging on the phone
|
|
489
505
|
|
|
@@ -507,10 +523,10 @@ aximo mobile setup # installs the Appium driver(s) for
|
|
|
507
523
|
aximo mobile doctor # checks tooling / drivers / bundled server
|
|
508
524
|
# Limit to one platform if you only test on one:
|
|
509
525
|
aximo mobile setup --platform ios # installs only the XCUITest driver
|
|
510
|
-
aximo mobile doctor --platform ios # checks Xcode /
|
|
526
|
+
aximo mobile doctor --platform ios # checks Xcode / devicectl / discovered signing
|
|
511
527
|
```
|
|
512
528
|
|
|
513
|
-
`setup` installs the Appium driver(s) — UiAutomator2 for Android, XCUITest for iOS — then prints what (if anything) is still missing. `doctor` is the first thing to run when anything's off: for Android it reports `adb` and the Android SDK; for iOS it reports `xcrun`/Xcode,
|
|
529
|
+
`setup` installs the Appium driver(s) — UiAutomator2 for Android, XCUITest for iOS — then prints what (if anything) is still missing. `doctor` is the first thing to run when anything's off: for Android it reports `adb` and the Android SDK; for iOS it reports `xcrun`/Xcode, the discovered signing identity/team, and whether the iOS device tunnel is running — alongside the bundled Appium server and driver — and exits non-zero if a required check fails.
|
|
514
530
|
|
|
515
531
|
### Registering and connecting
|
|
516
532
|
|
|
@@ -526,7 +542,7 @@ aximo mobile connect # starts managed Ap
|
|
|
526
542
|
# Ctrl+C to disconnect
|
|
527
543
|
```
|
|
528
544
|
|
|
529
|
-
`register` writes credentials to `$AXIMO_HOME/mobile-devices/<deviceId>.json` (mode `0600`). It targets the single connected phone by default — pass `--serial` (Android) or `--udid` (iOS) to pick a specific one when several are attached. `connect` re-checks prerequisites, starts the managed Appium server, and opens the tunnel; it runs until Ctrl+C. If you have more than one registered phone, pass `--device-id` to choose which to connect.
|
|
545
|
+
`register` writes credentials to `$AXIMO_HOME/mobile-devices/<deviceId>.json` (mode `0600`). It targets the single connected phone by default — pass `--serial` (Android) or `--udid` (iOS) to pick a specific one when several are attached. `connect` re-checks prerequisites, then — on iOS 17+ — ensures the device tunnel is running (prompting once for admin the first time), starts the managed Appium server, and opens the gateway tunnel to Aximo; it runs until Ctrl+C. If you have more than one registered phone, pass `--device-id` to choose which to connect.
|
|
530
546
|
|
|
531
547
|
Once connected, create a **mobile session in Aximo targeting this local device** — the agent routes its actions through the tunnel to the phone over Appium.
|
|
532
548
|
|
|
@@ -536,9 +552,11 @@ Unlike Device Farm, a local phone runs the apps already installed on it. To test
|
|
|
536
552
|
|
|
537
553
|
```bash
|
|
538
554
|
aximo mobile install --app ./app-debug.apk # Android: adb install -r
|
|
539
|
-
aximo mobile install --app ./MyApp.ipa # iOS:
|
|
555
|
+
aximo mobile install --app ./MyApp.ipa # iOS: auto-re-signed for the device if needed, installed via devicectl
|
|
540
556
|
```
|
|
541
557
|
|
|
558
|
+
On iOS the CLI inspects the `.ipa` first: if its embedded profile already covers the device it installs as-is; otherwise it **re-signs it with your discovered identity** (the same thing AWS Device Farm does to every upload — so the exact `.ipa` you upload there works here). When the bundle id has to be remapped (free teams), launches by the original bundle id are translated automatically during `connect` sessions, and the JSON result reports both ids. App Store downloads are FairPlay-encrypted and can't be re-signed — use a development/ad-hoc build. Opt out with `AXIMO_IOS_NO_RESIGN=1`.
|
|
559
|
+
|
|
542
560
|
Then create the session with the app's bundle id / package name as `--bundle-id` — the agent launches it on startup before the test begins:
|
|
543
561
|
|
|
544
562
|
```bash
|
package/dist/client.js
CHANGED
|
@@ -94,7 +94,22 @@ export async function requestToFile(path, destPath, deps = {}) {
|
|
|
94
94
|
const baseUrl = deps.baseUrl ?? getBaseUrl();
|
|
95
95
|
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
96
96
|
const url = buildUrl(baseUrl, path);
|
|
97
|
-
|
|
97
|
+
// Redirects (e.g. to a presigned S3 URL) are followed manually WITHOUT the
|
|
98
|
+
// x-api-key header — fetch only strips authorization/cookie on cross-origin
|
|
99
|
+
// redirects, so auto-follow would leak the org API key to the storage host.
|
|
100
|
+
let res = await fetchImpl(url, {
|
|
101
|
+
method: "GET",
|
|
102
|
+
headers: { "x-api-key": apiKey },
|
|
103
|
+
redirect: "manual",
|
|
104
|
+
});
|
|
105
|
+
// Only true redirects — other 3xx (e.g. 304 Not Modified) carry no Location
|
|
106
|
+
// and must fall through to normal handling instead of throwing here.
|
|
107
|
+
if ([301, 302, 303, 307, 308].includes(res.status)) {
|
|
108
|
+
const location = res.headers.get("location");
|
|
109
|
+
if (!location)
|
|
110
|
+
throw new Error(`Redirect from ${path} is missing a Location header`);
|
|
111
|
+
res = await fetchImpl(new URL(location, url).toString(), { method: "GET" });
|
|
112
|
+
}
|
|
98
113
|
if (!res.ok) {
|
|
99
114
|
const retryAfter = res.headers.get("retry-after") ?? undefined;
|
|
100
115
|
throw httpError(res.status, await errorMessage(res), retryAfter);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ErrorEnvelope } from "../../types.js";
|
|
2
2
|
import type { MobileController } from "../../mobile-control/controller.js";
|
|
3
|
+
import { type IosSigningConfig } from "../../mobile-control/ios-signing.js";
|
|
3
4
|
import { type MobileDeviceConfig } from "./paths.js";
|
|
4
5
|
export declare function getTunnelOrigin(): string;
|
|
5
6
|
interface ConfigOk {
|
|
@@ -7,6 +8,6 @@ interface ConfigOk {
|
|
|
7
8
|
config: MobileDeviceConfig;
|
|
8
9
|
}
|
|
9
10
|
export declare function resolveDeviceConfig(deviceId: string | undefined): ConfigOk | ErrorEnvelope;
|
|
10
|
-
export declare function buildController(config: MobileDeviceConfig, endpoint: string): MobileController;
|
|
11
|
+
export declare function buildController(config: MobileDeviceConfig, endpoint: string, iosSigning?: IosSigningConfig, wdaLocalPort?: number | (() => Promise<number>)): MobileController;
|
|
11
12
|
export declare function connectWithConfig(config: MobileDeviceConfig): Promise<void>;
|
|
12
13
|
export {};
|
|
@@ -2,8 +2,13 @@ import { getBaseUrl } from "../../client.js";
|
|
|
2
2
|
import { formatError } from "../../output.js";
|
|
3
3
|
import { AppiumController } from "../../mobile-control/appium-controller.js";
|
|
4
4
|
import { installUploadedApp } from "../../mobile-control/app-install.js";
|
|
5
|
-
import { startAppiumServer } from "../../mobile-control/appium-server.js";
|
|
6
|
-
import {
|
|
5
|
+
import { pickFreePort, startAppiumServer } from "../../mobile-control/appium-server.js";
|
|
6
|
+
import { withBundleIdTranslation } from "../../mobile-control/bundle-id-map.js";
|
|
7
|
+
import { getIosDeviceInfo, iosMajorVersion } from "../../mobile-control/ios-devicectl.js";
|
|
8
|
+
import { ensureIosTunnel, TUNNEL_STOP_COMMAND } from "../../mobile-control/ios-tunnel.js";
|
|
9
|
+
import { resolveIosSigning, resolveIosSigningAuto, } from "../../mobile-control/ios-signing.js";
|
|
10
|
+
import { resolveWdaCaching } from "../../mobile-control/ios-wda-cache.js";
|
|
11
|
+
import { resolvePreinstalledWdaStrategy } from "../../mobile-control/ios-wda-preinstall.js";
|
|
7
12
|
import { runControlTunnel } from "../../mobile-control/tunnel.js";
|
|
8
13
|
import { runMobileDoctor } from "./doctor.js";
|
|
9
14
|
import { listMobileDeviceConfigs, readMobileDeviceConfig, } from "./paths.js";
|
|
@@ -23,9 +28,8 @@ export function resolveDeviceConfig(deviceId) {
|
|
|
23
28
|
return formatError("validation_error", 'No registered devices. Register one first: aximo mobile register --name "My Pixel" --platform android', false);
|
|
24
29
|
}
|
|
25
30
|
if (all.length > 1) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
.join(", ")}`, false);
|
|
31
|
+
const lines = all.map((c) => ` - ${c.name} (${c.platform}) — device-id: ${c.deviceId}`);
|
|
32
|
+
return formatError("validation_error", `Multiple devices are registered on this machine; pass --device-id to pick one:\n${lines.join("\n")}`, false, `Re-run with --device-id, e.g. --device-id ${all[0]?.deviceId}`);
|
|
29
33
|
}
|
|
30
34
|
const only = all[0];
|
|
31
35
|
if (!only) {
|
|
@@ -33,12 +37,14 @@ export function resolveDeviceConfig(deviceId) {
|
|
|
33
37
|
}
|
|
34
38
|
return { ok: true, config: only };
|
|
35
39
|
}
|
|
36
|
-
export function buildController(config, endpoint) {
|
|
40
|
+
export function buildController(config, endpoint, iosSigning, wdaLocalPort) {
|
|
37
41
|
return new AppiumController({
|
|
38
42
|
endpoint,
|
|
39
43
|
platform: config.platform,
|
|
40
44
|
target: config.target,
|
|
41
|
-
...(config.platform === "ios"
|
|
45
|
+
...(config.platform === "ios"
|
|
46
|
+
? { iosSigning: iosSigning ?? resolveIosSigning(), ...(wdaLocalPort ? { wdaLocalPort } : {}) }
|
|
47
|
+
: {}),
|
|
42
48
|
});
|
|
43
49
|
}
|
|
44
50
|
// A blocking check is any hard failure, plus a missing automation driver
|
|
@@ -61,28 +67,125 @@ async function assertPrerequisites(platform) {
|
|
|
61
67
|
throw new Error(`Missing ${platform} prerequisites:\n${lines.join("\n")}\n` +
|
|
62
68
|
`Run \`${setup}\` and/or fix the above, then re-run. (\`${doctor}\` for details.)`);
|
|
63
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Preflight the physical device state via devicectl and fail with the exact
|
|
72
|
+
* on-device fix when an onboarding toggle is missing. Returns the device's iOS
|
|
73
|
+
* major version (null when devicectl can't see the device).
|
|
74
|
+
*/
|
|
75
|
+
async function preflightIosDevice(udid) {
|
|
76
|
+
const info = await getIosDeviceInfo(udid);
|
|
77
|
+
if (!info)
|
|
78
|
+
return null;
|
|
79
|
+
if (info.developerModeEnabled === false) {
|
|
80
|
+
throw new Error("Developer Mode is disabled on the iPhone. Enable it on the device: Settings → " +
|
|
81
|
+
"Privacy & Security → Developer Mode → On (the phone restarts), then re-run.");
|
|
82
|
+
}
|
|
83
|
+
if (info.paired === false) {
|
|
84
|
+
throw new Error("The iPhone is not paired with this Mac. Unlock the phone, reconnect the USB cable, " +
|
|
85
|
+
"and tap 'Trust This Computer'.");
|
|
86
|
+
}
|
|
87
|
+
return iosMajorVersion(info.osVersion);
|
|
88
|
+
}
|
|
64
89
|
export async function connectWithConfig(config) {
|
|
65
90
|
await assertPrerequisites(config.platform);
|
|
91
|
+
let iosMajor = null;
|
|
92
|
+
let tunnelRunning = false;
|
|
93
|
+
if (config.platform === "ios") {
|
|
94
|
+
iosMajor = await preflightIosDevice(config.target);
|
|
95
|
+
// Physical iPhones on iOS 17+ need the RemoteXPC tunnel before XCUITest can
|
|
96
|
+
// reach WebDriverAgent; start it (prompting for admin) unless one is running.
|
|
97
|
+
// Older devices use the classic lockdown path — no tunnel, no admin prompt.
|
|
98
|
+
if (iosMajor !== null && iosMajor < 17) {
|
|
99
|
+
console.error(`iOS ${iosMajor} device — skipping the RemoteXPC tunnel (not needed).`);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
const tunnel = await ensureIosTunnel();
|
|
103
|
+
tunnelRunning = tunnel.started || tunnel.reused;
|
|
104
|
+
if (tunnel.reused)
|
|
105
|
+
console.error("Reusing the running iOS device tunnel.");
|
|
106
|
+
}
|
|
107
|
+
}
|
|
66
108
|
const useDrivers = config.platform === "ios" ? ["xcuitest"] : ["uiautomator2"];
|
|
67
109
|
const server = await startAppiumServer({ useDrivers });
|
|
68
|
-
|
|
110
|
+
// WDA strategy ladder: (1) preinstalled prebuilt runner — no xcodebuild at all
|
|
111
|
+
// (iOS 17+, needs a discovered identity; profiles are minted on demand);
|
|
112
|
+
// (2) cached xcodebuild output (usePrebuiltWDA) when still valid; (3) full
|
|
113
|
+
// driver-managed xcodebuild. Everything is discovered from the keychain and
|
|
114
|
+
// installed profiles; env vars only override.
|
|
115
|
+
let iosSigning;
|
|
116
|
+
let wdaLocalPort;
|
|
117
|
+
if (config.platform === "ios") {
|
|
118
|
+
const signing = await resolveIosSigningAuto({ udid: config.target });
|
|
119
|
+
if (signing.teamId) {
|
|
120
|
+
console.error(`Signing as team ${signing.teamId} (WDA id ${signing.wdaBundleId}).`);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
console.error("No Apple signing identity found — physical-device WebDriverAgent signing will fail. " +
|
|
124
|
+
"Open Xcode → Settings → Accounts to add your Apple ID (see `aximo mobile doctor`).");
|
|
125
|
+
}
|
|
126
|
+
const preinstalled = await resolvePreinstalledWdaStrategy(signing, {
|
|
127
|
+
udid: config.target,
|
|
128
|
+
iosMajor,
|
|
129
|
+
log: (message) => console.error(message),
|
|
130
|
+
});
|
|
131
|
+
if (preinstalled) {
|
|
132
|
+
iosSigning = preinstalled;
|
|
133
|
+
console.error("Using the preinstalled WebDriverAgent (no Xcode build needed).");
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
iosSigning = signing.teamId
|
|
137
|
+
? await resolveWdaCaching(signing, { udid: config.target })
|
|
138
|
+
: signing;
|
|
139
|
+
if (iosSigning.usePrebuiltWDA)
|
|
140
|
+
console.error("Reusing the cached WebDriverAgent build.");
|
|
141
|
+
}
|
|
142
|
+
// Resolved lazily right before the Appium session is created — a port picked
|
|
143
|
+
// here would sit unbound (and stealable) until the first remote action.
|
|
144
|
+
wdaLocalPort = pickFreePort;
|
|
145
|
+
}
|
|
146
|
+
// Re-signing can remap bundle ids; launches from the backend use the original.
|
|
147
|
+
const installedBundleIds = new Map();
|
|
148
|
+
const rawController = buildController(config, server.endpoint, iosSigning, wdaLocalPort);
|
|
149
|
+
const controller = config.platform === "ios"
|
|
150
|
+
? withBundleIdTranslation(rawController, installedBundleIds)
|
|
151
|
+
: rawController;
|
|
69
152
|
try {
|
|
153
|
+
// Warm up the device session before connecting to Aximo so WDA build/signing/
|
|
154
|
+
// trust problems surface here — with a clear, actionable message — instead of
|
|
155
|
+
// failing opaquely on the first server-driven action.
|
|
156
|
+
if (config.platform === "ios") {
|
|
157
|
+
console.error("Preparing WebDriverAgent on the device…");
|
|
158
|
+
await controller.screenshot();
|
|
159
|
+
console.error("Device is ready.");
|
|
160
|
+
}
|
|
70
161
|
await runControlTunnel({
|
|
71
162
|
wsUrl: getTunnelOrigin(),
|
|
72
163
|
deviceToken: config.deviceToken,
|
|
73
164
|
deviceName: config.name,
|
|
74
165
|
controller,
|
|
75
166
|
installApp: async ({ uploadId }) => {
|
|
76
|
-
await installUploadedApp({
|
|
167
|
+
const result = await installUploadedApp({
|
|
77
168
|
uploadId,
|
|
78
169
|
platform: config.platform,
|
|
79
170
|
target: config.target,
|
|
171
|
+
log: (message) => console.error(message),
|
|
80
172
|
});
|
|
173
|
+
if (result.originalBundleId &&
|
|
174
|
+
result.installedBundleId &&
|
|
175
|
+
result.originalBundleId !== result.installedBundleId) {
|
|
176
|
+
installedBundleIds.set(result.originalBundleId, result.installedBundleId);
|
|
177
|
+
console.error(`App re-signed for this device: ${result.originalBundleId} installed as ` +
|
|
178
|
+
`${result.installedBundleId}.`);
|
|
179
|
+
}
|
|
81
180
|
},
|
|
82
181
|
});
|
|
83
182
|
}
|
|
84
183
|
finally {
|
|
85
184
|
await controller.close();
|
|
86
185
|
await server.stop();
|
|
186
|
+
if (tunnelRunning) {
|
|
187
|
+
console.error("The iOS device tunnel is still running in the background (admin-started; the next " +
|
|
188
|
+
`connect won't prompt again). Stop it anytime with: ${TUNNEL_STOP_COMMAND}`);
|
|
189
|
+
}
|
|
87
190
|
}
|
|
88
191
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { defineCommand } from "citty";
|
|
2
|
-
import {
|
|
2
|
+
import { mobileErrorHint } from "../../mobile-control/mobile-errors.js";
|
|
3
|
+
import { formatError } from "../../output.js";
|
|
3
4
|
import { connectWithConfig, resolveDeviceConfig } from "./connect-core.js";
|
|
5
|
+
import { printMobileResult } from "./output.js";
|
|
4
6
|
const IOS_PHYSICAL_WARNING = "Driving a physical iPhone goes through Appium's XCUITest driver, which builds and " +
|
|
5
7
|
"installs a WebDriverAgent runner on the device. The device must have Developer Mode " +
|
|
6
8
|
"enabled (Settings → Privacy & Security) and be trusted, and WDA needs an Apple Developer " +
|
|
@@ -19,7 +21,7 @@ export default defineCommand({
|
|
|
19
21
|
async run({ args }) {
|
|
20
22
|
const resolved = resolveDeviceConfig(args["device-id"]);
|
|
21
23
|
if (!resolved.ok) {
|
|
22
|
-
|
|
24
|
+
printMobileResult(resolved);
|
|
23
25
|
return;
|
|
24
26
|
}
|
|
25
27
|
const warning = iosPhysicalWarning(resolved.config);
|
|
@@ -29,7 +31,8 @@ export default defineCommand({
|
|
|
29
31
|
await connectWithConfig(resolved.config);
|
|
30
32
|
}
|
|
31
33
|
catch (error) {
|
|
32
|
-
|
|
34
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
35
|
+
printMobileResult(formatError("api_error", message, true, mobileErrorHint(message, resolved.config.platform)));
|
|
33
36
|
}
|
|
34
37
|
},
|
|
35
38
|
});
|
|
@@ -61,7 +61,7 @@ describe("resolveDeviceConfig", () => {
|
|
|
61
61
|
if (result.ok)
|
|
62
62
|
expect(result.config.deviceId).toBe("only-1");
|
|
63
63
|
});
|
|
64
|
-
it("requires --device-id when multiple are registered", () => {
|
|
64
|
+
it("requires --device-id when multiple are registered, listing each candidate", () => {
|
|
65
65
|
for (const id of ["a", "b"]) {
|
|
66
66
|
writeMobileDeviceConfig({
|
|
67
67
|
deviceId: id,
|
|
@@ -73,6 +73,12 @@ describe("resolveDeviceConfig", () => {
|
|
|
73
73
|
}
|
|
74
74
|
const ambiguous = resolveDeviceConfig(undefined);
|
|
75
75
|
expect(ambiguous.ok).toBe(false);
|
|
76
|
+
if (!ambiguous.ok) {
|
|
77
|
+
expect(ambiguous.error.message).toContain("pass --device-id");
|
|
78
|
+
expect(ambiguous.error.message).toContain("device-id: a");
|
|
79
|
+
expect(ambiguous.error.message).toContain("device-id: b");
|
|
80
|
+
expect(ambiguous.error.hint).toContain("--device-id");
|
|
81
|
+
}
|
|
76
82
|
const picked = resolveDeviceConfig("b");
|
|
77
83
|
expect(picked.ok).toBe(true);
|
|
78
84
|
if (picked.ok)
|
|
@@ -15,10 +15,14 @@ export interface MobileDoctorReport {
|
|
|
15
15
|
info: number;
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
+
export declare function checkIosTunnel(isHealthy?: (port: number) => Promise<boolean>): Promise<Check>;
|
|
18
19
|
export interface RunMobileDoctorOptions {
|
|
19
20
|
platform?: "ios" | "android" | undefined;
|
|
21
|
+
/** Injectable tunnel probe for tests. */
|
|
22
|
+
isTunnelHealthy?: (port: number) => Promise<boolean>;
|
|
20
23
|
}
|
|
21
24
|
export declare function runMobileDoctor(options?: RunMobileDoctorOptions): Promise<Envelope<MobileDoctorReport>>;
|
|
25
|
+
export declare function renderDoctorReport(data: MobileDoctorReport): string;
|
|
22
26
|
declare const _default: import("citty").CommandDef<{
|
|
23
27
|
readonly platform: {
|
|
24
28
|
readonly type: "string";
|