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
--- 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 {
+}