1
package com.avito.instrumentation
3
import com.avito.test.gradle.TestProjectGenerator
4
import com.avito.test.gradle.ciRun
5
import com.avito.test.gradle.module.AndroidAppModule
6
import com.avito.test.gradle.plugin.plugins
7
import org.junit.jupiter.api.Test
8
import org.junit.jupiter.api.io.TempDir
11
internal class LocalEnvironmentTest {
14
fun `run local instrumentation by name - ok`(@TempDir projectDir: File) {
15
val moduleName = "app"
19
id("com.avito.android.gradle-logger")
25
id(instrumentationPluginId)
28
"import com.avito.instrumentation.reservation.request.Device",
29
"import com.avito.instrumentation.configuration.report.ReportConfig",
31
buildGradleExtra = instrumentationConfigurationWithCloudEmulator(),
35
).generateIn(projectDir)
39
":$moduleName:instrumentationNonCloudLocal",
43
tasksShouldBeTriggered(":$moduleName:instrumentationNonCloudLocal")
47
private fun instrumentationConfigurationWithCloudEmulator(): String = """
49
| outputDir.set(project.file("outputs"))
50
| report.set(ReportConfig.NoOp)
52
| instrumentationParams = mapOf(
53
| "jobSlug" to "FunctionalTests"
58
| register("nonCloud") {
59
| instrumentationParams = mapOf(
60
| "deviceName" to "api22"
65
| deviceName = "api22"
69
| minimumSuccessCount = 1
72
| staticDevicesReservation {
73
| device = Device.LocalEmulator.device(27)
82
| instrumentationParams = mapOf(
83
| "deviceName" to "api29"
88
| deviceName = "api29"
92
| minimumSuccessCount = 1
95
| staticDevicesReservation {
96
| device = Device.CloudEmulator(
99
| model = "Android_SDK_built_for_x86_64",
100
| image = "avitotech/android-emulator-29:915c1f20be",
113
| testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
114
| testInstrumentationRunnerArguments(mapOf("planSlug" to "AvitoAndroid"))