I want to UI test an Activity that uses Jetpack Compose. The docs provide some information on how to test such a screen with two variants:
@get:Rule val composeTestRule = createComposeRule()
if I don't need the activity itself to run and want to test just my composables or
@get:Rule val composeTestRule = createAndroidComposeRule<MyActivity>()
if I do need the activity.
In the second case, how can I pass an Intent with Extras to the activity?
I've tried:
@Before
fun setUp() {
composeTestRule.activity.intent = Intent().apply {
putExtra(
"someKey",
123
)
}
}
but the intent extras are still null in the activity.