vide
03/12/2024, 8:27 PMrememberCoroutineScope()
?
I'm looking to do something like this:
@Composable fun Foo() { rememberCoroutineScope().launch { delay(1000) } }
@Test fun testSomething() { ...; composeRule.advanceTimeBy(1001); ...; }
Or would I need to inject a dispatcher and manually use that anywhere I would need to control time for tests?Zach Klippenstein (he/him) [MOD]
03/13/2024, 12:25 AMvide
03/13/2024, 1:54 PMvide
03/13/2024, 2:00 PM@ExperimentalTestApi
constructor(
activityRule: R,
effectContext: CoroutineContext = EmptyCoroutineContext,
activityProvider: (R) -> A,
) : this(
activityRule,
AndroidComposeUiTestEnvironment(effectContext) { activityProvider(activityRule) },
)
I'm looking to control the scheduler of other dispatchers (Default, IO) too by injecting those. I think there's no better way like for Main that is handled automatically?Zach Klippenstein (he/him) [MOD]
03/13/2024, 2:53 PM