parent
ce19709eae
commit
6480f405e2
|
@ -4,6 +4,7 @@
|
|||
|
||||
package org.mozilla.fenix.ui
|
||||
|
||||
import org.junit.Ignore
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.mozilla.fenix.helpers.HomeActivityTestRule
|
||||
|
@ -37,6 +38,7 @@ class SearchTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore("This test cannot run on virtual devices due to camera permissions being required")
|
||||
@Test
|
||||
fun scanButtonTest() {
|
||||
homeScreen { }.dismissOnboarding()
|
||||
|
@ -44,7 +46,6 @@ class SearchTest {
|
|||
homeScreen {
|
||||
}.openSearch {
|
||||
clickScanButton()
|
||||
verifyScanPrompt()
|
||||
clickDenyPermission()
|
||||
clickScanButton()
|
||||
clickAllowPermission()
|
||||
|
|
|
@ -37,7 +37,6 @@ class SearchRobot {
|
|||
fun verifySearchView() = assertSearchView()
|
||||
fun verifyBrowserToolbar() = assertBrowserToolbarEditView()
|
||||
fun verifyScanButton() = assertScanButton()
|
||||
fun verifyScanPrompt() = assertScanPrompt()
|
||||
fun verifyShortcutsButton() = assertShortcutsButton()
|
||||
fun verifySearchWithText() = assertSearchWithText()
|
||||
fun verifyDuckDuckGoResults() = assertDuckDuckGoResults()
|
||||
|
@ -107,9 +106,15 @@ private fun allowPermissionButton(): UiObject {
|
|||
return mDevice.findObject(UiSelector().text("Allow"))
|
||||
}
|
||||
|
||||
private fun scanButton() = onView(allOf(withId(R.id.search_scan_button)))
|
||||
private fun scanButton(): ViewInteraction {
|
||||
mDevice.wait(Until.findObject(By.res("R.id.search_scan_button")), TestAssetHelper.waitingTime)
|
||||
return onView(allOf(withId(R.id.search_scan_button)))
|
||||
}
|
||||
|
||||
private fun shortcutsButton() = onView(withId(R.id.search_shortcuts_button))
|
||||
private fun shortcutsButton(): ViewInteraction {
|
||||
mDevice.wait(Until.findObjects(By.res("R.id.search_shortcuts_button")), TestAssetHelper.waitingTime)
|
||||
return onView(withId(R.id.search_shortcuts_button))
|
||||
}
|
||||
|
||||
private fun assertDuckDuckGoURL() {
|
||||
onView(allOf(withText(startsWith("https://duckduckgo.com"))))
|
||||
|
@ -129,10 +134,6 @@ private fun assertBrowserToolbarEditView() =
|
|||
onView(Matchers.allOf(withId(R.id.mozac_browser_toolbar_edit_url_view)))
|
||||
.check(matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
||||
private fun assertScanPrompt() =
|
||||
onView(Matchers.allOf(withText("Allow Firefox Preview to take pictures and record video?")))
|
||||
.check(matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
||||
private fun assertScanButton() =
|
||||
onView(allOf(withText("Scan")))
|
||||
.check(matches(ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
||||
|
|
Loading…
Reference in New Issue