TestProject Forum

Support for Jetpack Compose?

Hey, there! Our dear Android devs are refactoring our app making more and more use of Jetpack Compose. The declared goal is to ultimately build the whole UI with it. As I am far from an expert on the implementation details I did a little research and found that UiAutomator (which is to my knowledge the driver used by TestProject) is and will be unable to locate any elements inside a Compose-View. If that holds true, we will soon be in some serious trouble because we won’t be able to use TestProject for our automated Android-App testing anymore. So my questions: What are we supposed to do? Will there be support for Compose in the near future? Or are we better off looking for an alternative take on test automation?
P.S.: Please tell me that I got it all wrong and there is no problem. I could really use that. :slight_smile:

Hi @severin.heidrich,
I checked a few apps that were built using jetpack compose and its working.
If you face any issue please let us know.

Kind regards

Hi @Tal.Efraim! Thanks for your quick response. I just tested other Compose components of our app and it worked fine. But there was one element which I could not locate. Maybe you can help here.

Think of a page where you can toggle some switches. Next to those switches there are two TextViews which describe what happens after you activate the switch. Our team decided it would be better, if you can toggle the switches by tapping the TextViews, too. So devs stacked a transparent Box just on top of the switch and the TextViews. Take a look at our production code:

internal fun CustomTextSwitchItem(
    switchToggledState: Boolean,
    onClickToggleSwitchState: () -> Unit,
    modifier: Modifier = Modifier,
    switchEnabledState: Boolean = true,
) {
        contentAlignment = Alignment.Center,
        modifier = Modifier
            .clickable { onClickToggleSwitchState() }
    ) {
            verticalAlignment = Alignment.CenterVertically,
            horizontalArrangement = Arrangement.SpaceBetween,
            modifier = modifier
        ) {
            Column(Modifier.weight(1f)) {
                Text(text = "Headline")
                Text(text = "SubHeadline")
                checked = switchToggledState,
                enabled = switchEnabledState,
                onCheckedChange = null

@Preview(widthDp = 480)
fun CustomPreview() {
        switchToggledState = false,
        onClickToggleSwitchState = {},
        modifier = Modifier,
        switchEnabledState = true

Is the box somehow blocking access to the switch element?