Hey Guys, I'm new with the creation of tests.. on ...
# compose
j
Hey Guys, I'm new with the creation of tests.. on Compose. I followed this guide: https://dev.to/pchmielowski/automate-taking-screenshots-of-android-app-with-jetpack-compose-2950 I'm getting this error:
Copy code
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/platform/graphics/HardwareRendererCompat;
at androidx.compose.ui.test.android.WindowCapture_androidKt.withDrawingEnabled(WindowCapture.android.kt:55)
at androidx.compose.ui.test.android.WindowCapture_androidKt.captureRegionToImage(WindowCapture.android.kt:46)
at androidx.compose.ui.test.AndroidImageHelpers_androidKt.processSingleWindowScreenshot(AndroidImageHelpers.android.kt:138)
at androidx.compose.ui.test.AndroidImageHelpers_androidKt.captureToImage(AndroidImageHelpers.android.kt:75)
at androidx.compose.ui.test.AndroidImageHelpers_androidKt.captureToImage(AndroidImageHelpers.android.kt:50)
and...
Copy code
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.platform.graphics.HardwareRendererCompat" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar",
Everything that invokes the
captureToImage
crashes
Copy code
fun SemanticsNodeInteraction.assertBackgroundColor2(color: Color) {
  val capturedName = captureToImage().colorSpace.name
  assertEquals(color.colorSpace.name, capturedName)
}
I'm using Kotlin 1.6.21 with the latest stable versions of the following libs
Copy code
androidTestImplementation TestDependencies.composeTooling
  androidTestImplementation Compose.test
  androidTestImplementation Compose.uiTest
  androidTestImplementation TestDependencies.hamcrest
  androidTestImplementation TestDependencies.espressoCore
  androidTestImplementation TestDependencies.espressoContrib
  androidTestImplementation TestDependencies.archCore
  androidTestImplementation TestDependencies.coreTest
  androidTestImplementation TestDependencies.truth
  androidTestImplementation TestDependencies.androidJunit
  androidTestImplementation TestDependencies.androidJunitKtx
  androidTestImplementation TestDependencies.androidxTestOrchestrator

  androidTestImplementation TestDependencies.androidxTestRunner
  androidTestImplementation TestDependencies.androidxTestRules
  androidTestImplementation TestDependencies.androidxTestMonitor

  androidTestUtil TestDependencies.androidxTestOrchestrator
Maybe I missed something.. or not... any suggestions?
🧵 6