Can i use robolectric to test runtime permissions in android ? I am talking about when the system pops up a window asking the user for the permission – how will i know ? I suspect i can use UIAutomator to gain access to the system screens but can it be used with robolectric ? What is the recommended way ? I need a way to interact with the system window for run time permissions. I see a class called UiDevice
Do you really need it to do it with
I haven’t used this framework yet for this kind of purpose, so I don’t tell you if it is possible. Moreover, I think that the best way already for making automated UI tests is using along two Google’s frameworks:
Here you would find why: Espresso & UIAutomator – the perfect tandem
For Android system UI elements, like notifications, screen lock or highlighted in topic runtime permissions,
uiatomator would be enough.
Especially as there is an article about how to handle it with
uiatomator: Handling Android runtime permissions in UI tests
Hope it help. Happy testing!
Answered By – piotrek1543