diff --git a/android/sample/build.gradle b/android/sample/build.gradle index 4922076fd..590ecaf07 100644 --- a/android/sample/build.gradle +++ b/android/sample/build.gradle @@ -5,7 +5,7 @@ android { buildToolsVersion rootProject.buildToolsVersion defaultConfig { minSdkVersion rootProject.minSdkVersion - testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner' + testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' applicationId 'com.facebook.flipper.sample' } @@ -34,5 +34,9 @@ dependencies { implementation deps.soloader implementation deps.okhttp3 + // Integration test + androidTestImplementation deps.testCore + androidTestImplementation deps.testRules + implementation project(':android') } diff --git a/android/sample/src/androidTest/java/com/facebook/flipper/sample/MainActivityTest.java b/android/sample/src/androidTest/java/com/facebook/flipper/sample/MainActivityTest.java new file mode 100644 index 000000000..f67412621 --- /dev/null +++ b/android/sample/src/androidTest/java/com/facebook/flipper/sample/MainActivityTest.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2018-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the LICENSE + * file in the root directory of this source tree. + * + */ +package com.facebook.flipper.sample; + +import androidx.test.filters.LargeTest; +import androidx.test.rule.ActivityTestRule; +import androidx.test.runner.AndroidJUnit4; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +@LargeTest +@RunWith(AndroidJUnit4.class) +public class MainActivityTest { + + @Rule + public final ActivityTestRule mTestRule = + new ActivityTestRule<>(MainActivity.class); + + @Test + public void activityStarts() { + final MainActivity activity = mTestRule.getActivity(); + + assert activity != null; + } +} diff --git a/build.gradle b/build.gradle index ec74a5ddb..f42ba4c90 100644 --- a/build.gradle +++ b/build.gradle @@ -75,6 +75,8 @@ ext.deps = [ stetho : 'com.facebook.stetho:stetho:1.5.0', okhttp3 : 'com.squareup.okhttp3:okhttp:3.10.0', leakcanary : 'com.squareup.leakcanary:leakcanary-android:1.6.1', + testCore : 'androidx.test:core:1.0.0', + testRules : 'androidx.test:rules:1.1.0', // Plugin dependencies rhino : 'org.mozilla:rhino:1.7.10', ]