|
@@ -56,26 +56,28 @@ public class ApplicationLifecycleTest {
|
56
|
56
|
rule.launchActivity(null);
|
57
|
57
|
assertThat(rule.getActivity().getContentView()).isNotNull().isInstanceOf(NavigationSplashView.class);
|
58
|
58
|
acceptOverlayPermissionIfNeeded();
|
59
|
|
- assertWelcomeShown();
|
|
59
|
+ assertMainShown();
|
60
|
60
|
}
|
61
|
61
|
|
62
|
62
|
@Test
|
63
|
63
|
public void _2_relaunchFromBackground() throws Exception {
|
64
|
64
|
rule.launchActivity(null);
|
65
|
|
- assertWelcomeShown();
|
|
65
|
+ acceptOverlayPermissionIfNeeded();
|
|
66
|
+ assertMainShown();
|
66
|
67
|
|
67
|
68
|
uiDevice().pressHome();
|
68
|
69
|
uiDevice().pressRecentApps();
|
69
|
70
|
uiDevice().findObject(new UiSelector().text("Playground")).click();
|
70
|
71
|
uiDevice().waitForIdle();
|
71
|
72
|
|
72
|
|
- assertWelcomeShown();
|
|
73
|
+ assertMainShown();
|
73
|
74
|
}
|
74
|
75
|
|
75
|
76
|
@Test
|
76
|
77
|
public void _3_relaunchAfterClose() throws Exception {
|
77
|
78
|
rule.launchActivity(null);
|
78
|
|
- assertWelcomeShown();
|
|
79
|
+ acceptOverlayPermissionIfNeeded();
|
|
80
|
+ assertMainShown();
|
79
|
81
|
|
80
|
82
|
uiDevice().pressBack();
|
81
|
83
|
uiDevice().waitForIdle();
|
|
@@ -83,10 +85,24 @@ public class ApplicationLifecycleTest {
|
83
|
85
|
rule.launchActivity(null);
|
84
|
86
|
uiDevice().waitForIdle();
|
85
|
87
|
|
86
|
|
- assertWelcomeShown();
|
|
88
|
+ assertMainShown();
|
|
89
|
+ }
|
|
90
|
+
|
|
91
|
+ @Test
|
|
92
|
+ public void _4_deviceOrientationDoesNotDestroyActivity() throws Exception {
|
|
93
|
+ MainActivity mainActivity = rule.launchActivity(null);
|
|
94
|
+ acceptOverlayPermissionIfNeeded();
|
|
95
|
+ assertMainShown();
|
|
96
|
+
|
|
97
|
+ uiDevice().setOrientationRight();
|
|
98
|
+ uiDevice().waitForIdle();
|
|
99
|
+
|
|
100
|
+ Thread.sleep(5000);
|
|
101
|
+ assertMainShown();
|
|
102
|
+ assertThat(rule.getActivity()).isSameAs(mainActivity);
|
87
|
103
|
}
|
88
|
104
|
|
89
|
|
- private void assertWelcomeShown() {
|
|
105
|
+ private void assertMainShown() {
|
90
|
106
|
onView(withText("React Native Navigation!")).check(matches(isDisplayed()));
|
91
|
107
|
uiDevice().waitForIdle();
|
92
|
108
|
}
|
|
@@ -105,5 +121,4 @@ public class ApplicationLifecycleTest {
|
105
|
121
|
uiDevice().pressBack();
|
106
|
122
|
uiDevice().pressBack();
|
107
|
123
|
}
|
108
|
|
-
|
109
|
124
|
}
|