Skip to content

Commit

Permalink
For mozilla-mobile#21133 fix openMainMenuSyncItemTest UI test
Browse files Browse the repository at this point in the history
  • Loading branch information
AndiAJ authored and mergify[bot] committed Sep 10, 2021
1 parent 2d2bac8 commit fc80628
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
3 changes: 2 additions & 1 deletion app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,10 @@ class SmokeTest {

navigationToolbar {
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
mDevice.waitForIdle()
}.openThreeDotMenu {
}.openSyncSignIn {
verifySyncSignInMenuHeader()
verifyTurnOnSyncMenu()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ package org.mozilla.fenix.ui.robots

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.espresso.matcher.ViewMatchers.Visibility
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.UiSelector
import org.hamcrest.CoreMatchers.allOf
import org.junit.Assert.assertTrue
import org.mozilla.fenix.R
import org.mozilla.fenix.helpers.TestAssetHelper.waitingTime
import org.mozilla.fenix.helpers.TestHelper.packageName
import org.mozilla.fenix.helpers.click

/**
Expand All @@ -22,7 +26,7 @@ import org.mozilla.fenix.helpers.click
class SyncSignInRobot {

fun verifyAccountSettingsMenuHeader() = assertAccountSettingsMenuHeader()
fun verifySyncSignInMenuHeader() = assertSyncSignInMenuHeader()
fun verifyTurnOnSyncMenu() = assertTurnOnSyncMenu()

class Transition {
val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())!!
Expand All @@ -46,7 +50,13 @@ private fun assertAccountSettingsMenuHeader() {
.check((matches(withEffectiveVisibility(Visibility.VISIBLE))))
}

private fun assertSyncSignInMenuHeader() {
onView(withText(R.string.sign_in_with_camera))
.check((matches(withEffectiveVisibility(Visibility.VISIBLE))))
private fun assertTurnOnSyncMenu() {
mDevice.findObject(UiSelector().resourceId("$packageName:id/container")).waitForExists(waitingTime)
assertTrue(
mDevice.findObject(
UiSelector()
.resourceId("$packageName:id/signInScanButton")
.resourceId("$packageName:id/signInEmailButton")
).waitForExists(waitingTime)
)
}

0 comments on commit fc80628

Please sign in to comment.