diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2016-10-20 10:20:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-20 10:20:56 +0200 |
commit | 9a7139b65ccc7d75c256cb04c4ec1e6bd4e327b6 (patch) | |
tree | b33621c0939b228867c962e2c60d14b3513ddfb3 /platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BaseStyleTest.java | |
parent | 76f91cc88d5e2c19bcac3e1421bd13b510e21979 (diff) | |
download | qtlocation-mapboxgl-9a7139b65ccc7d75c256cb04c4ec1e6bd4e327b6.tar.gz |
[android] - move instrumentation test code to correct package for Android Studio run configurations integration. (#6748)
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BaseStyleTest.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BaseStyleTest.java | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BaseStyleTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BaseStyleTest.java new file mode 100644 index 0000000000..5ec4e5437b --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BaseStyleTest.java @@ -0,0 +1,44 @@ +package com.mapbox.mapboxsdk.testapp.style; + +import android.app.Activity; + +import com.mapbox.mapboxsdk.testapp.utils.ScreenshotUtil; + +import static android.support.test.espresso.Espresso.onView; +import static android.support.test.espresso.assertion.ViewAssertions.matches; +import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; +import static android.support.test.espresso.matcher.ViewMatchers.withId; + +/** + * Base Test class for Style tests + */ +public class BaseStyleTest { + + protected final static String HOME_BUTTON_STRING = "Navigate up"; + + /* + * Shortcuts for common UI tests + */ + + protected void checkViewIsDisplayed(int id) { + onView(withId(id)) + .check(matches(isDisplayed())); + } + + /* + * Screenshots logic + */ + + protected void takeNamedScreenshot(final Activity activity, final String name) { + + // Screenshots need to be taken on the UI thread + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + ScreenshotUtil.take(activity, name); + } + }); + + } + +} |