Repository navigation
Issue 3211 fix flaky tests part 3 - #3355
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes more flaky instrumentation tests that fail on slow CI emulators (part 3, follows #3340 and #3347), re-enables the ones disabled as flaky, and fixes an app bug found on the way.
App fix
AccountAliasesViewModel.fetchUpdates()fetched the Gmail aliases (sendAs) for the account fromgetActiveAccountSuspend(), but saved them withactiveAccountLiveData.value. That LiveData gets its value asynchronously (afterwithDecryptedInfo()). If the API response came first,updateAliases(null, ...)silently saved nothing, so the alias signatures were missing in the compose screen on a slow device. Now the aliases are saved for the same account they were fetched for.AccountAliasesViewModelTestreproduces it deterministically (the LiveData isn't observed, so it has no value) and fails without the fix.CI
ci-wait-for-emulator.shsetshide_error_dialogs. Right after boot a slow emulator can report an ANR even forsystem_server, and then "Process system isn't responding" comes back for the whole job. The dialog takes the window focus, so ~15 unrelated tests of a shard failed withRootViewWithoutFocusException.Fixed tests
Most fixes replace
Thread.sleep()and one-time checks with waits for an observable state, and usereplaceText()instead oftypeText().AttachmentDownloadingWithRestrictionFlowTest#testDownloadingAttachment: re-enabled. Waits for the "download complete" notification instead of a fixed sleep. The mock web server holds the attachment until the test checks the "downloading" dialog (the dialog closes itself after the download).MessagesListChangeGmailLabelsFlowTest#testLabelsManagement: waits until the labels dialog is loaded, for thebatchModifyrequest and for the database update. UsesuseCommonIdling = false.MessageDetailsChangeGmailLabelsFlowTest#testLabelsManagement: re-enabled. Waits for the labels on the screen and in the dialog, and checks thebatchModifyrequest in the test thread (an assertion in the mock dispatcher didn't fail the test).ComposeScreen{NewMessage,Reply,Forward}WithGmailApiSignatureFlowTest#testAddingSignatureAfterStart: re-enabled. Wait for the signature text instead of a fixed sleep.MessageDetailsFlowTest: re-enabledtestFwdButton,testSignedMsgClearSignand 5testSignatureVerification...tests.testPgpBadgeswaits for the final badge types: while the sender's key is looked up, the list already has the final count withVERIFYING_SIGNATURE.ImportRecipientAllowAttesterSearchOnlyForDomainsFlowTest#testAllowAttesterSearchOnlyForDomains: re-enabled. Both tests of the class also check the Attester requests recorded by the mock web server, not only the text on the screen.CheckCredentialsFragmentInIsolationTest#testReturnExceptionForFailedAuthorization: re-enabled. Both tests wait for the fragment result instead of reading it right away, and the failed authorization test checks that the cause isAuthenticationFailedException.SignInScreenFlowTest#testUseGmail: waits up to 30 s for the Google Sign-in screen. On a slow emulator the Google Play services UI process can be frozen, and UiAutomator sees the new window later.Test infrastructure
BaseTest.waitUntilViewMatches()polls a view with its own failure handler (no screenshot per failed check) and fails with a regular Espresso error at the end.docs/testing-like-ci.md: the new emulator setup and thesystem_serverANR symptom.issue #3211
Tests (delete all except exactly one):
To be filled by reviewers
I have reviewed that this PR... (tick whichever items you personally focused on during this review):