summaryrefslogtreecommitdiffstats
path: root/browser/extensions/formautofill/test/browser/creditCard
diff options
context:
space:
mode:
Diffstat (limited to 'browser/extensions/formautofill/test/browser/creditCard')
-rw-r--r--browser/extensions/formautofill/test/browser/creditCard/browser.toml78
-rw-r--r--browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_capture_form_removal.js2
-rw-r--r--browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_capture_multiple_cc_number.js102
-rw-r--r--browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_doorhanger_not_shown.js2
4 files changed, 144 insertions, 40 deletions
diff --git a/browser/extensions/formautofill/test/browser/creditCard/browser.toml b/browser/extensions/formautofill/test/browser/creditCard/browser.toml
index 710cdbafb4..580ce936d4 100644
--- a/browser/extensions/formautofill/test/browser/creditCard/browser.toml
+++ b/browser/extensions/formautofill/test/browser/creditCard/browser.toml
@@ -17,66 +17,80 @@ support-files = [
]
["browser_anti_clickjacking.js"]
-skip-if = ["!debug && os == 'mac'"] # perma-fail see Bug 1600059
+skip-if = [
+ "apple_catalina && !debug", # perma-fail see Bug 1600059
+ "apple_silicon && !debug", # perma-fail see Bug 1600059
+]
["browser_creditCard_capture_form_removal.js"]
+["browser_creditCard_capture_multiple_cc_number.js"]
+skip-if = [
+ "apple_catalina && !debug", # perma-fail see Bug 1655601
+ "apple_silicon && !debug", # perma-fail see Bug 1655601
+ "win11_2009 && ccov", # Bug 1655600
+]
+
["browser_creditCard_capture_page_navigation.js"]
["browser_creditCard_doorhanger_action.js"]
skip-if = [
- "!debug && os == 'mac'", # perma-fail see Bug 1655601
- "os == 'win' && ccov", # Bug 1655600
+ "apple_catalina && !debug", # perma-fail see Bug 1655601
+ "apple_silicon && !debug", # perma-fail see Bug 1655601
+ "win11_2009 && ccov", # Bug 1655600
]
["browser_creditCard_doorhanger_display.js"]
skip-if = [
- "!debug && os == 'mac'", # perma-fail see Bug 1655601
- "os == 'win' && ccov", # Bug 1655600
+ "apple_catalina && !debug", # perma-fail see Bug 1655601
+ "apple_silicon && !debug", # perma-fail see Bug 1655601
+ "win11_2009 && ccov", # Bug 1655600
]
["browser_creditCard_doorhanger_fields.js"]
skip-if = [
- "!debug && os == 'mac'", # perma-fail see Bug 1655601
- "os == 'win' && ccov", # Bug 1655600
+ "apple_catalina && !debug", # perma-fail see Bug 1655601
+ "apple_silicon && !debug", # perma-fail see Bug 1655601
+ "win11_2009 && ccov", # Bug 1655600
]
["browser_creditCard_doorhanger_iframe.js"]
skip-if = [
- "!debug && os == 'mac'", # perma-fail see Bug 1655601
- "os == 'win' && ccov", # Bug 1655600
+ "apple_catalina && !debug", # perma-fail see Bug 1655601
+ "apple_silicon && !debug", # perma-fail see Bug 1655601
+ "win11_2009 && ccov", # Bug 1655600
]
["browser_creditCard_doorhanger_logo.js"]
skip-if = [
- "!debug && os == 'mac'", # perma-fail see Bug 1655601
- "os == 'win' && ccov", # Bug 1655600
+ "apple_catalina && !debug", # perma-fail see Bug 1655601
+ "apple_silicon && !debug", # perma-fail see Bug 1655601
+ "win11_2009 && ccov", # Bug 1655600
]
["browser_creditCard_doorhanger_not_shown.js"]
skip-if = [
- "!debug && os == 'mac'", # perma-fail see Bug 1655601
- "os == 'win' && ccov", # Bug 1655600
+ "apple_catalina && !debug", # perma-fail see Bug 1655601
+ "apple_silicon && !debug", # perma-fail see Bug 1655601
+ "win11_2009 && ccov", # Bug 1655600
]
["browser_creditCard_doorhanger_sync.js"]
skip-if = [
- "!debug && os == 'mac'", # perma-fail see Bug 1655601
- "os == 'win' && ccov", # Bug 1655600
+ "apple_catalina && !debug", # perma-fail see Bug 1655601
+ "apple_silicon && !debug", # perma-fail see Bug 1655601
+ "win11_2009 && ccov", # Bug 1655600
]
["browser_creditCard_dropdown_layout.js"]
-skip-if = [
- "os == 'mac'",
- "os == 'linux'",
- "os == 'win'",
-]
+skip-if = ["true"]
["browser_creditCard_fill_cancel_login.js"]
skip-if = [
- "!debug && os == 'mac'",
- "os == 'linux'",
- "os == 'win'",
+ "apple_catalina && !debug",
+ "os == 'linux' && os_version == '18.04'",
+ "win10_2009",
+ "win11_2009",
]
["browser_creditCard_heuristics.js"]
@@ -100,22 +114,10 @@ skip-if = [
]
["browser_editCreditCardDialog.js"]
-skip-if = [
- "os == 'mac'", # perma-fail see Bug 1600059
- "os == 'linux'", # perma-fail see Bug 1600059
- "os == 'win'", # perma-fail see Bug 1600059
-]
+skip-if = ["true"] # perma-fail see Bug 1600059
["browser_insecure_form.js"]
-skip-if = [
- "os == 'mac'", # bug 1456284
- "os == 'linux'", # bug 1456284
- "os == 'win'", # bug 1456284
-]
+skip-if = ["true"] # perma-fail see Bug 1456284
["browser_manageCreditCardsDialog.js"]
-skip-if = [
- "os == 'mac'",
- "os == 'linux'",
- "os == 'win'",
-]
+skip-if = ["true"]
diff --git a/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_capture_form_removal.js b/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_capture_form_removal.js
index a6c76aa675..3617062fad 100644
--- a/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_capture_form_removal.js
+++ b/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_capture_form_removal.js
@@ -113,7 +113,7 @@ add_task(async function test_credit_card_not_captured_without_prior_fetch() {
});
info("Ensure that credit card doorhanger is not shown");
- await ensureNoDoorhanger(browser);
+ await ensureNoDoorhanger();
}
);
});
diff --git a/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_capture_multiple_cc_number.js b/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_capture_multiple_cc_number.js
new file mode 100644
index 0000000000..5668e88e74
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_capture_multiple_cc_number.js
@@ -0,0 +1,102 @@
+"use strict";
+
+const TESTCASES = [
+ {
+ description: "Trigger credit card saving using multiple cc-number fields",
+ document: `<form id="form">
+ <input id="cc-name" autocomplete="cc-name">
+ <input id="cc-number1" autocomplete="cc-number" maxlength="4">
+ <input id="cc-number2" autocomplete="cc-number" maxlength="4">
+ <input id="cc-number3" autocomplete="cc-number" maxlength="4">
+ <input id="cc-number4" autocomplete="cc-number" maxlength="4">
+ <input id="cc-exp-month" autocomplete="cc-exp-month">
+ <input id="cc-exp-year" autocomplete="cc-exp-year">
+ <input id="submit" type="submit">
+ </form>`,
+ targetElementId: "cc-number1",
+ formValue: {
+ "#cc-name": "John Doe",
+ "#cc-number1": "3714",
+ "#cc-number2": "4963",
+ "#cc-number3": "5398",
+ "#cc-number4": "431",
+ "#cc-exp-month": 12,
+ "#cc-exp-year": 2000,
+ },
+ expected: [
+ {
+ "cc-name": "John Doe",
+ "cc-number": "371449635398431",
+ "cc-exp-month": 12,
+ "cc-exp-year": 2000,
+ "cc-type": "amex",
+ },
+ ],
+ },
+];
+
+async function expectSavedCreditCards(expectedCreditCards) {
+ const creditcards = await getCreditCards();
+ is(
+ creditcards.length,
+ expectedCreditCards.length,
+ `${creditcards.length} credit card in the storage`
+ );
+
+ for (let i = 0; i < expectedCreditCards.length; i++) {
+ for (const [key, value] of Object.entries(expectedCreditCards[i])) {
+ if (key == "cc-number") {
+ creditcards[i]["cc-number"] = await OSKeyStore.decrypt(
+ creditcards[i]["cc-number-encrypted"]
+ );
+ }
+ is(creditcards[i][key] ?? "", value, `field ${key} should be equal`);
+ }
+ }
+ return creditcards;
+}
+
+add_setup(async function () {
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["extensions.formautofill.creditCards.supported", "on"],
+ ["extensions.formautofill.creditCards.enabled", true],
+ ],
+ });
+});
+
+add_task(async function test_capture_multiple_cc_number() {
+ if (!OSKeyStoreTestUtils.canTestOSKeyStoreLogin()) {
+ todo(
+ OSKeyStoreTestUtils.canTestOSKeyStoreLogin(),
+ "Cannot test OS key store login on official builds."
+ );
+ return;
+ }
+
+ for (const TEST of TESTCASES) {
+ info(`Test ${TEST.description}`);
+
+ let onChanged = waitForStorageChangedEvents("add");
+ await BrowserTestUtils.withNewTab(EMPTY_URL, async function (browser) {
+ await SpecialPowers.spawn(browser, [TEST.document], doc => {
+ content.document.body.innerHTML = doc;
+ });
+
+ await SimpleTest.promiseFocus(browser);
+
+ const onPopupShown = waitForPopupShown();
+ await focusUpdateSubmitForm(browser, {
+ focusSelector: `#${TEST.targetElementId}`,
+ newValues: TEST.formValue,
+ });
+
+ await onPopupShown;
+ await clickDoorhangerButton(MAIN_BUTTON, 0);
+ });
+ await onChanged;
+
+ await expectSavedCreditCards(TEST.expected);
+ await removeAllRecords();
+ }
+});
diff --git a/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_doorhanger_not_shown.js b/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_doorhanger_not_shown.js
index f0752e0c22..0056b83727 100644
--- a/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_doorhanger_not_shown.js
+++ b/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_doorhanger_not_shown.js
@@ -86,7 +86,7 @@ add_task(async function test_save_doorhanger_not_shown() {
newValues: TEST.formValue,
});
- await ensureNoDoorhanger(browser);
+ await ensureNoDoorhanger();
});
}
});