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,8 +7,6 @@ import android.support.test.filters.SdkSuppress;
7 7
 import android.support.test.rule.ActivityTestRule;
8 8
 import android.support.test.runner.AndroidJUnit4;
9 9
 import android.support.test.uiautomator.UiDevice;
10
-import android.support.test.uiautomator.UiObjectNotFoundException;
11
-import android.support.test.uiautomator.UiScrollable;
12 10
 import android.support.test.uiautomator.UiSelector;
13 11
 
14 12
 import com.reactnativenavigation.views.NavigationSplashView;
@@ -16,7 +14,6 @@ import com.reactnativenavigation.views.NavigationSplashView;
16 14
 import org.junit.After;
17 15
 import org.junit.Before;
18 16
 import org.junit.FixMethodOrder;
19
-import org.junit.Ignore;
20 17
 import org.junit.Rule;
21 18
 import org.junit.Test;
22 19
 import org.junit.runner.RunWith;
@@ -43,11 +40,8 @@ public class ApplicationLifecycleTest {
43 40
     @Before
44 41
     public void beforeEach() throws Exception {
45 42
         uiDevice().wakeUp();
46
-
47 43
         reactIdlingResource.start();
48 44
         Espresso.registerIdlingResources(reactIdlingResource);
49
-
50
-        rule.launchActivity(null);
51 45
     }
52 46
 
53 47
     @After
@@ -59,6 +53,7 @@ public class ApplicationLifecycleTest {
59 53
 
60 54
     @Test
61 55
     public void _1_showSplash_AcceptsOverlayPermissions_ShowsWelcomeScreen() throws Exception {
56
+        rule.launchActivity(null);
62 57
         assertThat(rule.getActivity().getContentView()).isNotNull().isInstanceOf(NavigationSplashView.class);
63 58
         acceptOverlayPermissionIfNeeded();
64 59
         assertWelcomeShown();
@@ -66,6 +61,7 @@ public class ApplicationLifecycleTest {
66 61
 
67 62
     @Test
68 63
     public void _2_relaunchFromBackground() throws Exception {
64
+        rule.launchActivity(null);
69 65
         assertWelcomeShown();
70 66
 
71 67
         uiDevice().pressHome();
@@ -76,9 +72,9 @@ public class ApplicationLifecycleTest {
76 72
         assertWelcomeShown();
77 73
     }
78 74
 
79
-
80 75
     @Test
81 76
     public void _3_relaunchAfterClose() throws Exception {
77
+        rule.launchActivity(null);
82 78
         assertWelcomeShown();
83 79
 
84 80
         uiDevice().pressBack();
@@ -87,63 +83,7 @@ public class ApplicationLifecycleTest {
87 83
         rule.launchActivity(null);
88 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 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 89
     private void assertWelcomeShown() {
@@ -167,17 +107,3 @@ public class ApplicationLifecycleTest {
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
-