-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle iOS permission dialogs #9
Comments
@LeoNatan this is not urgent since it's not for Version 1 milestone |
Urgent. All tests fail once you get the dialog (for example notifications permissions usually happen on app launch or close to it) |
@DanielZlotin This is a big problem in Earl Grey also, due to in-process architecture. There seem to be several workarounds, including setting a DB file in the simulator subsystem to automatically allow permissions. |
If you can swizzle the permissions on demand at runtime, and have some JS API to mange it per test that would be best. If you could |
@yedidyak This will be a big issue to fix which will take much time. In the meantime, do not stop working on tests. Instead, mock the permission API to return success or failure. |
@LeoNatan That's possible in some cases, but in others the permission itself is necessary for the functionality. |
I have decided to go against swizzling APIs. It just does not scale, as more and more APIs are added each year. Detox is a testing framework for native apps, not just the small subset of APIs wrapped in RN. Instead, I have created
DetoxHelper is not ready for prime time just yet, but it is intended to support switching of permissions on the fly. This requires investigation and I am not 100% if possible at all. For now, let's integrate |
Kudos for this ! @LeoNatan Has |
@irrigator Unfortunately, integrating |
@LeoNatan I used applesimutils in the following manner:
It causes the simulator to refresh going black with a spinner then when the simulator is back on the app is closed and the tests fail. How would you suggest running it before the tests? Update: I figured out a way to do it by doing the following:
|
Yes, you need to launch the app. |
Great news @LeoNatan ! |
In development. Cannot comment on how long it will take, as I am not the one developing it, but it is in active development and is coming soon. |
Guys, support has landed in Detox for this feature. As we have not yet updated the documentation yet, for now, you can see the syntax here Currently supported permissions:
As described in the Getting Started document, you need to install |
@LeoNatan Thanks a lot for adding this feature! 💯 It works perfectly and it's super simple to use as well! |
@Monte9 Cheers, thanks for the kind words! |
Can anyone give me an example to approve location permission |
@yogeshthanvi it's now documented here
so you use it as the following await device.launchApp({ permissions: { location: 'always' } }) |
@yogeshthanvi Could you tell me where you have looked for this information? Might make sense to add this info right there to help the next person even faster 🤔 |
@menasameh Thanks man , love you |
Please make sure to read the documentation. |
For ease of other users:
Quoting from https://github.com/wix/detox/blob/master/detox/test/e2e/13.permissions.test.js |
EarlGrey has a hard time dealing with them since they're external to the app
google/EarlGrey#55
this thread offers some interesting workarounds.. we can add them directly into detox
The text was updated successfully, but these errors were encountered: