File tree Expand file tree Collapse file tree 5 files changed +69
-2
lines changed
src/androidTest/java/com/facebook/react/uiapp Expand file tree Collapse file tree 5 files changed +69
-2
lines changed Original file line number Diff line number Diff line change @@ -120,10 +120,12 @@ android {
120
120
121
121
defaultConfig {
122
122
applicationId " com.facebook.react.uiapp"
123
- minSdkVersion 16
123
+ minSdkVersion 18
124
124
targetSdkVersion 29
125
125
versionCode 1
126
126
versionName " 1.0"
127
+ testBuildType System . getProperty(' testBuildType' , ' debug' ) // This will later be used to control the test apk build type
128
+ testInstrumentationRunner ' androidx.test.runner.AndroidJUnitRunner'
127
129
}
128
130
signingConfigs {
129
131
release {
@@ -149,6 +151,8 @@ android {
149
151
minifyEnabled enableProguardInReleaseBuilds
150
152
proguardFiles getDefaultProguardFile(' proguard-android.txt' ), ' proguard-rules.pro'
151
153
signingConfig signingConfigs. release
154
+ // Detox-specific additions to pro-guard
155
+ proguardFile " ${ rootProject.projectDir} /../node_modules/detox/android/detox/proguard-rules-app.pro"
152
156
}
153
157
}
154
158
}
@@ -187,4 +191,8 @@ dependencies {
187
191
} else {
188
192
jscImplementation ' org.webkit:android-jsc:+'
189
193
}
194
+
195
+ // Use detox test library
196
+ androidTestImplementation(' com.wix:detox:+' ) { transitive = true }
197
+ androidTestImplementation ' junit:junit:4.12'
190
198
}
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ // This uses instructions from
9
+ // https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md#4-create-android-test-class
10
+
11
+ package com .facebook .react .uiapp ;
12
+
13
+ import androidx .test .ext .junit .runners .AndroidJUnit4 ;
14
+ import androidx .test .filters .LargeTest ;
15
+ import androidx .test .rule .ActivityTestRule ;
16
+ import com .wix .detox .Detox ;
17
+ import org .junit .Rule ;
18
+ import org .junit .Test ;
19
+ import org .junit .runner .RunWith ;
20
+
21
+ @ RunWith (AndroidJUnit4 .class )
22
+ @ LargeTest
23
+ public class DetoxTest {
24
+
25
+ @ Rule
26
+ public ActivityTestRule <RNTesterActivity > mActivityRule =
27
+ new ActivityTestRule <>(RNTesterActivity .class , false , false );
28
+
29
+ @ Test
30
+ public void runDetoxTests () {
31
+ Detox .runTests (mActivityRule );
32
+ }
33
+ }
Original file line number Diff line number Diff line change @@ -25,6 +25,11 @@ allprojects {
25
25
maven {
26
26
url = uri(" $rootDir /node_modules/jsc-android/dist" )
27
27
}
28
+ maven {
29
+ // https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md
30
+ // All of Detox's artifacts are provided via the npm module
31
+ url = uri(" $rootDir /node_modules/detox/Detox-android" )
32
+ }
28
33
mavenLocal()
29
34
google()
30
35
jcenter()
Original file line number Diff line number Diff line change 159
159
"runner-config" : " RNTester/e2e/config.json" ,
160
160
"specs" : " " ,
161
161
"configurations" : {
162
+ "android.emu.release" : {
163
+ "binaryPath" : " RNTester/android/app/build/outputs/apk/hermes/release/app-hermes-x86-release.apk" ,
164
+ "testBinaryPath" : " RNTester/android/app/build/outputs/apk/androidTest/hermes/release/app-hermes-release-androidTest.apk" ,
165
+ "build" :
166
+ " ./gradlew RNTester:android:app:assembleRelease RNTester:android:app:assembleAndroidTest -DtestBuildType=release" ,
167
+ "type" : " android.emulator" ,
168
+ "device" : {
169
+ "avdName" : " Nexus_6_API_29"
170
+ }
171
+ },
172
+ "android.emu.debug" : {
173
+ "binaryPath" : " RNTester/android/app/build/outputs/apk/hermes/debug/app-hermes-x86-debug.apk" ,
174
+ "testBinaryPath" : " RNTester/android/app/build/outputs/apk/androidTest/hermes/debug/app-hermes-debug-androidTest.apk" ,
175
+ "build" : " ./gradlew RNTester:android:app:assembleDebug RNTester:android:app:assembleAndroidTest -DtestBuildType=debug" ,
176
+ "type" : " android.emulator" ,
177
+ "device" : {
178
+ "avdName" : " Nexus_6_API_29"
179
+ }
180
+ },
162
181
"ios.sim.release" : {
163
182
"binaryPath" : " RNTester/build/Build/Products/Release-iphonesimulator/RNTester.app/" ,
164
183
"build" : " xcodebuild -workspace RNTester/RNTesterPods.xcworkspace -scheme RNTester -configuration Release -sdk iphonesimulator -derivedDataPath RNTester/build -UseModernBuildSystem=NO -quiet" ,
Original file line number Diff line number Diff line change @@ -11,9 +11,11 @@ buildscript {
11
11
google()
12
12
jcenter()
13
13
}
14
+ ext. kotlinVersion = ' 1.3.0'
14
15
dependencies {
15
16
classpath(" com.android.tools.build:gradle:3.5.3" )
16
-
17
+ // for Detox
18
+ classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion "
17
19
// NOTE: Do not place your application dependencies here; they belong
18
20
// in the individual module build.gradle files
19
21
}
You can’t perform that action at this time.
0 commit comments