|
|
|
@ -4,15 +4,12 @@
|
|
|
|
|
|
|
|
|
|
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.Visibility
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
|
|
|
|
import androidx.test.espresso.matcher.ViewMatchers.withText
|
|
|
|
|
import androidx.test.uiautomator.UiSelector
|
|
|
|
|
import org.hamcrest.CoreMatchers.allOf
|
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
|
import org.mozilla.fenix.helpers.Constants.TAG
|
|
|
|
|
import org.mozilla.fenix.helpers.MatcherHelper.assertUIObjectExists
|
|
|
|
|
import org.mozilla.fenix.helpers.MatcherHelper.itemWithResId
|
|
|
|
|
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
|
|
|
|
@ -25,9 +22,10 @@ import org.mozilla.fenix.helpers.click
|
|
|
|
|
*/
|
|
|
|
|
class SyncSignInRobot {
|
|
|
|
|
|
|
|
|
|
fun verifyAccountSettingsMenuHeader() = assertAccountSettingsMenuHeader()
|
|
|
|
|
fun verifyTurnOnSyncMenu() {
|
|
|
|
|
Log.i(TAG, "verifyTurnOnSyncMenu: Waiting for $waitingTime ms for sign in to sync menu to exist")
|
|
|
|
|
mDevice.findObject(UiSelector().resourceId("$packageName:id/container")).waitForExists(waitingTime)
|
|
|
|
|
Log.i(TAG, "verifyTurnOnSyncMenu: Waited for $waitingTime ms for sign in to sync menu to exist")
|
|
|
|
|
assertUIObjectExists(
|
|
|
|
|
itemWithResId("$packageName:id/signInScanButton"),
|
|
|
|
|
itemWithResId("$packageName:id/signInEmailButton"),
|
|
|
|
@ -36,7 +34,9 @@ class SyncSignInRobot {
|
|
|
|
|
|
|
|
|
|
class Transition {
|
|
|
|
|
fun goBack(interact: BrowserRobot.() -> Unit): BrowserRobot.Transition {
|
|
|
|
|
Log.i(TAG, "goBack: Trying to click the navigate up button")
|
|
|
|
|
goBackButton().click()
|
|
|
|
|
Log.i(TAG, "goBack: Clicked the navigate up button")
|
|
|
|
|
|
|
|
|
|
BrowserRobot().interact()
|
|
|
|
|
return BrowserRobot.Transition()
|
|
|
|
@ -46,10 +46,3 @@ class SyncSignInRobot {
|
|
|
|
|
|
|
|
|
|
private fun goBackButton() =
|
|
|
|
|
onView(allOf(withContentDescription("Navigate up")))
|
|
|
|
|
|
|
|
|
|
private fun assertAccountSettingsMenuHeader() {
|
|
|
|
|
// Replaced with the new string here, the test is assuming we are NOT signed in
|
|
|
|
|
// Sync tests in SettingsSyncTest are still TO-DO, so I'm not sure that we have a test for signing into Sync
|
|
|
|
|
onView(withText(R.string.preferences_account_settings))
|
|
|
|
|
.check((matches(withEffectiveVisibility(Visibility.VISIBLE))))
|
|
|
|
|
}
|
|
|
|
|