summaryrefslogtreecommitdiffstats
path: root/browser/extensions/formautofill/test/browser/heuristics
diff options
context:
space:
mode:
Diffstat (limited to 'browser/extensions/formautofill/test/browser/heuristics')
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser.toml39
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser_autocomplete_off_on_form.js83
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser_autocomplete_off_on_inputs.js111
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser_basic.js78
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser_capture_name.js149
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser_cc_exp.js56
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser_de_fields.js32
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser_fr_fields.js24
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser_ignore_unfocusable_fields.js159
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser_label_rules.js58
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser_multiple_section.js118
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser_parse_address_fields.js55
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser_parse_creditcard_expiry_fields.js198
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser_parse_name_fields.js86
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser_parse_street_address_fields.js148
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser_section_validation_address.js79
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/browser_sections_by_name.js318
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser.toml40
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser_BestBuy.js82
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser_CDW.js71
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser_CostCo.js194
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser_DirectAsda.js25
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Ebay.js25
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Euronics.js54
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser_GlobalDirectAsda.js24
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser_HomeDepot.js64
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Lufthansa.js28
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Lush.js31
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Macys.js40
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser_NewEgg.js109
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser_OfficeDepot.js83
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser_QVC.js96
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Sears.js81
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Staples.js78
-rw-r--r--browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Walmart.js93
35 files changed, 3009 insertions, 0 deletions
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser.toml b/browser/extensions/formautofill/test/browser/heuristics/browser.toml
new file mode 100644
index 0000000000..e7bbfa0283
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/browser.toml
@@ -0,0 +1,39 @@
+[DEFAULT]
+skip-if = ["os == 'android'"] # bug 1730213
+support-files = [
+ "../head.js",
+ "../../fixtures/**",
+]
+
+["browser_autocomplete_off_on_form.js"]
+
+["browser_autocomplete_off_on_inputs.js"]
+
+["browser_basic.js"]
+
+["browser_capture_name.js"]
+skip-if = ["apple_silicon && !debug"]
+
+["browser_cc_exp.js"]
+
+["browser_de_fields.js"]
+
+["browser_fr_fields.js"]
+
+["browser_ignore_unfocusable_fields.js"]
+
+["browser_label_rules.js"]
+
+["browser_multiple_section.js"]
+
+["browser_parse_address_fields.js"]
+
+["browser_parse_creditcard_expiry_fields.js"]
+
+["browser_parse_name_fields.js"]
+
+["browser_parse_street_address_fields.js"]
+
+["browser_section_validation_address.js"]
+
+["browser_sections_by_name.js"]
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_autocomplete_off_on_form.js b/browser/extensions/formautofill/test/browser/heuristics/browser_autocomplete_off_on_form.js
new file mode 100644
index 0000000000..ccc93bc539
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/browser_autocomplete_off_on_form.js
@@ -0,0 +1,83 @@
+/* Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+/* global add_heuristic_tests */
+
+// Ensures that fields are identified correctly even when the containing form
+// has its autocomplete attribute set to off.
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "autocomplete_off_on_form.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "organization" },
+ { fieldName: "street-address" },
+ { fieldName: "address-level2" },
+ { fieldName: "address-level1" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ { fieldName: "tel" },
+ { fieldName: "email" },
+ ],
+ },
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "organization" },
+ { fieldName: "address-line1" },
+ { fieldName: "address-line2", reason: "update-heuristic" },
+ { fieldName: "address-line3", reason: "update-heuristic" },
+ { fieldName: "address-level2" },
+ { fieldName: "address-level1" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ { fieldName: "tel" },
+ { fieldName: "email" },
+ ],
+ },
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "cc-number" },
+ { fieldName: "cc-name" },
+ { fieldName: "cc-exp-month" },
+ { fieldName: "cc-exp-year" },
+ ],
+ },
+ {
+ invalid: true,
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "address-line1" },
+ { fieldName: "address-level2" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "address-line1", reason: "update-heuristic" },
+ { fieldName: "organization", reason: "regex-heuristic" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [{ fieldName: "address-line1", reason: "update-heuristic" }],
+ },
+ ],
+ },
+ ],
+ "fixtures/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_autocomplete_off_on_inputs.js b/browser/extensions/formautofill/test/browser/heuristics/browser_autocomplete_off_on_inputs.js
new file mode 100644
index 0000000000..d57ef8dc82
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/browser_autocomplete_off_on_inputs.js
@@ -0,0 +1,111 @@
+/* Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+/* global add_heuristic_tests */
+
+// Ensures that fields are identified correctly even when the inputs
+// have their autocomplete attribute set to off.
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "autocomplete_off_on_inputs.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "organization" },
+ { fieldName: "street-address" },
+ { fieldName: "address-level2" },
+ { fieldName: "address-level1" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ { fieldName: "tel" },
+ { fieldName: "email" },
+ ],
+ },
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "organization" },
+ { fieldName: "address-line1" },
+ { fieldName: "address-line2", reason: "update-heuristic" },
+ { fieldName: "address-line3", reason: "update-heuristic" },
+ { fieldName: "address-level2" },
+ { fieldName: "address-level1" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ { fieldName: "tel" },
+ { fieldName: "email" },
+ ],
+ },
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "cc-number", reason: "fathom" },
+ { fieldName: "cc-name", reason: "fathom" },
+ { fieldName: "cc-exp-month" },
+ { fieldName: "cc-exp-year" },
+ ],
+ },
+ {
+ invalid: true,
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "address-line1" },
+ { fieldName: "address-level2" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "address-line1", reason: "update-heuristic" },
+ { fieldName: "organization", reason: "regex-heuristic" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [{ fieldName: "address-line1", reason: "update-heuristic" }],
+ },
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "organization" },
+ { fieldName: "address-line1", reason: "regex-heuristic" },
+ { fieldName: "address-line2", reason: "update-heuristic" },
+ { fieldName: "address-line3", reason: "update-heuristic" },
+ { fieldName: "address-level2", reason: "regex-heuristic" },
+ { fieldName: "address-level1" },
+ { fieldName: "postal-code", reason: "regex-heuristic" },
+ { fieldName: "country", reason: "regex-heuristic" },
+ { fieldName: "tel" },
+ { fieldName: "email", reason: "regex-heuristic" },
+ ],
+ },
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "cc-number", reason: "fathom" },
+ { fieldName: "cc-name" },
+ { fieldName: "cc-exp-month", reason: "regex-heuristic" },
+ { fieldName: "cc-exp-year", reason: "regex-heuristic" },
+ ],
+ },
+ ],
+ },
+ ],
+ "fixtures/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_basic.js b/browser/extensions/formautofill/test/browser/heuristics/browser_basic.js
new file mode 100644
index 0000000000..59447ac177
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/browser_basic.js
@@ -0,0 +1,78 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "autocomplete_basic.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "organization" },
+ { fieldName: "street-address" },
+ { fieldName: "address-level2" },
+ { fieldName: "address-level1" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ { fieldName: "tel" },
+ { fieldName: "email" },
+ ],
+ },
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "organization" },
+ { fieldName: "address-line1" },
+ { fieldName: "address-line2", reason: "update-heuristic" },
+ { fieldName: "address-line3", reason: "update-heuristic" },
+ { fieldName: "address-level2" },
+ { fieldName: "address-level1" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ { fieldName: "tel" },
+ { fieldName: "email" },
+ ],
+ },
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "cc-number" },
+ { fieldName: "cc-name" },
+ { fieldName: "cc-exp-month" },
+ { fieldName: "cc-exp-year" },
+ ],
+ },
+ {
+ invalid: true,
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "address-line1" },
+ { fieldName: "address-level2" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "address-line1", reason: "update-heuristic" },
+ { fieldName: "organization", reason: "regex-heuristic" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [{ fieldName: "address-line1", reason: "update-heuristic" }],
+ },
+ ],
+ },
+ ],
+ "fixtures/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_capture_name.js b/browser/extensions/formautofill/test/browser/heuristics/browser_capture_name.js
new file mode 100644
index 0000000000..2838d2d25e
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/browser_capture_name.js
@@ -0,0 +1,149 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/* import-globals-from ../head.js */
+
+"use strict";
+
+const TESTCASES = [
+ {
+ description: `cc fields + first name with autocomplete attribute`,
+ document: `<form id="form">
+ <input id="cc-number" autocomplete="cc-number">
+ <input id="cc-exp" autocomplete="cc-exp">
+ <input id="name" autocomplete="given-name">
+ <input type="submit"/>
+ </form>`,
+ fillValues: {
+ "#cc-number": "4111111111111111",
+ "#cc-exp": "12/24",
+ "#name": "John Doe",
+ },
+ expected: undefined,
+ },
+ {
+ description: `cc fields + first name without autocomplete attribute`,
+ document: `<form id="form">
+ <input id="cc-number" autocomplete="cc-number">
+ <input id="cc-exp" autocomplete="cc-exp">
+ <input id="name" placeholder="given-name">
+ <input type="submit"/>
+ </form>`,
+ fillValues: {
+ "#cc-number": "4111111111111111",
+ "#cc-exp": "12/24",
+ "#name": "John Doe",
+ },
+ expected: "John Doe",
+ },
+ {
+ description: `cc fields + first and last name with autocomplete attribute`,
+ document: `<form id="form">
+ <input id="cc-number" autocomplete="cc-number">
+ <input id="cc-exp" autocomplete="cc-exp">
+ <input id="given" autocomplete="given-name">
+ <input id="family" autocomplete="family-name">
+ <input type="submit"/>
+ </form>`,
+ fillValues: {
+ "#cc-number": "4111111111111111",
+ "#cc-exp": "12/24",
+ "#given": "John",
+ "#family": "Doe",
+ },
+ expected: undefined,
+ },
+ {
+ description: `cc fields + first and last name without autocomplete attribute`,
+ document: `<form id="form">
+ <input id="cc-number" autocomplete="cc-number">
+ <input id="cc-exp" autocomplete="cc-exp">
+ <input id="given" placeholder="given-name">
+ <input id="family" placeholder="family-name">
+ <input type="submit"/>
+ </form>`,
+ fillValues: {
+ "#cc-number": "4111111111111111",
+ "#cc-exp": "12/24",
+ "#given": "John",
+ "#family": "Doe",
+ },
+ expected: "John Doe",
+ },
+ {
+ description: `cc fields + cc-name + first and last name`,
+ document: `<form id="form">
+ <input id="cc-number" autocomplete="cc-number">
+ <input id="cc-name" autocomplete="cc-name">
+ <input id="cc-exp" autocomplete="cc-exp">
+ <input id="given" placeholder="given-name">
+ <input id="family" placeholder="family-name">
+ <input type="submit"/>
+ </form>`,
+ fillValues: {
+ "#cc-number": "4111111111111111",
+ "#cc-name": "Jane Poe",
+ "#cc-exp": "12/24",
+ "#given": "John",
+ "#family": "Doe",
+ },
+ expected: "Jane Poe",
+ },
+ {
+ description: `first and last name + cc fields`,
+ document: `<form id="form">
+ <input id="given" placeholder="given-name">
+ <input id="family" placeholder="family-name">
+ <input id="cc-number" autocomplete="cc-number">
+ <input id="cc-exp" autocomplete="cc-exp">
+ <input type="submit"/>
+ </form>`,
+ fillValues: {
+ "#cc-number": "4111111111111111",
+ "#cc-exp": "12/24",
+ "#given": "John",
+ "#family": "Doe",
+ },
+ expected: undefined,
+ },
+];
+
+add_setup(async function () {
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["extensions.formautofill.creditCards.supported", "on"],
+ ["extensions.formautofill.creditCards.enabled", true],
+ ],
+ });
+});
+
+add_task(async function test_save_doorhanger_click_save() {
+ 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);
+
+ let onPopupShown = waitForPopupShown();
+
+ await focusUpdateSubmitForm(browser, {
+ focusSelector: "#cc-number",
+ newValues: TEST.fillValues,
+ });
+
+ await onPopupShown;
+ await clickDoorhangerButton(MAIN_BUTTON);
+ });
+
+ await onChanged;
+
+ let creditCards = await getCreditCards();
+ is(creditCards.length, 1, "1 credit card in storage");
+ is(creditCards[0]["cc-name"], TEST.expected, "Verify the name field");
+ await removeAllRecords();
+ }
+});
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_cc_exp.js b/browser/extensions/formautofill/test/browser/heuristics/browser_cc_exp.js
new file mode 100644
index 0000000000..fefeaac606
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/browser_cc_exp.js
@@ -0,0 +1,56 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "heuristics_cc_exp.html",
+ expectedResult: [
+ {
+ description: "form1",
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "cc-name" },
+ { fieldName: "cc-number" },
+ { fieldName: "cc-exp-month" },
+ { fieldName: "cc-exp-year" },
+ ],
+ },
+ {
+ description: "form2",
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [{ fieldName: "cc-number" }, { fieldName: "cc-exp" }],
+ },
+ {
+ description: "form3",
+ fields: [
+ { fieldName: "cc-number", reason: "autocomplete" },
+ { fieldName: "cc-exp", reason: "update-heuristic" },
+ ],
+ },
+ {
+ description: "form4",
+ fields: [
+ { fieldName: "cc-number", reason: "autocomplete" },
+ { fieldName: "cc-exp-month", reason: "regex-heuristic" },
+ { fieldName: "cc-exp-year", reason: "regex-heuristic" },
+ ],
+ },
+ {
+ description: "form5",
+ fields: [
+ { fieldName: "cc-number", reason: "autocomplete" },
+ { fieldName: "cc-exp-month", reason: "regex-heuristic" },
+ { fieldName: "cc-exp-year", reason: "update-heuristic" },
+ ],
+ },
+ ],
+ },
+ ],
+ "fixtures/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_de_fields.js b/browser/extensions/formautofill/test/browser/heuristics/browser_de_fields.js
new file mode 100644
index 0000000000..0d47cb6935
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/browser_de_fields.js
@@ -0,0 +1,32 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "heuristics_de_fields.html",
+ expectedResult: [
+ {
+ fields: [
+ { fieldName: "cc-name", reason: "fathom" },
+ { fieldName: "cc-type", reason: "regex-heuristic" },
+ { fieldName: "cc-number", reason: "fathom" },
+ { fieldName: "cc-exp-month", reason: "regex-heuristic" },
+ { fieldName: "cc-exp-year", reason: "regex-heuristic" },
+ ],
+ },
+ {
+ fields: [
+ { fieldName: "cc-name", reason: "fathom" },
+ { fieldName: "cc-type", reason: "regex-heuristic" },
+ { fieldName: "cc-number", reason: "fathom" },
+ { fieldName: "cc-exp-month", reason: "regex-heuristic" },
+ { fieldName: "cc-exp-year", reason: "regex-heuristic" },
+ ],
+ },
+ ],
+ },
+ ],
+ "fixtures/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_fr_fields.js b/browser/extensions/formautofill/test/browser/heuristics/browser_fr_fields.js
new file mode 100644
index 0000000000..b43d1b1e2a
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/browser_fr_fields.js
@@ -0,0 +1,24 @@
+/* Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "heuristics_fr_fields.html",
+ expectedResult: [
+ {
+ fields: [
+ { fieldName: "cc-number", reason: "fathom" },
+ { fieldName: "cc-exp", reason: "update-heuristic" },
+ { fieldName: "cc-name", reason: "regex-heuristic" },
+ ],
+ },
+ ],
+ },
+ ],
+ "fixtures/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_ignore_unfocusable_fields.js b/browser/extensions/formautofill/test/browser/heuristics/browser_ignore_unfocusable_fields.js
new file mode 100644
index 0000000000..56f53a1e76
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/browser_ignore_unfocusable_fields.js
@@ -0,0 +1,159 @@
+/* Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests([
+ {
+ description: "All visual fields are considered focusable.",
+
+ fixtureData: `
+ <html>
+ <body>
+ <form>
+ <input type="text" id="name" autocomplete="name" />
+ <input type="text" id="tel" autocomplete="tel" />
+ <input type="text" id="email" autocomplete="email"/>
+ <select id="country" autocomplete="country">
+ <option value="United States">United States</option>
+ </select>
+ <input type="text" id="postal-code" autocomplete="postal-code"/>
+ <input type="text" id="address-line1" autocomplete="address-line1" />
+ <div>
+ <input type="text" id="address-line2" autocomplete="address-line2" />
+ </div>
+ </form>
+ </form>
+ </body>
+ </html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "name" },
+ { fieldName: "tel" },
+ { fieldName: "email" },
+ { fieldName: "country" },
+ { fieldName: "postal-code" },
+ { fieldName: "address-line1" },
+ { fieldName: "address-line2" },
+ ],
+ },
+ ],
+ },
+ {
+ // ignore opacity (see Bug 1835852),
+ description:
+ "Invisible fields with style.opacity=0 set are considered focusable.",
+
+ fixtureData: `
+ <html>
+ <body>
+ <form>
+ <input type="text" id="name" autocomplete="name" style="opacity:0" />
+ <input type="text" id="tel" autocomplete="tel" />
+ <input type="text" id="email" autocomplete="email" style="opacity:0"/>
+ <select id="country" autocomplete="country">
+ <option value="United States">United States</option>
+ </select>
+ <input type="text" id="postal-code" autocomplete="postal-code" />
+ <input type="text" id="address-line1" autocomplete="address-line1" />
+ <div>
+ <input type="text" id="address-line2" autocomplete="address-line2" />
+ </div>
+ </form>
+ </form>
+ </body>
+ </html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "name" },
+ { fieldName: "tel" },
+ { fieldName: "email" },
+ { fieldName: "country" },
+ { fieldName: "postal-code" },
+ { fieldName: "address-line1" },
+ { fieldName: "address-line2" },
+ ],
+ },
+ ],
+ },
+ {
+ description:
+ "Some fields are considered unfocusable due to their invisibility.",
+
+ fixtureData: `
+ <html>
+ <body>
+ <form>
+ <input type="text" id="name" autocomplete="name" />
+ <input type="text" id="tel" autocomplete="tel" />
+ <input type="text" id="email" autocomplete="email" />
+ <input type="text" id="country" autocomplete="country" />
+ <input type="text" id="postal-code" autocomplete="postal-code" hidden />
+ <input type="text" id="address-line1" autocomplete="address-line1" style="display:none" />
+ <div style="visibility: hidden">
+ <input type="text" id="address-line2" autocomplete="address-line2" />
+ </div>
+ </form>
+ </body>
+ </html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "name" },
+ { fieldName: "tel" },
+ { fieldName: "email" },
+ { fieldName: "country" },
+ ],
+ },
+ ],
+ },
+ {
+ description: `Disabled field and field with tabindex="-1" is considered unfocusable`,
+
+ fixtureData: `
+ <html>
+ <body>
+ <form>
+ <input type="text" id="name" autocomplete="name" />
+ <input type="text" id="tel" autocomplete="tel" />
+ <input type="text" id="email" autocomplete="email" />
+ <input type="text" id="country" autocomplete="country" disabled/>
+ <input type="text" id="postal-code" autocomplete="postal-code" tabindex="-1"/>
+ <input type="text" id="address-line1" autocomplete="address-line1" />
+ <input type="text" id="address-line2" autocomplete="address-line2" />
+ </form>
+ </body>
+ </html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "name" },
+ { fieldName: "tel" },
+ { fieldName: "email" },
+ { fieldName: "address-line1" },
+ { fieldName: "address-line2" },
+ ],
+ },
+ ],
+ },
+]);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_label_rules.js b/browser/extensions/formautofill/test/browser/heuristics/browser_label_rules.js
new file mode 100644
index 0000000000..16b5e8a56b
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/browser_label_rules.js
@@ -0,0 +1,58 @@
+/* Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests([
+ {
+ fixtureData: `
+ <html>
+ <body>
+ <form>
+ <input type="text" id="name" autocomplete="name"/>
+ <input type="text" id="country" autocomplete="country"/>
+ <label for="test1">sender-address</label>
+ <input type="text" id="test1"/>
+ <input type="text" id="test2" name="sender-address"/>
+ </form>
+ </body>
+ </html>`,
+ expectedResult: [
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ description: `Only "sender-address" keywords in labels"`,
+ fields: [
+ { fieldName: "name", reason: "autocomplete" },
+ { fieldName: "country", reason: "autocomplete" },
+ { fieldName: "address-line1" },
+ ],
+ },
+ ],
+ },
+ {
+ fixtureData: `
+ <html>
+ <body>
+ <form>
+ <input type="text" id="name" autocomplete="name"/>
+ <input type="text" id="country" autocomplete="country"/>
+ <input type="text" id="test" aria-label="street-address"/>
+ </form>
+ </body>
+ </html>`,
+ expectedResult: [
+ {
+ description: `keywords are in aria-label`,
+ fields: [
+ { fieldName: "name", reason: "autocomplete" },
+ { fieldName: "country", reason: "autocomplete" },
+ { fieldName: "street-address", reason: "regex-heuristic" },
+ ],
+ },
+ ],
+ },
+]);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_multiple_section.js b/browser/extensions/formautofill/test/browser/heuristics/browser_multiple_section.js
new file mode 100644
index 0000000000..078f2240db
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/browser_multiple_section.js
@@ -0,0 +1,118 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "multiple_section.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ addressType: "shipping",
+ },
+ fields: [
+ { fieldName: "name", addressType: "" },
+ { fieldName: "organization", addressType: "" },
+ { fieldName: "street-address" },
+ { fieldName: "address-level2" },
+ { fieldName: "address-level1" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ ],
+ },
+ {
+ default: {
+ reason: "autocomplete",
+ addressType: "billing",
+ },
+ fields: [
+ { fieldName: "street-address" },
+ { fieldName: "address-level2" },
+ { fieldName: "address-level1" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ ],
+ },
+ {
+ default: {
+ reason: "autocomplete",
+ section: "section-my",
+ },
+ fields: [
+ { fieldName: "street-address" },
+ { fieldName: "address-level2" },
+ { fieldName: "address-level1" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ { fieldName: "tel", section: "", contactType: "work" },
+ { fieldName: "email", section: "", contactType: "work" },
+ ],
+ },
+ {
+ invalid: true,
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ // Even the `contactType` of these two fields are different with the
+ // above two, we still consider they are identical until supporting
+ // multiple phone number and email in one profile.
+ { fieldName: "tel", contactType: "home" },
+ { fieldName: "email", contactType: "home" },
+ ],
+ },
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "name" },
+ { fieldName: "organization" },
+ { fieldName: "street-address" },
+ { fieldName: "address-level2" },
+ { fieldName: "address-level1" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ ],
+ },
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "street-address" },
+ { fieldName: "address-level2" },
+ { fieldName: "address-level1" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ ],
+ },
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "street-address" },
+ { fieldName: "address-level2" },
+ { fieldName: "address-level1" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ { fieldName: "tel", contactType: "work" },
+ { fieldName: "email", contactType: "work" },
+ ],
+ },
+ {
+ invalid: true,
+ default: {
+ reason: "autocomplete",
+ contactType: "home",
+ },
+ fields: [{ fieldName: "tel" }, { fieldName: "email" }],
+ },
+ ],
+ },
+ ],
+ "fixtures/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_parse_address_fields.js b/browser/extensions/formautofill/test/browser/heuristics/browser_parse_address_fields.js
new file mode 100644
index 0000000000..e602173ad5
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/browser_parse_address_fields.js
@@ -0,0 +1,55 @@
+/* Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests([
+ {
+ description:
+ "When a <select> is next to address-level2, we assume the select field is address-level1",
+ fixtureData: `
+ <html>
+ <body>
+ <form>
+ <input type="text" id="name" autocomplete="name" />
+ <input type="text" id="country" autocomplete="country"/>
+ <select><option value="test">test</option></select>
+ <input type="text" id="address-level2" autocomplete="address-level2" />
+ </form>
+ <form>
+ <input type="text" id="name" autocomplete="name" />
+ <input type="text" id="country" autocomplete="country"/>
+ <input type="text" id="address-level2" autocomplete="address-level2" />
+ <select><option value="test">test</option></select>
+ </form>
+ </body>
+ </html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "name" },
+ { fieldName: "country" },
+ { fieldName: "address-level1", reason: "update-heuristic" },
+ { fieldName: "address-level2" },
+ ],
+ },
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "name" },
+ { fieldName: "country" },
+ { fieldName: "address-level2" },
+ { fieldName: "address-level1", reason: "update-heuristic" },
+ ],
+ },
+ ],
+ },
+]);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_parse_creditcard_expiry_fields.js b/browser/extensions/formautofill/test/browser/heuristics/browser_parse_creditcard_expiry_fields.js
new file mode 100644
index 0000000000..aa61633f17
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/browser_parse_creditcard_expiry_fields.js
@@ -0,0 +1,198 @@
+/* Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests([
+ {
+ description:
+ "Apply credit card expiry heuristic only when there is only 1 credit card expiry field",
+ fixtureData: `
+ <html>
+ <body>
+ <form>
+ <input type="text" autocomplete="cc-number"/>
+ <input type="text" placeholder="mm-yy"/>
+ </form>
+ <form>
+ <input type="text" autocomplete="cc-number"/>
+ <input type="text" id="month"/>
+ </form>
+ <form>
+ <input type="text" autocomplete="cc-number"/>
+ <input type="text" id="year"/>
+ </form>
+ </body>
+ </html>
+ `,
+ expectedResult: [
+ {
+ fields: [
+ { fieldName: "cc-number", reason: "autocomplete" },
+ { fieldName: "cc-exp", reason: "regex-heuristic" },
+ ],
+ },
+ {
+ fields: [
+ { fieldName: "cc-number", reason: "autocomplete" },
+ { fieldName: "cc-exp", reason: "update-heuristic" },
+ ],
+ },
+ {
+ fields: [
+ { fieldName: "cc-number", reason: "autocomplete" },
+ { fieldName: "cc-exp", reason: "update-heuristic" },
+ ],
+ },
+ ],
+ },
+ {
+ description:
+ "Do not apply credit card expiry heuristic only when the previous field is not a cc field",
+ fixtureData: `
+ <html>
+ <body>
+ <form>
+ <input type="text" placeholder="mm-yy"/>
+ <input type="text" autocomplete="cc-number"/>
+ </form>
+ <form>
+ <input type="text" id="month"/>
+ <input type="text" autocomplete="cc-number"/>
+ </form>
+ <form>
+ <input type="text" id="year"/>
+ <input type="text" autocomplete="cc-number"/>
+ </form>
+ </body>
+ </html>
+ `,
+ expectedResult: [
+ {
+ fields: [
+ { fieldName: "cc-exp", reason: "regex-heuristic" },
+ { fieldName: "cc-number", reason: "autocomplete" },
+ ],
+ },
+ {
+ fields: [{ fieldName: "cc-number", reason: "autocomplete" }],
+ },
+ {
+ fields: [{ fieldName: "cc-number", reason: "autocomplete" }],
+ },
+ ],
+ },
+ {
+ description:
+ "Apply credit card expiry heuristic only when the previous fields has a credit card number field",
+ fixtureData: `
+ <html>
+ <body>
+ <form>
+ <input type="text" autocomplete="cc-number"/>
+ <input type="text" autocomplete="cc-name"/>
+ <input type="text" placeholder="month"/>
+ </form>
+ <form>
+ <input type="text" autocomplete="cc-number"/>
+ <input type="text" autocomplete="cc-family-name"/>
+ <input type="text" autocomplete="cc-given-name"/>
+ <input type="text" placeholder="month"/>
+ </form>
+ </body>
+ </html>
+ `,
+ expectedResult: [
+ {
+ fields: [
+ { fieldName: "cc-number", reason: "autocomplete" },
+ { fieldName: "cc-name", reason: "autocomplete" },
+ { fieldName: "cc-exp", reason: "update-heuristic" },
+ ],
+ },
+ {
+ fields: [
+ { fieldName: "cc-number", reason: "autocomplete" },
+ { fieldName: "cc-family-name", reason: "autocomplete" },
+ { fieldName: "cc-given-name", reason: "autocomplete" },
+ { fieldName: "cc-exp", reason: "update-heuristic" },
+ ],
+ },
+ ],
+ },
+ {
+ description:
+ "Apply credit card expiry heuristic only when there are credit card expiry fields",
+ fixtureData: `
+ <html>
+ <body>
+ <form>
+ <input type="text" autocomplete="cc-number"/>
+ <input type="text" placeholder="month"/>
+ <input type="text" placeholder="year"/>
+ </form>
+ <form>
+ <input type="text" autocomplete="cc-number"/>
+ <input type="text" placeholder="month"/>
+ <input type="text" placeholder="month"/>
+ </form>
+ <form>
+ <input type="text" autocomplete="cc-number"/>
+ <input type="text" placeholder="year"/>
+ <input type="text" placeholder="year"/>
+ </form>
+ </body>
+ </html>
+ `,
+ expectedResult: [
+ {
+ fields: [
+ { fieldName: "cc-number", reason: "autocomplete" },
+ { fieldName: "cc-exp-month", reason: "regex-heuristic" },
+ { fieldName: "cc-exp-year", reason: "regex-heuristic" },
+ ],
+ },
+ {
+ fields: [
+ { fieldName: "cc-number", reason: "autocomplete" },
+ { fieldName: "cc-exp-month", reason: "regex-heuristic" },
+ { fieldName: "cc-exp-year", reason: "update-heuristic" },
+ ],
+ },
+ {
+ fields: [
+ { fieldName: "cc-number", reason: "autocomplete" },
+ { fieldName: "cc-exp-month", reason: "update-heuristic" },
+ { fieldName: "cc-exp-year", reason: "regex-heuristic" },
+ ],
+ },
+ ],
+ },
+ {
+ description: "Honor autocomplete attribute",
+ fixtureData: `
+ <html>
+ <body>
+ <form>
+ <input type="text" autocomplete="cc-number"/>
+ <input type="text" placeholder="month" autocomplete="cc-exp"/>
+ <input type="text" placeholder="year" autocomplete="cc-exp"/>
+ </form>
+ </body>
+ </html>
+ `,
+ expectedResult: [
+ {
+ fields: [
+ { fieldName: "cc-number", reason: "autocomplete" },
+ { fieldName: "cc-exp", reason: "autocomplete" },
+ ],
+ },
+ {
+ fields: [{ fieldName: "cc-exp", reason: "autocomplete" }],
+ },
+ ],
+ },
+]);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_parse_name_fields.js b/browser/extensions/formautofill/test/browser/heuristics/browser_parse_name_fields.js
new file mode 100644
index 0000000000..6433a4a9ea
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/browser_parse_name_fields.js
@@ -0,0 +1,86 @@
+/* Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests([
+ {
+ description:
+ "Update name to cc-name when the previous section is a credit card section",
+ fixtureData: `
+ <html><body><form>
+ <input id="cc-number" autocomplete="cc-number">
+ <input id="given" placeholder="given-name">
+ <input id="family" placeholder="family-name">
+ </form></body></html>`,
+ expectedResult: [
+ {
+ fields: [
+ { fieldName: "cc-number", reason: "autocomplete" },
+ { fieldName: "cc-given-name", reason: "update-heuristic" },
+ { fieldName: "cc-family-name", reason: "update-heuristic" },
+ ],
+ },
+ ],
+ },
+ {
+ description:
+ "Do not update name to cc-name when the previous credit card section already contains cc-name",
+ fixtureData: `
+ <html><body><form>
+ <input id="cc-name" autocomplete="cc-name">
+ <input id="cc-number" autocomplete="cc-number">
+ <input id="given" placeholder="given-name">
+ <input id="family" placeholder="family-name">
+ <input id="address" autocomplete="street-address">
+ <input id="country" autocomplete="country">
+ </form></body></html>`,
+ expectedResult: [
+ {
+ fields: [
+ { fieldName: "cc-name", reason: "autocomplete" },
+ { fieldName: "cc-number", reason: "autocomplete" },
+ ],
+ },
+ {
+ fields: [
+ { fieldName: "given-name", reason: "regex-heuristic" },
+ { fieldName: "family-name", reason: "regex-heuristic" },
+ { fieldName: "street-address", reason: "autocomplete" },
+ { fieldName: "country", reason: "autocomplete" },
+ ],
+ },
+ ],
+ },
+ {
+ description:
+ "Do not update name to cc-name when the previous credit card section contains cc-csc",
+ fixtureData: `
+ <html><body><form>
+ <input id="cc-number" autocomplete="cc-number">
+ <input id="cc-csc" autocomplete="cc-csc">
+ <input id="given" placeholder="given-name">
+ <input id="family" placeholder="family-name">
+ <input id="address" autocomplete="street-address">
+ <input id="country" autocomplete="country">
+ </form></body></html>`,
+ expectedResult: [
+ {
+ fields: [
+ { fieldName: "cc-number", reason: "autocomplete" },
+ //{ fieldName: "cc-csc", reason: "autocomplete" },
+ ],
+ },
+ {
+ fields: [
+ { fieldName: "given-name", reason: "regex-heuristic" },
+ { fieldName: "family-name", reason: "regex-heuristic" },
+ { fieldName: "street-address", reason: "autocomplete" },
+ { fieldName: "country", reason: "autocomplete" },
+ ],
+ },
+ ],
+ },
+]);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_parse_street_address_fields.js b/browser/extensions/formautofill/test/browser/heuristics/browser_parse_street_address_fields.js
new file mode 100644
index 0000000000..699ddf086f
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/browser_parse_street_address_fields.js
@@ -0,0 +1,148 @@
+/* Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests([
+ {
+ description: "Apply heuristic when we only see one street-address fields",
+ fixtureData: `
+ <html><body>
+ <form><input type="text" id="street-address"/></form>
+ <form><input type="text" id="addr-1"/></form>
+ <form><input type="text" id="addr-2"/></form>
+ <form><input type="text" id="addr-3"/></form>
+ </body></html>`,
+ expectedResult: [
+ {
+ invalid: true,
+ fields: [{ fieldName: "street-address", reason: "regex-heuristic" }],
+ },
+ {
+ invalid: true,
+ fields: [{ fieldName: "address-line1", reason: "regex-heuristic" }],
+ },
+ {
+ invalid: true,
+ fields: [{ fieldName: "address-line1", reason: "update-heuristic" }],
+ },
+ {
+ invalid: true,
+ fields: [{ fieldName: "address-line1", reason: "update-heuristic" }],
+ },
+ ],
+ },
+ {
+ // Bug 1833613
+ description:
+ "street-address field is treated as address-line1 when address-line2 is present while adddress-line1 is not",
+ fixtureData: `
+ <html>
+ <body>
+ <form>
+ <input type="text" id="street-address" autocomplete="street-address"/>
+ <input type="text" id="address-line2" autocomplete="address-line2"/>
+ <input type="text" id="email" autocomplete="email"/>
+ </form>
+ </body>
+ </html>`,
+ expectedResult: [
+ {
+ fields: [
+ { fieldName: "address-line1", reason: "update-heuristic" },
+ { fieldName: "address-line2", reason: "autocomplete" },
+ { fieldName: "email", reason: "autocomplete" },
+ ],
+ },
+ ],
+ },
+ {
+ // Bug 1833613
+ description:
+ "street-address field should not be treated as address-line1 when address-line2 is not present",
+ fixtureData: `
+ <html>
+ <body>
+ <form>
+ <input type="text" id="street-address" autocomplete="street-address"/>
+ <input type="text" id="address-line3" autocomplete="address-line3"/>
+ <input type="text" id="email" autocomplete="email"/>
+ </form>
+ </body>
+ </html>`,
+ expectedResult: [
+ {
+ fields: [
+ { fieldName: "street-address", reason: "autocomplete" },
+ { fieldName: "address-line3", reason: "autocomplete" },
+ { fieldName: "email", reason: "autocomplete" },
+ ],
+ },
+ ],
+ },
+ {
+ // Bug 1833613
+ description:
+ "street-address field should not be treated as address-line1 when address-line1 is present",
+ fixtureData: `
+ <html>
+ <body>
+ <form>
+ <input type="text" id="street-address" autocomplete="street-address"/>
+ <input type="text" id="address-line1" autocomplete="address-line1"/>
+ <input type="text" id="email" autocomplete="email"/>
+ </form>
+ </body>
+ </html>`,
+ expectedResult: [
+ {
+ fields: [
+ { fieldName: "street-address", reason: "autocomplete" },
+ { fieldName: "address-line1", reason: "autocomplete" },
+ { fieldName: "email", reason: "autocomplete" },
+ ],
+ },
+ ],
+ },
+ {
+ description:
+ "street-address field is treated as address-line1 when address-line2 is present while adddress-line1 is not",
+ fixtureData: `
+ <html>
+ <body>
+ <form>
+ <input type="text" id="addr-3"/>
+ <input type="text" id="addr-2"/>
+ <input type="text" id="addr-1"/>
+ </form>
+ <form>
+ <input type="text" id="addr-3" autocomplete="address-line3"/>
+ <input type="text" id="addr-2" autocomplete="address-line2"/>
+ <input type="text" id="addr-1" autocomplete="address-line1"/>
+ </form>
+ </body>
+ </html>`,
+ expectedResult: [
+ {
+ description:
+ "Apply heuristic when we see 3 street-address fields occur in a row",
+ fields: [
+ { fieldName: "address-line1", reason: "update-heuristic" },
+ { fieldName: "address-line2", reason: "regex-heuristic" },
+ { fieldName: "address-line3", reason: "update-heuristic" },
+ ],
+ },
+ {
+ description:
+ "Do not apply heuristic when we see 3 street-address fields occur in a row but autocomplete attribute is present",
+ fields: [
+ { fieldName: "address-line3", reason: "autocomplete" },
+ { fieldName: "address-line2", reason: "autocomplete" },
+ { fieldName: "address-line1", reason: "autocomplete" },
+ ],
+ },
+ ],
+ },
+]);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_section_validation_address.js b/browser/extensions/formautofill/test/browser/heuristics/browser_section_validation_address.js
new file mode 100644
index 0000000000..2e9cf42ab0
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/browser_section_validation_address.js
@@ -0,0 +1,79 @@
+/* Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests([
+ {
+ description: `An address section is valid when it only contains more than three fields`,
+ fixtureData: `
+ <html><body>
+ <input id="street-address" autocomplete="street-address">
+ <input id="postal-code" autocomplete="postal-code">
+ <input id="email" autocomplete="email">
+ </body></html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "street-address" },
+ { fieldName: "postal-code" },
+ { fieldName: "email" },
+ ],
+ },
+ ],
+ },
+ {
+ description: `An address section is invalid when it contains less than threee fields`,
+ fixtureData: `
+ <html><body>
+ <input id="postal-code" autocomplete="postal-code">
+ <input id="email" autocomplete="email">
+
+ <input id="postal-code" autocomplete="postal-code">
+ </body></html>
+ `,
+ expectedResult: [
+ {
+ description: "A section with two fields",
+ invalid: true,
+ fields: [
+ { fieldName: "postal-code", reason: "autocomplete" },
+ { fieldName: "email", reason: "autocomplete" },
+ ],
+ },
+ {
+ description: "A section with one field",
+ invalid: true,
+ fields: [{ fieldName: "postal-code", reason: "autocomplete" }],
+ },
+ ],
+ },
+ {
+ description: `Address section validation only counts the number of different address field name in the section`,
+ fixtureData: `
+ <html><body>
+ <input id="postal-code" autocomplete="postal-code">
+ <input id="email" autocomplete="email">
+ <input id="email" autocomplete="email">
+ </body></html>
+ `,
+ expectedResult: [
+ {
+ description:
+ "A section with three fields but has duplicated email fields",
+ invalid: true,
+ fields: [
+ { fieldName: "postal-code", reason: "autocomplete" },
+ { fieldName: "email", reason: "autocomplete" },
+ { fieldName: "email", reason: "autocomplete" },
+ ],
+ },
+ ],
+ },
+]);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_sections_by_name.js b/browser/extensions/formautofill/test/browser/heuristics/browser_sections_by_name.js
new file mode 100644
index 0000000000..c6c8ea5759
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/browser_sections_by_name.js
@@ -0,0 +1,318 @@
+/* Any copyright is dedicated to the Public Domain.
+http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/* global add_heuristic_tests */
+
+"use strict";
+
+// The following are included in this test
+// - One named billing section
+// - One named billing section and one named shipping section
+// - One named billing section and one section without name
+// - Fields without section name are merged to a section with section name
+// - Two sections without name
+
+add_heuristic_tests([
+ {
+ description: `One named billing section`,
+ fixtureData: `
+ <html><body>
+ <input id="street-address" autocomplete="billing street-address">
+ <input id="postal-code" autocomplete="billing postal-code">
+ <input id="country" autocomplete="billing country">
+ </body></html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ addressType: "billing",
+ },
+ fields: [
+ { fieldName: "street-address" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ ],
+ },
+ ],
+ },
+ {
+ description: `One billing section and one shipping section`,
+ fixtureData: `
+ <html><body>
+ <input id="street-address" autocomplete="billing street-address">
+ <input id="postal-code" autocomplete="billing postal-code">
+ <input id="country" autocomplete="billing country">
+ <input id="street-address" autocomplete="shipping street-address">
+ <input id="postal-code" autocomplete="shipping postal-code">
+ <input id="country" autocomplete="shipping country">
+ </body></html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ addressType: "billing",
+ },
+ fields: [
+ { fieldName: "street-address" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ ],
+ },
+ {
+ default: {
+ reason: "autocomplete",
+ addressType: "shipping",
+ },
+ fields: [
+ { fieldName: "street-address" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ ],
+ },
+ ],
+ },
+ {
+ description: `One billing section, one shipping section, and then billing section`,
+ fixtureData: `
+ <html><body>
+ <input id="street-address" autocomplete="billing street-address">
+ <input id="postal-code" autocomplete="billing postal-code">
+ <input id="street-address" autocomplete="shipping street-address">
+ <input id="postal-code" autocomplete="shipping postal-code">
+ <input id="country" autocomplete="shipping country">
+ <input id="country" autocomplete="billing country">
+ </body></html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ addressType: "billing",
+ },
+ fields: [
+ { fieldName: "street-address" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ ],
+ },
+ {
+ default: {
+ reason: "autocomplete",
+ addressType: "shipping",
+ },
+ fields: [
+ { fieldName: "street-address" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ ],
+ },
+ ],
+ },
+ {
+ description: `one section without a name and one billing section`,
+ fixtureData: `
+ <html><body>
+ <input id="street-address" autocomplete="street-address">
+ <input id="postal-code" autocomplete="postal-code">
+ <input id="country" autocomplete="country">
+ <input id="street-address" autocomplete="billing street-address">
+ <input id="postal-code" autocomplete="billing postal-code">
+ <input id="country" autocomplete="billing country">
+ </body></html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "street-address" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ ],
+ },
+ {
+ default: {
+ reason: "autocomplete",
+ addressType: "billing",
+ },
+ fields: [
+ { fieldName: "street-address" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ ],
+ },
+ ],
+ },
+ {
+ description: `One billing section and one section without a name`,
+ fixtureData: `
+ <html><body>
+ <input id="street-address" autocomplete="billing street-address">
+ <input id="postal-code" autocomplete="billing postal-code">
+ <input id="country" autocomplete="billing country">
+ <input id="street-address" autocomplete="street-address">
+ <input id="postal-code" autocomplete="postal-code">
+ <input id="country" autocomplete="country">
+ </body></html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ addressType: "billing",
+ },
+ fields: [
+ { fieldName: "street-address" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ ],
+ },
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "street-address" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ ],
+ },
+ ],
+ },
+ {
+ description: `Fields without section name are merged (test both before and after the section with a name)`,
+ fixtureData: `
+ <html><body>
+ <input id="name" autocomplete="name">
+ <input id="street-address" autocomplete="billing street-address">
+ <input id="postal-code" autocomplete="billing postal-code">
+ <input id="country" autocomplete="billing country">
+ <input id="street-address" autocomplete="shipping street-address">
+ <input id="postal-code" autocomplete="shipping postal-code">
+ <input id="country" autocomplete="shipping country">
+ <input id="name" autocomplete="name">
+ </body></html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ addressType: "billing",
+ },
+ fields: [
+ { fieldName: "name", addressType: "" },
+ { fieldName: "street-address" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ ],
+ },
+ {
+ default: {
+ reason: "autocomplete",
+ addressType: "shipping",
+ },
+ fields: [
+ { fieldName: "street-address" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ { fieldName: "name", addressType: "" },
+ ],
+ },
+ ],
+ },
+ {
+ description: `Fields without section name are merged, but do not merge if the field already exists`,
+ fixtureData: `
+ <html><body>
+ <input id="name" autocomplete="name">
+ <input id="street-address" autocomplete="billing street-address">
+ <input id="postal-code" autocomplete="billing postal-code">
+ <input id="country" autocomplete="billing country">
+ <input id="name" autocomplete="name">
+ </body></html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ addressType: "billing",
+ },
+ fields: [
+ { fieldName: "name", addressType: "" },
+ { fieldName: "street-address" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [{ fieldName: "name", reason: "autocomplete" }],
+ },
+ ],
+ },
+ {
+ description: `Fields without section name are merged (multi-fields)`,
+ fixtureData: `
+ <html><body>
+ <input id="street-address" autocomplete="billing street-address">
+ <input id="postal-code" autocomplete="billing postal-code">
+ <input id="country" autocomplete="billing country">
+ <input id="email" autocomplete="email">
+ <input id="email" autocomplete="email">
+ </body></html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ addressType: "billing",
+ },
+ fields: [
+ { fieldName: "street-address" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ { fieldName: "email", addressType: "" },
+ { fieldName: "email", addressType: "" },
+ ],
+ },
+ ],
+ },
+ {
+ description: `Two sections without name`,
+ fixtureData: `
+ <html><body>
+ <input id="street-address" autocomplete="street-address">
+ <input id="postal-code" autocomplete="postal-code">
+ <input id="country" autocomplete="country">
+ <input id="street-address" autocomplete="street-address">
+ <input id="postal-code" autocomplete="postal-code">
+ <input id="country" autocomplete="country">
+ </body></html>
+ `,
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "street-address" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ ],
+ },
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "street-address" },
+ { fieldName: "postal-code" },
+ { fieldName: "country" },
+ ],
+ },
+ ],
+ },
+]);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser.toml b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser.toml
new file mode 100644
index 0000000000..aba28e6597
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser.toml
@@ -0,0 +1,40 @@
+[DEFAULT]
+skip-if = ["os == 'android'"] # bug 1730213
+support-files = [
+ "../../head.js",
+ "../../../fixtures/**",
+]
+
+["browser_BestBuy.js"]
+
+["browser_CDW.js"]
+
+["browser_CostCo.js"]
+
+["browser_DirectAsda.js"]
+
+["browser_Ebay.js"]
+
+["browser_Euronics.js"]
+
+["browser_GlobalDirectAsda.js"]
+
+["browser_HomeDepot.js"]
+
+["browser_Lufthansa.js"]
+
+["browser_Lush.js"]
+
+["browser_Macys.js"]
+
+["browser_NewEgg.js"]
+
+["browser_OfficeDepot.js"]
+
+["browser_QVC.js"]
+
+["browser_Sears.js"]
+
+["browser_Staples.js"]
+
+["browser_Walmart.js"]
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_BestBuy.js b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_BestBuy.js
new file mode 100644
index 0000000000..e91c19de45
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_BestBuy.js
@@ -0,0 +1,82 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "Checkout_ShippingAddress.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "given-name" },
+ { fieldName: "family-name" },
+ { fieldName: "street-address" },
+ { fieldName: "address-level2" }, // city
+ { fieldName: "address-level1" }, // state
+ { fieldName: "postal-code" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "email", reason: "regex-heuristic" }, // sign-up
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "email", reason: "regex-heuristic" },
+ { fieldName: "tel", reason: "regex-heuristic" },
+ ],
+ },
+ ],
+ },
+ {
+ fixturePath: "Checkout_Payment.html",
+ expectedResult: [
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "email", reason: "regex-heuristic" },
+ ],
+ },
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "given-name" },
+ { fieldName: "family-name" },
+ { fieldName: "street-address" },
+ { fieldName: "address-level2" }, // city
+ { fieldName: "address-level1" }, // state
+ { fieldName: "postal-code" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "email", reason: "regex-heuristic" },
+ { fieldName: "tel", reason: "regex-heuristic" },
+ ],
+ },
+ ],
+ },
+ {
+ fixturePath: "SignIn.html",
+ expectedResult: [
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "email", reason: "regex-heuristic" }, // sign-in
+ ],
+ },
+ ],
+ },
+ ],
+ "fixtures/third_party/BestBuy/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_CDW.js b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_CDW.js
new file mode 100644
index 0000000000..020f26ff42
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_CDW.js
@@ -0,0 +1,71 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "Checkout_ShippingInfo.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "given-name" },
+ { fieldName: "family-name" },
+ { fieldName: "organization" },
+ { fieldName: "address-line1" },
+ { fieldName: "address-line2" },
+ { fieldName: "address-level2" }, // city
+ { fieldName: "address-level1" }, // state
+ { fieldName: "postal-code" },
+ { fieldName: "postal-code" }, // EXt
+ { fieldName: "email" },
+ { fieldName: "tel" },
+ { fieldName: "tel-extension", reason: "update-heuristic" },
+ ],
+ },
+ ],
+ },
+ {
+ fixturePath: "Checkout_BillingPaymentInfo.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "given-name" },
+ { fieldName: "family-name" },
+ { fieldName: "organization" },
+ { fieldName: "address-line1" },
+ { fieldName: "address-line2" },
+ { fieldName: "address-level2" }, // city
+ { fieldName: "address-level1" }, // state
+ { fieldName: "postal-code" },
+ { fieldName: "postal-code" }, // Ext
+ ],
+ },
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "cc-type" }, // ac-off
+ { fieldName: "cc-number", reason: "fathom" }, // ac-off
+ { fieldName: "cc-exp-month" },
+ { fieldName: "cc-exp-year" },
+ // {fieldName: "cc-csc"},
+ ],
+ },
+ ],
+ },
+ {
+ fixturePath: "Checkout_Logon.html",
+ expectedResult: [
+ ],
+ },
+ ],
+ "fixtures/third_party/CDW/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_CostCo.js b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_CostCo.js
new file mode 100644
index 0000000000..510656a773
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_CostCo.js
@@ -0,0 +1,194 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "ShippingAddress.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "given-name" },
+ { fieldName: "additional-name" }, // middle-name initial
+ { fieldName: "family-name" },
+ { fieldName: "organization" },
+ { fieldName: "country" },
+ { fieldName: "address-line1" },
+ { fieldName: "address-line2", reason:"update-heuristic" },
+ { fieldName: "address-level2" }, // city
+ { fieldName: "address-level1" }, // state
+ { fieldName: "postal-code" },
+ { fieldName: "tel" },
+ { fieldName: "email" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "address-line1", reason:"regex-heuristic" },
+ ],
+ },
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "given-name" },
+ { fieldName: "additional-name" }, // middle-name initial
+ { fieldName: "family-name" },
+ { fieldName: "organization" },
+ { fieldName: "country" },
+ { fieldName: "address-line1" },
+ { fieldName: "address-line2", reason:"update-heuristic" },
+ { fieldName: "address-level2" }, // city
+ { fieldName: "address-level1" }, // state
+ { fieldName: "postal-code" },
+ { fieldName: "tel" },
+ { fieldName: "email" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "address-line1", reason:"regex-heuristic" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "email", reason: "regex-heuristic" },
+ ],
+ },
+ ],
+ },
+ {
+ fixturePath: "Payment.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "cc-type" }, // ac-off
+ { fieldName: "cc-number", reason: "fathom" }, // ac-off
+ { fieldName: "cc-exp-month" },
+ { fieldName: "cc-exp-year" },
+ // { fieldName: "cc-csc"}, // ac-off
+ { fieldName: "cc-name", reason: "fathom" }, // ac-off
+ ],
+ },
+ {
+ invalid: true, // confidence is not high enough
+ fields: [
+ { fieldName: "cc-number", reason: "fathom" }, // ac-off
+ ],
+ },
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "given-name" },
+ { fieldName: "additional-name" }, // middle-name initial
+ { fieldName: "family-name" },
+ { fieldName: "organization" },
+ { fieldName: "country" },
+ { fieldName: "address-line1" },
+ { fieldName: "address-line2", reason:"update-heuristic" },
+ { fieldName: "address-level2" }, // city
+ { fieldName: "address-level1" }, // state
+ { fieldName: "postal-code" },
+ { fieldName: "tel" },
+ { fieldName: "email" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "address-line1", reason:"regex-heuristic" },
+ ],
+ },
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "given-name" },
+ { fieldName: "additional-name" }, // middle-name initial
+ { fieldName: "family-name" },
+ { fieldName: "organization" },
+ { fieldName: "country" },
+ { fieldName: "address-line1" },
+ { fieldName: "address-line2", reason:"update-heuristic" },
+ { fieldName: "address-level2" },
+ { fieldName: "address-level1" }, // state
+ { fieldName: "postal-code" },
+ { fieldName: "tel" },
+ { fieldName: "email" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "address-line1", reason:"regex-heuristic" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "email", reason: "regex-heuristic" },
+ ],
+ },
+ ],
+ },
+ {
+ fixturePath: "SignIn.html",
+ expectedResult: [
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "email", reason: "regex-heuristic" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ // Forgot password
+ { fieldName: "email", reason: "regex-heuristic" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "email", reason: "regex-heuristic" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "email", reason: "regex-heuristic" },
+ // {fieldName: "password"},
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ // Sign up
+ { fieldName: "email", reason: "regex-heuristic" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "email", reason: "regex-heuristic" },
+ ],
+ }
+ ],
+ },
+ ],
+ "fixtures/third_party/CostCo/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_DirectAsda.js b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_DirectAsda.js
new file mode 100644
index 0000000000..6cb7979173
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_DirectAsda.js
@@ -0,0 +1,25 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "Payment.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "fathom",
+ },
+ fields: [
+ { fieldName: "cc-number" },
+ { fieldName: "cc-name" },
+ { fieldName: "cc-exp-month", reason: "regex-heuristic" },
+ { fieldName: "cc-exp-year", reason: "regex-heuristic" },
+ ],
+ },
+ ],
+ },
+ ],
+ "fixtures/third_party/DirectAsda/"
+)
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Ebay.js b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Ebay.js
new file mode 100644
index 0000000000..db6047718f
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Ebay.js
@@ -0,0 +1,25 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "Checkout_Payment_FR.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "cc-number" },
+ { fieldName: "cc-exp" },
+ { fieldName: "cc-given-name" },
+ { fieldName: "cc-family-name" },
+ ],
+ },
+ ],
+ },
+ ],
+ "fixtures/third_party/Ebay/"
+)
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Euronics.js b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Euronics.js
new file mode 100644
index 0000000000..cd9757bd35
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Euronics.js
@@ -0,0 +1,54 @@
+/* global runHeuristicsTest */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "Payment.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "cc-number" },
+ //{ fieldName: "cc-cvc" },
+ { fieldName: "cc-exp-month" },
+ { fieldName: "cc-exp-year" },
+ ],
+ },
+ {
+ invalid: true,
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "cc-number" },
+ ],
+ },
+ {
+ invalid: true,
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "cc-number" },
+ { fieldName: "cc-type" },
+ ],
+ },
+ {
+ invalid: true,
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "country" },
+ { fieldName: "organization" },
+ ],
+ },
+ ],
+ },
+ ],
+ "fixtures/third_party/Euronics/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_GlobalDirectAsda.js b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_GlobalDirectAsda.js
new file mode 100644
index 0000000000..7b82009032
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_GlobalDirectAsda.js
@@ -0,0 +1,24 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "Payment.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "cc-number", reason: "fathom" },
+ { fieldName: "cc-exp-month" },
+ { fieldName: "cc-exp-year" },
+ ],
+ },
+ ],
+ },
+ ],
+ "fixtures/third_party/GlobalDirectAsda/"
+)
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_HomeDepot.js b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_HomeDepot.js
new file mode 100644
index 0000000000..46e5ecef3c
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_HomeDepot.js
@@ -0,0 +1,64 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "Checkout_ShippingPayment.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "given-name" },
+ { fieldName: "family-name" },
+ { fieldName: "email" },
+ { fieldName: "tel" },
+ { fieldName: "street-address" },
+ { fieldName: "postal-code" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ {
+ fieldName: "street-address",
+ reason: "autocomplete",
+ addressType: "billing",
+ },
+ ],
+ },
+ {
+ default: {
+ reason: "autocomplete",
+ },
+ fields: [
+ { fieldName: "cc-number", reason: "fathom" },
+ { fieldName: "cc-exp-month", reason: "regex-heuristic" },
+ { fieldName: "cc-exp-year", reason: "regex-heuristic" },
+ ],
+ },
+ ],
+ },
+ {
+ fixturePath: "SignIn.html",
+ expectedResult: [
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "email",reason: "regex-heuristic" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "email",reason: "regex-heuristic" },
+ ],
+ },
+ ],
+ },
+ ],
+ "fixtures/third_party/HomeDepot/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Lufthansa.js b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Lufthansa.js
new file mode 100644
index 0000000000..801dbf66be
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Lufthansa.js
@@ -0,0 +1,28 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "Checkout_Payment.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "fathom",
+ },
+ fields: [
+ { fieldName: "cc-type", reason: "regex-heuristic" },
+ { fieldName: "cc-number" },
+ { fieldName: "cc-number" },
+ { fieldName: "cc-number" },
+ { fieldName: "cc-number" },
+ { fieldName: "cc-exp-month", reason: "regex-heuristic" },
+ { fieldName: "cc-exp-year", reason: "regex-heuristic" },
+ ],
+ },
+ ],
+ },
+ ],
+ "fixtures/third_party/Lufthansa/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Lush.js b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Lush.js
new file mode 100644
index 0000000000..a59fc966e5
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Lush.js
@@ -0,0 +1,31 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "index.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "fathom",
+ },
+ fields: [
+ { fieldName: "cc-name" },
+ { fieldName: "cc-number" },
+ ],
+ },
+ {
+ fields: [
+ { fieldName: "cc-number", reason: "autocomplete" },
+ { fieldName: "cc-name", reason: "fathom" },
+ { fieldName: "cc-exp-month", reason: "regex-heuristic" },
+ { fieldName: "cc-exp-year", reason: "regex-heuristic" },
+ ],
+ },
+ ],
+ },
+ ],
+ "fixtures/third_party/Lush/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Macys.js b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Macys.js
new file mode 100644
index 0000000000..dab7a4cc70
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Macys.js
@@ -0,0 +1,40 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "SignIn.html",
+ expectedResult: [
+ {
+ invalid: true,
+ fields: [
+ // Sign in
+ { fieldName: "email", reason: "regex-heuristic"},
+ // {fieldName: "password"},
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ // Forgot password
+ { fieldName: "email", reason: "regex-heuristic"},
+ ],
+ },
+ // Bug 1836256: The 'securityCode' field is being recognized as both an 'email'
+ // and 'csc' field. Given that we match 'csc' before the 'email' field, this
+ // field is currently recognized as a 'csc' field. We need to implement a heuristic
+ // to accurately determine the field type when a field aligns with multiple field types
+ // instead of depending on the order of we perform the matching
+ //{
+ //invalid: true,
+ //fields: [
+ //{ fieldName: "email", reason: "regex-heuristic"},
+ //],
+ //},
+ ],
+ },
+ ],
+ "fixtures/third_party/Macys/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_NewEgg.js b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_NewEgg.js
new file mode 100644
index 0000000000..d914f02890
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_NewEgg.js
@@ -0,0 +1,109 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "ShippingInfo.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "given-name" },
+ { fieldName: "family-name" },
+ { fieldName: "country" },
+ { fieldName: "address-line1" },
+ { fieldName: "address-line2" },
+ { fieldName: "address-level2" },
+ { fieldName: "address-level1" }, // state
+ { fieldName: "postal-code" },
+ { fieldName: "tel" },
+ { fieldName: "email" },
+ ],
+ },
+ ],
+ },
+ {
+ fixturePath: "BillingInfo.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "fathom",
+ },
+ fields: [
+ { fieldName: "cc-name" },
+ { fieldName: "cc-number" }, // ac-off
+ ],
+ },
+ {
+ default: {
+ reason: "fathom",
+ },
+ fields: [
+ { fieldName: "cc-name" },
+ { fieldName: "cc-number" }, // ac-off
+ { fieldName: "cc-exp-month", reason: "regex-heuristic" },
+ { fieldName: "cc-exp-year", reason: "regex-heuristic" },
+ // { fieldName: "cc-csc"},
+ ],
+ },
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "country" },
+ { fieldName: "address-line1" },
+ { fieldName: "address-line2" },
+ { fieldName: "address-level2" },
+ { fieldName: "address-level1" }, // state
+ { fieldName: "postal-code" },
+ { fieldName: "tel" },
+ ],
+ },
+ {
+ default: {
+ reason: "fathom",
+ },
+ fields: [
+ { fieldName: "cc-name" },
+ { fieldName: "cc-number" }, // ac-off
+ { fieldName: "cc-exp-month", reason: "regex-heuristic" },
+ { fieldName: "cc-exp-year", reason: "regex-heuristic" },
+ ],
+ },
+ {
+ default: {
+ reason: "fathom",
+ },
+ fields: [
+ { fieldName: "cc-name" },
+ { fieldName: "cc-number" }, // ac-off
+ ],
+ },
+ ],
+ },
+ {
+ fixturePath: "Login.html",
+ expectedResult: [
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "email", reason: "regex-heuristic" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "email", reason: "regex-heuristic" }, // Email Address
+ { fieldName: "email", reason: "regex-heuristic" }, // Confirm Email Address
+ ],
+ },
+ ],
+ },
+ ],
+ "fixtures/third_party/NewEgg/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_OfficeDepot.js b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_OfficeDepot.js
new file mode 100644
index 0000000000..8b56d50eca
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_OfficeDepot.js
@@ -0,0 +1,83 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "ShippingAddress.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "given-name" },
+ { fieldName: "family-name" },
+ { fieldName: "organization" },
+ { fieldName: "address-line1" },
+ { fieldName: "address-line2" },
+ { fieldName: "postal-code" },
+ { fieldName: "address-level2" }, // City & State
+ { fieldName: "address-level2" }, // City
+ { fieldName: "address-level1" }, // State
+ { fieldName: "tel-area-code", reason: "update-heuristic" },
+ { fieldName: "tel-local-prefix", reason: "update-heuristic" },
+ { fieldName: "tel-local-suffix", reason: "update-heuristic" },
+ { fieldName: "tel-extension", reason: "update-heuristic" },
+ { fieldName: "email" },
+ ],
+ },
+ ],
+ },
+ {
+ fixturePath: "Payment.html",
+ expectedResult: [
+ {
+ invalid: true, // because non of them is identified by fathom
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "cc-exp-month" },
+ { fieldName: "cc-exp-year" },
+ { fieldName: "cc-number" },
+ ],
+ },
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "given-name" },
+ { fieldName: "family-name" },
+ { fieldName: "organization" },
+ { fieldName: "address-line1" },
+ { fieldName: "address-line2" },
+ { fieldName: "postal-code" },
+ { fieldName: "address-level2" }, // City & State
+ { fieldName: "address-level2" }, // City
+ { fieldName: "address-level1" }, // state
+ { fieldName: "tel-area-code", reason: "update-heuristic" },
+ { fieldName: "tel-local-prefix", reason: "update-heuristic" },
+ { fieldName: "tel-local-suffix", reason: "update-heuristic" },
+ { fieldName: "tel-extension", reason: "update-heuristic" },
+ { fieldName: "email" },
+ ],
+ },
+ ],
+ },
+ {
+ fixturePath: "SignIn.html",
+ expectedResult: [
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "email", reason: "regex-heuristic" },
+ ],
+ },
+ ],
+ },
+ ],
+ "fixtures/third_party/OfficeDepot/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_QVC.js b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_QVC.js
new file mode 100644
index 0000000000..00705293f7
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_QVC.js
@@ -0,0 +1,96 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "YourInformation.html",
+ expectedResult: [
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "tel", reason: "regex-heuristic" },
+ { fieldName: "email", reason: "regex-heuristic" },
+ // { fieldName: "bday-month"}, // select
+ // { fieldName: "bday-day"}, // select
+ // { fieldName: "bday-year"},
+ ],
+ },
+ {
+ fields: [
+ // { fieldName: "cc-csc"},
+ { fieldName: "cc-type", reason: "regex-heuristic" },
+ { fieldName: "cc-number", reason: "fathom" },
+ { fieldName: "cc-exp", reason: "update-heuristic" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "cc-number", reason: "regex-heuristic" }, // txtQvcGiftCardNumber
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "email", reason: "regex-heuristic" },
+ { fieldName: "email", reason: "regex-heuristic" },
+ ],
+ },
+ ],
+ },
+ {
+ fixturePath: "PaymentMethod.html",
+ expectedResult: [
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "tel", reason: "regex-heuristic" },
+ { fieldName: "email", reason: "regex-heuristic" },
+ // { fieldName: "bday-month"}, // select
+ // { fieldName: "bday-day"}, // select
+ // { fieldName: "bday-year"}, // select
+ ],
+ },
+ {
+ default: {
+ reason: "fathom",
+ },
+ fields: [
+ { fieldName: "cc-type", reason: "regex-heuristic" }, // ac-off
+ { fieldName: "cc-number" }, // ac-off
+ { fieldName: "cc-exp", reason: "update-heuristic" },
+ // { fieldName: "cc-csc"},
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "cc-number", reason: "regex-heuristic" }, // txtQvcGiftCardNumbe, ac-off
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "email", reason: "regex-heuristic" },
+ { fieldName: "email", reason: "regex-heuristic" },
+ ],
+ },
+ ],
+ },
+ {
+ fixturePath: "SignIn.html",
+ expectedResult: [
+ {
+ // Sign in
+ invalid: true,
+ fields: [
+ { fieldName: "email", reason: "regex-heuristic" },
+ ],
+ },
+ ],
+ },
+ ],
+ "fixtures/third_party/QVC/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Sears.js b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Sears.js
new file mode 100644
index 0000000000..c2ee60f220
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Sears.js
@@ -0,0 +1,81 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "ShippingAddress.html",
+ expectedResult: [
+ {
+ invalid: true,
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "email" },
+ ]
+ },
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ // check-out, ac-off
+ { fieldName: "given-name" },
+ { fieldName: "family-name" },
+ { fieldName: "address-line1" },
+ { fieldName: "address-line2" },
+ { fieldName: "address-level2" },
+ { fieldName: "address-level1" },
+ { fieldName: "postal-code" },
+ { fieldName: "tel" },
+ { fieldName: "tel-extension", reason: "update-heuristic" },
+ { fieldName: "email" },
+ { fieldName: "email" },
+ ],
+ },
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ // ac-off
+ // { fieldName: "email"},
+ { fieldName: "given-name" },
+ { fieldName: "family-name" },
+ { fieldName: "address-line1" },
+ { fieldName: "address-line2" },
+ { fieldName: "address-level2" },
+ { fieldName: "address-level1" },
+ { fieldName: "postal-code" },
+ { fieldName: "tel" },
+ { fieldName: "tel-extension", reason: "update-heuristic" },
+ // { fieldName: "new-password"},
+ ],
+ },
+ {
+ invalid: true,
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ // ac-off
+ { fieldName: "email" },
+ ]
+ },
+ {
+ invalid: true,
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ // ac-off
+ { fieldName: "email" },
+ ]
+ },
+ ],
+ },
+ ],
+ "fixtures/third_party/Sears/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Staples.js b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Staples.js
new file mode 100644
index 0000000000..7f116110cd
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Staples.js
@@ -0,0 +1,78 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "Basic.html",
+ expectedResult: [
+ {
+ // ac-off
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "given-name" },
+ { fieldName: "family-name" },
+ { fieldName: "address-line1" },
+ { fieldName: "email" },
+ { fieldName: "tel" },
+ { fieldName: "tel" }, // Extension
+ { fieldName: "organization" },
+ ]
+ },
+ ],
+ },
+ {
+ fixturePath: "Basic_ac_on.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "given-name" },
+ { fieldName: "family-name" },
+ { fieldName: "address-line1" },
+ { fieldName: "email" },
+ { fieldName: "tel" },
+ { fieldName: "tel" }, // Extension
+ { fieldName: "organization" },
+ ],
+ },
+ ],
+ },
+ {
+ fixturePath: "PaymentBilling.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "cc-number", reason: "fathom" },
+ { fieldName: "cc-exp", reason:"update-heuristic" },
+ // {fieldName: "cc-csc"},
+ ],
+ },
+ ],
+ },
+ {
+ fixturePath: "PaymentBilling_ac_on.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "cc-number", reason: "fathom" },
+ { fieldName: "cc-exp", reason:"update-heuristic" },
+ // { fieldName: "cc-csc"},
+ ],
+ },
+ ],
+ },
+ ],
+ "fixtures/third_party/Staples/"
+);
diff --git a/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Walmart.js b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Walmart.js
new file mode 100644
index 0000000000..6260a6be0f
--- /dev/null
+++ b/browser/extensions/formautofill/test/browser/heuristics/third_party/browser_Walmart.js
@@ -0,0 +1,93 @@
+/* global add_heuristic_tests */
+
+"use strict";
+
+add_heuristic_tests(
+ [
+ {
+ fixturePath: "Checkout.html",
+ expectedResult: [
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "postal-code", reason: "regex-heuristic" },
+ ],
+ },
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "email", reason: "regex-heuristic" },
+ // { fieldName: "password"}, // ac-off
+ ],
+ },
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "given-name" },
+ { fieldName: "family-name" },
+ { fieldName: "email" }, // ac-off
+ // { fieldName: "password"},
+ // { fieldName: "password"}, // ac-off
+ ],
+ },
+ ],
+ },
+ {
+ fixturePath: "Payment.html",
+ expectedResult: [
+ {
+ default: {
+ reason: "autocomplete",
+ section: "section-payment",
+ },
+ fields: [
+ { fieldName: "given-name" },
+ { fieldName: "family-name" },
+ { fieldName: "tel" },
+ ],
+ },
+ {
+ default: {
+ reason: "autocomplete",
+ section: "section-payment",
+ },
+ fields: [
+ { fieldName: "cc-number" },
+ { fieldName: "cc-exp-month" },
+ { fieldName: "cc-exp-year" },
+ // { fieldName: "cc-csc"},
+ ],
+ },
+ ],
+ },
+ {
+ fixturePath: "Shipping.html",
+ expectedResult: [
+ {
+ invalid: true,
+ fields: [
+ { fieldName: "postal-code", reason: "regex-heuristic" },
+ ],
+ },
+ {
+ default: {
+ reason: "regex-heuristic",
+ },
+ fields: [
+ { fieldName: "given-name" },
+ { fieldName: "family-name" },
+ { fieldName: "tel" },
+ { fieldName: "address-line1" },
+ { fieldName: "address-line2", reason:"update-heuristic" },
+ { fieldName: "address-level2" }, // city
+ { fieldName: "address-level1" }, // state
+ { fieldName: "postal-code" },
+ ],
+ },
+ ],
+ },
+ ],
+ "fixtures/third_party/Walmart/"
+);