-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Several tests in SetupViewModelTest and LoginViewModelTest intermittently fail due to missed or overwritten emissions from state flows. These tests often hang or timeout with UncompletedCoroutinesError, especially when intermediate states (like LOADING, SAVING_TOKEN, etc.) are not collected in time during the test execution.
This makes the tests flaky and unreliable despite correct logic in the ViewModel implementation.
Examples:
testGetAuthToken_successfulFlow_setsStateToSuccessEventually(SetupViewModelTest)testAuthStatus_tokenIsValid_setsStateToLoggedInEventually(LoginViewModelTest)
Steps to Reproduce
- Run the instrumented tests using
./gradlew connectedDebugAndroidTest - Observe that certain tests randomly hang or fail
- Rerun without changing the code — sometimes they pass, sometimes not
Expected Behavior
All state emission-based tests should deterministically pass when the underlying logic is correct. State transitions like LOADING → LOGGED_IN or FETCHING_TOKEN → SUCCESS should be reliably captured by the test collectors.
Screenshots or Videos (if applicable)
No response
Device/Emulator Information
No response
Android Version
No response
Log Output (if applicable)
com.notifier.app.auth.presentation.login.LoginViewModelTest > testAuthStatus_tokenIsValid_setsStateToLoggedInEventually[emulator-5554 - 13] FAILED
kotlinx.coroutines.test.UncompletedCoroutinesError: After waiting for 1m, the test body did not run to completion
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$2$1$2.invokeSuspend$lambda$0(TestBuilders.kt:353)
com.notifier.app.auth.presentation.setup.SetupViewModelTest > testGetAuthToken_networkError_setsStateToFailedEventually_emitsNetworkErrorEvent[emulator-5554 - 13] FAILED
kotlinx.coroutines.test.UncompletedCoroutinesError: After waiting for 1m, the test body did not run to completionReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working