Bug 1882732 - Add logs to SettingsSubMenuSitePermissionsRobot

fenix/125.0
AndiAJ 4 months ago committed by mergify[bot]
parent 2e45df0898
commit 216c8cfdb2

@ -4,6 +4,7 @@
package org.mozilla.fenix.ui.robots package org.mozilla.fenix.ui.robots
import android.util.Log
import androidx.preference.R import androidx.preference.R
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import androidx.test.espresso.Espresso.onView import androidx.test.espresso.Espresso.onView
@ -17,6 +18,7 @@ import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText import androidx.test.espresso.matcher.ViewMatchers.withText
import org.hamcrest.CoreMatchers.allOf import org.hamcrest.CoreMatchers.allOf
import org.mozilla.fenix.helpers.Constants.TAG
import org.mozilla.fenix.helpers.TestHelper.scrollToElementByText import org.mozilla.fenix.helpers.TestHelper.scrollToElementByText
import org.mozilla.fenix.helpers.click import org.mozilla.fenix.helpers.click
@ -25,13 +27,20 @@ import org.mozilla.fenix.helpers.click
*/ */
class SettingsSubMenuSitePermissionsRobot { class SettingsSubMenuSitePermissionsRobot {
fun verifySitePermissionsToolbarTitle() = fun verifySitePermissionsToolbarTitle() {
Log.i(TAG, "verifySitePermissionsToolbarTitle: Trying to verify that the \"Site permissions\" toolbar title is visible")
onView(withText("Site permissions")).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) onView(withText("Site permissions")).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
Log.i(TAG, "verifySitePermissionsToolbarTitle: Verified that the \"Site permissions\" toolbar title is visible")
}
fun verifyToolbarGoBackButton() = fun verifyToolbarGoBackButton() {
Log.i(TAG, "verifyToolbarGoBackButton: Trying to verify that the navigate up toolbar button is visible")
goBackButton().check(matches(withEffectiveVisibility(Visibility.VISIBLE))) goBackButton().check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
Log.i(TAG, "verifyToolbarGoBackButton: Verified that the navigate up toolbar button is visible")
}
fun verifySitePermissionOption(option: String, summary: String = "") { fun verifySitePermissionOption(option: String, summary: String = "") {
Log.i(TAG, "verifySitePermissionOption: Trying to verify that the $option option with $summary summary is visible")
scrollToElementByText(option) scrollToElementByText(option)
onView( onView(
allOf( allOf(
@ -39,11 +48,14 @@ class SettingsSubMenuSitePermissionsRobot {
hasSibling(withText(summary)), hasSibling(withText(summary)),
), ),
).check(matches(withEffectiveVisibility(Visibility.VISIBLE))) ).check(matches(withEffectiveVisibility(Visibility.VISIBLE)))
Log.i(TAG, "verifySitePermissionOption: Trying to verify that the $option option with $summary summary is visible")
} }
class Transition { class Transition {
fun goBack(interact: SettingsRobot.() -> Unit): SettingsRobot.Transition { fun goBack(interact: SettingsRobot.() -> Unit): SettingsRobot.Transition {
Log.i(TAG, "goBack: Trying to click navigate up toolbar button")
goBackButton().click() goBackButton().click()
Log.i(TAG, "goBack: Clicked the navigate up toolbar button")
SettingsRobot().interact() SettingsRobot().interact()
return SettingsRobot.Transition() return SettingsRobot.Transition()
@ -52,13 +64,16 @@ class SettingsSubMenuSitePermissionsRobot {
fun openAutoPlay( fun openAutoPlay(
interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit, interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit,
): SettingsSubMenuSitePermissionsCommonRobot.Transition { ): SettingsSubMenuSitePermissionsCommonRobot.Transition {
Log.i(TAG, "openAutoPlay: Trying to perform scroll action to the \"Autoplay\" button")
onView(withId(R.id.recycler_view)).perform( onView(withId(R.id.recycler_view)).perform(
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>( RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
hasDescendant(withText("Autoplay")), hasDescendant(withText("Autoplay")),
), ),
) )
Log.i(TAG, "openAutoPlay: Performed scroll action to the \"Autoplay\" button")
Log.i(TAG, "openAutoPlay: Trying to click the \"Autoplay\" button")
openAutoPlay().click() openAutoPlay().click()
Log.i(TAG, "openAutoPlay: Clicked the \"Autoplay\" button")
SettingsSubMenuSitePermissionsCommonRobot().interact() SettingsSubMenuSitePermissionsCommonRobot().interact()
return SettingsSubMenuSitePermissionsCommonRobot.Transition() return SettingsSubMenuSitePermissionsCommonRobot.Transition()
@ -67,13 +82,16 @@ class SettingsSubMenuSitePermissionsRobot {
fun openCamera( fun openCamera(
interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit, interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit,
): SettingsSubMenuSitePermissionsCommonRobot.Transition { ): SettingsSubMenuSitePermissionsCommonRobot.Transition {
Log.i(TAG, "openCamera: Trying to perform scroll action to the \"Camera\" button")
onView(withId(R.id.recycler_view)).perform( onView(withId(R.id.recycler_view)).perform(
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>( RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
hasDescendant(withText("Camera")), hasDescendant(withText("Camera")),
), ),
) )
Log.i(TAG, "openCamera: Performed scroll action to the \"Camera\" button")
Log.i(TAG, "openCamera: Trying to click the \"Camera\" button")
openCamera().click() openCamera().click()
Log.i(TAG, "openCamera: Clicked the \"Camera\" button")
SettingsSubMenuSitePermissionsCommonRobot().interact() SettingsSubMenuSitePermissionsCommonRobot().interact()
return SettingsSubMenuSitePermissionsCommonRobot.Transition() return SettingsSubMenuSitePermissionsCommonRobot.Transition()
@ -82,13 +100,16 @@ class SettingsSubMenuSitePermissionsRobot {
fun openLocation( fun openLocation(
interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit, interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit,
): SettingsSubMenuSitePermissionsCommonRobot.Transition { ): SettingsSubMenuSitePermissionsCommonRobot.Transition {
Log.i(TAG, "openLocation: Trying to perform scroll action to the \"Location\" button")
onView(withId(R.id.recycler_view)).perform( onView(withId(R.id.recycler_view)).perform(
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>( RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
hasDescendant(withText("Location")), hasDescendant(withText("Location")),
), ),
) )
Log.i(TAG, "openLocation: Performed scroll action to the \"Location\" button")
Log.i(TAG, "openLocation: Trying to click the \"Location\" button")
openLocation().click() openLocation().click()
Log.i(TAG, "openLocation: Clicked the \"Location\" button")
SettingsSubMenuSitePermissionsCommonRobot().interact() SettingsSubMenuSitePermissionsCommonRobot().interact()
return SettingsSubMenuSitePermissionsCommonRobot.Transition() return SettingsSubMenuSitePermissionsCommonRobot.Transition()
@ -97,13 +118,16 @@ class SettingsSubMenuSitePermissionsRobot {
fun openMicrophone( fun openMicrophone(
interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit, interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit,
): SettingsSubMenuSitePermissionsCommonRobot.Transition { ): SettingsSubMenuSitePermissionsCommonRobot.Transition {
Log.i(TAG, "openMicrophone: Trying to perform scroll action to the \"Microphone\" button")
onView(withId(R.id.recycler_view)).perform( onView(withId(R.id.recycler_view)).perform(
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>( RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
hasDescendant(withText("Microphone")), hasDescendant(withText("Microphone")),
), ),
) )
Log.i(TAG, "openMicrophone: Performed scroll action to the \"Microphone\" button")
Log.i(TAG, "openMicrophone: Trying to click the \"Microphone\" button")
openMicrophone().click() openMicrophone().click()
Log.i(TAG, "openMicrophone: Clicked the \"Microphone\" button")
SettingsSubMenuSitePermissionsCommonRobot().interact() SettingsSubMenuSitePermissionsCommonRobot().interact()
return SettingsSubMenuSitePermissionsCommonRobot.Transition() return SettingsSubMenuSitePermissionsCommonRobot.Transition()
@ -112,13 +136,16 @@ class SettingsSubMenuSitePermissionsRobot {
fun openNotification( fun openNotification(
interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit, interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit,
): SettingsSubMenuSitePermissionsCommonRobot.Transition { ): SettingsSubMenuSitePermissionsCommonRobot.Transition {
Log.i(TAG, "openNotification: Trying to perform scroll action to the \"Notification\" button")
onView(withId(R.id.recycler_view)).perform( onView(withId(R.id.recycler_view)).perform(
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>( RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
hasDescendant(withText("Notification")), hasDescendant(withText("Notification")),
), ),
) )
Log.i(TAG, "openNotification: Performed scroll action to the \"Notification\" button")
Log.i(TAG, "openNotification: Trying to click the \"Notification\" button")
openNotification().click() openNotification().click()
Log.i(TAG, "openNotification: Clicked the \"Notification\" button")
SettingsSubMenuSitePermissionsCommonRobot().interact() SettingsSubMenuSitePermissionsCommonRobot().interact()
return SettingsSubMenuSitePermissionsCommonRobot.Transition() return SettingsSubMenuSitePermissionsCommonRobot.Transition()
@ -127,13 +154,16 @@ class SettingsSubMenuSitePermissionsRobot {
fun openPersistentStorage( fun openPersistentStorage(
interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit, interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit,
): SettingsSubMenuSitePermissionsCommonRobot.Transition { ): SettingsSubMenuSitePermissionsCommonRobot.Transition {
Log.i(TAG, "openPersistentStorage: Trying to perform scroll action to the \"Persistent Storage\" button")
onView(withId(R.id.recycler_view)).perform( onView(withId(R.id.recycler_view)).perform(
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>( RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
hasDescendant(withText("Persistent Storage")), hasDescendant(withText("Persistent Storage")),
), ),
) )
Log.i(TAG, "openPersistentStorage: Performed scroll action to the \"Persistent Storage\" button")
Log.i(TAG, "openPersistentStorage: Trying to click the \"Persistent Storage\" button")
openPersistentStorage().click() openPersistentStorage().click()
Log.i(TAG, "openPersistentStorage: Clicked the \"Persistent Storage\" button")
SettingsSubMenuSitePermissionsCommonRobot().interact() SettingsSubMenuSitePermissionsCommonRobot().interact()
return SettingsSubMenuSitePermissionsCommonRobot.Transition() return SettingsSubMenuSitePermissionsCommonRobot.Transition()
@ -142,13 +172,16 @@ class SettingsSubMenuSitePermissionsRobot {
fun openDRMControlledContent( fun openDRMControlledContent(
interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit, interact: SettingsSubMenuSitePermissionsCommonRobot.() -> Unit,
): SettingsSubMenuSitePermissionsCommonRobot.Transition { ): SettingsSubMenuSitePermissionsCommonRobot.Transition {
Log.i(TAG, "openDRMControlledContent: Trying to perform scroll action to the \"DRM-controlled content\" button")
onView(withId(R.id.recycler_view)).perform( onView(withId(R.id.recycler_view)).perform(
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>( RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
hasDescendant(withText("DRM-controlled content")), hasDescendant(withText("DRM-controlled content")),
), ),
) )
Log.i(TAG, "openDRMControlledContent: Performed scroll action to the \"DRM-controlled content\" button")
Log.i(TAG, "openDRMControlledContent: Trying to click the \"DRM-controlled content\" button")
openDrmControlledContent().click() openDrmControlledContent().click()
Log.i(TAG, "openDRMControlledContent: Clicked the \"DRM-controlled content\" button")
SettingsSubMenuSitePermissionsCommonRobot().interact() SettingsSubMenuSitePermissionsCommonRobot().interact()
return SettingsSubMenuSitePermissionsCommonRobot.Transition() return SettingsSubMenuSitePermissionsCommonRobot.Transition()
@ -157,13 +190,16 @@ class SettingsSubMenuSitePermissionsRobot {
fun openExceptions( fun openExceptions(
interact: SettingsSubMenuSitePermissionsExceptionsRobot.() -> Unit, interact: SettingsSubMenuSitePermissionsExceptionsRobot.() -> Unit,
): SettingsSubMenuSitePermissionsExceptionsRobot.Transition { ): SettingsSubMenuSitePermissionsExceptionsRobot.Transition {
Log.i(TAG, "openExceptions: Trying to perform scroll action to the \"Exceptions\" button")
onView(withId(R.id.recycler_view)).perform( onView(withId(R.id.recycler_view)).perform(
RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>( RecyclerViewActions.scrollTo<RecyclerView.ViewHolder>(
hasDescendant(withText("Exceptions")), hasDescendant(withText("Exceptions")),
), ),
) )
Log.i(TAG, "openExceptions: Performed scroll action to the \"Exceptions\" button")
Log.i(TAG, "openExceptions: Trying to click the \"Exceptions\" button")
openExceptions().click() openExceptions().click()
Log.i(TAG, "openExceptions: Clicked the \"Exceptions\" button")
SettingsSubMenuSitePermissionsExceptionsRobot().interact() SettingsSubMenuSitePermissionsExceptionsRobot().interact()
return SettingsSubMenuSitePermissionsExceptionsRobot.Transition() return SettingsSubMenuSitePermissionsExceptionsRobot.Transition()

Loading…
Cancel
Save