mobitru-mobile-cli 1.0.0-beta.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/CHANGELOG.md +20 -0
- package/README.md +201 -0
- package/mobitru-mobile-cli.js +154 -0
- package/package.json +36 -0
- package/skills/SKILL.md +650 -0
- package/skills/references/mobile-sessions.md +125 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
Initial release. Drives real Android and iOS devices on Mobitru cloud via Appium.
|
|
6
|
+
|
|
7
|
+
- Device booking (immediate use + future reservations) — native or web sessions, custom lease duration
|
|
8
|
+
- Observation: screenshots, accessibility snapshots, screen-size, orientation
|
|
9
|
+
- Interaction: taps by ref or pixel coordinates, typing, swipes (directional + multi-point), hardware button presses
|
|
10
|
+
- Apps: launch / terminate / is-installed / install / OTA install / uninstall
|
|
11
|
+
- Artifacts: list, info, upload (APK/IPA, target auto-detected), download
|
|
12
|
+
- Recording (screen video), device logs (logcat / syslog), crashlogs
|
|
13
|
+
- Network conditions: throttling (named presets + custom bandwidth/latency), device GPS, outbound IP geolocation
|
|
14
|
+
- HTTP traffic capture (HAR, Android only)
|
|
15
|
+
- CPU/memory profiler, camera image mock, biometric touch mock
|
|
16
|
+
- Espresso (Android) and XCUITest (iOS) test runs — async submit + status polling
|
|
17
|
+
- Custom Appium scripts via `appium-run` (mocha-style, single-job-at-a-time)
|
|
18
|
+
- Web sessions: `open-url`, `click-web-element`
|
|
19
|
+
- Session state persists across CLI invocations
|
|
20
|
+
- Bundled agent skill installable via `mobitru-mobile-cli install --skills=claude|agents`
|
package/README.md
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# mobitru-mobile-cli
|
|
2
|
+
|
|
3
|
+
CLI for AI agents to automate mobile app testing on the Mobitru cloud platform.
|
|
4
|
+
|
|
5
|
+
Drives a **real Android phone or iOS device on Mobitru cloud** via Appium. Session state (active booking, Appium session) persists across short-lived CLI invocations so each command stays cheap. No local emulator.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g mobitru-mobile-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# 1. Configure once (env vars OR ~/.mobitru-cli/config.json)
|
|
17
|
+
export DEVICE_FARM_BASE_URL=app.mobitru.com
|
|
18
|
+
export DEVICE_FARM_API_KEY=mobitru_ak_...
|
|
19
|
+
export DEVICE_FARM_SLUG=your-slug
|
|
20
|
+
|
|
21
|
+
# 2. Automate
|
|
22
|
+
mobitru-mobile-cli device-list android
|
|
23
|
+
mobitru-mobile-cli device-use <serial>
|
|
24
|
+
mobitru-mobile-cli snapshot
|
|
25
|
+
mobitru-mobile-cli tap e3
|
|
26
|
+
mobitru-mobile-cli type "user@example.com" --submit
|
|
27
|
+
mobitru-mobile-cli screenshot
|
|
28
|
+
mobitru-mobile-cli device-release
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Configuration
|
|
32
|
+
|
|
33
|
+
Credentials are resolved in order: **env vars → `~/.mobitru-cli/config.json`**.
|
|
34
|
+
|
|
35
|
+
| Field | Env var | Description |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| `baseUrl` | `DEVICE_FARM_BASE_URL` | Mobitru REST API host |
|
|
38
|
+
| `apiKey` | `DEVICE_FARM_API_KEY` | API key (`mobitru_ak_...`) |
|
|
39
|
+
| `slug` | `DEVICE_FARM_SLUG` | Billing/workspace slug |
|
|
40
|
+
| `wid` | `DEVICE_FARM_WID` | Workspace ID (default `"0"`) |
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
mobitru-mobile-cli config # inspect resolved credentials (api key redacted)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Session lifecycle
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
mobitru-mobile-cli device-list android # ios | android
|
|
50
|
+
mobitru-mobile-cli device-use <serial> # native session, 180-min lease
|
|
51
|
+
mobitru-mobile-cli device-use <serial> --duration=30 # custom lease in minutes
|
|
52
|
+
mobitru-mobile-cli device-use <serial> --web # browser (web) session
|
|
53
|
+
|
|
54
|
+
mobitru-mobile-cli device-release # release cloud slot (always do this)
|
|
55
|
+
mobitru-mobile-cli stop # release + reset session state
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
> ⚠️ **One active booking at a time.** Switching devices requires `device-release` first, then a 30-60s cloud cleanup window before the released serial is re-bookable. Pick a different serial to recover faster.
|
|
59
|
+
|
|
60
|
+
Switching between native and web sessions on the **same device** is fast (~5-10s, booking preserved). Switching to a **different device** incurs the cleanup window.
|
|
61
|
+
|
|
62
|
+
## Parallel devices
|
|
63
|
+
|
|
64
|
+
The CLI holds one device per daemon. For multiple devices in parallel, run separate CLIs with isolated daemon dirs:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Terminal 1
|
|
68
|
+
MOBITRU_CLI_HOME=/tmp/run-a mobitru-mobile-cli device-use <serial-a>
|
|
69
|
+
|
|
70
|
+
# Terminal 2
|
|
71
|
+
MOBITRU_CLI_HOME=/tmp/run-b mobitru-mobile-cli device-use <serial-b>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Each daemon has its own state, socket, and Appium session — they never collide.
|
|
75
|
+
|
|
76
|
+
## Commands
|
|
77
|
+
|
|
78
|
+
### Observation
|
|
79
|
+
```bash
|
|
80
|
+
screenshot [--output=<path>] # PNG to disk; stdout: { path, bytes }
|
|
81
|
+
snapshot [--output=<path>] # AX tree to disk; stdout: { path, refCount }
|
|
82
|
+
screen-size # device pixel dimensions
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Interaction
|
|
86
|
+
```bash
|
|
87
|
+
tap <ref> # tap an element by snapshot ref (e1..eN)
|
|
88
|
+
tap-at <x> <y> # tap raw pixel coordinates
|
|
89
|
+
type <text> [--submit] # type into focused field; --submit presses ENTER
|
|
90
|
+
swipe <up|down|left|right> [--force=0.5] # full-screen directional gesture
|
|
91
|
+
continuous-swipe <x,y> <x,y> [...] # multi-point drag (2..20 points)
|
|
92
|
+
press <HOME|BACK|VOLUME_UP|VOLUME_DOWN|ENTER|DPAD_*>
|
|
93
|
+
get-orientation | set-orientation <portrait|landscape>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Web session
|
|
97
|
+
```bash
|
|
98
|
+
open-url <url> # navigate the device browser (--web sessions only)
|
|
99
|
+
click-web-element <selector> # CSS selector click
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Apps
|
|
103
|
+
```bash
|
|
104
|
+
launch <app-id> # com.android.chrome / com.apple.mobilesafari
|
|
105
|
+
terminate <app-id>
|
|
106
|
+
is-installed <app-id>
|
|
107
|
+
install-app <artifact-id> # blocks until installation completes
|
|
108
|
+
install-app-ota <ota-url> # iOS only — install from OTA manifest
|
|
109
|
+
uninstall-app <app-id>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Artifacts
|
|
113
|
+
```bash
|
|
114
|
+
artifacts-list
|
|
115
|
+
artifacts-info <id>
|
|
116
|
+
artifacts-upload <file> [--alias=<name>] # APK or IPA; target auto-detected by extension
|
|
117
|
+
artifacts-download <id> [--output=<path>]
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Bookings (future reservations)
|
|
121
|
+
```bash
|
|
122
|
+
bookings-list [--till=<iso>]
|
|
123
|
+
bookings-info <id>
|
|
124
|
+
booking-create --name=<n> --start=<iso> --end=<iso> --devices=<serial>[,<serial>...] [--private]
|
|
125
|
+
booking-cancel <id>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Recording, logs, crashlogs
|
|
129
|
+
```bash
|
|
130
|
+
recording-start # screen video; returns max-duration
|
|
131
|
+
recording-stop # returns recordingId
|
|
132
|
+
recording-download <recordingId> [--output=<path>]
|
|
133
|
+
logs-start | logs-stop # device logs (logcat / syslog)
|
|
134
|
+
crashlogs [--output=<path>] # zip of crash reports
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Network conditions
|
|
138
|
+
```bash
|
|
139
|
+
throttling-presets # list named presets
|
|
140
|
+
throttling-status
|
|
141
|
+
throttling-enable <preset> # 3g, 4g, edge, custom, ...
|
|
142
|
+
throttling-enable custom --download=<kbps> --upload=<kbps> --latency=<ms>
|
|
143
|
+
throttling-disable
|
|
144
|
+
|
|
145
|
+
geolocation-get | geolocation-set <lat> <lng>
|
|
146
|
+
ip-location-list | ip-location-set <country-code|DEFAULT>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### HTTP traffic, profiler, mock injection
|
|
150
|
+
```bash
|
|
151
|
+
http-inspection-start [--capture-binary] [--no-capture-response-content] # Android only
|
|
152
|
+
http-inspection-stop
|
|
153
|
+
har-download <har-id> [--output=<path>]
|
|
154
|
+
|
|
155
|
+
profiler-start <appPackage> # target must be running
|
|
156
|
+
profiler-stop [--output=<path>]
|
|
157
|
+
|
|
158
|
+
inject-image <path> [--content-type=<mime>] [--name=<file>] # camera frame mock
|
|
159
|
+
inject-touch <valid|invalid> # biometric mock
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Test runs
|
|
163
|
+
```bash
|
|
164
|
+
espresso-run --app=<id> --test=<id> --runner=<class> [--serial=<s>] [--filter=...] [--shards=N]
|
|
165
|
+
xcuitest-run --serial=<s> --app=<id> --test=<id> [--no-resign]
|
|
166
|
+
espresso-list | espresso-status <run-id> | espresso-cancel <run-id>
|
|
167
|
+
xcuitest-list | xcuitest-status <run-id> | xcuitest-cancel <run-id>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Appium scripts (custom WebDriver tests)
|
|
171
|
+
```bash
|
|
172
|
+
appium-run <script.js> [--timeout=<ms>] [--capabilities=<json>]
|
|
173
|
+
appium-status | appium-logs | appium-cancel
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Lifecycle
|
|
177
|
+
```bash
|
|
178
|
+
status # show session state
|
|
179
|
+
stop # release device + reset session
|
|
180
|
+
config # inspect resolved credentials
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Artifacts
|
|
184
|
+
|
|
185
|
+
Auto-generated files (screenshots, snapshots, recordings, logs, …) land in the **artifact directory**:
|
|
186
|
+
|
|
187
|
+
| Setting | Path |
|
|
188
|
+
|---|---|
|
|
189
|
+
| Default | `<CWD>/.mobitru-mobile-cli/` |
|
|
190
|
+
| Override | `MOBILE_CLI_OUTPUT_DIR=/your/path mobitru-mobile-cli ...` |
|
|
191
|
+
|
|
192
|
+
The artifact dir is resolved **per-invocation** from the shell CWD. If you `cd` between commands, files land relative to the new CWD. Pass `--output=<absolute-path>` for unambiguous placement, or stay in one directory for the duration of a session.
|
|
193
|
+
|
|
194
|
+
## Agent skill
|
|
195
|
+
|
|
196
|
+
Install the bundled skill so your agent knows how to use the CLI:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
mobitru-mobile-cli install --skills=claude # → .claude/skills/mobitru-mobile-cli/
|
|
200
|
+
mobitru-mobile-cli install --skills=agents # → .agents/skills/mobitru-mobile-cli/
|
|
201
|
+
```
|