prowl-tools 0.1.6 → 0.1.8

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 CHANGED
@@ -1,12 +1,53 @@
1
1
  # Prowl
2
2
 
3
- CLI-first QA testing tool for deterministic web testing with Playwright.
3
+ End-to-end testing for **native macOS apps and web apps** from the same
4
+ declarative YAML.
4
5
 
5
6
  <!-- ILLUSTRATION: Prowl raccoon mascot hero image — cyan raccoon with terminal window showing pass/fail output -->
6
7
 
7
- Write tests in YAML. Run them from the terminal. Get screenshots, traces, and reports automatically.
8
+ Write a test (a "hunt") in YAML, run it from the terminal, and get screenshots,
9
+ traces, and reports automatically. The same step vocabulary — `click`, `fill`,
10
+ `assert` — drives a macOS app through Apple's Accessibility API and a web app
11
+ through Playwright. One tool, one file format, both targets.
12
+
13
+ **Desktop-first.** The macOS target — menu-bar extras (`NSStatusItem`) included —
14
+ is the gap no other tool fills: [Maestro](https://maestro.mobile.dev) targets
15
+ mobile and web, [Playwright](https://playwright.dev) is web-only, and
16
+ [XCUITest](https://developer.apple.com/documentation/xctest) means Swift and
17
+ Xcode. Web is Prowl's second first-class target; iOS and Android are
18
+ experimental. The macOS target is **experimental today** — install its signed
19
+ helper with `prowl macdriver install` (see
20
+ [macOS Target](#macos-target-experimental)) — but it's where Prowl leads.
21
+
22
+ **Native macOS app** — driven through the Accessibility API:
8
23
 
9
24
  ```yaml
25
+ # .prowl/config.yml → target: { type: macos, app: "com.example.App" }
26
+ # .prowl/hunts/save-note.yml
27
+ name: save-note
28
+ steps:
29
+ - click: "id=newNote"
30
+ - type: "Buy milk"
31
+ - click: "id=saveButton"
32
+ - assert:
33
+ visible: "Saved"
34
+ ```
35
+
36
+ ```text
37
+ ● Running hunt: save-note
38
+ ✓ click "id=newNote" (90ms)
39
+ ✓ type "Buy milk" (40ms)
40
+ ✓ click "id=saveButton" (110ms)
41
+ ✓ assert visible "Saved" (12ms)
42
+
43
+ PASS save-note (252ms) 4/4 steps
44
+ Artifacts: .prowl/runs/2026-02-09_10-30-45
45
+ ```
46
+
47
+ **Web app** — driven through Playwright:
48
+
49
+ ```yaml
50
+ # .prowl/config.yml → target: { type: web, url: "http://localhost:3000" }
10
51
  # .prowl/hunts/login-flow.yml
11
52
  name: login-flow
12
53
  steps:
@@ -20,7 +61,7 @@ steps:
20
61
  visible: "Dashboard"
21
62
  ```
22
63
 
23
- ```
64
+ ```text
24
65
  ● Running hunt: login-flow
25
66
  ✓ navigate "/login" (120ms)
26
67
  ✓ fill "Email" (85ms)
@@ -32,6 +73,23 @@ steps:
32
73
  Artifacts: .prowl/runs/2026-02-09_10-30-45
33
74
  ```
34
75
 
76
+ ## Why Prowl
77
+
78
+ - **Desktop-first, from the same YAML.** Native macOS apps (Accessibility API)
79
+ and web apps (Playwright) share one step vocabulary, one config, one report
80
+ format. No incumbent covers the Mac desktop the way Prowl aims to.
81
+ - **Deterministic.** Explicit scripted steps — no natural-language guessing.
82
+ - **Developer-ready artifacts.** Every run writes screenshots, a Playwright
83
+ trace, a console log, and both human- (`summary.md`) and machine-readable
84
+ (`result.json`) reports.
85
+ - **Self-sovereign & file-based.** Hunts, run history, and baselines live in
86
+ your repo. No database, no account, no service to sign up for.
87
+ - **Guardrails built in.** Allowed domains/apps, forbidden selectors, and step
88
+ caps keep runs scoped and safe.
89
+
90
+ Additional experimental targets — iOS Simulator and Android — follow the same
91
+ hunt format; see their sections below.
92
+
35
93
  ---
36
94
 
37
95
  ## Getting Started
@@ -87,20 +145,23 @@ prowl init
87
145
 
88
146
  <!-- ILLUSTRATION: Terminal screenshot showing `prowl init` output with raccoon mascot and file listing -->
89
147
 
90
- This creates a `.prowl/` directory with a config file and 8 example hunts:
148
+ This creates a `.prowl/` directory with a config file and two starter hunts:
91
149
 
92
150
  ```text
93
151
  .prowl/
94
- ├── config.yml # Target URL, browser settings, guardrails
152
+ ├── config.yml # Target URL, browser settings, guardrails
153
+ ├── .gitignore # Keeps runs/, auth-state.json, and .env out of git
95
154
  └── hunts/
96
- ├── homepage.yml # Basic page load smoke test
97
- ├── login-flow.yml # Email/password authentication
98
- ├── signup-flow.yml # Registration with validation
99
- ├── form-submit.yml # Form fill and submit
100
- ├── form-validation.yml # Validation errors and resubmit
101
- ├── crud-cycle.yml # Create, read, update, delete lifecycle
102
- ├── checkout-flow.yml # E-commerce checkout
103
- └── onboarding-wizard.yml # Multi-step SaaS onboarding
155
+ ├── hello.yml # Minimal smoke test verifies the app loads
156
+ └── login-flow.yml # Fuller example — auth, secrets, assertions
157
+ ```
158
+
159
+ `prowl init` finishes by pointing you at the first hunt:
160
+
161
+ ```text
162
+ Initialized .prowl directory.
163
+ Run prowl run hello to get started.
164
+ See .prowl/hunts/login-flow.yml for a fuller example.
104
165
  ```
105
166
 
106
167
  ### 3. Configure
@@ -112,11 +173,26 @@ target:
112
173
  url: "http://localhost:3000"
113
174
  ```
114
175
 
115
- ### 4. Write Your First Hunt
176
+ ### 4. Run the starter hunt
177
+
178
+ Run the bundled `hello` hunt to confirm your app is reachable:
179
+
180
+ ```bash
181
+ prowl run hello
182
+ ```
116
183
 
117
- Edit `.prowl/hunts/homepage.yml` or create a new file:
184
+ <!-- ILLUSTRATION: Terminal screenshot showing colorized pass/fail output with step timings -->
185
+
186
+ A hunt's name is its **file name** under `.prowl/hunts/` — `hello` runs
187
+ `.prowl/hunts/hello.yml`.
188
+
189
+ ### 5. Write your own hunt
190
+
191
+ Create a new file `.prowl/hunts/smoke-test.yml`. The file name *is* the hunt
192
+ name, so this hunt runs as `smoke-test`:
118
193
 
119
194
  ```yaml
195
+ # .prowl/hunts/smoke-test.yml
120
196
  name: smoke-test
121
197
  steps:
122
198
  - navigate: "/"
@@ -127,18 +203,239 @@ assertions:
127
203
  - noConsoleErrors: true
128
204
  ```
129
205
 
130
- ### 5. Run
206
+ Run it by file name:
131
207
 
132
208
  ```bash
133
209
  prowl run smoke-test
134
210
  ```
135
211
 
136
- <!-- ILLUSTRATION: Terminal screenshot showing colorized pass/fail output with step timings -->
137
-
138
212
  That's it. You're testing.
139
213
 
140
214
  ---
141
215
 
216
+ ## macOS Target (Experimental)
217
+
218
+ > **Experimental (PROWL-048).** Prowl can drive **native macOS apps** — including
219
+ > menu bar extras (`NSStatusItem` + `NSMenu`) — through Apple's Accessibility API,
220
+ > in addition to the web. The API, selector dialect, and step coverage may change.
221
+
222
+ ### Enabling it
223
+
224
+ 1. **Install the helper** (recommended — no Xcode, no Swift toolchain):
225
+
226
+ ```bash
227
+ prowl macdriver install
228
+ ```
229
+
230
+ This downloads the pinned, **signed and notarized** `prowl-macdriver` binary
231
+ from GitHub Releases, verifies its SHA-256 against the released checksum, and
232
+ installs it to `~/.prowl/macdriver/<version>/prowl-macdriver`. Check what's
233
+ resolved at any time with `prowl macdriver status`.
234
+
235
+ > **Until the first signed release is cut, `prowl macdriver install` returns a
236
+ > 404** (the maintainer publishes the first `macdriver-v*` release and
237
+ > verifies the flow before this becomes the default path). In the meantime,
238
+ > build from source as below.
239
+
240
+ **Contributors / pre-release — build from source** (requires the Swift
241
+ toolchain / Xcode CLT):
242
+
243
+ ```bash
244
+ cd macdriver
245
+ swift build -c release
246
+ ```
247
+
248
+ **Binary search order.** Prowl resolves the helper via, in order:
249
+ 1. `$PROWL_MACDRIVER_BIN` (absolute path to a binary), then
250
+ 2. the user-level install at `~/.prowl/macdriver/<version>/prowl-macdriver`
251
+ (what `prowl macdriver install` writes), then
252
+ 3. the repo-local source build at `macdriver/.build/release/prowl-macdriver`
253
+ (then `.../debug/...`).
254
+
255
+ If none is found, Prowl fails with a clear message pointing at
256
+ `prowl macdriver install` (with the source build as the contributor fallback)
257
+ rather than crashing.
258
+
259
+ 2. **Point your config at a macOS target:**
260
+
261
+ ```yaml
262
+ target:
263
+ type: macos
264
+ app: "com.example.App" # bundle id, or an absolute /path/to/App.app
265
+ guardrails:
266
+ allowedApps: # optional scope; empty = allow the target app
267
+ - "com.example.App"
268
+ ```
269
+
270
+ When `target.app` is an app path, `allowedApps` may list the exact `.app`
271
+ path, the app bundle name (`Example` for `Example.app`), or the bundle id
272
+ from `Contents/Info.plist` when that file is readable.
273
+
274
+ 3. **Grant Accessibility permission** (see below), then run a hunt as usual:
275
+ `prowl run my-macos-hunt`.
276
+
277
+ ### Accessibility & Screen Recording permission
278
+
279
+ The **process that hosts** Prowl (your terminal — Terminal, iTerm, VS Code, or a CI
280
+ agent) must be granted **Accessibility** permission: **System Settings → Privacy &
281
+ Security → Accessibility**, then enable that app. macOS attributes the grant to the
282
+ hosting app, not to `prowl-macdriver`. `prowl macdriver status` prints the
283
+ resolved binary path, installed versions, and this permission guidance. Preflight
284
+ the Accessibility grant directly from the helper (use the path `status` reports,
285
+ or the source build):
286
+
287
+ ```bash
288
+ MACDRIVER_VERSION=0.1.0 # replace with the version shown by `prowl macdriver status`
289
+ ~/.prowl/macdriver/$MACDRIVER_VERSION/prowl-macdriver check
290
+ # or: macdriver/.build/release/prowl-macdriver check
291
+ # prints {"trusted": <bool>}; prompts on first run
292
+ ```
293
+
294
+ The `screenshot`/`assertScreenshot` steps additionally need **Screen Recording**
295
+ permission for the hosting app.
296
+
297
+ **CI notes (macOS runners):** headless CI cannot click "Allow" in a dialog, so grant
298
+ the permissions non-interactively before the run. On a self-hosted runner you can
299
+ pre-authorize the agent's host app with a TCC profile via MDM, or (on ephemeral
300
+ runners where it's acceptable) seed the TCC database, e.g.:
301
+
302
+ ```bash
303
+ sudo sqlite3 "/Library/Application Support/com.apple.TCC/TCC.db" \
304
+ "INSERT OR REPLACE INTO access VALUES('kTCCServiceAccessibility','<runner-app-bundle-id>',0,2,2,1,NULL,NULL,NULL,'UNUSED',NULL,0,1,NULL,NULL,NULL);"
305
+ ```
306
+
307
+ GitHub-hosted macOS runners do not grant Accessibility, so the macOS target is aimed
308
+ at self-hosted / MDM-managed runners for now.
309
+
310
+ ### Selector dialect (macOS)
311
+
312
+ See the [Native Selector Dialect matrix](#native-selector-dialect-compatibility-matrix)
313
+ for how these compare across native targets (and the `label=` exact-match trap).
314
+ Native selectors address accessibility identifiers, roles, and labels:
315
+
316
+ | Selector | Matches |
317
+ |---|---|
318
+ | `id=openSettings` | element whose `AXIdentifier` equals `openSettings` |
319
+ | `role=button[name="Save"]` | an `AXButton` whose title/description/value contains `Save` |
320
+ | `label="Email"` | element whose accessibility label equals `Email` |
321
+ | `text="Save"` or bare `Save` | element whose title/description/value contains the text |
322
+ | `statusItem` | opens the app's menu bar status-item menu |
323
+ | `menu=Preferences…` | opens the status-item menu and clicks that item |
324
+
325
+ `forbiddenSelectors` still applies (text patterns match via the same substring
326
+ semantics as the web target). Prefer `id=` (accessibility identifiers) — the native
327
+ analog of `data-testid`.
328
+
329
+ ### Finding selectors
330
+
331
+ Don't guess selectors — dump them. `prowl analyze` works on the macOS target the
332
+ same way it does on the web: it launches/attaches to the app, walks the
333
+ Accessibility tree, and prints every interactive element with **ranked selector
334
+ candidates** (best first) plus the app's windows and status-item menu contents.
335
+ It is read-only (the only interaction is opening and closing the status menu),
336
+ honors `guardrails.allowedApps`, and leaves the app running when done.
337
+
338
+ ```bash
339
+ # Uses the macOS target from .prowl/config.yml:
340
+ prowl analyze
341
+
342
+ # …or point it at any app without a config:
343
+ prowl analyze --app com.example.App
344
+ prowl analyze --app "/Applications/Example.app"
345
+
346
+ # Machine-readable output for agents:
347
+ prowl analyze --app com.example.App --json
348
+ ```
349
+
350
+ Example (human-readable) output:
351
+
352
+ ```text
353
+ App Analysis: com.example.App
354
+
355
+ Windows:
356
+ "Main Window" id=mainWindow
357
+
358
+ Interactive Elements:
359
+ AXButton id=saveButton "Save"
360
+ AXTextField label="Email" "Email"
361
+ AXCheckBox label="Remember me" "Remember me" (disabled)
362
+
363
+ Menu Bar:
364
+ AXMenuItem id=preferences "Preferences…"
365
+ AXMenuItem label="Quit" "Quit"
366
+
367
+ 3 elements, 1 windows, 2 menu items
368
+ ```
369
+
370
+ Selectors are ranked `id=` > `label=` > `role=…[name="…"]` > `text=` — copy the
371
+ first (most durable) candidate into your hunt. Status-item menu identifiers
372
+ (`id=preferences` above) are especially valuable, since menu titles often carry
373
+ ellipses or localized text that are awkward to match by substring.
374
+
375
+ ### Step compatibility
376
+
377
+ Portable steps run on **both** targets; web-only steps are rejected up front on the
378
+ macOS target (with a clear error), and `prowl login` / URL guardrails do not apply.
379
+
380
+ | Portable (web + macOS) | Web-only (rejected on macOS) |
381
+ |---|---|
382
+ | `click`, `fill`, `type`, `press` | `navigate`, `waitForUrl`, `waitForNetworkIdle` |
383
+ | `wait`, `waitForSelector` | `mockRoute` / `unmockRoute` |
384
+ | `assert: visible` / `notVisible` | `evalScript`, `runScript` |
385
+ | `screenshot`, `assertScreenshot` | `onDialog`, `select` / `selectOption` |
386
+ | `hover`, `scrollTo` | `setInputFiles`, `waitForDownload` |
387
+ | `repeat`, `if`, `runHunt`, `copyText` | `scroll` (directional; see below) / `assert: urlIncludes` / `urlEquals` |
388
+
389
+ **Scroll steps** differ per verb across targets:
390
+
391
+ - **`scrollTo: { selector }`** is portable across **web, macOS, iOS, and Android**. macOS
392
+ resolves the element and calls **AXScrollToVisible**; iOS/Android run a bounded down/up
393
+ swipe probe until the element appears; web scrolls the element into view.
394
+ - **`scroll: { direction, amount? }`** (directional) runs on **web, iOS, and Android** but is
395
+ **rejected on macOS** — the mobile path synthesizes a touch swipe (no macOS accessibility
396
+ equivalent), so on macOS use `scrollTo` to bring a specific element into view instead. On
397
+ the mobile targets the swipe starts from the screen centre (direction semantics match the
398
+ web step; `amount` maps to the swipe distance in device points, defaulting to 75% of the
399
+ relevant screen axis; negative amounts reverse direction, matching the web target). An
400
+ explicit `swipe` step is a deferred follow-up.
401
+
402
+ Notes: `press` accepts the same key vocabulary as the web target — single printable
403
+ characters, `Enter`/`Return`/`Space`, `Tab`, `Escape`, `Backspace`, `Delete`, `Home`,
404
+ `End`, `PageUp`, `PageDown`, arrows (`ArrowUp`/`ArrowDown`/`ArrowLeft`/`ArrowRight`),
405
+ `F1`–`F12`, and `+`-joined modifier combos (`Control`, `Shift`, `Alt`, `Meta`,
406
+ `ControlOrMeta`; aliases: `Ctrl`, `Option`, `Cmd`, `Command`; `ControlOrMeta` maps
407
+ to Command on macOS), e.g. `Shift+Tab`, `ControlOrMeta+a`, or `Meta+a`; unknown keys
408
+ error clearly. A bare `Enter`/`Return`/`Space` uses the element's activate action when
409
+ available, otherwise keystrokes are synthesized and posted to the target app (activated
410
+ first) so they never land elsewhere — the existing Accessibility grant already covers
411
+ this, no new permission prompt. `type` fills the focused control; app teardown quits the
412
+ target app after the run.
413
+
414
+ #### Hunt-level assertion compatibility
415
+
416
+ Hunt-level `assertions:` are evaluated after the steps complete (even when a step
417
+ failed, matching the web path). Selector assertions run on every target; URL, console,
418
+ and network assertions are web-only and are reported as **`skipped`** on a native
419
+ target — visible in `result.json` / `summary.md` / JUnit, never silently dropped and
420
+ never a hard error.
421
+
422
+ | Assertion | Web | macOS | Android | iOS |
423
+ |---|---|---|---|---|
424
+ | `selectorExists`, `selectorNotExists` | ✅ runs | ✅ runs | ✅ runs | ✅ runs |
425
+ | `urlIncludes`, `urlEquals` | ✅ runs | ⏭️ skipped (web-only) | ⏭️ skipped | ⏭️ skipped |
426
+ | `noConsoleErrors`, `noNetworkErrors` | ✅ runs | ⏭️ skipped (web-only) | ⏭️ skipped | ⏭️ skipped |
427
+
428
+ A web-only assertion a hunt explicitly authored also prints a console warning naming
429
+ the target; the `noConsoleErrors` / `noNetworkErrors` config defaults are surfaced as
430
+ `skipped` but do not warn on every run. For per-step checks on a native target, use
431
+ inline `assert: visible` / `notVisible` steps.
432
+
433
+ > Docs follow-up: the customer-facing docs site (`prowl-docs`) should gain a "macOS
434
+ > target" page mirroring this section (target type + step-compatibility matrix +
435
+ > assertion-compatibility matrix + permission setup); tracked separately from this repo.
436
+
437
+ ---
438
+
142
439
  ## Step Type Reference
143
440
 
144
441
  Prowl supports both **shorthand** and **explicit** syntax for most step types. Shorthand is concise and readable. Explicit gives you full control over selectors.
@@ -200,6 +497,14 @@ Press a keyboard key on a specific element.
200
497
  key: "Enter"
201
498
  ```
202
499
 
500
+ Key names follow the web (Playwright) vocabulary — e.g. `Enter`, `Escape`, `Tab`,
501
+ `Backspace`, `Delete`, arrows, `F1`–`F12`, single characters, and modifier combos like
502
+ `Control+a`, `ControlOrMeta+a`, or `Shift+Tab`. The macOS target accepts the same names
503
+ (see the macOS target notes above); `ControlOrMeta` maps to Command, and
504
+ `Cmd`/`Command`/`Option` are also accepted there as aliases for `Meta`/`Alt`.
505
+ On macOS, a shortcut letter in a combo (e.g. `Meta+s`) is synthesized against the US/ANSI
506
+ physical keyboard layout — the standard trade-off for synthesized keystrokes.
507
+
203
508
  ### select / selectOption
204
509
 
205
510
  Select a dropdown value. Shorthand finds by label, explicit uses a selector.
@@ -438,6 +743,10 @@ assertions:
438
743
  - noNetworkErrors: true # No HTTP responses >= 400
439
744
  ```
440
745
 
746
+ On native targets (macOS / Android / iOS) the selector assertions run and the
747
+ URL/console/network ones are reported as `skipped` — see the
748
+ [hunt-level assertion compatibility matrix](#hunt-level-assertion-compatibility).
749
+
441
750
  ---
442
751
 
443
752
  ## Config Reference
@@ -699,9 +1008,17 @@ spans. When the app emits no trace headers, nothing is recorded (no noise).
699
1008
 
700
1009
  ## CLI Reference
701
1010
 
1011
+ A `<hunt-name>` is a hunt's file name under `.prowl/hunts/` — `homepage` for
1012
+ `.prowl/hunts/homepage.yml`, or `admin/users` for a nested
1013
+ `.prowl/hunts/admin/users.yml`. `run`, `watch`, and `history` also accept
1014
+ supported `.yml` path forms (`.prowl/hunts/homepage.yml` or
1015
+ `hunts/homepage.yml`) and a bare `.yml` file name (`homepage.yml`); they resolve
1016
+ to the same hunt.
1017
+
702
1018
  ```bash
703
1019
  # Run a hunt
704
1020
  prowl run <hunt-name>
1021
+ prowl run .prowl/hunts/homepage.yml # A literal path resolves to `homepage`
705
1022
  prowl run <hunt-name> --headed # Show browser window
706
1023
  prowl run <hunt-name> --trace # Capture Playwright trace
707
1024
  prowl run <hunt-name> --slow-mo 500 # Slow down actions (ms)
@@ -927,14 +1244,6 @@ CLI Commands
927
1244
 
928
1245
  ---
929
1246
 
930
- ## Community Hub
931
-
932
- Browse and contribute hunt templates through the internal community registry (contact ops for access).
933
-
934
- Templates cover auth flows (OAuth, 2FA), e-commerce (Stripe), admin panels, SaaS patterns, and more. Each template is heavily commented and ready to customize.
935
-
936
- ---
937
-
938
1247
  ## Native Selector Dialect (compatibility matrix)
939
1248
 
940
1249
  Android and iOS now consume one shared selector dialect implementation, so `id=`
@@ -967,163 +1276,8 @@ label-shaped ids, but runtime and host-side matching still resolve `id=` against
967
1276
  WDA's `name`.
968
1277
 
969
1278
  Prefer `id=` on every native target — the native analog of `data-testid`. Per-target
970
- specifics (escaping, `statusItem`/`menu=` on macOS, the Compose `testTagsAsResourceId`
971
- caveat on Android) follow in each target's own section below.
972
-
973
- ---
974
-
975
- ## macOS Target (Experimental)
976
-
977
- > **Experimental (PROWL-048).** Prowl can drive **native macOS apps** — including
978
- > menu bar extras (`NSStatusItem` + `NSMenu`) — through Apple's Accessibility API,
979
- > in addition to the web. The API, selector dialect, and step coverage may change.
980
- > **Distribution is deferred:** the required helper binary is **not** shipped in the
981
- > npm package; you build it locally (below).
982
-
983
- ### Enabling it
984
-
985
- 1. **Build the helper** (one time; requires the Swift toolchain / Xcode CLT):
986
-
987
- ```bash
988
- cd macdriver
989
- swift build -c release
990
- ```
991
-
992
- Prowl finds the binary at `macdriver/.build/release/prowl-macdriver`, or at
993
- `$PROWL_MACDRIVER_BIN` if set. If it is missing, Prowl fails with a clear
994
- "build the helper" message rather than crashing.
995
-
996
- 2. **Point your config at a macOS target:**
997
-
998
- ```yaml
999
- target:
1000
- type: macos
1001
- app: "com.example.App" # bundle id, or an absolute /path/to/App.app
1002
- guardrails:
1003
- allowedApps: # optional scope; empty = allow the target app
1004
- - "com.example.App"
1005
- ```
1006
-
1007
- When `target.app` is an app path, `allowedApps` may list the exact `.app`
1008
- path, the app bundle name (`Example` for `Example.app`), or the bundle id
1009
- from `Contents/Info.plist` when that file is readable.
1010
-
1011
- 3. **Grant Accessibility permission** (see below), then run a hunt as usual:
1012
- `prowl run my-macos-hunt`.
1013
-
1014
- ### Accessibility & Screen Recording permission
1015
-
1016
- The **process that hosts** Prowl (your terminal — Terminal, iTerm, VS Code, or a CI
1017
- agent) must be granted **Accessibility** permission: **System Settings → Privacy &
1018
- Security → Accessibility**, then enable that app. macOS attributes the grant to the
1019
- hosting app, not to `prowl-macdriver`. Preflight from the helper:
1020
-
1021
- ```bash
1022
- macdriver/.build/release/prowl-macdriver check # prints {"trusted": <bool>}; prompts on first run
1023
- ```
1024
-
1025
- The `screenshot`/`assertScreenshot` steps additionally need **Screen Recording**
1026
- permission for the hosting app.
1027
-
1028
- **CI notes (macOS runners):** headless CI cannot click "Allow" in a dialog, so grant
1029
- the permissions non-interactively before the run. On a self-hosted runner you can
1030
- pre-authorize the agent's host app with a TCC profile via MDM, or (on ephemeral
1031
- runners where it's acceptable) seed the TCC database, e.g.:
1032
-
1033
- ```bash
1034
- sudo sqlite3 "/Library/Application Support/com.apple.TCC/TCC.db" \
1035
- "INSERT OR REPLACE INTO access VALUES('kTCCServiceAccessibility','<runner-app-bundle-id>',0,2,2,1,NULL,NULL,NULL,'UNUSED',NULL,0,1,NULL,NULL,NULL);"
1036
- ```
1037
-
1038
- GitHub-hosted macOS runners do not grant Accessibility, so the macOS target is aimed
1039
- at self-hosted / MDM-managed runners for now.
1040
-
1041
- ### Selector dialect (macOS)
1042
-
1043
- See the [Native Selector Dialect matrix](#native-selector-dialect-compatibility-matrix)
1044
- for how these compare across native targets (and the `label=` exact-match trap).
1045
- Native selectors address accessibility identifiers, roles, and labels:
1046
-
1047
- | Selector | Matches |
1048
- |---|---|
1049
- | `id=openSettings` | element whose `AXIdentifier` equals `openSettings` |
1050
- | `role=button[name="Save"]` | an `AXButton` whose title/description/value contains `Save` |
1051
- | `label="Email"` | element whose accessibility label equals `Email` |
1052
- | `text="Save"` or bare `Save` | element whose title/description/value contains the text |
1053
- | `statusItem` | opens the app's menu bar status-item menu |
1054
- | `menu=Preferences…` | opens the status-item menu and clicks that item |
1055
-
1056
- `forbiddenSelectors` still applies (text patterns match via the same substring
1057
- semantics as the web target). Prefer `id=` (accessibility identifiers) — the native
1058
- analog of `data-testid`.
1059
-
1060
- ### Finding selectors
1061
-
1062
- Don't guess selectors — dump them. `prowl analyze` works on the macOS target the
1063
- same way it does on the web: it launches/attaches to the app, walks the
1064
- Accessibility tree, and prints every interactive element with **ranked selector
1065
- candidates** (best first) plus the app's windows and status-item menu contents.
1066
- It is read-only (the only interaction is opening and closing the status menu),
1067
- honors `guardrails.allowedApps`, and leaves the app running when done.
1068
-
1069
- ```bash
1070
- # Uses the macOS target from .prowl/config.yml:
1071
- prowl analyze
1072
-
1073
- # …or point it at any app without a config:
1074
- prowl analyze --app com.example.App
1075
- prowl analyze --app "/Applications/Example.app"
1076
-
1077
- # Machine-readable output for agents:
1078
- prowl analyze --app com.example.App --json
1079
- ```
1080
-
1081
- Example (human-readable) output:
1082
-
1083
- ```text
1084
- App Analysis: com.example.App
1085
-
1086
- Windows:
1087
- "Main Window" id=mainWindow
1088
-
1089
- Interactive Elements:
1090
- AXButton id=saveButton "Save"
1091
- AXTextField label="Email" "Email"
1092
- AXCheckBox label="Remember me" "Remember me" (disabled)
1093
-
1094
- Menu Bar:
1095
- AXMenuItem id=preferences "Preferences…"
1096
- AXMenuItem label="Quit" "Quit"
1097
-
1098
- 3 elements, 1 windows, 2 menu items
1099
- ```
1100
-
1101
- Selectors are ranked `id=` > `label=` > `role=…[name="…"]` > `text=` — copy the
1102
- first (most durable) candidate into your hunt. Status-item menu identifiers
1103
- (`id=preferences` above) are especially valuable, since menu titles often carry
1104
- ellipses or localized text that are awkward to match by substring.
1105
-
1106
- ### Step compatibility
1107
-
1108
- Portable steps run on **both** targets; web-only steps are rejected up front on the
1109
- macOS target (with a clear error), and `prowl login` / URL guardrails do not apply.
1110
-
1111
- | Portable (web + macOS) | Web-only (rejected on macOS) |
1112
- |---|---|
1113
- | `click`, `fill`, `type`, `press` | `navigate`, `waitForUrl`, `waitForNetworkIdle` |
1114
- | `wait`, `waitForSelector` | `mockRoute` / `unmockRoute` |
1115
- | `assert: visible` / `notVisible` | `evalScript`, `runScript` |
1116
- | `screenshot`, `assertScreenshot` | `onDialog`, `select` / `selectOption` |
1117
- | `hover`, `scrollTo` | `setInputFiles`, `waitForDownload` |
1118
- | `repeat`, `if`, `runHunt`, `copyText` | `scroll` (directional), `assert: urlIncludes` / `urlEquals` |
1119
-
1120
- Notes: `press` maps Enter/Return/Space onto the element's activate action (other keys
1121
- are unsupported); `type` fills the focused control; app teardown quits the target app
1122
- after the run.
1123
-
1124
- > Docs follow-up: the customer-facing docs site (`prowl-docs`) should gain a "macOS
1125
- > target" page mirroring this section (target type + step-compatibility matrix +
1126
- > permission setup); tracked separately from this repo.
1279
+ specifics (escaping, `statusItem`/`menu=` on macOS above, the Compose
1280
+ `testTagsAsResourceId` caveat on Android below) live in each target's own section.
1127
1281
 
1128
1282
  ---
1129
1283
 
@@ -1219,6 +1373,11 @@ equivalent yet and are rejected with a clear message; scroll-gesture support is
1219
1373
  follow-up. A degraded pure-`adb` fallback (`uiautomator dump` + `input tap`) is a
1220
1374
  possible future diagnostic mode, not the primary path.
1221
1375
 
1376
+ Hunt-level `assertions:` behave as on macOS — `selectorExists` / `selectorNotExists`
1377
+ run against the device; `urlIncludes` / `urlEquals` / `noConsoleErrors` /
1378
+ `noNetworkErrors` are web-only and reported as `skipped`. See the
1379
+ [hunt-level assertion compatibility matrix](#hunt-level-assertion-compatibility).
1380
+
1222
1381
  ### Finding selectors (Android)
1223
1382
 
1224
1383
  Don't guess selectors — dump them. `prowl analyze` works on the Android target the
@@ -1364,6 +1523,11 @@ message. Screenshots are captured with `simctl` (not WDA), so artifacts still wo
1364
1523
  even if the agent wedges. `hover` and `scrollTo` have no touch equivalent yet and are
1365
1524
  rejected with a clear message; scroll-gesture support is a follow-up.
1366
1525
 
1526
+ Hunt-level `assertions:` behave as on macOS — `selectorExists` / `selectorNotExists`
1527
+ run against the simulator; `urlIncludes` / `urlEquals` / `noConsoleErrors` /
1528
+ `noNetworkErrors` are web-only and reported as `skipped`. See the
1529
+ [hunt-level assertion compatibility matrix](#hunt-level-assertion-compatibility).
1530
+
1367
1531
  ### Finding selectors (iOS)
1368
1532
 
1369
1533
  Don't guess selectors — dump them. `prowl analyze` works on the iOS target the