简体   繁体   English

Android Studio Instrumented测试-如何处理权限对话框

[英]Android Studio Instrumented Tests - how to handle permission dialogs

I am writing instrumented test automation for an Android app. 我正在为Android应用程序编写仪器化的测试自动化程序。 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. 该应用在启动过程中会弹出几个本机权限对话框(例如,允许访问Camera),这些对话框不会在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! 找到了一种方法-Espresso无法处理多个应用程序,但是uiautomator可以! And it's also packaged in with Android Studio. 而且它也与Android Studio打包在一起。 Here's a link: https://developer.android.com/training/testing/ui-testing/uiautomator-testing.html#run 这是链接: https : //developer.android.com/training/testing/ui-testing/uiautomator-testing.html#run

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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