Having some issues with Espresso and Compose inter...
# compose
p
Having some issues with Espresso and Compose interoperability will post code examples in thread. Espresso seems unable to find Compose elements even if I'm trying to find them by text rather than ID:s. There is the ComposeTestRule class but I can't use that because it does not seems to support launching activities with custom intents? I'm setting the Compose layouts inside fragments
Copy code
override fun onCreateView(
    inflater: LayoutInflater,
    container: ViewGroup?,
    savedInstanceState: Bundle?
): View {
    return ComposeView(requireContext()).apply {
        setContent {
            MyComposeView()
        }
    }
}
Copy code
onView(withText(text)).perform(click())
Copy code
fun clickIUnderstandButton() =
    apply { clickViewWithText(TextKeys.Generic_Next) }
Copy code
Button(
    onClick = { onNextClick() },
    colors = ButtonDefaults.buttonColors(backgroundColor = Color(lightButtonOnWhiteBg)),
    modifier = Modifier
        .fillMaxWidth()
        .padding(vertical = 15.dp, horizontal = 15.dp)
) {
    Text(
        text = TextKeys.Generic_Next.toString(),
        color = Color(vtextOnLightButtonOnWhiteBg),
        fontSize = 21.sp,
        fontFamily = FontFamily(appFonts.regular)
    )
}