'compose.ui.test in multi module app problem with launching activity
I have a MainActivity in main app module, and then I have some feature modules. These feature modules has their own compose screens.
Using createAndroidComposeRule<MainActivity>() I can create a rule that launches mentioned activity but this way I can only have UI tests in main module, because feature modules doesn't know about MainActivity what so ever. Is there a way to have compose UI tests in their corresponding modules?
I am also using kaspresso, but I think this part is irrelevant.
@RunWith(AndroidJUnit4::class)
abstract class BaseUiTest : TestCase(
kaspressoBuilder = Kaspresso.Builder.withComposeSupport(
customize = {
flakySafetyParams = FlakySafetyParams.custom(timeoutMs = 5000, intervalMs = 1000)
},
lateComposeCustomize = { composeBuilder ->
composeBuilder.semanticsBehaviorInterceptors = composeBuilder.semanticsBehaviorInterceptors.filter {
it !is SystemDialogSafetySemanticsBehaviorInterceptor
}.toMutableList()
}
)
) {
@get:Rule
val composeTestRule = createAndroidComposeRule<MainActivity>() // this is the problem
}
I am new to testing overall, and even newer to testing UI written in compose, so sorry for this vague question.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
