diff options
Diffstat (limited to 'browser/extensions/formautofill/test/mochitest/creditCard/test_basic_creditcard_autocomplete_form.html')
-rw-r--r-- | browser/extensions/formautofill/test/mochitest/creditCard/test_basic_creditcard_autocomplete_form.html | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/browser/extensions/formautofill/test/mochitest/creditCard/test_basic_creditcard_autocomplete_form.html b/browser/extensions/formautofill/test/mochitest/creditCard/test_basic_creditcard_autocomplete_form.html index 8d1333b727..9fad869629 100644 --- a/browser/extensions/formautofill/test/mochitest/creditCard/test_basic_creditcard_autocomplete_form.html +++ b/browser/extensions/formautofill/test/mochitest/creditCard/test_basic_creditcard_autocomplete_form.html @@ -59,6 +59,11 @@ async function setupFormHistory() { ]); } +function replaceStars(str) +{ + return str.replaceAll("*", "•") +} + initPopupListener(); // Form with history only. @@ -86,7 +91,7 @@ add_task(async function all_saved_fields_less_than_threshold() { synthesizeKey("KEY_ArrowDown"); checkMenuEntries([reducedMockRecord].map(patchRecordCCNumber).map(({ cc, expected }) => JSON.stringify({ primary: cc["cc-name"], - secondary: cc.ccNumberFmt, + secondary: replaceStars(cc.ccNumberFmt), ariaLabel: `Visa ${cc["cc-name"]} ${cc.ccNumberFmt}`, image: expected.image, }))); @@ -102,8 +107,8 @@ add_task(async function check_menu_when_both_existed() { await expectPopup(); synthesizeKey("KEY_ArrowDown"); checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(({ cc, expected }) => JSON.stringify({ - primary: cc.ccNumberFmt, - secondary: cc["cc-name"], + primary: replaceStars(cc.ccNumberFmt), + secondary: cc["cc-name"].toString(), ariaLabel: `${getCCTypeName(cc)} ${cc.ccNumberFmt.replaceAll("*", "")} ${cc["cc-name"]}`, image: expected.image, }))); @@ -112,8 +117,8 @@ add_task(async function check_menu_when_both_existed() { await expectPopup(); synthesizeKey("KEY_ArrowDown"); checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(({ cc, expected }) => JSON.stringify({ - primary: cc["cc-name"], - secondary: cc.ccNumberFmt, + primary: cc["cc-name"].toString(), + secondary: replaceStars(cc.ccNumberFmt), ariaLabel: `${getCCTypeName(cc)} ${cc["cc-name"]} ${cc.ccNumberFmt}`, image: expected.image, }))); @@ -122,8 +127,8 @@ add_task(async function check_menu_when_both_existed() { await expectPopup(); synthesizeKey("KEY_ArrowDown"); checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(({ cc, expected }) => JSON.stringify({ - primary: cc["cc-exp-year"], - secondary: cc.ccNumberFmt, + primary: cc["cc-exp-year"].toString(), + secondary: replaceStars(cc.ccNumberFmt), ariaLabel: `${getCCTypeName(cc)} ${cc["cc-exp-year"]} ${cc.ccNumberFmt}`, image: expected.image, }))); @@ -132,8 +137,8 @@ add_task(async function check_menu_when_both_existed() { await expectPopup(); synthesizeKey("KEY_ArrowDown"); checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(({ cc, expected }) => JSON.stringify({ - primary: cc["cc-exp-month"], - secondary: cc.ccNumberFmt, + primary: cc["cc-exp-month"].toString(), + secondary: replaceStars(cc.ccNumberFmt), ariaLabel: `${getCCTypeName(cc)} ${cc["cc-exp-month"]} ${cc.ccNumberFmt}`, image: expected.image, }))); @@ -185,17 +190,22 @@ add_task(async function check_fields_after_form_autofill() { // The popup doesn't auto-show on focus because the field isn't empty await expectPopup(); checkMenuEntries(MOCK_STORAGE.slice(1).map(patchRecordCCNumber).map(({ cc, expected }) => JSON.stringify({ - primary: cc["cc-exp-year"], - secondary: cc.ccNumberFmt, + primary: cc["cc-exp-year"].toString(), + secondary: replaceStars(cc.ccNumberFmt), ariaLabel: `${getCCTypeName(cc)} ${cc["cc-exp-year"]} ${cc.ccNumberFmt}`, image: expected.image, }))); synthesizeKey("KEY_ArrowDown"); - let osKeyStoreLoginShown = waitForOSKeyStoreLogin(true); + let osKeyStoreLoginShown = Promise.resolve(); + if(OSKeyStore.canReauth()) { + osKeyStoreLoginShown = waitForOSKeyStoreLogin(true); + } await new Promise(resolve => SimpleTest.executeSoon(resolve)); await triggerAutofillAndCheckProfile(MOCK_STORAGE[1].cc); await osKeyStoreLoginShown; + // Enforcing this since it is unable to change back in chaos mode. + SpecialPowers.clearUserPref("toolkit.osKeyStore.unofficialBuildOnlyLogin"); }); // Fallback to history search after autofill values (for non-empty fields). @@ -220,7 +230,7 @@ add_task(async function check_cc_popup_on_field_blank() { await expectPopup(); checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(({ cc, expected }) => JSON.stringify({ primary: cc["cc-name"], - secondary: cc.ccNumberFmt, + secondary: replaceStars(cc.ccNumberFmt), ariaLabel: `${getCCTypeName(cc)} ${cc["cc-name"]} ${cc.ccNumberFmt}`, image: expected.image, }))); @@ -240,7 +250,7 @@ add_task(async function check_form_autofill_resume() { await expectPopup(); checkMenuEntries(MOCK_STORAGE.map(patchRecordCCNumber).map(({ cc, expected }) => JSON.stringify({ primary: cc["cc-name"], - secondary: cc.ccNumberFmt, + secondary: replaceStars(cc.ccNumberFmt), ariaLabel: `${getCCTypeName(cc)} ${cc["cc-name"]} ${cc.ccNumberFmt}`, image: expected.image, }))); |