From 5944b5b8bf322188f1c585d6b4e5495e8a77347a Mon Sep 17 00:00:00 2001 From: AndiAJ Date: Tue, 27 Feb 2024 13:09:43 +0200 Subject: [PATCH] Bug 1882264 - Add logs to SettingsSubMenuOpenLinksInAppsRobot --- .../robots/SettingsSubMenuOpenLinksInAppsRobot.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuOpenLinksInAppsRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuOpenLinksInAppsRobot.kt index f10d5db94..1ee72b2cd 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuOpenLinksInAppsRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SettingsSubMenuOpenLinksInAppsRobot.kt @@ -4,6 +4,7 @@ package org.mozilla.fenix.ui.robots +import android.util.Log import androidx.test.espresso.Espresso.onView import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.matcher.ViewMatchers.hasSibling @@ -11,6 +12,7 @@ import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withText import org.hamcrest.CoreMatchers.allOf import org.mozilla.fenix.R +import org.mozilla.fenix.helpers.Constants.TAG import org.mozilla.fenix.helpers.DataGenerationHelper.getStringResource import org.mozilla.fenix.helpers.MatcherHelper.assertUIObjectExists import org.mozilla.fenix.helpers.MatcherHelper.itemContainingText @@ -44,26 +46,35 @@ class SettingsSubMenuOpenLinksInAppsRobot { verifySelectedOpenLinksInAppOption(selectedOpenLinkInAppsOption) } - fun verifySelectedOpenLinksInAppOption(openLinkInAppsOption: String) = + fun verifySelectedOpenLinksInAppOption(openLinkInAppsOption: String) { + Log.i(TAG, "verifySelectedOpenLinksInAppOption: Trying to verify that the $openLinkInAppsOption option is checked") onView( allOf( withId(R.id.radio_button), hasSibling(withText(openLinkInAppsOption)), ), ).check(matches(isChecked(true))) + Log.i(TAG, "verifySelectedOpenLinksInAppOption: Verified that the $openLinkInAppsOption option is checked") + } fun clickOpenLinkInAppOption(openLinkInAppsOption: String) { + Log.i(TAG, "clickOpenLinkInAppOption: Trying to click the $openLinkInAppsOption option") when (openLinkInAppsOption) { "Always" -> alwaysOption().click() "Ask before opening" -> askBeforeOpeningOption().click() "Never" -> neverOption().click() } + Log.i(TAG, "clickOpenLinkInAppOption: Clicked the $openLinkInAppsOption option") } 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") + Log.i(TAG, "goBack: Trying to click the navigate up button") goBackButton().click() + Log.i(TAG, "goBack: Clicked the navigate up button") SettingsRobot().interact() return SettingsRobot.Transition()