Created
September 28, 2016 08:34
-
-
Save maydin/406ea239a8064f67dcad23a7a3007d0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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), withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE), | |
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),withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE), | |
withText("Bye World"))); | |
textView2.check(matches(withText("Bye World"))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment