|
@@ -1,5 +1,7 @@
|
1
|
1
|
package com.reactnativenavigation.e2e.androide2e;
|
2
|
2
|
|
|
3
|
+import android.graphics.Bitmap;
|
|
4
|
+import android.graphics.BitmapFactory;
|
3
|
5
|
import android.support.test.runner.AndroidJUnit4;
|
4
|
6
|
import android.support.test.uiautomator.By;
|
5
|
7
|
import android.support.test.uiautomator.BySelector;
|
|
@@ -13,6 +15,8 @@ import org.junit.After;
|
13
|
15
|
import org.junit.Before;
|
14
|
16
|
import org.junit.runner.RunWith;
|
15
|
17
|
|
|
18
|
+import java.io.File;
|
|
19
|
+
|
16
|
20
|
import static android.support.test.InstrumentationRegistry.getInstrumentation;
|
17
|
21
|
import static org.assertj.core.api.Java6Assertions.assertThat;
|
18
|
22
|
|
|
@@ -81,6 +85,14 @@ public abstract class BaseTest {
|
81
|
85
|
assertThat(device().findObject(selector).getVisibleCenter().y).isPositive().isLessThan(device().getDisplayHeight());
|
82
|
86
|
}
|
83
|
87
|
|
|
88
|
+ public Bitmap captureScreenshot() throws Exception {
|
|
89
|
+ File file = File.createTempFile("tmpE2E", "png");
|
|
90
|
+ device().takeScreenshot(file);
|
|
91
|
+ Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath());
|
|
92
|
+ file.delete();
|
|
93
|
+ return bitmap;
|
|
94
|
+ }
|
|
95
|
+
|
84
|
96
|
public void swipeOpenLeftSideMenu() {
|
85
|
97
|
device().swipe(5, 152, 500, 152, 15);
|
86
|
98
|
}
|