Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

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

Merged
merged 1 commit into from
Aug 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 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 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.Before
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
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() {

Expand Down Expand Up @@ -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) }
Expand Down