Bug 1951175 - add icon_click Glean event for Review Checker sidebar icon. r=sidebar-reviewers,shopping-reviewers,rking,jsudiaman

Differential Revision: https://phabricator.services.mozilla.com/D240087
This commit is contained in:
kpatenio
2025-03-03 23:02:40 +00:00
parent ef8df87259
commit de5da3721b
3 changed files with 60 additions and 0 deletions

View File

@@ -173,6 +173,7 @@ var SidebarController = {
revampL10nId: "sidebar-menu-review-checker-label",
iconUrl: "chrome://browser/content/shopping/assets/shopping.svg",
gleanEvent: Glean.shopping.sidebarToggle,
gleanClickEvent: Glean.sidebar.shoppingReviewCheckerIconClick,
recordSidebarVersion: true,
}
);

View File

@@ -243,6 +243,26 @@ sidebar:
addon_id:
type: string
description: The extension's ID.
shopping_review_checker_icon_click:
type: event
description: >
The Review Checker icon was clicked.
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1951175
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1951175
data_sensitivity:
- interaction
expires: 147
notification_emails:
- betling@mozilla.com
- fx-desktop-shopping-eng@mozilla.com
send_in_pings:
- events
extra_keys:
sidebar_open:
type: boolean
description: Whether the sidebar is expanded or collapsed.
keyboard_shortcut:
type: event
description: >

View File

@@ -610,6 +610,37 @@ async function testIconClick(expanded) {
Services.fog.testResetFOG();
}
async function testIconClickReviewChecker(expanded) {
await SpecialPowers.pushPrefEnv({
set: [
[
"sidebar.main.tools",
"aichat,syncedtabs,history,bookmarks,reviewchecker",
],
],
});
const { sidebarMain } = SidebarController;
await SidebarController.initializeUIState({ launcherExpanded: expanded });
let reviewCheckerButton = sidebarMain.shadowRoot.querySelector(
"moz-button[view='viewReviewCheckerSidebar']"
);
EventUtils.synthesizeMouseAtCenter(reviewCheckerButton, {});
let event = Glean.sidebar.shoppingReviewCheckerIconClick.testGetValue();
Assert.equal(event?.length, 1, "One event was reported.");
Assert.deepEqual(
event?.[0].extra,
{ sidebar_open: `${expanded}` },
`Event indicates the sidebar was ${expanded ? "expanded" : "collapsed"}.`
);
await SpecialPowers.popPrefEnv();
Services.fog.testResetFOG();
}
add_task(async function test_icon_click_collapsed_sidebar() {
await testIconClick(false);
});
@@ -617,3 +648,11 @@ add_task(async function test_icon_click_collapsed_sidebar() {
add_task(async function test_icon_click_expanded_sidebar() {
await testIconClick(true);
});
add_task(async function test_review_checker_icon_click_collapsed_sidebar() {
await testIconClickReviewChecker(false);
});
add_task(async function test_review_checker_icon_click_expanded_sidebar() {
await testIconClickReviewChecker(true);
});