theapache64
05/08/2021, 4:50 PMCould not find androidx.annotation:annotation:1.1.0
when test executed. 🧵theapache64
05/08/2021, 4:50 PMtestImplementation(compose("org.jetbrains.compose.ui:ui-test-junit4"))
but am getting
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find androidx.annotation:annotation:1.1.0.
Here's my test
import androidx.compose.material.Text
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithText
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
import org.junit.Rule
import org.junit.jupiter.api.Test
class SplashScreenTest {
@get:Rule
val composeRule = createComposeRule()
@Test
fun `My Test`() {
runBlocking(Dispatchers.Main) {
composeRule.setContent {
Text(text = "Something")
}
composeRule.onNodeWithText("Something").assertExists()
}
}
}
theapache64
05/08/2021, 5:04 PMIgor Demin
05/08/2021, 5:17 PMtheapache64
05/08/2021, 5:34 PMlateinit property window has not been initialized
kotlin.UninitializedPropertyAccessException: lateinit property window has not been initialized
at androidx.compose.ui.test.junit4.DesktopComposeTestRule.getWindow(DesktopComposeTestRule.desktop.kt:64)
at androidx.compose.ui.test.junit4.DesktopComposeTestRule.setContent(DesktopComposeTestRule.desktop.kt:146)
Igor Demin
05/08/2021, 5:38 PMcreateComposeRule
this way?
@get:Rule
val rule = createComposeRule()
theapache64
05/08/2021, 6:16 PMIgor Demin
05/08/2021, 6:31 PMimport org.junit.jupiter.api.TestMaybe this is because you are using Junit 5. We didn't test Compose with it.
theapache64
05/09/2021, 2:50 PM