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.
Browse files
Browse the repository at this point in the history
…refreshing
- Loading branch information
Oana Horvath
committed
Oct 29, 2021
1 parent
da10c06
commit 1af80cf
Showing
6 changed files
with
145 additions
and
76 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
app/src/androidTest/java/org/mozilla/fenix/helpers/FeatureSettingsHelper.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,36 @@ | ||
package org.mozilla.fenix.helpers | ||
|
||
import android.content.Context | ||
import androidx.test.platform.app.InstrumentationRegistry | ||
import org.mozilla.fenix.ext.settings | ||
|
||
class FeatureSettingsHelper { | ||
private val context: Context = InstrumentationRegistry.getInstrumentation().targetContext | ||
private val settings = context.settings() | ||
|
||
// saving default values of feature flags | ||
private var isPocketEnabled: Boolean = settings.showPocketRecommendationsFeature | ||
private var isJumpBackInCFREnabled: Boolean = settings.shouldShowJumpBackInCFR | ||
private var isRecentTabsFeatureEnabled: Boolean = settings.showRecentTabsFeature | ||
|
||
fun setPocketEnabled(enabled: Boolean) { | ||
settings.showPocketRecommendationsFeature = enabled | ||
} | ||
|
||
fun setJumpBackCFREnabled(enabled: Boolean) { | ||
settings.shouldShowJumpBackInCFR = enabled | ||
} | ||
|
||
fun setRecentTabsFeatureEnabled(enabled: Boolean) { | ||
settings.showRecentTabsFeature = enabled | ||
} | ||
|
||
// Important: | ||
// Use this after each test if you have modified these feature settings | ||
// to make sure the app goes back to the default state | ||
fun resetAllFeatureFlags() { | ||
settings.showPocketRecommendationsFeature = isPocketEnabled | ||
settings.shouldShowJumpBackInCFR = isJumpBackInCFREnabled | ||
settings.showRecentTabsFeature = isRecentTabsFeatureEnabled | ||
} | ||
} |
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
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.