I want to test keyboard visibility when an activity calls onCreate() and onResume().
How can i test whether or not the keyboard is shown using espresso?
This is a kind of trick to check if keyboard is visible, it's not a perfect solution but for me was enough:
Simple code example:
onView(allOf(withId(R.id.myFragment),isDisplayed()));
onView(withId(R.id.myFragment)).perform(pressBack());
onView(allOf(withId(R.id.myFragment),isDisplayed()));
If keyboard is visible means that the second time you press back button the view container is still there ;)
Hope this help!