Skip to content

Instantly share code, notes, and snippets.

@yairkukielka
Forked from jabKnowsNothing/CustomViewAction
Created May 9, 2016 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yairkukielka/fdf12aa201d30f91f27f91231b5f15ae to your computer and use it in GitHub Desktop.
Save yairkukielka/fdf12aa201d30f91f27f91231b5f15ae to your computer and use it in GitHub Desktop.
/*
* This class is used for buttons that have a pressed state animation.
* Can't use default click() because espresso bug where click becomes long click, which causes
* animation, which causes tests to stall because ui thread is busy. :(
* https://code.google.com/p/android-test-kit/issues/detail?id=45
*/
public class CallOnClickAction implements ViewAction {
@Override
public Matcher<View> getConstraints() {
return allOf(isClickable(), isDisplayed());
}
@Override
public String getDescription() {
return "CallOnClick";
}
@Override
public void perform(UiController uiController, View view) {
view.callOnClick();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment