Repository navigation
Conversation
Glide's disk cache renames its journal while it rebuilds it. When the file disappears between exists() and delete(), delete() returns false and cleanDir() threw IOException. This broke ClearAppSettingsRule (e.g. WkdClientTest on CI). Treat it as an error only when the file still exists.
androidx.test takeScreenshot() redraws the app windows on the main thread. When a window is being destroyed after a failure, it crashes the app process with NPE in ViewCapture.forceRedraw. The crash hides the original failure and stops RetryRule. UiAutomation takes the screenshot on the system side, and any screenshot error is now only logged.
RetryRule printed only "run N failed". Print the stack trace too, so a failure hidden by a successful retry can be found in logcat.
On a slow emulator the IME session restarts after the focus change and
typed characters are lost ("message" became "essage" in
EncryptedReplyComposeGmailApiFlow). fillInAllFields() now inserts the
message at the cursor directly and keeps existing text, e.g. a
signature.
PassPhrasesInRAMService clears expired pass phrases once per DELAY_TIMEOUT, counted from the service start, and the screen is updated asynchronously. Wait for the result instead of one check after a fixed sleep.
- Clicking Send during the recipient lookup shows a "please wait" toast instead of the dialog. The popup tests now wait until the recipient chip is settled. - The chip color check in CreateMessageFragmentDisallowAttesterSearchForDomainInIsolationTest now waits for the lookup result. - typeText() lost characters when the IME session restarted (the recipient became "...@flowcrypt.te"), so these tests use replaceText().
On slow emulators Gboard restarts its input session after focus
changes, and the app drops text committed to the old session
("Session id mismatch ... commitText" in logcat). typeText() then loses
characters, e.g. "message" became "essage" and "...@flowcrypt.test"
became "...@flowcrypt.te".
ci-wait-for-emulator.sh now disables Gboard and the Google TTS voice
IME (the system falls back to it without Gboard), so Espresso key
events go to the view directly. On a CI-like emulator 44 typeText-heavy
tests ran in ~622s without an IME vs 680-813s with Gboard, with no new
failures. Set DISABLE_IME=0 to keep the keyboard.
# Conflicts: # FlowCrypt/src/androidTest/java/com/flowcrypt/email/base/BaseTest.kt # FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/gmailapi/passwordprotected/BaseComposeScreenPasswordProtectedDisallowedTermsTest.kt # FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/gmailapi/passwordprotected/ComposeScreenPasswordProtectedDisallowedTermsReFetchConfigurationFlowTest.kt # script/ci-wait-for-emulator.sh
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 2, follows #3340) and re-enables 3 of them.
Most failures are races with recipient lookups and lost key events on the compose screen:
typeText(). On a slow emulator the IME restarts its input session and the app drops text committed to the old session (Session id mismatch ... commitTextin logcat), e.g."message"->"essage"or a recipient...@flowcrypt.te.ci-wait-for-emulator.shnow disables the IME (Gboard and the Google TTS voice IME) on test emulators.DISABLE_IME=0keeps the keyboard.insertTextAtCursor()view action inserts text without key events.BaseComposeScreenTest.fillInAllFields()uses it for the message body.replaceText()instead oftypeText()for recipients, subject and message.waitUntilRecipientChipIsSettled()instead of a single chip check orThread.sleep().Fixed tests:
ComposeScreenFlowTest#testEmptyEmailSubject: fixed and re-enabledComposeScreenFlowTest#testSelectImportPublicKeyFromPopUp: fixed and re-enabled (also replaced a 5 ×Thread.sleep(1000)clipboard loop withwaitUntil)CreateMessageFragmentDisallowAttesterSearchInIsolationTest#testDisallowLookupOnAttester: fixed and re-enabledComposeScreenFlowTest#testSelectedRemoveRecipientFromPopUp,#testSelectedStandardEncryptionTypeFromPopUp,#testSelectedCopyFromOtherContactFromPopUpCreateMessageFragmentDisallowAttesterSearchForDomainInIsolationTest#testCanLookupThisRecipientOnAttesterPrivateKeyDetailsFragmentPassInRamFlexibleTimeFlowTest#testInMemoryPassPhraseSessionLengthParameter: waits until the pass phrase expires instead of a fixedThread.sleep(DELAY_TIMEOUT). The service can start late on a slow emulator.Test infrastructure:
RetryRuleprints the stack trace of every failed run, so failures hidden by a successful retry are visible in logcat.ScreenshotTestRuletakes screenshots viaUiAutomation.androidx.testtakeScreenshot()force-redraws app windows and could crash the app process (NPE inViewCapture.forceRedraw) when a window was being destroyed, which hid the original failure and stoppedRetryRule. A screenshot error no longer replaces the original failure.FileAndDirectoryUtils: a file removed by another component (e.g. Glide's disk cache) during directory cleanup is not reported as an error.docs/testing-like-ci.md: how to repeat a test from a class with a@ClassRulemock web server (RepeatableAndroidJUnit4ClassRunnerstarts the rule twice and fails withEADDRINUSE).Verified on a CI-like slow emulator (
docs/testing-like-ci.md,RetryRule(1)): e.g.testEmptyEmailSubjectfailed 4 of 5 runs before the fix and passed 15 of 15 after it. The wholeComposeScreenFlowTestclass passed without retries.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):