mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1654167 - Add preferences telemetry for Credit Card A/B testing. r=abr
Differential Revision: https://phabricator.services.mozilla.com/D84293
This commit is contained in:
parent
48beff740e
commit
11395cf9ff
@ -11,6 +11,7 @@
|
||||
const { FormAutofill } = ChromeUtils.import(
|
||||
"resource://formautofill/FormAutofill.jsm"
|
||||
);
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
@ -181,6 +182,9 @@ class EditCreditCardDialog extends AutofillEditDialog {
|
||||
"blur",
|
||||
this._onCCNumberFieldBlur.bind(this)
|
||||
);
|
||||
if (record) {
|
||||
Services.telemetry.recordEvent("creditcard", "show_entry", "manage");
|
||||
}
|
||||
}
|
||||
|
||||
_onCCNumberFieldBlur() {
|
||||
@ -205,6 +209,13 @@ class EditCreditCardDialog extends AutofillEditDialog {
|
||||
creditCard,
|
||||
this._record ? this._record.guid : null
|
||||
);
|
||||
|
||||
if (this._record?.guid) {
|
||||
Services.telemetry.recordEvent("creditcard", "edit", "manage");
|
||||
} else {
|
||||
Services.telemetry.recordEvent("creditcard", "add", "manage");
|
||||
}
|
||||
|
||||
window.close();
|
||||
} catch (ex) {
|
||||
Cu.reportError(ex);
|
||||
|
@ -366,6 +366,9 @@ class ManageCreditCards extends ManageRecords {
|
||||
FormAutofillUtils.stringBundle.GetStringFromName(key)
|
||||
).join("\n")
|
||||
);
|
||||
|
||||
Services.telemetry.recordEvent("creditcard", "show", "manage");
|
||||
|
||||
this._isDecrypted = false;
|
||||
}
|
||||
|
||||
@ -448,6 +451,13 @@ class ManageCreditCards extends ManageRecords {
|
||||
}
|
||||
}
|
||||
|
||||
async removeRecords(options) {
|
||||
await super.removeRecords(options);
|
||||
for (let i = 0; i < options.length; i++) {
|
||||
Services.telemetry.recordEvent("creditcard", "delete", "manage");
|
||||
}
|
||||
}
|
||||
|
||||
updateButtonsStates(selectedCount) {
|
||||
super.updateButtonsStates(selectedCount);
|
||||
}
|
||||
|
@ -300,3 +300,106 @@ add_task(async function test_submit_creditCard_update() {
|
||||
["creditcard", "save", "update_doorhanger"],
|
||||
]);
|
||||
});
|
||||
|
||||
const TEST_SELECTORS = {
|
||||
selRecords: "#credit-cards",
|
||||
btnRemove: "#remove",
|
||||
btnAdd: "#add",
|
||||
btnEdit: "#edit",
|
||||
};
|
||||
|
||||
const DIALOG_SIZE = "width=600,height=400";
|
||||
|
||||
add_task(async function test_removingCreditCardsViaKeyboardDelete() {
|
||||
Services.telemetry.clearEvents();
|
||||
Services.telemetry.setEventRecordingEnabled("creditcard", true);
|
||||
|
||||
await saveCreditCard(TEST_CREDIT_CARD_1);
|
||||
let win = window.openDialog(
|
||||
MANAGE_CREDIT_CARDS_DIALOG_URL,
|
||||
null,
|
||||
DIALOG_SIZE
|
||||
);
|
||||
await waitForFocusAndFormReady(win);
|
||||
|
||||
let selRecords = win.document.querySelector(TEST_SELECTORS.selRecords);
|
||||
|
||||
is(selRecords.length, 1, "One credit card");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(selRecords.children[0], {}, win);
|
||||
EventUtils.synthesizeKey("VK_DELETE", {}, win);
|
||||
await BrowserTestUtils.waitForEvent(selRecords, "RecordsRemoved");
|
||||
is(selRecords.length, 0, "No credit cards left");
|
||||
|
||||
win.close();
|
||||
|
||||
await assertTelemetry(undefined, [
|
||||
["creditcard", "show", "manage"],
|
||||
["creditcard", "delete", "manage"],
|
||||
]);
|
||||
await removeAllRecords();
|
||||
});
|
||||
|
||||
add_task(async function test_saveCreditCard() {
|
||||
Services.telemetry.clearEvents();
|
||||
Services.telemetry.setEventRecordingEnabled("creditcard", true);
|
||||
|
||||
await testDialog(EDIT_CREDIT_CARD_DIALOG_URL, win => {
|
||||
EventUtils.synthesizeKey("VK_TAB", {}, win);
|
||||
EventUtils.synthesizeKey(TEST_CREDIT_CARD_1["cc-number"], {}, win);
|
||||
EventUtils.synthesizeKey("VK_TAB", {}, win);
|
||||
EventUtils.synthesizeKey(
|
||||
"0" + TEST_CREDIT_CARD_1["cc-exp-month"].toString(),
|
||||
{},
|
||||
win
|
||||
);
|
||||
EventUtils.synthesizeKey("VK_TAB", {}, win);
|
||||
EventUtils.synthesizeKey(
|
||||
TEST_CREDIT_CARD_1["cc-exp-year"].toString(),
|
||||
{},
|
||||
win
|
||||
);
|
||||
EventUtils.synthesizeKey("VK_TAB", {}, win);
|
||||
EventUtils.synthesizeKey(TEST_CREDIT_CARD_1["cc-name"], {}, win);
|
||||
EventUtils.synthesizeKey("VK_TAB", {}, win);
|
||||
EventUtils.synthesizeKey(TEST_CREDIT_CARD_1["cc-type"], {}, win);
|
||||
EventUtils.synthesizeKey("VK_TAB", {}, win);
|
||||
EventUtils.synthesizeKey("VK_TAB", {}, win);
|
||||
info("saving credit card");
|
||||
EventUtils.synthesizeKey("VK_RETURN", {}, win);
|
||||
});
|
||||
|
||||
await removeAllRecords();
|
||||
|
||||
await assertTelemetry(undefined, [["creditcard", "add", "manage"]]);
|
||||
});
|
||||
|
||||
add_task(async function test_editCreditCard() {
|
||||
Services.telemetry.clearEvents();
|
||||
Services.telemetry.setEventRecordingEnabled("creditcard", true);
|
||||
|
||||
await saveCreditCard(TEST_CREDIT_CARD_1);
|
||||
|
||||
let creditCards = await getCreditCards();
|
||||
is(creditCards.length, 1, "only one credit card is in storage");
|
||||
await testDialog(
|
||||
EDIT_CREDIT_CARD_DIALOG_URL,
|
||||
win => {
|
||||
EventUtils.synthesizeKey("VK_TAB", {}, win);
|
||||
EventUtils.synthesizeKey("VK_TAB", {}, win);
|
||||
EventUtils.synthesizeKey("VK_TAB", {}, win);
|
||||
EventUtils.synthesizeKey("VK_TAB", {}, win);
|
||||
EventUtils.synthesizeKey("VK_RIGHT", {}, win);
|
||||
EventUtils.synthesizeKey("test", {}, win);
|
||||
win.document.querySelector("#save").click();
|
||||
},
|
||||
{
|
||||
record: creditCards[0],
|
||||
}
|
||||
);
|
||||
await removeAllRecords();
|
||||
await assertTelemetry(undefined, [
|
||||
["creditcard", "show_entry", "manage"],
|
||||
["creditcard", "edit", "manage"],
|
||||
]);
|
||||
});
|
||||
|
@ -369,6 +369,24 @@ creditcard:
|
||||
- "firefox"
|
||||
record_in_processes: ["main"]
|
||||
release_channel_collection: opt-out
|
||||
manage:
|
||||
description: >-
|
||||
User interactions for credit card autofill preferences management UI.
|
||||
objects:
|
||||
- "manage"
|
||||
methods:
|
||||
- "show"
|
||||
- "add"
|
||||
- "delete"
|
||||
- "show_entry"
|
||||
- "edit"
|
||||
bug_numbers: [1653073, 1654167]
|
||||
notification_emails: ["jmathies@mozilla.com", "chsiang@mozilla.com"]
|
||||
expiry_version: "93"
|
||||
products:
|
||||
- "firefox"
|
||||
record_in_processes: ["main"]
|
||||
release_channel_collection: opt-out
|
||||
cc_form:
|
||||
description: >-
|
||||
User interactions for credit card autofill forms
|
||||
|
Loading…
Reference in New Issue
Block a user