Bug 1884653 - Add logs to AccountSettingsRobot

fenix/125.0
AndiAJ 3 months ago committed by mergify[bot]
parent 53c0e021de
commit 71ea2a990e

@ -4,45 +4,66 @@
package org.mozilla.fenix.ui.robots package org.mozilla.fenix.ui.robots
import android.util.Log
import androidx.test.espresso.Espresso import androidx.test.espresso.Espresso
import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.espresso.matcher.ViewMatchers.Visibility
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
import org.hamcrest.CoreMatchers import org.hamcrest.CoreMatchers
import org.mozilla.fenix.R import org.mozilla.fenix.R
import org.mozilla.fenix.helpers.Constants.TAG
import org.mozilla.fenix.helpers.click import org.mozilla.fenix.helpers.click
/** /**
* Implementation of Robot Pattern for the URL toolbar. * Implementation of Robot Pattern for the URL toolbar.
*/ */
class AccountSettingsRobot { class AccountSettingsRobot {
fun verifyBookmarksCheckbox() = fun verifyBookmarksCheckbox() {
Log.i(TAG, "verifyBookmarksCheckbox: Trying to verify that the bookmarks check box is visible")
bookmarksCheckbox().check( bookmarksCheckbox().check(
matches( matches(
withEffectiveVisibility( 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( historyCheckbox().check(
matches( matches(
withEffectiveVisibility( withEffectiveVisibility(
ViewMatchers.Visibility.VISIBLE, Visibility.VISIBLE,
), ),
), ),
) )
Log.i(TAG, "verifyHistoryCheckbox: Verified that the history check box is visible")
}
fun verifySignOutButton() = fun verifySignOutButton() {
signOutButton().check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE))) Log.i(TAG, "verifySignOutButton: Trying to verify that the \"Sign out\" button is visible")
fun verifyDeviceName() = deviceName().check(matches(withEffectiveVisibility(ViewMatchers.Visibility.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 { class Transition {
fun disconnectAccount(interact: SettingsRobot.() -> Unit): SettingsRobot.Transition { fun disconnectAccount(interact: SettingsRobot.() -> Unit): SettingsRobot.Transition {
Log.i(TAG, "disconnectAccount: Trying to click the \"Sign out\" button")
signOutButton().click() signOutButton().click()
Log.i(TAG, "disconnectAccount: Clicked the \"Sign out\" button")
Log.i(TAG, "disconnectAccount: Trying to click the \"Disconnect\" button")
disconnectButton().click() disconnectButton().click()
Log.i(TAG, "disconnectAccount: Clicked the \"Disconnect\" button")
SettingsRobot().interact() SettingsRobot().interact()
return SettingsRobot.Transition() return SettingsRobot.Transition()

Loading…
Cancel
Save