Bug 1417255 - Add Espresso to build.gradle. draft
authorNevin Chen <cnevinchen@gmail.com>
Wed, 15 Nov 2017 07:13:31 +0800
changeset 708914 a4454902dc8553455d5145fbed40ff5e0cb97bdf
parent 708706 4b94da21a9e6171f9911ffad171af23c26e6227b
child 708915 654a99911dbfee9d3030587d54ba0e0f4c569eab
push id92480
push userbmo:cnevinchen@gmail.com
push dateThu, 07 Dec 2017 09:53:01 +0000
bugs1417255
milestone59.0a1
Bug 1417255 - Add Espresso to build.gradle. There's some depedency issue in support library so I can't use the latest Espresso. Current is 23.xx and the latest use 25.xx) I'll try not to hard code the Espresso version here. MozReview-Commit-ID: H9e7YTYHF15
mobile/android/app/build.gradle
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/HelloWorldEspressoTest.java
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -20,16 +20,18 @@ android {
 
         applicationId mozconfig.substs.ANDROID_PACKAGE_NAME
         testApplicationId 'org.mozilla.roboexample.test'
         testInstrumentationRunner 'org.mozilla.gecko.FennecInstrumentationTestRunner'
         // Used by Robolectric based tests; see TestRunner.
         buildConfigField 'String', 'BUILD_DIR', "\"${project.buildDir}\""
 
         vectorDrawables.useSupportLibrary = true
+        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+
     }
 
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_7
         targetCompatibility JavaVersion.VERSION_1_7
     }
 
     dexOptions {
@@ -264,16 +266,32 @@ dependencies {
     // It doesn't seem like there is a non-trivial way to be conditional on 'localOld', so instead we explicitly
     // define a version of leakcanary for every flavor:
     localCompile 'com.squareup.leakcanary:leakcanary-android:1.4-beta1'
     localOldCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
     officialCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
     officialCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
     testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta1'
 
+    androidTestCompile ('com.android.support.test.espresso:espresso-core:3.0.1'){
+        exclude module: 'support-annotations'
+        exclude module: 'support-v4'
+        exclude module: 'support-v13'
+        exclude module: 'recyclerview-v7'
+        exclude module: 'appcompat-v7'
+    }
+    androidTestCompile ('com.android.support.test:runner:1.0.1'){
+        exclude module: 'support-annotations'
+        exclude module: 'support-v4'
+        exclude module: 'support-v13'
+        exclude module: 'recyclerview-v7'
+        exclude module: 'appcompat-v7'
+    }
+
+
     // With a simple "compile", Gradle will always build these libraries in their default configuration
     // (i.e. release), so we need to explicitly forward our own build configuration here (bug 1385695).
     //
     // Official builds compile a hacked up app:Official..Debug, but need the
     // release versions of the dependencies, in order to not have debugging
     // information.  It's not yet possible to specify just officialDebug, so we
     // hack around it here.
     if (mozconfig.substs.MOZILLA_OFFICIAL) {
new file mode 100644
--- /dev/null
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/HelloWorldEspressoTest.java
@@ -0,0 +1,8 @@
+package org.mozilla.gecko;
+
+/**
+ * Created by nechen on 11/14/17.
+ */
+
+public class HelloWorldEspressoTest {
+}