fal
12/09/2025, 6:30 PMprivate val composeTestRule: ComposeTestRule = createEmptyComposeRule()
// and then I launch my starting activity like:
ActivityScenario.launch<T>(startActivityIntent)
We of course need ComposeTestRule to be able to match semantics as it is SemanticsNodeInteractionsProvider . This is fine, but sometimes I will need to either manually advance the composeTestRule.mainClock or use functions like composeTestRule.waitUntil which under the hood advances the clock (if autoAdvance is true). If I don't do this and I have things like the following in my screen:
LaunchedEffect(Unit) {
delay(1000)
onEvent(ScreenEvent.CloseThis)
}
it will completely freeze the app and fail assertions. This level of control is great for precise UI tests where I want to specifically care about this, but from the perspective of an E2E test ideally I'd like to not care about this. It's the same when it comes to infinite animations and needing workarounds like withInfiniteAnimationFrameNanos . It feels like I should be able to not care if I don't want to. It seems like if I want to make E2E tests, I should instead do them through UiAutomator2 (which indeed is more black-box), but that has so many tradeoffs on speed and reliability that I feel like there should be a middle-ground no? Maybe I'm just super off-base here, so really curious on any opinions here, thanks!Vladimír Púpava
12/09/2025, 7:12 PMfal
12/10/2025, 10:48 AMLouis Pullen-Freilich [G]
12/10/2025, 3:35 PMThe general sentiment though I think remains, we have to be careful of implementation for the sake of our E2E tests and that somehow doesn't feel greatNot sure I really understand what you mean by this. You need to have some kind of synchronization barrier if the app state needs to settle in a test, and if the app state is driven by something like an animation or something external to the UI, then the test infra needs to be notified / know about it somehow
fal
12/11/2025, 3:40 PMval scope = rememberCoroutineScope()
and on this scope we launch a job to dismiss a notification after a delay. For the sake of tests we basically cannot do this, it needs to be a different scope, otherwise I'll have to manually advance the clock everytime we have a notification. And it wouldn't even make sense to be under an animation that gets disabled because here we do want to see the notification and possibly assert against it on the tests.
At the end of the day, I just think that everytime I need to change production code for my tests to work, it's intrusive.Louis Pullen-Freilich [G]
12/11/2025, 4:29 PMLouis Pullen-Freilich [G]
12/11/2025, 4:29 PMfal
12/11/2025, 5:23 PM