From 71ea2a990e7c4cffb84a16d43b1ca452af57c040 Mon Sep 17 00:00:00 2001 From: AndiAJ Date: Mon, 11 Mar 2024 14:15:43 +0200 Subject: [PATCH] Bug 1884653 - Add logs to AccountSettingsRobot --- .../fenix/ui/robots/AccountSettingsRobot.kt | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/AccountSettingsRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/AccountSettingsRobot.kt index 12164ca64..e411fc908 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/AccountSettingsRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/AccountSettingsRobot.kt @@ -4,45 +4,66 @@ package org.mozilla.fenix.ui.robots +import android.util.Log import androidx.test.espresso.Espresso import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.matcher.ViewMatchers +import androidx.test.espresso.matcher.ViewMatchers.Visibility import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility import org.hamcrest.CoreMatchers import org.mozilla.fenix.R +import org.mozilla.fenix.helpers.Constants.TAG import org.mozilla.fenix.helpers.click /** * Implementation of Robot Pattern for the URL toolbar. */ class AccountSettingsRobot { - fun verifyBookmarksCheckbox() = + fun verifyBookmarksCheckbox() { + Log.i(TAG, "verifyBookmarksCheckbox: Trying to verify that the bookmarks check box is visible") bookmarksCheckbox().check( matches( withEffectiveVisibility( - ViewMatchers.Visibility.VISIBLE, + Visibility.VISIBLE, ), ), ) + Log.i(TAG, "verifyBookmarksCheckbox: Verified that the bookmarks check box is visible") + } - fun verifyHistoryCheckbox() = + fun verifyHistoryCheckbox() { + Log.i(TAG, "verifyHistoryCheckbox: Trying to verify that the history check box is visible") historyCheckbox().check( matches( withEffectiveVisibility( - ViewMatchers.Visibility.VISIBLE, + Visibility.VISIBLE, ), ), ) + Log.i(TAG, "verifyHistoryCheckbox: Verified that the history check box is visible") + } - fun verifySignOutButton() = - signOutButton().check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) - fun verifyDeviceName() = deviceName().check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) + fun verifySignOutButton() { + Log.i(TAG, "verifySignOutButton: Trying to verify that the \"Sign out\" button is visible") + signOutButton().check(matches(withEffectiveVisibility(Visibility.VISIBLE))) + Log.i(TAG, "verifySignOutButton: Verified that the \"Sign out\" button is visible") + } + + fun verifyDeviceName() { + Log.i(TAG, "verifyDeviceName: Trying to verify that the \"Device name\" option is visible") + deviceName().check(matches(withEffectiveVisibility(Visibility.VISIBLE))) + Log.i(TAG, "verifyDeviceName: Verified that the \"Device name\" option is visible") + } class Transition { fun disconnectAccount(interact: SettingsRobot.() -> Unit): SettingsRobot.Transition { + Log.i(TAG, "disconnectAccount: Trying to click the \"Sign out\" button") signOutButton().click() + Log.i(TAG, "disconnectAccount: Clicked the \"Sign out\" button") + Log.i(TAG, "disconnectAccount: Trying to click the \"Disconnect\" button") disconnectButton().click() + Log.i(TAG, "disconnectAccount: Clicked the \"Disconnect\" button") SettingsRobot().interact() return SettingsRobot.Transition()