Skip to content

Instantly share code, notes, and snippets.

@jabKnowsNothing
Created May 19, 2015 20:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jabKnowsNothing/fe34673419500dcc6fc9 to your computer and use it in GitHub Desktop.
Save jabKnowsNothing/fe34673419500dcc6fc9 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