|
| 1 | +import { PackageManagerTabs } from '@theme'; |
| 2 | + |
| 3 | +# Permissions |
| 4 | + |
| 5 | +Harness exposes a single top-level `permissions` flag: |
| 6 | + |
| 7 | +```javascript |
| 8 | +{ |
| 9 | + permissions: true, |
| 10 | +} |
| 11 | +``` |
| 12 | + |
| 13 | +This setting is currently **all-or-nothing**. |
| 14 | +You can enable permission automation for the whole run or disable it completely. |
| 15 | +Harness does not yet support selecting individual permission types or per-platform overrides. |
| 16 | + |
| 17 | +## Current Behavior |
| 18 | + |
| 19 | +When `permissions` is `false`: |
| 20 | + |
| 21 | +- Harness does not start permission automation helpers. |
| 22 | +- On iOS, this means the XCTest-based permission helper is not started. |
| 23 | + |
| 24 | +When `permissions` is `true`: |
| 25 | + |
| 26 | +- On iOS simulators, Harness starts the XCTest agent and enables best-effort permission prompt auto-accept. |
| 27 | +- On iOS physical devices, Harness also starts the XCTest agent when the runner is configured with `device.codeSign`. |
| 28 | +- On Android, the shared config flag exists, but there is currently no dedicated Android permission automation implementation in the codebase. |
| 29 | + |
| 30 | +## What iOS Actually Automates |
| 31 | + |
| 32 | +The current iOS implementation does **not** pre-approve every permission up front. |
| 33 | +Instead, it runs a best-effort watchdog that taps known positive system-prompt buttons such as: |
| 34 | + |
| 35 | +- `Allow` |
| 36 | +- `OK` |
| 37 | +- `Continue` |
| 38 | +- `While Using the App` |
| 39 | +- `Always Allow` |
| 40 | +- `Allow Once` |
| 41 | + |
| 42 | +Because this is button-based automation, it should be treated as a practical helper for common prompts rather than a guarantee that every permission dialog will be handled. |
| 43 | + |
| 44 | +## Performance Impact |
| 45 | + |
| 46 | +Enabling `permissions` can make Harness heavier on iOS because it starts an additional XCTest agent session alongside the normal run. |
| 47 | + |
| 48 | +This can have a negative impact on: |
| 49 | + |
| 50 | +- startup time |
| 51 | +- device preparation time |
| 52 | +- overall run performance |
| 53 | + |
| 54 | +The impact is most important to keep in mind for iOS physical devices, where the XCTest agent requires code signing and extra setup, but the same helper is also started on iOS simulators when permissions are enabled. |
| 55 | + |
| 56 | +## Physical iOS Devices |
| 57 | + |
| 58 | +To use permission automation on a physical iOS device, the runner must provide `device.codeSign`. |
| 59 | + |
| 60 | +```javascript |
| 61 | +applePlatform({ |
| 62 | + name: 'iphone', |
| 63 | + device: applePhysicalDevice('My iPhone', { |
| 64 | + codeSign: { teamId: 'TEAMID1234' }, |
| 65 | + }), |
| 66 | + bundleId: 'com.example.myapp', |
| 67 | +}) |
| 68 | +``` |
| 69 | + |
| 70 | +If `permissions: true` is set without `device.codeSign`, Harness skips the XCTest agent for that physical device. |
| 71 | + |
| 72 | +## Recommendation |
| 73 | + |
| 74 | +Leave `permissions` disabled unless your tests actually need system permission prompts to be handled automatically. |
| 75 | + |
| 76 | +That keeps the default Harness startup path lighter and avoids paying the extra iOS XCTest overhead on runs that do not need it. |
0 commit comments