https://kotlinlang.org logo
Title
m

Marcin Wisniowski

11/06/2020, 10:51 PM
This was just released. You try it out and see how updating can look. You write the Compose testing blog post that will be referenced for years to come. It's experimental tech at this point, there are no established patterns, unless you establish them.
:thread-please: 1
👆 4
s

spierce7

11/06/2020, 10:57 PM
Well there either is a way or their isn’t. My question is mostly wondering if something such as
androidx.ui:ui-test
exists for desktop. i.e.
class MyComposeTest {

    @get:Rule
    val composeTestRule = createAndroidComposeRule<MyActivity>()
    // createComposeRule() if you don't need access to the activityTestRule

    @Test
    fun MyTest() {
        // Start the app
        composeTestRule.setContent {
            MyAppTheme {
                MainScreen(uiState = exampleUiState, ...)
            }
        }

        onNodeWithText("Continue").performClick()

        onNodeWithText("Welcome").assertIsDisplayed()
    }
}
or maybe it’s possible to use a subset of the android testing library to actually test compose desktop
a

Arkadii Ivanov

11/06/2020, 11:56 PM
If you keep UI dumb and move all the logic out, you can test everything but UI with plain unit tests. The only thing left is to test the dumb UI, which is much less important in this case.
Checkout the Todo example. There are unit and integration tests in the
list
module.
s

spierce7

11/07/2020, 4:07 AM
@Arkadii Ivanov There is no list module in the todo example.
main has some tests though and I assume that’s what your talking about
a

Arkadii Ivanov

11/07/2020, 6:46 AM
Yeah, the
main
module
i

Igor Demin

11/07/2020, 10:37 AM
or maybe it’s possible to use a subset of the android testing library to actually test compose desktop
Try this: https://kotlinlang.slack.com/archives/C01D6HTPATV/p1604652533173500?thread_ts=1604618624.149600&amp;cid=C01D6HTPATV