Kaspresso падает в конструкторе
Решил освоить Kaspresso для ui тестирования, написал по образцу простой тест, но при инициализации он постоянно падает, в а чем причина никак не пойму
gradle.build моего фича модуля
plugins {
id(Plugins.ANDROID_LIBRARY)
kotlin(Plugins.KOTLIN_ANDROID)
id(Plugins.KOTLIN_PARCELIZE)
kotlin(Plugins.KOTLIN_KAPT)
id(Plugins.NAVIGATION_SAFE_ARGS)
}
android {
compileSdkVersion(AndroidConfig.COMPILE_SDK_VERSION)
defaultConfig {
minSdkVersion(AndroidConfig.MIN_SDK_VERSION)
targetSdkVersion(AndroidConfig.TARGET_SDK_VERSION)
testInstrumentationRunner = AndroidConfig.TEST_INSTRUMENTATION_RUNNER
testInstrumentationRunnerArguments["clearPackageData"] = "true"
}
buildFeatures {
viewBinding = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
sourceSets {
getByName("androidTest").java.srcDirs("src/androidTest/kotlin")
getByName("debug").java.srcDirs("src/debug/kotlin")
getByName("release").java.srcDirs("src/release/kotlin")
getByName("main").java.srcDirs("src/main/kotlin")
getByName("test").java.srcDirs("src/test/kotlin")
}
testOptions {
execution = "ANDROIDX_TEST_ORCHESTRATOR"
unitTests.isReturnDefaultValues = true
unitTests.isIncludeAndroidResources = true
}
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().all {
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}
dependencies {
// Modules
implementation(project(Modules.COMMON_NAV))
implementation(project(Modules.COMMON_RES))
implementation(project(Modules.COMMON_UTILS))
implementation(project(Modules.COMMON_VIEWS))
implementation(project(Modules.COMMON_PICKER_PHOTO))
implementation(project(Modules.CORE))
// Android
implementation(Dependencies.APPCOMPAT)
implementation(Dependencies.CONSTRAINT)
implementation(Dependencies.CORE_KTX)
implementation(Dependencies.SWIPE_REFRESH)
// Glide
implementation(Dependencies.GLIDE)
implementation(Dependencies.GLIDE_OKHTTP)
kapt(Dependencies.GLIDE_KAPT)
// Gson
implementation(Dependencies.GSON)
// Koin
implementation(Dependencies.KOIN_VIEWMODEL)
// Kotlin
implementation(Dependencies.KOTLIN)
// Lifecycle
implementation(Dependencies.LIFECYCLE_VIEWMODEL)
// Material Design
implementation(Dependencies.MATERIAL)
// Navigation
implementation(Dependencies.NAVIGATION_FRAGMENT)
implementation(Dependencies.NAVIGATION_UI_KTX)
// Network
implementation(Dependencies.OKSSE)
implementation(Dependencies.OKHTTP_LOGGING_INTERCEPTOR)
implementation(Dependencies.RETROFIT)
// Paging
implementation(Dependencies.PAGING)
// View Binding Delegate
implementation(Dependencies.VIEW_BINDING)
// androidTestImplementation(project(Modules.COMMON_PICKER_PHOTO))
debugImplementation("androidx.fragment:fragment-testing:1.5.4")
testImplementation("com.kaspersky.android-components:kaspresso:1.4.1")
testImplementation("junit:junit:4.13.2")
testImplementation("androidx.test:runner:1.5.1")
testImplementation("androidx.test:rules:1.5.0")
testImplementation("androidx.test.ext:junit:1.1.4")
testImplementation("androidx.test.ext:junit-ktx:1.1.4")
testImplementation("androidx.arch.core:core-testing:2.1.0")
testImplementation("androidx.test:core-ktx:1.5.0")
testImplementation("org.robolectric:robolectric:4.8.2")
androidTestImplementation("com.kaspersky.android-components:kaspresso:1.4.1")
androidTestImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test:runner:1.5.1")
androidTestImplementation("androidx.test:rules:1.5.0")
androidTestImplementation("androidx.test.ext:junit:1.1.4")
androidTestImplementation("androidx.test.ext:junit-ktx:1.1.4")
androidTestImplementation("androidx.arch.core:core-testing:2.1.0")
androidTestImplementation("androidx.test:core-ktx:1.5.0")
}
сам test класс
class FileSearchTest: TestCase() {
@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
)
@Test
fun openBottom() {
launchFragmentInContainer<FileSearchFragment>()
before {
startKoin {
testModule
}
}
run{
step("Open bottom pickerBar"){
FileSearchScreen {
loadButton.apply {
isVisible()
click()
}
}
}
step("Check visible bottom bar") {
// BottomPhotoPickerBarScreen {
// btnChooseFromGallery.isVisible()
// }
}
}
}
}
ошибка:
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/hamcrest/Matchers;
at androidx.test.espresso.matcher.ViewMatchers.withContentDescription(ViewMatchers.java:2)
at androidx.test.espresso.Espresso.<clinit>(Espresso.java:4)
at androidx.test.espresso.Espresso.setFailureHandler(Espresso.java:1)
at com.kaspersky.kaspresso.kaspresso.Kaspresso$Builder.build$kaspresso_release(Kaspresso.kt:983)
at com.kaspersky.kaspresso.testcases.api.testcase.BaseTestCase.<init>(BaseTestCase.kt:33)
at com.kaspersky.kaspresso.testcases.api.testcase.BaseTestCase.<init>(BaseTestCase.kt:27)
at com.kaspersky.kaspresso.testcases.api.testcase.TestCase.<init>(TestCase.kt:13)
at com.kaspersky.kaspresso.testcases.api.testcase.TestCase.<init>(TestCase.kt:11)
at org.complitech.faceneurovision.features.filesearch.test.FileSearchTest.<init>(FileSearchTest.kt:16)
... 32 trimmed
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.hamcrest.Matchers" on path: DexPathList[[zip file "/data/app/~~tkS5N8iH7g2-a-_f4qCxMQ==/org.complitech.faceneurovision.features.filesearch.test-PhuTObHjA0gQP4Z-F_8wIg==/base.apk"],nativeLibraryDirectories=[/data/app/~~tkS5N8iH7g2-a-_f4qCxMQ==/org.complitech.faceneurovision.features.filesearch.test-PhuTObHjA0gQP4Z-F_8wIg==/lib/x86_64, /data/app/~~tkS5N8iH7g2-a-_f4qCxMQ==/org.complitech.faceneurovision.features.filesearch.test-PhuTObHjA0gQP4Z-F_8wIg==/base.apk!/lib/x86_64, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 42 more
Что я упустил, почему он постоянно падает?