Android Marshmallow: Test permissions with Espresso?

前端 未结 13 1369
庸人自扰
庸人自扰 2020-11-29 19:31

The new permissions scheme introduced by Android Marshmallow requires checking for specific permissions at runtime, which implies the need to provide different flows dependi

13条回答
  •  死守一世寂寞
    2020-11-29 20:34

    Actually there are 2 ways of doing this I know so far:

    1. Grant the permission using adb command before test starts (documentation):

    adb shell pm grant "com.your.package" android.permission.your_permission

    1. You can click on permission dialog and set the permission using UIAutomator (documentation). If your tests are written with Espresso for android you can combine Espresso and UIAutomator steps in one test easily.

提交回复
热议问题