Skip to content

Instantly share code, notes, and snippets.

@vuhung3990
Last active March 7, 2017 12:18
Show Gist options
  • Save vuhung3990/97016751de3846039347983c521795ad to your computer and use it in GitHub Desktop.
Save vuhung3990/97016751de3846039347983c521795ad to your computer and use it in GitHub Desktop.
- espresso pull to refresh and load more basic - RecyclerViewActions: androidTestCompile("com.android.support.test.espresso:espresso-contrib:$espressoVersion") { // Necessary to avoid version conflicts exclude group: 'com.android.support', module: 'appcompat' exclude group: 'com.android.support', module: 'support-v4' exclude group: 'com.android.…
package com.dev22.dealhunter;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.swipeDown;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
/**
* Created by dev22 on 3/7/17.
*/
@RunWith(AndroidJUnit4.class)
public class MainActivityTest {
@Rule
public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class);
@Test
public void pullToRefresh_shouldPass() throws Exception {
onView(withId(R.id.swipeRefreshLayout)).perform(swipeDown());
}
@Test
public void loadMore_shouldPass() throws Exception {
onView(withId(R.id.recycleview)).perform(RecyclerViewActions.scrollToPosition(99)).perform(swipeUp());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment