jeudi 24 décembre 2015

Testing Android NavigationView menu item with espresso

As part of my automation test using Espresso, I would like to assert a given menu item is visible, and then perform a click on that item. For my visibility check I've tried the following...

onView(viewMatcher...).check(ViewAssertions.matches(isDisplayed()));

Using this, I end up with a NoMatchingViewException.

android.support.test.espresso.NoMatchingViewException: No views in
hierarchy found matching: with id:
com.example.android:id/menuitem_my_item

From what I gathered, it's possible that menu items are not visible on the view hierarchy. Has anyone with more experience testing on Android figured out a way around this?

Aucun commentaire:

Enregistrer un commentaire