diff options
author | Kevin Li <kevin.li@mapbox.com> | 2019-06-26 16:33:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-26 16:33:59 +0800 |
commit | 3b90d95b938485936e9295c8a4044c93c7939cbf (patch) | |
tree | 18dbccb51e2c18b3ceaa9ba4963861265ccdeea8 /platform | |
parent | 3b0e5a59a288b165e7fac26c22ff51ee524e1568 (diff) | |
download | qtlocation-mapboxgl-3b90d95b938485936e9295c8a4044c93c7939cbf.tar.gz |
[android]Add MicroSoft AppCenter lib. (#14995)
Diffstat (limited to 'platform')
17 files changed, 53 insertions, 16 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle index ca280436ea..bcdafd55d5 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle +++ b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle @@ -79,6 +79,7 @@ dependencies { androidTestImplementation dependenciesList.testEspressoIntents androidTestImplementation dependenciesList.testEspressoContrib androidTestImplementation dependenciesList.testUiAutomator + androidTestImplementation dependenciesList.appCenter } apply from: "${rootDir}/gradle/gradle-make.gradle" diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/AppCenter.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/AppCenter.kt new file mode 100644 index 0000000000..fb946a9c31 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/AppCenter.kt @@ -0,0 +1,16 @@ +package com.mapbox.mapboxsdk + +import com.microsoft.appcenter.espresso.Factory +import org.junit.After +import org.junit.Rule + +abstract class AppCenter { + @get:Rule + var reportHelper = Factory.getReportHelper()!! + + + @After + open fun afterTest() { + reportHelper.label(javaClass.simpleName) + } +}
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt index aeb8863790..554ab644b6 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt @@ -5,11 +5,12 @@ import android.content.Intent import android.content.Intent.FLAG_ACTIVITY_NEW_TASK import android.support.test.InstrumentationRegistry import android.support.test.uiautomator.* +import com.mapbox.mapboxsdk.AppCenter import org.junit.Before const val TIMEOUT_UI_SEARCH_WAIT = 5000L -abstract class BaseIntegrationTest { +abstract class BaseIntegrationTest : AppCenter(){ protected lateinit var device: UiDevice diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/BaseLayerTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/BaseLayerTest.kt index 9a6f9c3c26..7019129e6e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/BaseLayerTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/BaseLayerTest.kt @@ -2,11 +2,12 @@ package com.mapbox.mapboxsdk.maps import android.support.test.InstrumentationRegistry import android.support.test.runner.AndroidJUnit4 +import com.mapbox.mapboxsdk.AppCenter import com.mapbox.mapboxsdk.style.layers.Layer import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) -abstract class BaseLayerTest { +abstract class BaseLayerTest : AppCenter(){ private lateinit var nativeMapView: NativeMap companion object { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxTest.java index c8737e2802..50c10766af 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxTest.java @@ -2,6 +2,8 @@ package com.mapbox.mapboxsdk.maps; import android.support.test.annotation.UiThreadTest; import android.support.test.runner.AndroidJUnit4; + +import com.mapbox.mapboxsdk.AppCenter; import com.mapbox.mapboxsdk.Mapbox; import org.junit.Test; import org.junit.runner.RunWith; @@ -11,7 +13,7 @@ import static junit.framework.Assert.assertSame; import static junit.framework.Assert.assertTrue; @RunWith(AndroidJUnit4.class) -public class MapboxTest { +public class MapboxTest extends AppCenter { private static final String ACCESS_TOKEN = "pk.0000000001"; private static final String ACCESS_TOKEN_2 = "pk.0000000002"; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt index a1fe6af659..409d956a13 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/NativeMapViewTest.kt @@ -5,6 +5,7 @@ import android.graphics.PointF import android.support.test.InstrumentationRegistry import android.support.test.annotation.UiThreadTest import android.support.test.runner.AndroidJUnit4 +import com.mapbox.mapboxsdk.AppCenter import com.mapbox.mapboxsdk.camera.CameraPosition import com.mapbox.mapboxsdk.geometry.LatLng import com.mapbox.mapboxsdk.geometry.LatLngBounds @@ -19,7 +20,7 @@ import org.junit.Test import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) -class NativeMapViewTest { +class NativeMapViewTest : AppCenter() { private lateinit var nativeMapView: NativeMap diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseTest.java index c91afe9b60..054069f92c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseTest.java @@ -3,6 +3,8 @@ package com.mapbox.mapboxsdk.testapp.activity; import android.support.annotation.CallSuper; import android.support.annotation.UiThread; import android.support.test.rule.ActivityTestRule; + +import com.mapbox.mapboxsdk.AppCenter; import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; @@ -22,7 +24,7 @@ import static junit.framework.TestCase.assertTrue; /** * Base class for all Activity test hooking into an existing Activity that will load style. */ -public abstract class BaseTest { +public abstract class BaseTest extends AppCenter { private static final int WAIT_TIMEOUT = 30; //seconds @@ -46,7 +48,7 @@ public abstract class BaseTest { @After @CallSuper public void afterTest() { - // override to add logic + super.afterTest(); } @UiThread diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/fragment/MapDialogFragmentTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/fragment/MapDialogFragmentTest.kt index 2731b20db7..2abee8095c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/fragment/MapDialogFragmentTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/fragment/MapDialogFragmentTest.kt @@ -7,6 +7,7 @@ import android.support.test.espresso.matcher.ViewMatchers.withId import android.support.test.filters.LargeTest import android.support.test.rule.ActivityTestRule import android.support.test.runner.AndroidJUnit4 +import com.mapbox.mapboxsdk.AppCenter import com.mapbox.mapboxsdk.testapp.R import com.mapbox.mapboxsdk.testapp.action.WaitAction import com.mapbox.mapboxsdk.testapp.activity.maplayout.MapInDialogActivity @@ -20,7 +21,7 @@ import org.junit.runner.RunWith */ @RunWith(AndroidJUnit4::class) @LargeTest -class MapDialogFragmentTest { +class MapDialogFragmentTest : AppCenter() { @get:Rule var activityRule: ActivityTestRule<MapInDialogActivity> = ActivityTestRule(MapInDialogActivity::class.java) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt index 4de4b1d55b..539cc85035 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt @@ -2,6 +2,7 @@ package com.mapbox.mapboxsdk.testapp.maps import android.support.test.rule.ActivityTestRule import android.support.test.runner.AndroidJUnit4 +import com.mapbox.mapboxsdk.AppCenter import com.mapbox.mapboxsdk.maps.MapView import com.mapbox.mapboxsdk.maps.Style import com.mapbox.mapboxsdk.testapp.R @@ -16,7 +17,7 @@ import java.util.concurrent.TimeUnit import java.util.concurrent.TimeoutException @RunWith(AndroidJUnit4::class) -class ImageMissingTest { +class ImageMissingTest : AppCenter(){ @Rule @JvmField diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/RemoveUnusedImagesTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/RemoveUnusedImagesTest.kt index d42494b3e9..492a75b7cf 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/RemoveUnusedImagesTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/RemoveUnusedImagesTest.kt @@ -3,6 +3,7 @@ package com.mapbox.mapboxsdk.testapp.maps import android.graphics.Bitmap import android.support.test.rule.ActivityTestRule import android.support.test.runner.AndroidJUnit4 +import com.mapbox.mapboxsdk.AppCenter import com.mapbox.mapboxsdk.camera.CameraUpdateFactory import com.mapbox.mapboxsdk.geometry.LatLng import com.mapbox.mapboxsdk.maps.MapView @@ -20,7 +21,7 @@ import java.util.concurrent.TimeUnit import java.util.concurrent.TimeoutException @RunWith(AndroidJUnit4::class) -class RemoveUnusedImagesTest { +class RemoveUnusedImagesTest : AppCenter() { @Rule @JvmField diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt index 8e5f3f7c5f..3f98937527 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt @@ -3,6 +3,7 @@ package com.mapbox.mapboxsdk.testapp.offline import android.content.Context import android.support.test.rule.ActivityTestRule import android.support.test.runner.AndroidJUnit4 +import com.mapbox.mapboxsdk.AppCenter import com.mapbox.mapboxsdk.offline.OfflineManager import com.mapbox.mapboxsdk.offline.OfflineRegion import com.mapbox.mapboxsdk.storage.FileSource @@ -18,7 +19,7 @@ import java.util.concurrent.CountDownLatch @FixMethodOrder(MethodSorters.NAME_ASCENDING) @RunWith(AndroidJUnit4::class) -class OfflineManagerTest { +class OfflineManagerTest : AppCenter() { companion object { private const val TEST_DB_FILE_NAME = "offline_test.db" diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineUtilsTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineUtilsTest.java index 40fba08c25..48eb8e832d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineUtilsTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineUtilsTest.java @@ -1,6 +1,8 @@ package com.mapbox.mapboxsdk.testapp.offline; import android.support.test.runner.AndroidJUnit4; + +import com.mapbox.mapboxsdk.AppCenter; import com.mapbox.mapboxsdk.testapp.utils.OfflineUtils; import org.junit.Test; import org.junit.runner.RunWith; @@ -13,7 +15,7 @@ import static junit.framework.Assert.assertEquals; import static junit.framework.TestCase.assertTrue; @RunWith(AndroidJUnit4.class) -public class OfflineUtilsTest { +public class OfflineUtilsTest extends AppCenter { private static final String REGION_NAME = "hello world"; private static final String CONVERTED_REGION_NAME = "{\"FIELD_REGION_NAME\":\"hello world\"}"; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/render/RenderTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/render/RenderTest.java index 14b138e917..c74e110b6c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/render/RenderTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/render/RenderTest.java @@ -7,6 +7,8 @@ import android.support.test.espresso.IdlingResourceTimeoutException; import android.support.test.rule.ActivityTestRule; import android.support.test.rule.GrantPermissionRule; import android.support.test.runner.AndroidJUnit4; + +import com.mapbox.mapboxsdk.AppCenter; import com.mapbox.mapboxsdk.testapp.activity.render.RenderTestActivity; import com.mapbox.mapboxsdk.testapp.utils.SnapshotterIdlingResource; import org.junit.After; @@ -28,7 +30,7 @@ import static android.support.test.espresso.matcher.ViewMatchers.withId; * Instrumentation render tests */ @RunWith(AndroidJUnit4.class) -public class RenderTest { +public class RenderTest extends AppCenter { private static final int RENDER_TEST_TIMEOUT = 30; private SnapshotterIdlingResource idlingResource; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceMapTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceMapTest.kt index 5e3489d755..7a5801a814 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceMapTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceMapTest.kt @@ -3,6 +3,7 @@ package com.mapbox.mapboxsdk.testapp.storage import android.support.test.annotation.UiThreadTest import android.support.test.rule.ActivityTestRule import android.support.test.runner.AndroidJUnit4 +import com.mapbox.mapboxsdk.AppCenter import com.mapbox.mapboxsdk.storage.FileSource import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity import junit.framework.Assert @@ -15,7 +16,7 @@ import org.junit.runner.RunWith import java.util.concurrent.CountDownLatch @RunWith(AndroidJUnit4::class) -open class FileSourceMapTest { +open class FileSourceMapTest : AppCenter() { private lateinit var fileSourceTestUtils: FileSourceTestUtils diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceStandaloneTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceStandaloneTest.kt index 08a15b0c54..428d0ed757 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceStandaloneTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceStandaloneTest.kt @@ -3,6 +3,7 @@ package com.mapbox.mapboxsdk.testapp.storage import android.support.test.annotation.UiThreadTest import android.support.test.rule.ActivityTestRule import android.support.test.runner.AndroidJUnit4 +import com.mapbox.mapboxsdk.AppCenter import com.mapbox.mapboxsdk.storage.FileSource import com.mapbox.mapboxsdk.testapp.activity.FeatureOverviewActivity import org.junit.* @@ -12,7 +13,7 @@ import java.util.concurrent.CountDownLatch import java.util.concurrent.TimeUnit @RunWith(AndroidJUnit4::class) -class FileSourceStandaloneTest { +class FileSourceStandaloneTest : AppCenter() { private lateinit var fileSourceTestUtils: FileSourceTestUtils private lateinit var fileSource: FileSource diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceTestUtils.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceTestUtils.kt index c79d3b2752..0010880414 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceTestUtils.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/storage/FileSourceTestUtils.kt @@ -2,12 +2,13 @@ package com.mapbox.mapboxsdk.testapp.storage import android.app.Activity import android.support.annotation.WorkerThread +import com.mapbox.mapboxsdk.AppCenter import com.mapbox.mapboxsdk.storage.FileSource import junit.framework.Assert import java.io.File import java.util.concurrent.CountDownLatch -class FileSourceTestUtils(private val activity: Activity) { +class FileSourceTestUtils(private val activity: Activity) : AppCenter() { val originalPath = FileSource.getResourcesCachePath(activity) val testPath = "$originalPath/test" val testPath2 = "$originalPath/test2" diff --git a/platform/android/gradle/dependencies.gradle b/platform/android/gradle/dependencies.gradle index b7e5298477..a7ff1dbfe6 100644 --- a/platform/android/gradle/dependencies.gradle +++ b/platform/android/gradle/dependencies.gradle @@ -32,7 +32,8 @@ ext { lint : '26.1.4', gms : '16.0.0', soLoader : '0.6.0', - jacoco : '0.8.3' + jacoco : '0.8.3', + appcenter : '1.4' ] dependenciesList = [ @@ -53,6 +54,7 @@ ext { testEspressoIntents : "com.android.support.test.espresso:espresso-intents:${versions.espresso}", testEspressoContrib : "com.android.support.test.espresso:espresso-contrib:${versions.espresso}", testUiAutomator : "com.android.support.test.uiautomator:uiautomator-v18:${versions.uiAutomator}", + appCenter : "com.microsoft.appcenter:espresso-test-extension:${versions.appcenter}", commonsIO : 'commons-io:commons-io:2.5', supportAnnotations : "com.android.support:support-annotations:${versions.supportLib}", supportAppcompatV7 : "com.android.support:appcompat-v7:${versions.supportLib}", |