Browse Source

android: removed unneeded e2e

Daniel Zlotin 7 years ago
parent
commit
6fa9d2493d

+ 3
- 77
playground/android/app/src/androidTest/java/com/reactnativenavigation/playground/ApplicationLifecycleTest.java View File

7
 import android.support.test.rule.ActivityTestRule;
7
 import android.support.test.rule.ActivityTestRule;
8
 import android.support.test.runner.AndroidJUnit4;
8
 import android.support.test.runner.AndroidJUnit4;
9
 import android.support.test.uiautomator.UiDevice;
9
 import android.support.test.uiautomator.UiDevice;
10
-import android.support.test.uiautomator.UiObjectNotFoundException;
11
-import android.support.test.uiautomator.UiScrollable;
12
 import android.support.test.uiautomator.UiSelector;
10
 import android.support.test.uiautomator.UiSelector;
13
 
11
 
14
 import com.reactnativenavigation.views.NavigationSplashView;
12
 import com.reactnativenavigation.views.NavigationSplashView;
16
 import org.junit.After;
14
 import org.junit.After;
17
 import org.junit.Before;
15
 import org.junit.Before;
18
 import org.junit.FixMethodOrder;
16
 import org.junit.FixMethodOrder;
19
-import org.junit.Ignore;
20
 import org.junit.Rule;
17
 import org.junit.Rule;
21
 import org.junit.Test;
18
 import org.junit.Test;
22
 import org.junit.runner.RunWith;
19
 import org.junit.runner.RunWith;
43
     @Before
40
     @Before
44
     public void beforeEach() throws Exception {
41
     public void beforeEach() throws Exception {
45
         uiDevice().wakeUp();
42
         uiDevice().wakeUp();
46
-
47
         reactIdlingResource.start();
43
         reactIdlingResource.start();
48
         Espresso.registerIdlingResources(reactIdlingResource);
44
         Espresso.registerIdlingResources(reactIdlingResource);
49
-
50
-        rule.launchActivity(null);
51
     }
45
     }
52
 
46
 
53
     @After
47
     @After
59
 
53
 
60
     @Test
54
     @Test
61
     public void _1_showSplash_AcceptsOverlayPermissions_ShowsWelcomeScreen() throws Exception {
55
     public void _1_showSplash_AcceptsOverlayPermissions_ShowsWelcomeScreen() throws Exception {
56
+        rule.launchActivity(null);
62
         assertThat(rule.getActivity().getContentView()).isNotNull().isInstanceOf(NavigationSplashView.class);
57
         assertThat(rule.getActivity().getContentView()).isNotNull().isInstanceOf(NavigationSplashView.class);
63
         acceptOverlayPermissionIfNeeded();
58
         acceptOverlayPermissionIfNeeded();
64
         assertWelcomeShown();
59
         assertWelcomeShown();
66
 
61
 
67
     @Test
62
     @Test
68
     public void _2_relaunchFromBackground() throws Exception {
63
     public void _2_relaunchFromBackground() throws Exception {
64
+        rule.launchActivity(null);
69
         assertWelcomeShown();
65
         assertWelcomeShown();
70
 
66
 
71
         uiDevice().pressHome();
67
         uiDevice().pressHome();
76
         assertWelcomeShown();
72
         assertWelcomeShown();
77
     }
73
     }
78
 
74
 
79
-
80
     @Test
75
     @Test
81
     public void _3_relaunchAfterClose() throws Exception {
76
     public void _3_relaunchAfterClose() throws Exception {
77
+        rule.launchActivity(null);
82
         assertWelcomeShown();
78
         assertWelcomeShown();
83
 
79
 
84
         uiDevice().pressBack();
80
         uiDevice().pressBack();
87
         rule.launchActivity(null);
83
         rule.launchActivity(null);
88
         uiDevice().waitForIdle();
84
         uiDevice().waitForIdle();
89
 
85
 
90
-        onView(withText("React Native Navigation!")).check(matches(isDisplayed()));
91
-    }
92
-
93
-    @Test
94
-    @Ignore
95
-    public void relaunchAfterActivityKilledBySystem() throws Exception {
96
-        //TODO this test should be compiled in its own APK and run separately.
97
-        assertWelcomeShown();
98
-
99
-        setSettingsNoBackgroundProcesses();
100
-        openCalculator();
101
-
102
-        uiDevice().pressRecentApps();
103
-        uiDevice().findObject(new UiSelector().text("Playground")).click();
104
-        uiDevice().waitForIdle();
105
-
106
         assertWelcomeShown();
86
         assertWelcomeShown();
107
-
108
-        setSettingsNormalProcesses();
109
-    }
110
-
111
-    private void setSettingsNoBackgroundProcesses() throws Exception {
112
-        uiDevice().pressHome();
113
-        uiDevice().waitForIdle();
114
-        uiDevice().findObject(new UiSelector().description("Apps")).clickAndWaitForNewWindow();
115
-        new UiScrollable(new UiSelector().scrollable(true)).scrollTextIntoView("Settings");
116
-        uiDevice().findObject(new UiSelector().text("Settings")).click();
117
-        new UiScrollable(new UiSelector().scrollable(true)).flingToEnd(100);
118
-        uiDevice().findObject(new UiSelector().text("Developer options")).click();
119
-        new UiScrollable(new UiSelector().scrollable(true)).flingToEnd(100);
120
-        uiDevice().findObject(new UiSelector().text("Background process limit")).click();
121
-        uiDevice().findObject(new UiSelector().text("No background processes")).click();
122
-        uiDevice().pressHome();
123
-        uiDevice().waitForIdle();
124
-    }
125
-
126
-    private void openCalculator() throws Exception {
127
-        uiDevice().pressHome();
128
-        uiDevice().waitForIdle();
129
-        uiDevice().findObject(new UiSelector().description("Apps")).clickAndWaitForNewWindow();
130
-        new UiScrollable(new UiSelector().scrollable(true)).scrollTextIntoView("Calculator");
131
-        uiDevice().findObject(new UiSelector().text("Calculator")).click();
132
-    }
133
-
134
-    private void setSettingsNormalProcesses() throws UiObjectNotFoundException {
135
-        uiDevice().pressHome();
136
-        uiDevice().waitForIdle();
137
-        uiDevice().findObject(new UiSelector().description("Apps")).clickAndWaitForNewWindow();
138
-        new UiScrollable(new UiSelector().scrollable(true)).scrollTextIntoView("Settings");
139
-        uiDevice().findObject(new UiSelector().text("Settings")).click();
140
-        new UiScrollable(new UiSelector().scrollable(true)).flingToEnd(100);
141
-        uiDevice().findObject(new UiSelector().text("Developer options")).click();
142
-        new UiScrollable(new UiSelector().scrollable(true)).flingToEnd(100);
143
-        uiDevice().findObject(new UiSelector().text("Background process limit")).click();
144
-        uiDevice().findObject(new UiSelector().text("Standard limit")).click();
145
-        uiDevice().pressHome();
146
-        uiDevice().waitForIdle();
147
     }
87
     }
148
 
88
 
149
     private void assertWelcomeShown() {
89
     private void assertWelcomeShown() {
167
     }
107
     }
168
 
108
 
169
 }
109
 }
170
-//
171
-//        it('launch after reactContext killed by system', () => {
172
-//        //
173
-//        });
174
-//
175
-//        it('launch from push notification', () => {
176
-//        //
177
-//        });
178
-//
179
-//        it('launch from intent filter', () => {
180
-//        //
181
-//        });
182
-//        });
183
-