Skip to content

Commit c108d92

Browse files
committed
docs: document device permissions support
1 parent 1b83947 commit c108d92

3 files changed

Lines changed: 54 additions & 0 deletions

File tree

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,30 @@ const config = {
5555
export default config;
5656
```
5757

58+
## Device Permissions Fixture
59+
60+
Harness now exposes a deterministic `device.permissions` API for test setup:
61+
62+
```ts
63+
import { device } from 'react-native-harness';
64+
65+
await device.permissions.grant('microphone');
66+
await device.permissions.revoke('microphone');
67+
await device.permissions.reset('microphone');
68+
69+
await device.permissions.grantAll();
70+
await device.permissions.denyAll();
71+
await device.permissions.resetAll();
72+
```
73+
74+
Platform behavior:
75+
76+
- Android emulator and physical device: named permissions and bulk operations use host-side ADB commands.
77+
- iOS simulator: named permissions and bulk operations use `xcrun simctl privacy` for supported simulator services.
78+
- iOS physical device: named permission calls warn and no-op; bulk calls configure XCTest Agent prompt handling for future permission prompts.
79+
80+
Existing `permissions: true` config continues to work and now maps to `grantAll()` semantics through the same host-side permission controller.
81+
5882
## Documentation
5983

6084
The documentation is available at [react-native-harness.dev](https://react-native-harness.dev). You can also use the following links to jump to specific topics:

packages/platform-android/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ const config = {
5252
export default config;
5353
```
5454

55+
## Permissions
56+
57+
Android runners support the shared `device.permissions` fixture API.
58+
59+
```ts
60+
import { device } from 'react-native-harness';
61+
62+
await device.permissions.grant('camera');
63+
await device.permissions.denyAll();
64+
```
65+
66+
Harness resolves bulk operations from the app's declared dangerous permissions and applies them through ADB. Existing config-driven `permissions: true` support is routed through the same controller as `grantAll()`.
67+
5568
## API
5669

5770
### `androidPlatform(config)`

packages/platform-ios/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,23 @@ const config = {
4747
export default config;
4848
```
4949

50+
## Permissions
51+
52+
Apple runners support the shared `device.permissions` fixture API with platform-specific behavior.
53+
54+
```ts
55+
import { device } from 'react-native-harness';
56+
57+
await device.permissions.grant('photos');
58+
await device.permissions.resetAll();
59+
```
60+
61+
- iOS simulator: supported permissions are applied through `xcrun simctl privacy`.
62+
- iOS physical device: named permission calls warn and no-op; `grantAll()`, `denyAll()`, and `resetAll()` configure XCTest Agent prompt handling for future prompts.
63+
- iOS simulator `camera` is intentionally unsupported in v1.
64+
65+
Existing config-driven `permissions: true` support is routed through the same controller as `grantAll()`.
66+
5067
## API
5168

5269
### `applePlatform(config)`

0 commit comments

Comments
 (0)