/**
2 * Created by GuYin on 2017/3/15.
3 */
4 @RunWith(AndroidJUnit4.class)
5 @LargeTest
6 public class MainTest {
7 private static final String STRING_TO_BE_TYPED = "peter";
8
9 @Rule
10 public ActivityTestRule<MainActivity> mainActivityRule = new ActivityTestRule<>(MainActivity.class);
11
12 @Test
13 public void sayHello(){
14 onView(withId(R.id.name)).perform(typeText(STRING_TO_BE_TYPED), ViewActions.closeSoftKeyboard());
15 onView(withText("SAY HELLO")).perform(click());
16 String expectedText = "Hello,"+STRING_TO_BE_TYPED+"!";
17 onView(withId(R.id.text)).check(matches(withText(expectedText)));
18 }
19 }