This repository has been archived by the owner on Feb 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Oana Horvath
committed
Feb 23, 2022
1 parent
81d8c38
commit 9980a76
Showing
6 changed files
with
241 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
160 changes: 160 additions & 0 deletions
160
app/src/androidTest/java/org/mozilla/fenix/ui/SettingsHomepageTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package org.mozilla.fenix.ui | ||
|
||
import okhttp3.mockwebserver.MockWebServer | ||
import org.junit.After | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.mozilla.fenix.customannotations.SmokeTest | ||
import org.mozilla.fenix.helpers.AndroidAssetDispatcher | ||
import org.mozilla.fenix.helpers.FeatureSettingsHelper | ||
import org.mozilla.fenix.helpers.HomeActivityIntentTestRule | ||
import org.mozilla.fenix.helpers.TestAssetHelper.getGenericAsset | ||
import org.mozilla.fenix.helpers.TestHelper.restartApp | ||
import org.mozilla.fenix.ui.robots.browserScreen | ||
import org.mozilla.fenix.ui.robots.homeScreen | ||
import org.mozilla.fenix.ui.robots.navigationToolbar | ||
|
||
/** | ||
* Tests for verifying the Homepage settings menu | ||
* | ||
*/ | ||
class SettingsHomepageTest { | ||
private lateinit var mockWebServer: MockWebServer | ||
private val featureSettingsHelper = FeatureSettingsHelper() | ||
|
||
@get:Rule | ||
val activityIntentTestRule = HomeActivityIntentTestRule() | ||
|
||
@Before | ||
fun setUp() { | ||
mockWebServer = MockWebServer().apply { | ||
dispatcher = AndroidAssetDispatcher() | ||
start() | ||
} | ||
featureSettingsHelper.setJumpBackCFREnabled(false) | ||
} | ||
|
||
@After | ||
fun tearDown() { | ||
mockWebServer.shutdown() | ||
|
||
// resetting modified features enabled setting to default | ||
featureSettingsHelper.resetAllFeatureFlags() | ||
} | ||
|
||
@SmokeTest | ||
@Test | ||
fun jumpBackInOptionTest() { | ||
val genericURL = getGenericAsset(mockWebServer, 1) | ||
|
||
navigationToolbar { | ||
}.enterURLAndEnterToBrowser(genericURL.url) { | ||
}.goToHomescreen { | ||
verifyJumpBackInSectionIsDisplayed() | ||
}.openThreeDotMenu { | ||
}.openCustomizeHome { | ||
clickJumpBackInButton() | ||
}.goBack { | ||
verifyJumpBackInSectionIsNotDisplayed() | ||
} | ||
} | ||
|
||
@SmokeTest | ||
@Test | ||
fun recentBookmarksOptionTest() { | ||
val genericURL = getGenericAsset(mockWebServer, 1) | ||
|
||
navigationToolbar { | ||
}.enterURLAndEnterToBrowser(genericURL.url) { | ||
}.openThreeDotMenu { | ||
}.bookmarkPage { | ||
}.goToHomescreen { | ||
verifyRecentBookmarksSectionIsDisplayed() | ||
}.openThreeDotMenu { | ||
}.openCustomizeHome { | ||
clickRecentBookmarksButton() | ||
}.goBack { | ||
verifyRecentBookmarksSectionIsNotDisplayed() | ||
} | ||
} | ||
|
||
@SmokeTest | ||
@Test | ||
fun startOnHomepageTest() { | ||
val genericURL = getGenericAsset(mockWebServer, 1) | ||
|
||
navigationToolbar { | ||
}.enterURLAndEnterToBrowser(genericURL.url) { | ||
}.openThreeDotMenu { | ||
}.openSettings { | ||
}.openHomepageSubMenu { | ||
clickStartOnHomepageButton() | ||
} | ||
|
||
restartApp(activityIntentTestRule) | ||
|
||
homeScreen { | ||
verifyHomeScreen() | ||
} | ||
} | ||
|
||
@SmokeTest | ||
@Test | ||
fun startOnLastTabTest() { | ||
val firstWebPage = getGenericAsset(mockWebServer, 1) | ||
|
||
homeScreen { | ||
}.openThreeDotMenu { | ||
}.openSettings { | ||
}.openHomepageSubMenu { | ||
clickStartOnHomepageButton() | ||
} | ||
|
||
restartApp(activityIntentTestRule) | ||
|
||
homeScreen { | ||
verifyHomeScreen() | ||
} | ||
|
||
navigationToolbar { | ||
}.enterURLAndEnterToBrowser(firstWebPage.url) { | ||
}.goToHomescreen { | ||
}.openThreeDotMenu { | ||
}.openCustomizeHome { | ||
clickStartOnLastTabButton() | ||
} | ||
|
||
restartApp(activityIntentTestRule) | ||
|
||
browserScreen { | ||
verifyUrl(firstWebPage.url.toString()) | ||
} | ||
} | ||
|
||
@SmokeTest | ||
@Test | ||
fun setWallpaperTest() { | ||
val wallpapers = listOf( | ||
"Wallpaper Item: amethyst", | ||
"Wallpaper Item: cerulean", | ||
"Wallpaper Item: sunrise" | ||
) | ||
|
||
for (wallpaper in wallpapers) { | ||
homeScreen { | ||
}.openThreeDotMenu { | ||
}.openCustomizeHome { | ||
openWallpapersMenu() | ||
selectWallpaper(wallpaper) | ||
verifySnackBarText("Wallpaper updated!") | ||
}.clickSnackBarViewButton { | ||
verifyWallpaperImageApplied(true) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.