Enables emulatorControl from convention plugins

Change-Id: I2d544e9605b7c24eb8cf6528425bd95ab9b1e51f
ja/edge-to-edge-dropshots
Jose Alcérreca 8 months ago
parent ec53bddb9b
commit 9c101f2224

@ -61,15 +61,6 @@ android {
excludes.add("/META-INF/{AL2.0,LGPL2.1}") excludes.add("/META-INF/{AL2.0,LGPL2.1}")
} }
} }
testOptions {
unitTests {
isIncludeAndroidResources = true
}
// Espresso Device
emulatorControl {
enable = true
}
}
namespace = "com.google.samples.apps.nowinandroid" namespace = "com.google.samples.apps.nowinandroid"
} }

@ -91,7 +91,6 @@ class EdgeToEdgeTest {
@Before @Before
fun enableDemoMode() { fun enableDemoMode() {
UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()).apply {
executeShellCommand( executeShellCommand(
"settings put global development_settings_enabled 1", "settings put global development_settings_enabled 1",
) )
@ -121,7 +120,6 @@ class EdgeToEdgeTest {
"network -e satellite hide", "network -e satellite hide",
) )
} }
}
@After @After
fun disableDemoMode() { fun disableDemoMode() {
@ -332,7 +330,7 @@ class EdgeToEdgeTest {
private fun executeShellCommand(command: String) { private fun executeShellCommand(command: String) {
runOnUiThread { runOnUiThread {
InstrumentationRegistry.getInstrumentation().uiAutomation.executeShellCommand(command) UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()).executeShellCommand(command)
} }
// ADB commands are not synchronized. This sleep was found empirically. // ADB commands are not synchronized. This sleep was found empirically.
Thread.sleep(20) Thread.sleep(20)

@ -42,6 +42,8 @@ class AndroidApplicationConventionPlugin : Plugin<Project> {
@Suppress("UnstableApiUsage") @Suppress("UnstableApiUsage")
testOptions.animationsDisabled = true testOptions.animationsDisabled = true
configureGradleManagedDevices(this) configureGradleManagedDevices(this)
testOptions.emulatorControl.enable = true
// testOptions.unitTests.isIncludeAndroidResources
} }
extensions.configure<ApplicationAndroidComponentsExtension> { extensions.configure<ApplicationAndroidComponentsExtension> {
configurePrintApksTask(this) configurePrintApksTask(this)

@ -32,6 +32,7 @@ class AndroidFeatureConventionPlugin : Plugin<Project> {
extensions.configure<LibraryExtension> { extensions.configure<LibraryExtension> {
testOptions.animationsDisabled = true testOptions.animationsDisabled = true
testOptions.emulatorControl.enable = true
configureGradleManagedDevices(this) configureGradleManagedDevices(this)
} }

@ -40,6 +40,7 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
defaultConfig.targetSdk = 35 defaultConfig.targetSdk = 35
defaultConfig.testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" defaultConfig.testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testOptions.animationsDisabled = true testOptions.animationsDisabled = true
testOptions.emulatorControl.enable = true
configureFlavors(this) configureFlavors(this)
configureGradleManagedDevices(this) configureGradleManagedDevices(this)
// The resource prefix is derived from the module name, // The resource prefix is derived from the module name,

Loading…
Cancel
Save