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

Commit

Permalink
Closes #26750: fix failing ui tests, fix wallpaper onboarding display…
Browse files Browse the repository at this point in the history
…ing conditions
  • Loading branch information
mike a committed Sep 1, 2022
1 parent f1496a3 commit 1f6143e
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class FeatureSettingsHelper {
private var isRecentlyVisitedFeatureEnabled: Boolean = settings.historyMetadataUIFeature
private var isUserKnowsAboutPwasTrue: Boolean = settings.userKnowsAboutPwas
private var isTCPCFREnabled: Boolean = settings.shouldShowTotalCookieProtectionCFR
private var isWallpaperOnboardingEnabled: Boolean = settings.showWallpaperOnboarding

fun setPocketEnabled(enabled: Boolean) {
settings.showPocketRecommendationsFeature = enabled
Expand All @@ -28,6 +29,10 @@ class FeatureSettingsHelper {
settings.shouldShowJumpBackInCFR = enabled
}

fun setShowWallpaperOnboarding(enabled: Boolean) {
settings.showWallpaperOnboarding = enabled
}

fun setRecentTabsFeatureEnabled(enabled: Boolean) {
settings.showRecentTabsFeature = enabled
}
Expand Down Expand Up @@ -65,5 +70,6 @@ class FeatureSettingsHelper {
settings.historyMetadataUIFeature = isRecentlyVisitedFeatureEnabled
settings.userKnowsAboutPwas = isUserKnowsAboutPwasTrue
settings.shouldShowTotalCookieProtectionCFR = isTCPCFREnabled
settings.showWallpaperOnboarding = isWallpaperOnboardingEnabled
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class CrashReportingTest {
fun setUp() {
featureSettingsHelper.setJumpBackCFREnabled(false)
featureSettingsHelper.setPocketEnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)

mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
mockWebServer = MockWebServer().apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class HomeScreenTest {
fun dismissOnboardingUsingHelpTest() {
val settings = activityTestRule.activity.applicationContext.settings()
settings.shouldShowJumpBackInCFR = false
settings.showWallpaperOnboarding = false
homeScreen {
verifyWelcomeHeader()
}.openThreeDotMenu {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class NoNetworkAccessStartupTests {
@Before
fun setUp() {
featureSettingsHelper.setTCPCFREnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class SearchTest {
featureSettingsHelper.setJumpBackCFREnabled(false)
featureSettingsHelper.setTCPCFREnabled(false)
featureSettingsHelper.setPocketEnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class SettingsAddonsTest {
}

featureSettingsHelper.setTCPCFREnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class SettingsAdvancedTest {
}
featureSettingsHelper.setPocketEnabled(false)
featureSettingsHelper.setTCPCFREnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class SettingsBasicsTest {

featureSettingsHelper.setJumpBackCFREnabled(false)
featureSettingsHelper.setTCPCFREnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class SettingsPrivacyTest {
featureSettingsHelper.setJumpBackCFREnabled(false)
featureSettingsHelper.setTCPCFREnabled(false)
featureSettingsHelper.disablePwaCFR(true)
featureSettingsHelper.setShowWallpaperOnboarding(false)

if (Build.VERSION.SDK_INT == Build.VERSION_CODES.R) {
val autofillManager: AutofillManager =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class SettingsSearchTest {
start()
}
featureSettingsHelper.setJumpBackCFREnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)
}

@After
Expand Down
1 change: 1 addition & 0 deletions app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class SmokeTest {
// disabling the new homepage pop-up that interferes with the tests.
featureSettingsHelper.setJumpBackCFREnabled(false)
featureSettingsHelper.setTCPCFREnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)

mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
mockWebServer = MockWebServer().apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class StrictEnhancedTrackingProtectionTest {
featureSettingsHelper.setStrictETPEnabled()
featureSettingsHelper.setJumpBackCFREnabled(false)
featureSettingsHelper.setTCPCFREnabled(false)
featureSettingsHelper.setShowWallpaperOnboarding(false)
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,12 @@ class SessionControlView(
).showSyncCFR()
}
}
if (!isCFRDisplayed &&

val higherPriorityCFRShown = !isCFRDisplayed &&
!context.settings().showHomeOnboardingDialog &&
(!context.settings().shouldShowJumpBackInCFR ||
!context.settings().showSyncCFR) &&
context.settings().showWallpaperOnboarding
// && onboarding.userHasBeenOnboarded()
) {
(!context.settings().shouldShowJumpBackInCFR || !context.settings().showSyncCFR)

if (!higherPriorityCFRShown && context.settings().showWallpaperOnboarding) {
interactor.showWallpapersOnboardingDialog()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class SyncCFRPresenter(
/**
* Find the synced view and if it is available, then show the synced tab CFR.
*/
fun showSyncCFR() : Boolean {
fun showSyncCFR(): Boolean {
findSyncTabsView()?.let {
CFRPopup(
text = context.getString(R.string.sync_cfr_message),
Expand Down

0 comments on commit 1f6143e

Please sign in to comment.