lundi 26 octobre 2015

Android: Espresso test for lock screen/main screen

When I run my app I have a banner notification pop up on certain dates alerting the user of app activity. When the user double clicks this they're taken to the app. Also, on the top left of the app is a notification icon that when clicked shows the banner again (if the user did not clear it at the lock screen).

I need to write a test for these two, but I'm only familiar with onView, specifically things like:

   onView(withId(R.id.list_product)).perform(longClick());

Does the lock screen on an emulator have an R.id, or does the home screen (not for the app, but for android)? How can I test these two?

Something like "On emulator start, double click x/y. If x/y takes you to R.id.myappshomescreen assert that X is notNull".

The code would be nice for clicking a notification, but I just want to know if it's even possible for espresso to click on the locked screen.

Aucun commentaire:

Enregistrer un commentaire