commit 5634917913a5d139a37698452732bc4ccabfef9b parent c0ed632a456fe182bc04f0e9d48ad48254d40fe5 Author: AndiAJ <andiaj@users.noreply.github.com> Date: Wed, 12 Nov 2025 11:34:34 +0000 Bug 1999589 - Fix verifyClockFormInteractionsTest UI test r=mcarare The UI test was failing on Firebase because the time was sometimes set by default to PM, meaning that when we set the time to 10:10 it would actually set it to 22:10 and we were checking for 10:10 To fix this problem, I've added an extra step, namely to always set the time to AM. Another problem noticed while checking locally, is that the time couldn't actually be selected properly due to some selector changes. (not sure why this hasn't occurred when Gabi did the first changes) To fix this I've updated the selectors used to select the time. The UI test [[ https://treeherder.mozilla.org/jobs?repo=try&selectedTaskRun=DL5hCDyxTeGVmr-6TCirWg.0&revision=2201050a90d520d1ccc37a50c8928926727435f6 | successfully passed ]] 25x on Firebase ✅ Differential Revision: https://phabricator.services.mozilla.com/D272217 Diffstat:
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/helpers/MatcherHelper.kt b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/helpers/MatcherHelper.kt @@ -54,6 +54,11 @@ object MatcherHelper { return mDevice.findObject(UiSelector().resourceId(resourceId).index(index)) } + fun itemWithClassNameAndContainingDescription(className: String, description: String): UiObject { + Log.i(TAG, "Looking for item with class name: $className and description: $description") + return mDevice.findObject(UiSelector().className(className).descriptionContains(description)) + } + fun itemWithClassNameAndIndex(className: String, index: Int): UiObject { Log.i(TAG, "Looking for item with class name: $className and index: $index") return mDevice.findObject(UiSelector().className(className).index(index)) diff --git a/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt b/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/ui/robots/BrowserRobot.kt @@ -65,6 +65,7 @@ import org.mozilla.fenix.helpers.MatcherHelper.assertItemTextEquals import org.mozilla.fenix.helpers.MatcherHelper.assertUIObjectExists import org.mozilla.fenix.helpers.MatcherHelper.assertUIObjectIsGone import org.mozilla.fenix.helpers.MatcherHelper.itemContainingText +import org.mozilla.fenix.helpers.MatcherHelper.itemWithClassNameAndContainingDescription import org.mozilla.fenix.helpers.MatcherHelper.itemWithDescription import org.mozilla.fenix.helpers.MatcherHelper.itemWithResId import org.mozilla.fenix.helpers.MatcherHelper.itemWithResIdAndText @@ -766,11 +767,21 @@ class BrowserRobot { } fun selectTime(hour: Int, minute: Int) { - Log.i(TAG, "selectTime: Trying to select time picker hour: $hour and minute: $minute") - itemWithDescription("$hour o'clock").click() + Log.i(TAG, "selectTime: Trying to select time picker hour: $hour and minute: $minute AM") + itemWithClassNameAndContainingDescription( + "android.widget.TextView", + "$hour o'clock", + ).click() waitForAppWindowToBeUpdated() - itemWithDescription("$minute minutes").click() - Log.i(TAG, "selectTime: Selected time picker hour: $hour and minute: $minute") + itemWithClassNameAndContainingDescription( + "android.widget.TextView", + "$minute minutes", + ).click() + itemWithResIdContainingText( + "$packageName:id/material_clock_period_am_button", + "AM", + ).click() + Log.i(TAG, "selectTime: Selected time picker hour: $hour and minute: $minute AM") } fun verifySelectedDate() {