No issue: fix glean metrics tests for expired metrics (#20621)

* Remove references to preferences.open_links_in_private and preferences.private_search_suggestions in tests. These metrics have been expired and may be removed.

* Add ignores for performance metrics that have expired.

* Remove tabs_tray.cfr.dismiss and tabs_tray.cfr.go_to_settings telemetry probes.

* Remove metrics controller from signature and remove in tests
upstream-sync
Elise Richards 3 years ago committed by GitHub
parent a80b7fa329
commit 7fdade49ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2650,38 +2650,6 @@ reader_mode:
- android-probes@mozilla.com
expires: "2022-02-01"
tabs_tray.cfr:
dismiss:
type: event
description: |
A user dismisses the tabs tray CFR.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/16485
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/17442
- https://github.com/mozilla-mobile/fenix/issues/16485#issuecomment-759641324
- https://github.com/mozilla-mobile/fenix/pull/19924#issuecomment-861423789
data_sensitivity:
- interaction
notification_emails:
- android-probes@mozilla.com
expires: "2021-08-01"
go_to_settings:
type: event
description: |
A user selects the CFR option to navigate to settings.
bugs:
- https://github.com/mozilla-mobile/fenix/issues/16485
data_reviews:
- https://github.com/mozilla-mobile/fenix/pull/17442
- https://github.com/mozilla-mobile/fenix/issues/16485#issuecomment-759641324
- https://github.com/mozilla-mobile/fenix/pull/19924#issuecomment-861423789
data_sensitivity:
- interaction
notification_emails:
- android-probes@mozilla.com
expires: "2021-08-01"
tabs_tray:
opened:
type: event

@ -190,8 +190,6 @@ sealed class Event {
object TabsTraySaveToCollectionPressed : Event()
object TabsTrayShareAllTabsPressed : Event()
object TabsTrayCloseAllTabsPressed : Event()
object TabsTrayCfrDismissed : Event()
object TabsTrayCfrTapped : Event()
object ProgressiveWebAppOpenFromHomescreenTap : Event()
object ProgressiveWebAppInstallAsShortcut : Event()

@ -60,7 +60,6 @@ import org.mozilla.fenix.GleanMetrics.SyncedTabs
import org.mozilla.fenix.GleanMetrics.Tab
import org.mozilla.fenix.GleanMetrics.Tabs
import org.mozilla.fenix.GleanMetrics.TabsTray
import org.mozilla.fenix.GleanMetrics.TabsTrayCfr
import org.mozilla.fenix.GleanMetrics.Tip
import org.mozilla.fenix.GleanMetrics.ToolbarSettings
import org.mozilla.fenix.GleanMetrics.TopSites
@ -702,12 +701,6 @@ private val Event.wrapper: EventWrapper<*>?
is Event.TabsTrayCloseAllTabsPressed -> EventWrapper<NoExtraKeys>(
{ TabsTray.closeAllTabs.record(it) }
)
is Event.TabsTrayCfrDismissed -> EventWrapper<NoExtraKeys>(
{ TabsTrayCfr.dismiss.record(it) }
)
is Event.TabsTrayCfrTapped -> EventWrapper<NoExtraKeys>(
{ TabsTrayCfr.goToSettings.record(it) }
)
is Event.AutoPlaySettingVisited -> EventWrapper<NoExtraKeys>(
{ Autoplay.visitedSetting.record(it) }
)

@ -201,8 +201,7 @@ class TabsTrayFragment : AppCompatDialogFragment() {
store = requireComponents.core.store,
infoBannerView = view.info_banner,
settings = requireComponents.settings,
navigationInteractor = navigationInteractor,
metrics = requireComponents.analytics.metrics
navigationInteractor = navigationInteractor
),
owner = this,
view = view

@ -21,8 +21,6 @@ import mozilla.components.lib.state.helpers.AbstractBinding
import mozilla.components.support.ktx.kotlinx.coroutines.flow.ifChanged
import org.mozilla.fenix.R
import org.mozilla.fenix.browser.infobanner.InfoBanner
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.components.metrics.MetricController
import org.mozilla.fenix.utils.Settings
@OptIn(ExperimentalCoroutinesApi::class)
@ -31,8 +29,7 @@ class TabsTrayInfoBannerBinding(
store: BrowserStore,
private val infoBannerView: ViewGroup,
private val settings: Settings,
private val navigationInteractor: NavigationInteractor,
private val metrics: MetricController?
private val navigationInteractor: NavigationInteractor
) : AbstractBinding<BrowserState>(store) {
@VisibleForTesting
@ -70,12 +67,10 @@ class TabsTrayInfoBannerBinding(
container = infoBannerView,
dismissByHiding = true,
dismissAction = {
metrics?.track(Event.TabsTrayCfrDismissed)
settings.shouldShowAutoCloseTabsBanner = false
}
) {
navigationInteractor.onTabSettingsClicked()
metrics?.track(Event.TabsTrayCfrTapped)
settings.shouldShowAutoCloseTabsBanner = false
}
} else {

@ -162,8 +162,6 @@ class FenixApplicationTest {
assertEquals(true, Preferences.bookmarksSuggestion.testGetValue())
assertEquals(true, Preferences.clipboardSuggestionsEnabled.testGetValue())
assertEquals(true, Preferences.searchShortcutsEnabled.testGetValue())
assertEquals(true, Preferences.openLinksInPrivate.testGetValue())
assertEquals(true, Preferences.privateSearchSuggestions.testGetValue())
assertEquals(true, Preferences.voiceSearchEnabled.testGetValue())
assertEquals(true, Preferences.openLinksInAppEnabled.testGetValue())
assertEquals(true, Preferences.signedInSync.testGetValue())

@ -21,7 +21,6 @@ import org.mozilla.fenix.GleanMetrics.Events
import org.mozilla.fenix.GleanMetrics.History
import org.mozilla.fenix.GleanMetrics.SyncedTabs
import org.mozilla.fenix.GleanMetrics.TabsTray
import org.mozilla.fenix.GleanMetrics.TabsTrayCfr
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
@RunWith(FenixRobolectricTestRunner::class)
@ -250,14 +249,6 @@ class GleanMetricsServiceTest {
assertFalse(TabsTray.closeAllTabs.testHasValue())
gleanService.track(Event.TabsTrayCloseAllTabsPressed)
assertTrue(TabsTray.closeAllTabs.testHasValue())
assertFalse(TabsTrayCfr.dismiss.testHasValue())
gleanService.track(Event.TabsTrayCfrDismissed)
assertTrue(TabsTrayCfr.dismiss.testHasValue())
assertFalse(TabsTrayCfr.goToSettings.testHasValue())
gleanService.track(Event.TabsTrayCfrTapped)
assertTrue(TabsTrayCfr.goToSettings.testHasValue())
}
@Test

@ -16,6 +16,7 @@ import mozilla.components.support.test.robolectric.testContext
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@ -41,6 +42,7 @@ class StorageStatsMetricsTest {
}
@Test
@Ignore("These metrics have expired.")
fun `WHEN reporting THEN the values from the storageStats are accumulated`() {
every { storageStats.appBytes } returns 100
every { storageStats.cacheBytes } returns 200
@ -54,6 +56,7 @@ class StorageStatsMetricsTest {
}
@Test
@Ignore("These metrics have expired.")
fun `WHEN reporting THEN the query duration is measured`() {
StorageStatsMetrics.reportSync(mockContext)
assertTrue(Metrics.queryStatsDuration.testHasValue())

@ -22,8 +22,6 @@ import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.components.metrics.MetricController
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
import org.mozilla.fenix.tabstray.TabsTrayInfoBannerBinding.Companion.TAB_COUNT_SHOW_CFR
import org.mozilla.fenix.utils.Settings
@ -35,7 +33,6 @@ class TabsTrayInfoBannerBindingTest {
private lateinit var store: BrowserStore
private lateinit var view: ViewGroup
private lateinit var interactor: NavigationInteractor
private lateinit var metrics: MetricController
private lateinit var settings: Settings
@get:Rule
@ -46,7 +43,6 @@ class TabsTrayInfoBannerBindingTest {
store = BrowserStore()
view = CoordinatorLayout(testContext)
interactor = mockk(relaxed = true)
metrics = mockk(relaxed = true)
settings = Settings(testContext)
}
@ -60,8 +56,7 @@ class TabsTrayInfoBannerBindingTest {
store = store,
infoBannerView = view,
settings = settings,
navigationInteractor = interactor,
metrics = metrics
navigationInteractor = interactor
)
binding.start()
@ -88,8 +83,7 @@ class TabsTrayInfoBannerBindingTest {
store = store,
infoBannerView = view,
settings = settings,
navigationInteractor = interactor,
metrics = metrics
navigationInteractor = interactor
)
binding.start()
@ -103,7 +97,5 @@ class TabsTrayInfoBannerBindingTest {
verify(exactly = 0) { interactor.onTabSettingsClicked() }
assert(!settings.shouldShowAutoCloseTabsBanner)
verify(exactly = 0) { metrics.track(Event.TabsTrayCfrTapped) }
verify(exactly = 1) { metrics.track(Event.TabsTrayCfrDismissed) }
}
}

Loading…
Cancel
Save