Skip to content

Commit 92d9c5f

Browse files
author
Paige Mcauliffe
committed
Add testing sample for Espresso Device
1 parent e83318e commit 92d9c5f

File tree

6 files changed

+21
-53
lines changed

6 files changed

+21
-53
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.gradle
2+
local.properties
3+
.idea
4+
.DS_Store
5+
build
6+
*.iml

ui/espresso/EspressoDeviceSample/BUILD.bazel

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,44 @@ load("//:common_defs.bzl", "minSdkVersion", "targetSdkVersion")
44
load("@rules_jvm_external//:defs.bzl", "artifact")
55

66
android_library(
7-
name = "EspressoDeviceBasicSampleLib",
7+
name = "EspressoDeviceSampleLib",
88
srcs = glob(["app/src/main/**/*.java"]),
9-
custom_package = "com.example.android.testing.espresso.EspressoDeviceBasicSample",
9+
custom_package = "com.example.android.testing.espresso.EspressoDeviceSample",
1010
manifest = "app/src/main/AndroidManifest.xml",
1111
resource_files = glob(["app/src/main/res/**/*"]),
12-
deps = [
13-
artifact("com.google.guava:guava")
14-
],
1512
)
1613

1714
android_binary(
18-
name = "EspressoDeviceBasicSample",
19-
custom_package = "com.example.android.testing.espresso.EspressoDeviceBasicSample",
15+
name = "EspressoDeviceSample",
16+
custom_package = "com.example.android.testing.espresso.EspressoDeviceSample",
2017
manifest = "app/src/main/AppManifest.xml",
2118
manifest_values = {
2219
"minSdkVersion": minSdkVersion,
2320
"targetSdkVersion": targetSdkVersion,
2421
},
25-
deps = [":BasicSampleLib"],
22+
deps = [":EspressoDeviceSampleLib"],
2623
)
2724

2825
android_library(
29-
name = "EspressoDeviceBasicSampleTestLib",
26+
name = "EspressoDeviceSampleTestLib",
3027
srcs = glob(["app/src/androidTest/**/*.java"]),
31-
custom_package = "com.example.android.testing.espresso.EspressoDeviceBasicSample.test",
28+
custom_package = "com.example.android.testing.espresso.EspressoDeviceSample.test",
3229
deps = [
33-
":EspressoDeviceBasicSampleLib",
30+
":EspressoDeviceSampleLib",
3431
"//:test_deps",
3532
],
3633
)
3734

3835
android_binary(
39-
name = "EspressoDeviceBasicSampleTest",
40-
custom_package = "com.example.android.testing.espresso.EspressoDeviceBasicSample.test",
41-
instruments = ":EspressoDeviceBasicSample",
36+
name = "EspressoDeviceSampleTest",
37+
custom_package = "com.example.android.testing.espresso.EspressoDeviceSample.test",
38+
instruments = ":EspressoDeviceSample",
4239
manifest = "app/src/androidTest/AndroidManifest.xml",
4340
manifest_values = {
4441
"minSdkVersion": minSdkVersion,
4542
"targetSdkVersion": targetSdkVersion,
4643
},
47-
deps = [":EspressoDeviceBasicSampleTestLib"],
44+
deps = [":EspressoDeviceSampleTestLib"],
4845
)
4946

5047
API_LEVELS = [
@@ -55,7 +52,7 @@ API_LEVELS = [
5552
]
5653

5754
[android_instrumentation_test(
58-
name = "EspressoDeviceBasicSampleInstrumentationTest_%s" % API_LEVEL,
55+
name = "EspressoDeviceSampleInstrumentationTest_%s" % API_LEVEL,
5956
target_device = "@android_test_support//tools/android/emulated_devices/generic_phone:android_%s_qemu2" % API_LEVEL,
60-
test_app = ":EspressoDeviceBasicSampleTest",
57+
test_app = ":EspressoDeviceSampleTest",
6158
) for API_LEVEL in API_LEVELS]

ui/espresso/EspressoDeviceSample/app/build.gradle

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,6 @@ android {
2525
unitTests {
2626
includeAndroidResources = true
2727
}
28-
managedDevices {
29-
devices {
30-
31-
// run with ../gradlew nexusOneApi30DebugAndroidTest
32-
nexusOneApi30(com.android.build.api.dsl.ManagedVirtualDevice) {
33-
// A lower resolution device is used here for better emulator performance
34-
device = "Nexus One"
35-
apiLevel = 30
36-
// Also use the AOSP ATD image for better emulator performance
37-
systemImageSource = "aosp-atd"
38-
}
39-
}
40-
}
4128
}
4229
}
4330

@@ -48,26 +35,12 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
4835
}
4936

5037
dependencies {
51-
// App dependencies
52-
implementation 'androidx.annotation:annotation:' + rootProject.androidxAnnotationVersion;
53-
implementation 'com.google.guava:guava:' + rootProject.guavaVersion
54-
55-
// Testing-only dependencies
5638
androidTestImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
57-
androidTestImplementation 'androidx.test:core:' + rootProject.coreVersion
58-
androidTestImplementation 'androidx.test:core-ktx:' + rootProject.coreVersion
5939
androidTestImplementation 'androidx.test.ext:junit:' + rootProject.extJUnitVersion
6040
androidTestImplementation 'androidx.test.ext:junit-ktx:' + rootProject.extJUnitVersion
61-
androidTestImplementation 'androidx.test:runner:' + rootProject.runnerVersion
62-
androidTestImplementation 'androidx.test.espresso:espresso-core:' + rootProject.espressoVersion
6341
androidTestImplementation 'androidx.test.espresso:espresso-device:' + rootProject.espressoDeviceVersion
6442

65-
testImplementation 'androidx.test:core:' + rootProject.coreVersion;
6643
testImplementation 'androidx.test.ext:junit:' + rootProject.extJUnitVersion
6744
testImplementation 'junit:junit:4.12'
6845
testImplementation 'org.robolectric:robolectric:' + rootProject.robolectricVersion
69-
testImplementation 'androidx.test.espresso:espresso-core:' + rootProject.espressoVersion
70-
testImplementation 'androidx.test.espresso:espresso-intents:' + rootProject.espressoVersion
71-
testImplementation 'androidx.test.ext:truth:' + rootProject.extTruthVersion
72-
testImplementation 'androidx.test.espresso:espresso-device:' + rootProject.espressoDeviceVersion
7346
}

ui/espresso/EspressoDeviceSample/app/src/androidTest/java/com/example/android/testing/espresso/EspressoDeviceSample/RequiresDisplayTest.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ import org.junit.runner.RunWith
2727
*/
2828
@RunWith(AndroidJUnit4::class)
2929
class RequiresDisplayTest {
30-
@Test
31-
fun shouldAlwaysRun() {}
32-
3330
@RequiresDisplay(
3431
widthSizeClass = WidthSizeClass.Companion.WidthSizeClassEnum.COMPACT,
3532
heightSizeClass = HeightSizeClass.Companion.HeightSizeClassEnum.COMPACT

ui/espresso/EspressoDeviceSample/app/src/main/AppManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
-->
1717

1818
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
19-
package="com.example.android.testing.espresso.BasicSample" >
19+
package="com.example.android.testing.espresso.EspressoDeviceSample" >
2020

2121
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="28" />
2222
</manifest>

ui/espresso/EspressoDeviceSample/build.gradle

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,8 @@ allprojects {
2727

2828
ext {
2929
buildToolsVersion = "32.0.0"
30-
androidxAnnotationVersion = "1.5.0"
3130
robolectricVersion = "4.9"
32-
guavaVersion = "31.1-android"
3331
extTruthVersion = "1.5.0-beta01"
34-
coreVersion = "1.5.0-beta01"
3532
extJUnitVersion = "1.1.4-beta01"
36-
runnerVersion = "1.5.0-beta01"
37-
espressoVersion = "3.5.0-beta01"
3833
espressoDeviceVersion = "1.0.0-alpha01"
3934
}

0 commit comments

Comments
 (0)