Hi folks, I'm an SDET who is relatively new to wri...
# compose-android
i
Hi folks, I'm an SDET who is relatively new to writing native tests. My teams transitioned to leveraging the Compose Testing APIs for our E2E tests recently and I had a question about the ComposeTestRule parameter effectContext. We've had a couple of particular tests that have seemingly presented themselves as flaky for what seemed like rather unexplainable reasons. Every few runs or so of these tests, UI elements would fail to have updates to the View Model propagated to the View despite leveraging the synchronization aspects of the API like waitForIdle and waitUntil. Due to this flakiness I decided to investigate the internal mechanics of the Compose APIs, and decided to set the effectContext parameter to Dispatchers.Main. This has seemingly fixed that test, but has led to issues with others. I know it might be a tall order, but can someone explain what exactly this parameter does in a technical context , what the intended purpose and context of setting it is, and why it might have helped that other test? The UI Element that gets stuck is set by a collectAsState call which I can see the underlining implementation does inherit from produceState which does utilize a LaunchedEffect. Which the effectContext parameter according to the function document has an effect on.