-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathMainScreenTest.java
More file actions
36 lines (29 loc) · 1.32 KB
/
MainScreenTest.java
File metadata and controls
36 lines (29 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.flatstack.android;
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.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.intent.Intents.intended;
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasComponent;
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.withText;
@RunWith(AndroidJUnit4.class)
public class MainScreenTest {
@Rule
public ScreenshotActivityRule<MainActivity> testRule =
new ScreenshotActivityRule<>(MainActivity.class);
@Test
public void whenAppLaunch_androidBaseVisible() throws Exception {
onView(allOf(withId(R.id.title), withText(R.string.app_name)))
.check(matches(isDisplayed()));
}
@Test
public void whenButtonClick_startedActivity() {
onView(withId(R.id.selectAvatar)).perform(click());
intended(hasComponent(SecondActivity.class.getName()));
}
}