简体   繁体   中英

Android Studio Instrumented Tests - how to handle permission dialogs

I am writing instrumented test automation for an Android app. The app pops up several native permission dialogs during start-up (like, allow access to Camera) which do not register in the Espresso Test Recorder. How do I handle these dialogs (click Allow) so I can get the app to launch? Or is there a way to grant the app permissions when installing, so the dialogs won't show up?

Found a way to do it - Espresso can't handle multiple apps, but uiautomator can! And it's also packaged in with Android Studio. Here's a link: https://developer.android.com/training/testing/ui-testing/uiautomator-testing.html#run

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM