From 16123a723743fe434f8f69c13997cfa32543de07 Mon Sep 17 00:00:00 2001 From: AndiAJ Date: Tue, 12 Mar 2024 13:02:26 +0200 Subject: [PATCH] Bug 1884904 - Add logs to SettingsSubMenuSetDefaultBrowserRobot --- .../fenix/ui/robots/SettingsSubMenuAboutRobot.kt | 16 ++++++++-------- .../SettingsSubMenuSetDefaultBrowserRobot.kt | 6 ++++++ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAboutRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAboutRobot.kt index 23f657a24..221a3f02f 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAboutRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuAboutRobot.kt @@ -76,21 +76,21 @@ class SettingsSubMenuAboutRobot { } fun verifyProductCompany() { - Log.i(TAG, "verifyVersionNumber: Trying to verify that the about section contains the company that produced the app info: ${"$appName is produced by Mozilla."}") + Log.i(TAG, "verifyProductCompany: Trying to verify that the about section contains the company that produced the app info: ${"$appName is produced by Mozilla."}") onView(withId(R.id.about_content)) .check(matches(withText(containsString("$appName is produced by Mozilla.")))) - Log.i(TAG, "verifyVersionNumber: Verified that the about section contains the company that produced the app info: ${"$appName is produced by Mozilla."}") + Log.i(TAG, "verifyProductCompany: Verified that the about section contains the company that produced the app info: \"$appName is produced by Mozilla.\"") } fun verifyCurrentTimestamp() { - Log.i(TAG, "verifyVersionNumber: Trying to verify that the about section contains \"debug build\"") + Log.i(TAG, "verifyCurrentTimestamp: Trying to verify that the about section contains \"debug build\"") onView(withId(R.id.build_date)) // Currently UI tests run against debug builds, which display a hard-coded string 'debug build' // instead of the date. See https://github.com/mozilla-mobile/fenix/pull/10812#issuecomment-633746833 .check(matches(withText(containsString("debug build")))) // This assertion should be valid for non-debug build types. // .check(BuildDateAssertion.isDisplayedDateAccurate()) - Log.i(TAG, "verifyVersionNumber: Verified that the about section contains \"debug build\"") + Log.i(TAG, "verifyCurrentTimestamp: Verified that the about section contains \"debug build\"") } fun verifyAboutToolbar() { @@ -110,12 +110,12 @@ class SettingsSubMenuAboutRobot { Log.i(TAG, "verifyWhatIsNewInFirefoxLink: Performed ${LISTS_MAXSWIPES}x a scroll action to the end of the about list") val firefox = TestHelper.appContext.getString(R.string.firefox) - Log.i(TAG, "verifyAboutToolbar: Trying to verify that the \"What’s new in $firefox\" link is visible") + Log.i(TAG, "verifyWhatIsNewInFirefoxLink: Trying to verify that the \"What’s new in $firefox\" link is visible") onView(withText("What’s new in $firefox")).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) - Log.i(TAG, "verifyAboutToolbar: Verified that the \"What’s new in $firefox\" link is visible") - Log.i(TAG, "verifyAboutToolbar: Trying to click the \"What’s new in $firefox\" link") + Log.i(TAG, "verifyWhatIsNewInFirefoxLink: Verified that the \"What’s new in $firefox\" link is visible") + Log.i(TAG, "verifyWhatIsNewInFirefoxLink: Trying to click the \"What’s new in $firefox\" link") onView(withText("What’s new in $firefox")).perform(click()) - Log.i(TAG, "verifyAboutToolbar: Clicked the \"What’s new in $firefox\" link") + Log.i(TAG, "verifyWhatIsNewInFirefoxLink: Clicked the \"What’s new in $firefox\" link") } fun verifySupport() { Log.i(TAG, "verifySupport: Trying to perform ${LISTS_MAXSWIPES}x a scroll action to the end of the about list") diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSetDefaultBrowserRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSetDefaultBrowserRobot.kt index 558cc892b..3b26702b3 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSetDefaultBrowserRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuSetDefaultBrowserRobot.kt @@ -4,16 +4,22 @@ package org.mozilla.fenix.ui.robots +import android.util.Log +import org.mozilla.fenix.helpers.Constants.TAG import org.mozilla.fenix.helpers.TestHelper.mDevice class SettingsSubMenuSetDefaultBrowserRobot { class Transition { fun goBack(interact: SettingsRobot.() -> Unit): SettingsRobot.Transition { + Log.i(TAG, "goBack: Waiting for device to be idle") mDevice.waitForIdle() + Log.i(TAG, "goBack: Waited for device to be idle") // We are now in system settings / showing a default browser dialog. // Really want to go back to the app. Not interested in up navigation like in other robots. + Log.i(TAG, "clearNotifications: Trying to click the device back button") mDevice.pressBack() + Log.i(TAG, "clearNotifications: Clicked the device back button") SettingsRobot().interact() return SettingsRobot.Transition()