Clicking a button in Espresso test got problem. Let\'s say I have two activities \"Activity1\" and \"Activity2\". Click a dialog OK button in Activity1 starts Activity2 wher
The solution is to create your custom GeneralClickAction with view visibility that you want to click less then Espresso's GeneralClickAction requires. Currently the minimum visibility value is 90% - see code here line 60. Set it to be 80% or less. Just copy the whole class rename it and change the value provided to this method to 80 isDisplayingAtLeast(80)
. Then create your click action that uses your custom GeneralClickAction:
public static ViewAction customClick() {
return actionWithAssertions(
new CustomGeneralClickAction(Tap.SINGLE, GeneralLocation.VISIBLE_CENTER, Press.FINGER));
}
But I'd rather fix the layout of the activity if possible to avoid creation of workaround for button visibility.