|
@@ -39,11 +39,14 @@ public class ApplicationLifecycleTest {
|
39
|
39
|
|
40
|
40
|
@Before
|
41
|
41
|
public void beforeEach() {
|
|
42
|
+ reactIdlingResource.start();
|
42
|
43
|
Espresso.registerIdlingResources(reactIdlingResource);
|
43
|
44
|
}
|
44
|
45
|
|
45
|
46
|
@After
|
46
|
47
|
public void afterEach() {
|
|
48
|
+ uiDevice().waitForIdle();
|
|
49
|
+ reactIdlingResource.stop();
|
47
|
50
|
Espresso.unregisterIdlingResources(reactIdlingResource);
|
48
|
51
|
}
|
49
|
52
|
|
|
@@ -70,40 +73,38 @@ public class ApplicationLifecycleTest {
|
70
|
73
|
}
|
71
|
74
|
|
72
|
75
|
@Test
|
73
|
|
- public void _2_relaunchFromBackground() throws Exception {
|
|
76
|
+ public void _2_RelaunchFromBackground() throws Exception {
|
74
|
77
|
rule.launchActivity(null);
|
|
78
|
+
|
75
|
79
|
onView(withText("React Native Navigation!")).check(matches(isDisplayed()));
|
|
80
|
+ uiDevice().waitForIdle();
|
76
|
81
|
|
77
|
82
|
uiDevice().pressHome();
|
78
|
83
|
uiDevice().pressRecentApps();
|
79
|
84
|
uiDevice().findObject(new UiSelector().text("Playground")).click();
|
|
85
|
+ uiDevice().waitForIdle();
|
80
|
86
|
|
81
|
87
|
onView(withText("React Native Navigation!")).check(matches(isDisplayed()));
|
82
|
88
|
}
|
83
|
89
|
|
84
|
90
|
@Test
|
85
|
|
- public void _3_relaunchAfterClose() throws Exception {
|
|
91
|
+ public void _3_RelaunchAfterClose() throws Exception {
|
86
|
92
|
rule.launchActivity(null);
|
|
93
|
+ uiDevice().waitForIdle();
|
|
94
|
+
|
87
|
95
|
uiDevice().pressBack();
|
|
96
|
+ uiDevice().waitForIdle();
|
|
97
|
+
|
88
|
98
|
rule.launchActivity(null);
|
|
99
|
+ uiDevice().waitForIdle();
|
|
100
|
+
|
89
|
101
|
onView(withText("React Native Navigation!")).check(matches(isDisplayed()));
|
90
|
102
|
}
|
91
|
103
|
}
|
92
|
|
-// xdescribe('android application lifecycle', () => {
|
93
|
|
-////launch, pause, and resume
|
94
|
|
-//
|
95
|
|
-// it('launch already running in background', () => {
|
96
|
|
-// //
|
97
|
|
-// });
|
98
|
|
-//
|
99
|
104
|
// it('launch after activity killed by system', () => {
|
100
|
105
|
// //
|
101
|
106
|
// });
|
102
|
107
|
//
|
103
|
|
-// it('launch and ask react overlay permissions', () => {
|
104
|
|
-// //
|
105
|
|
-// });
|
106
|
|
-//
|
107
|
108
|
// it('launch after reactContext killed by system', () => {
|
108
|
109
|
// //
|
109
|
110
|
// });
|