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

Commit

Permalink
For #21002: add missing steps to selectSearchEnginesShortcutTest, add…
Browse files Browse the repository at this point in the history
…PredefinedSearchEngineTest
  • Loading branch information
Oana Horvath authored and mergify[bot] committed Nov 18, 2021
1 parent 77672df commit 4892f0d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 52 deletions.
74 changes: 22 additions & 52 deletions app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -470,75 +470,45 @@ class SmokeTest {

@Test
// Verifies changing the default engine from the Search Shortcut menu
fun verifySearchEngineCanBeChangedTemporarilyUsingShortcuts() {
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)

homeScreen {
}.openSearch {
verifyKeyboardVisibility()
clickSearchEngineShortcutButton()
verifySearchEngineList(activityTestRule)
changeDefaultSearchEngine(activityTestRule, "Amazon.com")
verifySearchEngineIcon("Amazon.com")
}.goToSearchEngine {
mDevice.waitForIdle()
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
}.openTabDrawer {
}.openNewTab {
clickSearchEngineShortcutButton()
mDevice.waitForIdle()
changeDefaultSearchEngine(activityTestRule, "Bing")
verifySearchEngineIcon("Bing")
}.goToSearchEngine {
mDevice.waitForIdle()
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
}.openTabDrawer {
}.openNewTab {
clickSearchEngineShortcutButton()
mDevice.waitForIdle()
changeDefaultSearchEngine(activityTestRule, "DuckDuckGo")
verifySearchEngineIcon("DuckDuckGo")
}.goToSearchEngine {
mDevice.waitForIdle()
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
}.openTabDrawer {
}.openNewTab {
clickSearchEngineShortcutButton()
changeDefaultSearchEngine(activityTestRule, "Wikipedia")
verifySearchEngineIcon("Wikipedia")
}.goToSearchEngine {
mDevice.waitForIdle()
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
}.openTabDrawer {
// Checking whether the next search will be with default or not
}.openNewTab {
}.goToSearchEngine {
mDevice.waitForIdle()
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
}.openNavigationToolbar {
}.clickUrlbar {
verifyDefaultSearchEngine("Google")
fun selectSearchEnginesShortcutTest() {
val enginesList = listOf("DuckDuckGo", "Google", "Amazon.com", "Wikipedia", "Bing", "eBay")

for (searchEngine in enginesList) {
homeScreen {
}.openSearch {
verifyKeyboardVisibility()
clickSearchEngineShortcutButton()
verifySearchEngineList(activityTestRule)
changeDefaultSearchEngine(activityTestRule, searchEngine)
verifySearchEngineIcon(searchEngine)
}.submitQuery("mozilla ") {
verifyUrl(searchEngine)
}.goToHomescreen { }
}
}

@Test
// Ads a new search engine from the list of custom engines
fun addPredefinedSearchEngineTest() {
val searchEngine = "Reddit"

homeScreen {
}.openThreeDotMenu {
}.openSettings {
}.openSearchSubMenu {
openAddSearchEngineMenu()
verifyAddSearchEngineList()
addNewSearchEngine("YouTube")
verifyEngineListContains("YouTube")
addNewSearchEngine(searchEngine)
verifyEngineListContains(searchEngine)
}.goBack {
}.goBack {
}.openSearch {
verifyKeyboardVisibility()
clickSearchEngineShortcutButton()
activityTestRule.waitForIdle()
verifyEnginesListShortcutContains(activityTestRule, "YouTube")
verifyEnginesListShortcutContains(activityTestRule, searchEngine)
changeDefaultSearchEngine(activityTestRule, searchEngine)
}.submitQuery("mozilla ") {
verifyUrl(searchEngine)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,10 @@ private fun ComposeTestRule.assertSearchEngineList() {
onNodeWithText("Wikipedia")
.assertExists()
.assertIsDisplayed()

onNodeWithText("eBay")
.assertExists()
.assertIsDisplayed()
}

@OptIn(ExperimentalTestApi::class)
Expand Down

0 comments on commit 4892f0d

Please sign in to comment.