Espresso Testing: Software Choice "Never" on Smart Lock.

Doing an espresso UI test on Android and trying to bypass the smart lock screen. The problem is that we are testing Firebase and cannot disable smart locking of the device in general since they are in the cloud (I don't believe). The popup is also not part of the application itself, so I cannot get the id using the Stetho or Layout inspector. I believe this is another application (or OS function) drawn on top of our application.

How can I press the "no thanks" or "never" button on an espresso?

Smart lock

+3


source to share


1 answer


You can use uiautomator

graddle

androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'

      



And add it to your code :

waitSeconds(10) // Waiting for smartlock window
val uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
val currentPackageName = uiDevice.currentPackageName
if (currentPackageName != "your.app.package") {
     uiDevice.pressBack()
}

      

0


source







All Articles