|
@@ -4,7 +4,9 @@ import android.annotation.TargetApi;
|
4
|
4
|
import android.content.Intent;
|
5
|
5
|
import android.support.test.filters.SdkSuppress;
|
6
|
6
|
import android.support.test.runner.AndroidJUnit4;
|
|
7
|
+import android.support.test.uiautomator.By;
|
7
|
8
|
import android.support.test.uiautomator.UiDevice;
|
|
9
|
+import android.support.test.uiautomator.Until;
|
8
|
10
|
|
9
|
11
|
import org.junit.Test;
|
10
|
12
|
import org.junit.runner.RunWith;
|
|
@@ -16,9 +18,13 @@ import static org.assertj.core.api.Java6Assertions.assertThat;
|
16
|
18
|
@SdkSuppress(minSdkVersion = 23)
|
17
|
19
|
@TargetApi(23)
|
18
|
20
|
public class ApplicationLifecycleTest {
|
|
21
|
+
|
|
22
|
+ public static final String PACKAGE_NAME = "com.reactnativenavigation.playground";
|
|
23
|
+
|
19
|
24
|
@Test
|
20
|
25
|
public void showSplash_AcceptsOverlayPermissions_ShowsWelcomeScreen() throws Exception {
|
21
|
26
|
launchTheApp();
|
|
27
|
+
|
22
|
28
|
// assertThat(rule.getActivity().getContentView()).isNotNull().isInstanceOf(NavigationSplashView.class);
|
23
|
29
|
// acceptOverlayPermissionIfNeeded();
|
24
|
30
|
// assertMainShown();
|
|
@@ -40,10 +46,10 @@ public class ApplicationLifecycleTest {
|
40
|
46
|
uiDevice().wakeUp();
|
41
|
47
|
uiDevice().pressHome();
|
42
|
48
|
uiDevice().waitForIdle();
|
43
|
|
- Intent intent = getInstrumentation().getTargetContext().getPackageManager().getLaunchIntentForPackage("com.reactnativenavigation.playground");
|
|
49
|
+ Intent intent = getInstrumentation().getTargetContext().getPackageManager().getLaunchIntentForPackage(PACKAGE_NAME);
|
44
|
50
|
assertThat(intent).isNotNull();
|
45
|
51
|
getInstrumentation().getTargetContext().startActivity(intent);
|
46
|
|
- uiDevice().waitForIdle();
|
|
52
|
+ uiDevice().wait(Until.hasObject(By.pkg("com.reactnativenavigation.playground").depth(0)), 5000);
|
47
|
53
|
}
|
48
|
54
|
|
49
|
55
|
private UiDevice uiDevice() {
|