Skip to content

Instantly share code, notes, and snippets.

View jabKnowsNothing's full-sized avatar

Danny Briggs jabKnowsNothing

View GitHub Profile
@jabKnowsNothing
jabKnowsNothing / MultipleIntentsTest.java
Last active February 15, 2017 15:20
ActivityTestRule launchActivity=false
@RunWith(AndroidJUnit4.class)
public class MultipleIntentsTest {
@Rule
public ActivityTestRule<MyActivity> testRule = new ActivityTestRule<>(MyActivity.class,
false, // initialTouchMode
false); // launchActivity. False to set intent per test);
@Test
public void testOscarGrouchy() {
Intent grouchyIntent = new Intent();
/*
* 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());
@jabKnowsNothing
jabKnowsNothing / espresso_failure_for_blog
Created February 20, 2015 22:13
Blog: google default failure handler
private static class CustomFailureHandler implements FailureHandler {
private final FailureHandler delegate;
public CustomFailureHandler(Context targetContext) {
delegate = new DefaultFailureHandler(targetContext);
}
@Override
public void handle(Throwable error, Matcher<View> viewMatcher) {
try {