Skip to content

Instantly share code, notes, and snippets.

@maydin
Created September 28, 2016 08:22
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 maydin/94463046e5a52fd028198b6805d6e1aa to your computer and use it in GitHub Desktop.
Save maydin/94463046e5a52fd028198b6805d6e1aa to your computer and use it in GitHub Desktop.
@LargeTest
@RunWith(AndroidJUnit4.class)
public class MainActivityTest {
@Rule
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class);
@Test
public void mainActivityTest() {
ViewInteraction textView = onView(allOf(withId(R.id.textview),
withText("Hello World")));
textView.check(matches(withText("Hello World")));
ViewInteraction appCompatButton = onView(
allOf(withId(R.id.button), withText("Click"), isDisplayed()));
appCompatButton.perform(click());
try {
Thread.sleep(300);
} catch (InterruptedException e) {
e.printStackTrace();
}
ViewInteraction textView2 = onView(allOf(withId(R.id.textview),
withText("Bye World")));
textView.check(matches(withText("Bye World")));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment