1
0
Fork 0

No issue: Fix failing UI tests because of renamed views (#4527)

master
Emily Kager 2019-08-05 08:09:34 -07:00 committed by Colin Lee
parent bfd4849064
commit 890833d7ac
2 changed files with 15 additions and 18 deletions

View File

@ -17,18 +17,18 @@ import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.uiautomator.UiDevice
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.UiObject
import androidx.test.uiautomator.UiScrollable
import androidx.test.uiautomator.UiSelector
import androidx.test.uiautomator.Until
import org.hamcrest.CoreMatchers.allOf
import org.hamcrest.CoreMatchers.startsWith
import org.hamcrest.Matchers
import org.mozilla.fenix.R
import org.mozilla.fenix.helpers.TestAssetHelper
import androidx.test.uiautomator.UiSelector
import org.hamcrest.CoreMatchers.startsWith
/**
* Implementation of Robot Pattern for the search fragment.
@ -108,12 +108,12 @@ private fun allowPermissionButton(): UiObject {
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)))
return onView(allOf(withId(R.id.searchScanButton)))
}
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))
return onView(withId(R.id.searchShortcutsButton))
}
private fun assertDuckDuckGoURL() {

View File

@ -14,28 +14,25 @@ import androidx.test.rule.ActivityTestRule
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiSelector
import androidx.test.uiautomator.Until
import org.junit.After
import org.junit.Rule
import org.junit.Test
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
import org.mozilla.fenix.helpers.HomeActivityTestRule
import org.mozilla.fenix.helpers.TestAssetHelper
import tools.fastlane.screengrab.Screengrab
import tools.fastlane.screengrab.locale.LocaleTestRule
import br.com.concretesolutions.kappuccino.actions.ClickActions
import br.com.concretesolutions.kappuccino.extensions.type
import okhttp3.mockwebserver.MockWebServer
import org.hamcrest.Matchers
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityTestRule
import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.helpers.click
import org.mozilla.fenix.ui.robots.homeScreen
import org.mozilla.fenix.ui.robots.navigationToolbar
import org.mozilla.fenix.ui.robots.swipeToBottom
import tools.fastlane.screengrab.Screengrab
import tools.fastlane.screengrab.locale.LocaleTestRule
class MenuScreenShotTest : ScreenshotTest() {
@ -234,7 +231,7 @@ fun saveToCollectionButton() = Espresso.onView(Matchers.allOf(ViewMatchers.withI
fun collectionsButton() = Espresso.onView(Matchers.allOf(ViewMatchers.withId(R.id.collection_overflow_button))).click()
fun addBookmarkFolderButton() = Espresso.onView(Matchers.allOf(ViewMatchers.withId(R.id.add_bookmark_folder))).click()
fun confirmAddFolderButton() = Espresso.onView(Matchers.allOf(ViewMatchers.withId(R.id.confirm_add_folder_button))).click()
fun addFolderName() = Espresso.onView(Matchers.allOf(ViewMatchers.withId(R.id.bookmark_add_folder_title_edit)))
fun addFolderName() = Espresso.onView(Matchers.allOf(ViewMatchers.withId(R.id.bookmarkAddFolderTitleEdit)))
.type("folder")
fun bookmarkFolderMenu() = Espresso.onView(Matchers.allOf(ViewMatchers.withId(R.id.overflow_menu))).click()
fun editBookmarkFolder() = ClickActions.click { text(R.string.bookmark_menu_edit_button) }