Skip to content

[Detox Patch] Add support for autoGrantPermissions capability (AAP-20840) - #7

Open
vvHacker007 wants to merge 2 commits into
patched-20.51.3from
AAP-20840_autogrant-permissions-cap
Open

[Detox Patch] Add support for autoGrantPermissions capability (AAP-20840)#7
vvHacker007 wants to merge 2 commits into
patched-20.51.3from
AAP-20840_autogrant-permissions-cap

Conversation

@vvHacker007

@vvHacker007 vvHacker007 commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

What

Adds autoGrantPermissions to the cloud session capabilities, mirroring the local-testing caps addition (ff319fa / original PR #7):

  • detox/src/configuration/index.js — forward the cap in the websocket ?caps= query
  • detox/src/configuration/composeSessionConfig.js — add to cloudSupportedCaps (no "not honoured" warning) + boolean validation
  • detox/detox.d.ts — type for session.autoGrantPermissions

Usage:

session: {
  server: 'wss://detox.browserstack.com/init',
  autoGrantPermissions: true,
}

Why

JIRA: AAP-20840 — Detox has no Appium driver to honour autoGrantPermissions, and Android Detox exposes no permissions API of its own, so runtime-permission dialogs currently block Detox tests on BrowserStack. The platform side now pre-grants the app's requested permissions at session start when this capability is set:

Without this client change the capability is silently dropped on the customer's machine (the caps query is built from a fixed whitelist), so this PR is the customer-facing enabler.

Testing

Verified end-to-end on devdas staging with exactly this patch applied to the installed 20.51.3 client (same device/host/app across runs, OnePlus 11R / Android 13):

  • cap set + platform fix: CAMERA / RECORD_AUDIO / LOCATION granted at session start (~0.33s), no permission dialogs — session d255d75a90064296f27ce9de8ac421f317b3af1f
  • cap set, old platform: ignored (baseline) — session 41b7394a0fc8ceaf7229b9f3ff775f05e3b58f51
  • cap not set: nothing granted (gate verified)

Note

Needs an npm republish of the patched package after merge for customers to pick it up.

🤖 Generated with Claude Code

Adds autoGrantPermissions to the cloud session caps so the client
forwards it to BrowserStack, where the platform pre-grants the app's
requested Android runtime permissions at session start (AAP-20840).
Mirrors the local-testing caps addition (ff319fa).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
"workspace:*" is not resolvable in this fork (the root package.json has
no workspaces), so 'npm install' in examples/demo-react-native fails with
EUNSUPPORTEDPROTOCOL - which breaks DetoxBstackPatchTester's setup step.
Pin upstream detox 20.51.3 instead: the install provides the .bin/detox
shim and the prebuilt Detox-android maven repo for the APK build; the
pipeline then swaps node_modules/detox for the patched source symlink
before running the tests, exactly as designed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vvHacker007

Copy link
Copy Markdown
Collaborator Author

Added a second commit: the example's "detox": "workspace:*" devDependency is unresolvable in this fork (no root workspaces), which would fail npm install in DetoxBstackPatchTester's setup. Pinned upstream detox@20.51.3 — install provides the CLI shim + prebuilt Detox-android for the APK build; the pipeline's symlink swap still substitutes the patched JS client before the test run. Needed to run the official tester job against this branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant