Created
March 5, 2017 22:55
-
-
Save jraczak/ea88125330d30cb0df972814f4bd30f4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package com.udacity.gradle.builditbigger; | |
import android.support.test.espresso.ViewInteraction; | |
import android.support.test.rule.ActivityTestRule; | |
import android.support.test.runner.AndroidJUnit4; | |
import android.test.suitebuilder.annotation.LargeTest; | |
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.click; | |
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; | |
import static android.support.test.espresso.matcher.ViewMatchers.withId; | |
import static android.support.test.espresso.matcher.ViewMatchers.withParent; | |
import static android.support.test.espresso.matcher.ViewMatchers.withText; | |
import static org.hamcrest.Matchers.allOf; | |
@LargeTest | |
@RunWith(AndroidJUnit4.class) | |
public class MainActivityTest { | |
@Rule | |
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class); | |
@Test | |
public void mainActivityTest() { | |
ViewInteraction appCompatButton = onView( | |
allOf(withText("Tell Joke"), | |
withParent(allOf(withId(R.id.fragment), | |
withParent(withId(android.R.id.content)))), | |
isDisplayed())); | |
appCompatButton.perform(click()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment