In my application I'm turning on BlueTooth
when first Activity
starts up.
It results in the system dialog asking for the authorization to activate the BlueTooth
.
How can I asset that this dialog is present and click on the "Yes" Button with Espresso
? Is it possible ?
I tried the following but the view is not found in the layout hierarchy.
onView(withText("Bluetooth")).check(matches(isDisplayed()));
I guess this is because it's a system Activity
.
Thank you.
You can use UIAutomator for this purpose. It is possible to combine Espresso tests with UIAutomator in one test case. The only limitation is that it requires API level 18+ which can be achieved by adding flavor in your
build.gradle
file.