For #25401 - Add the PocketIntegration Glean annotation tag to all Pocket telemetry

pull/543/head
Mugurell 2 years ago committed by mergify[bot]
parent d4dd62341a
commit f906dda054

@ -1623,6 +1623,9 @@ customize_home:
notification_emails: notification_emails:
- android-probes@mozilla.com - android-probes@mozilla.com
expires: 105 expires: 105
metadata:
tags:
- PocketIntegration
sponsored_pocket: sponsored_pocket:
type: boolean type: boolean
description: | description: |
@ -5390,6 +5393,9 @@ pocket:
notification_emails: notification_emails:
- android-probes@mozilla.com - android-probes@mozilla.com
expires: 106 expires: 106
metadata:
tags:
- PocketIntegration
home_recs_story_clicked: home_recs_story_clicked:
type: event type: event
description: | description: |
@ -5413,6 +5419,9 @@ pocket:
notification_emails: notification_emails:
- android-probes@mozilla.com - android-probes@mozilla.com
expires: 106 expires: 106
metadata:
tags:
- PocketIntegration
home_recs_spoc_clicked: home_recs_spoc_clicked:
type: event type: event
description: | description: |
@ -5493,6 +5502,9 @@ pocket:
notification_emails: notification_emails:
- android-probes@mozilla.com - android-probes@mozilla.com
expires: 106 expires: 106
metadata:
tags:
- PocketIntegration
home_recs_discover_clicked: home_recs_discover_clicked:
type: event type: event
description: | description: |
@ -5507,6 +5519,9 @@ pocket:
notification_emails: notification_emails:
- android-probes@mozilla.com - android-probes@mozilla.com
expires: 106 expires: 106
metadata:
tags:
- PocketIntegration
home_recs_learn_more_clicked: home_recs_learn_more_clicked:
type: event type: event
description: | description: |
@ -5520,6 +5535,9 @@ pocket:
notification_emails: notification_emails:
- android-probes@mozilla.com - android-probes@mozilla.com
expires: 106 expires: 106
metadata:
tags:
- PocketIntegration
first_session: first_session:
campaign: campaign:

@ -240,10 +240,11 @@ class SessionControlInteractorTest {
@Test @Test
fun `GIVEN a PocketStoriesInteractor WHEN a story is shown THEN handle it in a PocketStoriesController`() { fun `GIVEN a PocketStoriesInteractor WHEN a story is shown THEN handle it in a PocketStoriesController`() {
val shownStory: PocketStory = mockk() val shownStory: PocketStory = mockk()
val storyGridLocation = 1 to 2
interactor.onStoryShown(shownStory) interactor.onStoryShown(shownStory, storyGridLocation)
verify { pocketStoriesController.handleStoryShown(shownStory) } verify { pocketStoriesController.handleStoryShown(shownStory, storyGridLocation) }
} }
@Test @Test

@ -145,16 +145,30 @@ class DefaultPocketStoriesControllerTest {
} }
@Test @Test
fun `WHEN a new story is shown THEN update the State`() { fun `WHEN a new recommended story is shown THEN update the State`() {
val store = spyk(AppStore()) val store = spyk(AppStore())
val controller = DefaultPocketStoriesController(mockk(), store, mockk()) val controller = DefaultPocketStoriesController(mockk(), store, mockk())
val storyShown: PocketStory = mockk() val storyShown: PocketRecommendedStory = mockk()
val storyGridLocation = 1 to 2
controller.handleStoryShown(storyShown) controller.handleStoryShown(storyShown, storyGridLocation)
verify { store.dispatch(AppAction.PocketStoriesShown(listOf(storyShown))) } verify { store.dispatch(AppAction.PocketStoriesShown(listOf(storyShown))) }
} }
@Test
fun `WHEN a new sponsored story is shown THEN update the State and record telemetry`() {
val store = spyk(AppStore())
val controller = DefaultPocketStoriesController(mockk(), store, mockk())
val storyShown: PocketSponsoredStory = mockk(relaxed = true)
val storyGridLocation = 1 to 2
controller.handleStoryShown(storyShown, storyGridLocation)
verify { store.dispatch(AppAction.PocketStoriesShown(listOf(storyShown))) }
assertNotNull(Pocket.homeRecsSpocShown.testGetValue())
}
@Test @Test
fun `WHEN new stories are shown THEN update the State and record telemetry`() { fun `WHEN new stories are shown THEN update the State and record telemetry`() {
val store = spyk(AppStore()) val store = spyk(AppStore())
@ -199,7 +213,7 @@ class DefaultPocketStoriesControllerTest {
} }
@Test @Test
fun `WHEN a sponsored story is clicked THEN open that story's url using HomeActivity and don't record telemetry`() { fun `WHEN a sponsored story is clicked THEN open that story's url using HomeActivity and record telemetry`() {
val story = PocketSponsoredStory( val story = PocketSponsoredStory(
id = 7, id = 7,
title = "", title = "",
@ -208,11 +222,11 @@ class DefaultPocketStoriesControllerTest {
sponsor = "", sponsor = "",
shim = mockk(), shim = mockk(),
priority = 3, priority = 3,
caps = mockk(), caps = mockk(relaxed = true),
) )
val homeActivity: HomeActivity = mockk(relaxed = true) val homeActivity: HomeActivity = mockk(relaxed = true)
val controller = DefaultPocketStoriesController(homeActivity, mockk(), mockk(relaxed = true)) val controller = DefaultPocketStoriesController(homeActivity, mockk(), mockk(relaxed = true))
assertNull(Pocket.homeRecsStoryClicked.testGetValue()) assertNull(Pocket.homeRecsSpocClicked.testGetValue())
controller.handleStoryClicked(story, 1 to 2) controller.handleStoryClicked(story, 1 to 2)

Loading…
Cancel
Save