|
@@ -1,26 +1,17 @@
|
1
|
1
|
package com.reactnativenavigation.e2e.androide2e;
|
2
|
2
|
|
3
|
|
-import android.content.pm.ApplicationInfo;
|
4
|
|
-import android.content.pm.PackageInfo;
|
5
|
|
-import android.graphics.Bitmap;
|
6
|
|
-import android.graphics.BitmapFactory;
|
7
|
|
-import android.support.test.runner.AndroidJUnit4;
|
8
|
|
-import android.support.test.uiautomator.By;
|
9
|
|
-import android.support.test.uiautomator.BySelector;
|
10
|
|
-import android.support.test.uiautomator.UiDevice;
|
11
|
|
-import android.support.test.uiautomator.UiObject;
|
12
|
|
-import android.support.test.uiautomator.UiScrollable;
|
13
|
|
-import android.support.test.uiautomator.UiSelector;
|
14
|
|
-import android.support.test.uiautomator.Until;
|
15
|
|
-
|
16
|
|
-import org.junit.After;
|
17
|
|
-import org.junit.Before;
|
18
|
|
-import org.junit.runner.RunWith;
|
19
|
|
-
|
20
|
|
-import java.io.File;
|
21
|
|
-
|
22
|
|
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
|
23
|
|
-import static org.assertj.core.api.Java6Assertions.assertThat;
|
|
3
|
+import android.content.pm.*;
|
|
4
|
+import android.graphics.*;
|
|
5
|
+import android.support.test.runner.*;
|
|
6
|
+import android.support.test.uiautomator.*;
|
|
7
|
+
|
|
8
|
+import org.junit.*;
|
|
9
|
+import org.junit.runner.*;
|
|
10
|
+
|
|
11
|
+import java.io.*;
|
|
12
|
+
|
|
13
|
+import static android.support.test.InstrumentationRegistry.*;
|
|
14
|
+import static org.assertj.core.api.Java6Assertions.*;
|
24
|
15
|
|
25
|
16
|
@RunWith(AndroidJUnit4.class)
|
26
|
17
|
public abstract class BaseTest {
|
|
@@ -38,6 +29,7 @@ public abstract class BaseTest {
|
38
|
29
|
@After
|
39
|
30
|
public void afterEach() throws Exception {
|
40
|
31
|
device().executeShellCommand("am force-stop " + PACKAGE_NAME);
|
|
32
|
+ device().executeShellCommand("am kill " + PACKAGE_NAME);
|
41
|
33
|
}
|
42
|
34
|
|
43
|
35
|
public UiDevice device() {
|
|
@@ -97,8 +89,16 @@ public abstract class BaseTest {
|
97
|
89
|
return bitmap;
|
98
|
90
|
}
|
99
|
91
|
|
100
|
|
- public void swipeOpenLeftSideMenu() {
|
101
|
|
- device().swipe(5, 102, 500, 152, 15);
|
|
92
|
+ public void swipeOpenFromLeft() {
|
|
93
|
+ int w = device().getDisplayWidth();
|
|
94
|
+ int h = device().getDisplayHeight();
|
|
95
|
+ device().swipe(5, h / 2, w / 2, h / 2, 10);
|
|
96
|
+ }
|
|
97
|
+
|
|
98
|
+ public void swipeOpenFromRight() {
|
|
99
|
+ int w = device().getDisplayWidth();
|
|
100
|
+ int h = device().getDisplayHeight();
|
|
101
|
+ device().swipe(w - 5, h / 2, w / 2, h / 2, 10);
|
102
|
102
|
}
|
103
|
103
|
|
104
|
104
|
public boolean isDebug() throws Exception {
|