You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: core/ui/contract/src/commonTest/kotlin/net/thunderbird/core/ui/contract/mvi/UnidirectionalViewModelKtTest.kt
* Platform-agnostic test harness for Compose UI tests.
10
11
*
11
12
* The harness wraps the platform-specific [androidx.compose.ui.test.v2.runComposeUiTest] implementation and exposes a
12
13
* common [ComposeUiTestScope].
14
+
*
15
+
* @param mainDispatcher Optional dispatcher to install as [kotlinx.coroutines.Dispatchers.Main] for each
16
+
* [runComposeTest] call. When set and [runComposeTest] uses the default [effectContext], the same dispatcher is also
17
+
* used as Compose's effect context.
13
18
*/
14
-
publicexpectabstractclassComposeUiTestHarness() {
19
+
publicexpectabstractclassComposeUiTestHarness(
20
+
mainDispatcher:TestDispatcher? = null,
21
+
) {
15
22
16
23
/**
17
24
* Runs a Compose UI test.
18
25
*
19
26
* The parameters mirror [androidx.compose.ui.test.v2.runComposeUiTest]. [effectContext] is used for composition,
20
27
* `LaunchedEffect`, `rememberCoroutineScope`, and the main test clock. [runTestContext] is used for the test block.
21
28
* Compose requires these contexts to not share a [kotlinx.coroutines.test.TestCoroutineScheduler].
29
+
* If this harness was created with a main dispatcher and [effectContext] is left as [EmptyCoroutineContext], the main
30
+
* dispatcher is used as [effectContext].
22
31
*
23
32
* @param effectContext The [CoroutineContext] to use for the [androidx.compose.ui.test.v2.runComposeUiTest] implementation.
24
-
* @param runTestContext The [kotlinx.coroutines.test.StandardTestDispatcher] to use for the [androidx.compose.ui.test.v2.runComposeUiTest] implementation.
33
+
* @param runTestContext The [CoroutineContext] to use for the [androidx.compose.ui.test.v2.runComposeUiTest] implementation.
25
34
* @param testTimeout The timeout for the test, defaults to 60 seconds.
26
35
* @param block The block of code to execute within the Compose UI test harness.
27
36
*/
@@ -32,3 +41,12 @@ public expect abstract class ComposeUiTestHarness() {
0 commit comments