gpaligot
10/19/2021, 7:34 PMdarkmoon_uk
10/20/2021, 5:04 AMUgi
10/20/2021, 8:55 AMUgi
10/20/2021, 8:59 AMval composeJUnit4 = "org.jetbrains.compose.ui:ui-test-junit4"
val commonTest by getting {
dependencies {
implementation(compose(Deps.Common.Test.composeJUnit4)) {
exclude("net.java.dev.jna", "jna")
}
}
}
And then in jvmTest or whatever your test source set is something like this
class PlaceholderTest {
@get:Rule
val composeTestRule = createComposeRule()
@Test
fun test() {
var clicked = false
composeTestRule.setContent {
Button(onClick = {
clicked = true
}){
Text("Hello")
}
}
composeTestRule.onNodeWithText("Hello").performClick()
assertTrue(clicked)
}
}
Ugi
10/20/2021, 8:59 AMUgi
10/20/2021, 9:03 AMdarkmoon_uk
10/21/2021, 5:07 AMTODO()
in place of performTextInput
- of course this is a really fundamental method for testing most Apps, so the API is not so useful right now.darkmoon_uk
10/21/2021, 5:19 AMdarkmoon_uk
10/21/2021, 12:47 PMWindow
into the testRule
, it should be the content inside your window. It seems to place that inside a TestWindow
for you.
I wonder if that limits some forms of testing? Already I have some layout logic that depends on the Window size, but not sure this design leaves us with a way to change the Test Window size from its default?Ugi
10/22/2021, 9:10 AMUgi
10/22/2021, 9:18 AMdarkmoon_uk
10/22/2021, 9:44 AMUgi
10/22/2021, 9:49 AM