tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit ee6e36ad2f05d7924770dd233e5aac67cff1ff14
parent 863296ba9fd460379bd0e14a83fa65037a7e3b55
Author: AndiAJ <andiaj@users.noreply.github.com>
Date:   Fri,  9 Jan 2026 14:23:13 +0000

Bug 1995738 - Fix verifyTheExtensionInstallationTest UI test r=aaronmt

The UI test was flaky when trying to verify the "Extensions" button while an extensions was installed.

It constantly failed because of a **ComposeNotIdleException**.
This was happening because Compose was busy (recomposing, running animations, collecting flows, etc.).

**waitUntilAtLeastOneExists** only waits for a node to appear in the semantics tree but it doesn't ensure that Compose is idle.
**assertIsDisplayed** requires an idle Compose state, causing the assertion to run while recomposition or animations are still in progress.

To overcome these inconsistencies, I've switched from doing the assertion with Compose to UIAutomator.

  - **verifyTheExtensionInstallationTest** - successfully passed 50x on Firebase ✅
  - ** verifyTheExtensionMenuListWhileExtensionsAreDisabledTest** (disabled because of the same problem) - successfully passed 50x on Firebase ✅
  - **verifyUBlockWorksInPrivateModeTest** and  **verifyUBlockWorksInNormalModeTest**(use the verifyExtensionsButtonWithInstalledExtension function) - successfully passed 25x on Firebase ✅

Differential Revision: https://phabricator.services.mozilla.com/D278466

Diffstat:
Mmobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/MainMenuTest.kt | 1-
Mmobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ThreeDotMenuMainRobot.kt | 15+++++----------
2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/MainMenuTest.kt b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/MainMenuTest.kt @@ -771,7 +771,6 @@ class MainMenuTest : TestSetup() { } // TestRail link: https://mozilla.testrail.io/index.php?/cases/view/3080162 - @Ignore("Failing, see: https://bugzilla.mozilla.org/show_bug.cgi?id=2002573") @SmokeTest @Test fun verifyTheExtensionMenuListWhileExtensionsAreDisabledTest() { diff --git a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ThreeDotMenuMainRobot.kt b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/ThreeDotMenuMainRobot.kt @@ -46,6 +46,7 @@ import org.mozilla.fenix.helpers.MatcherHelper.assertUIObjectExists import org.mozilla.fenix.helpers.MatcherHelper.itemContainingText import org.mozilla.fenix.helpers.MatcherHelper.itemWithDescription import org.mozilla.fenix.helpers.MatcherHelper.itemWithResId +import org.mozilla.fenix.helpers.MatcherHelper.itemWithResIdAndDescription import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime import org.mozilla.fenix.helpers.TestAssetHelper.waitingTimeLong import org.mozilla.fenix.helpers.TestAssetHelper.waitingTimeShort @@ -376,16 +377,10 @@ class ThreeDotMenuMainRobot(private val composeTestRule: ComposeTestRule) { @OptIn(ExperimentalTestApi::class) fun verifyExtensionsButtonWithInstalledExtension(extensionTitle: String) { - Log.i(TAG, "verifyExtensionsButtonWithInstalledExtension: Waiting for $waitingTime for the collapsed \"Extensions\" button with installed $extensionTitle to exist.") - composeTestRule.waitUntilAtLeastOneExists(hasContentDescription(extensionTitle, substring = true, ignoreCase = true), waitingTime) - Log.i(TAG, "verifyExtensionsButtonWithInstalledExtension: Waited for $waitingTime for the collapsed \"Extensions\" button with installed $extensionTitle to exist.") - Log.i(TAG, "verifyExtensionsButtonWithInstalledExtension: Trying to verify that the collapsed \"Extensions\" button with installed $extensionTitle exists.") - composeTestRule.onNode( - hasTestTag("mainMenu.extensions"), - ).assert( - hasContentDescription(extensionTitle, substring = true, ignoreCase = true), - ).assertIsDisplayed() - Log.i(TAG, "verifyExtensionsButtonWithInstalledExtension: Verified that the collapsed \"Extensions\" button with installed $extensionTitle exists.") + Log.i(TAG, "verifyExtensionsButtonWithInstalledExtension: Waiting for the compose test rule to be idle.") + composeTestRule.waitForIdle() + Log.i(TAG, "verifyExtensionsButtonWithInstalledExtension: Waited for the compose test rule to be idle.") + assertUIObjectExists(itemWithResIdAndDescription("mainMenu.extensions", extensionTitle)) } @OptIn(ExperimentalTestApi::class)