Bug 1361237 - Part 2: Fix all Credit Card related test cases.; r?MattN draft
authorSean Lee <selee@mozilla.com>
Tue, 06 Jun 2017 00:42:42 +0800
changeset 651150 eb94bb2c743584583f43d946c8ccfe81fab1a2b4
parent 650151 8e27e7541b86ce0270543f64ff36b046a3f1d3e3
child 727600 189c3d6ebdf3c589d86122c2c058fe04842421ef
push id75609
push userbmo:selee@mozilla.com
push dateWed, 23 Aug 2017 08:49:28 +0000
reviewersMattN
bugs1361237
milestone57.0a1
Bug 1361237 - Part 2: Fix all Credit Card related test cases.; r?MattN MozReview-Commit-ID: IkwKaNWr1fO
browser/extensions/formautofill/test/unit/heuristics/third_party/test_CDW.js
browser/extensions/formautofill/test/unit/heuristics/third_party/test_CostCo.js
browser/extensions/formautofill/test/unit/heuristics/third_party/test_HomeDepot.js
browser/extensions/formautofill/test/unit/heuristics/third_party/test_NewEgg.js
browser/extensions/formautofill/test/unit/heuristics/third_party/test_OfficeDepot.js
browser/extensions/formautofill/test/unit/heuristics/third_party/test_QVC.js
browser/extensions/formautofill/test/unit/heuristics/third_party/test_Sears.js
browser/extensions/formautofill/test/unit/heuristics/third_party/test_Staples.js
browser/extensions/formautofill/test/unit/heuristics/third_party/test_Walmart.js
--- a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_CDW.js
+++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_CDW.js
@@ -10,20 +10,22 @@ runHeuristicsTest([
         {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "organization"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, // city
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // state
         {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"},
-        {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-extension"}, // FIXME: ZIP ext
+
+        // FIXME: bug 1392932 - misdetect ZIP ext string
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-extension"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "email"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"},
-        // FIXME: The below "tel-extension" is correct and removed due to the
+        // The below "tel-extension" is correct and removed due to the
         // duplicated field above.
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-extension"},
       ],
       [],
     ],
   }, {
     fixturePath: "Checkout_BillingPaymentInfo.html",
     expectedResult: [
@@ -31,27 +33,29 @@ runHeuristicsTest([
         {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "organization"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, // city
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // state
         {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"},
-        {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-extension"}, // FIXME: ZIP ext
+
+        // FIXME: bug 1392932 - misdetect ZIP ext string
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-extension"},
+//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-type"},
+//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, // ac-off
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"},
+
+        // FIXME: bug 1392940 - the below element can not match to "cc-exp-year" regexp directly.
+//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"},
+
+//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"},
       ],
-      [
- /* TODO: Credit Card
-        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-type"},
-        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"},
-        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"},
-        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"},
-        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"},
-*/
-      ],
+      [],
     ],
   }, {
     fixturePath: "Checkout_Logon.html",
     expectedResult: [
       [],
       [],
       [],
     ],
--- a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_CostCo.js
+++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_CostCo.js
@@ -41,24 +41,25 @@ runHeuristicsTest([
         {"section": "", "addressType": "", "contactType": "", "fieldName": "email"},
       ],
       [],
     ],
   }, {
     fixturePath: "Payment.html",
     expectedResult: [
       [
-/* TODO: credit card
-        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-type"},
-        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, // ac-off
+//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-type"},
+//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, // ac-off
         {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"},
-        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"},
-        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"}, // ac-off
-        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-name"}, // ac-off
-*/
+
+        // FIXME: bug 1392940 - the below element can not match to "cc-exp-year" regexp directly.
+//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"},
+
+//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"}, // ac-off
+//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-name"}, // ac-off
       ],
       [],
       [],
       [],
       [
         {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "additional-name"}, // middle-name initial
         {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"},
--- a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_HomeDepot.js
+++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_HomeDepot.js
@@ -9,19 +9,27 @@ runHeuristicsTest([
       [
         {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "email"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"},
         {"section": "", "addressType": "billing", "contactType": "", "fieldName": "street-address"}, // <select>
+
+        // FIXME: bug 1392944 - the uncommented cc-exp-month and cc-exp-year are
+        // both invisible <input> elements, and the following two <select>
+        // elements are the correct ones. BTW, they are both applied
+        // autocomplete attr.
         {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"},
-//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"},
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"},
+//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"},
+//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"},
+
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"},
       ],
     ],
   }, {
     fixturePath: "SignIn.html",
     expectedResult: [
       [
         {"section": "", "addressType": "", "contactType": "", "fieldName": "email"},
--- a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_NewEgg.js
+++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_NewEgg.js
@@ -19,41 +19,40 @@ runHeuristicsTest([
         {"section": "", "addressType": "", "contactType": "", "fieldName": "email"},
       ],
       [],
     ],
   }, {
     fixturePath: "BillingInfo.html",
     expectedResult: [
       [
-/* TODO: Should match the following fields.
         {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-name"},
-        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"},
-        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"},
-        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-name"},
-        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, // ac-off
+//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, // ac-off
         {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"},
-        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"},
-*/
+//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "country"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // state
         {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"},
-//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-name"}, // TODO
-//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, // TODO
-//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"}, // TODO
-//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"}, // TODO
+      ],
+      [
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-name"},
+//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, // ac-off
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"},
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"},
       ],
       [],
-      [],
-      [],
+      [
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-name"},
+//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, // ac-off
+      ],
     ],
   }, {
     fixturePath: "Login.html",
     expectedResult: [
       [
         {"section": "", "addressType": "", "contactType": "", "fieldName": "email"},
       ],
       [],
--- a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_OfficeDepot.js
+++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_OfficeDepot.js
@@ -24,33 +24,37 @@ runHeuristicsTest([
         {"section": "", "addressType": "", "contactType": "", "fieldName": "email"},
       ],
       [],
     ],
   }, {
     fixturePath: "Payment.html",
     expectedResult: [
       [
-//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"},
-//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"},
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"},
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "organization"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // state
 
         {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-area-code"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-local-prefix"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-local-suffix"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-extension"},
 
         {"section": "", "addressType": "", "contactType": "", "fieldName": "email"},
+
+        // FIXME: bug 1392950 - the membership number should not be detected
+        // as cc-number.
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"},
       ],
     ],
   }, {
     fixturePath: "SignIn.html",
     expectedResult: [
       [ // ac-off
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "email"},
       ],
--- a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_QVC.js
+++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_QVC.js
@@ -4,39 +4,54 @@
 
 runHeuristicsTest([
   {
     fixturePath: "YourInformation.html",
     expectedResult: [
       [
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, // ac-off
         {"section": "", "addressType": "", "contactType": "", "fieldName": "email"},
+//      {"section": "", "addressType": "", "contactType": "", "fieldName": "bday-month"}, // select
+//      {"section": "", "addressType": "", "contactType": "", "fieldName": "bday-day"}, // select
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "bday-year"},
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-type"},
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"},
+
+        // FIXME: bug 1392947 - this is a compound cc-exp field rather than the
+        // separated ones below. the birthday fields are misdetected as
+        // cc-exp-year and cc-exp-month.
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp"},
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"},
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"},
+
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"},
-//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"},
       ],
       [
         {"section": "", "addressType": "", "contactType": "", "fieldName": "email"},
       ],
     ],
   }, {
     fixturePath: "PaymentMethod.html",
     expectedResult: [
       [
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"}, // ac-off
         {"section": "", "addressType": "", "contactType": "", "fieldName": "email"},
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "bday-month"}, // select
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "bday-day"}, // select
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "bday-year"}, // select
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-type"}, // select
-//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"},
+//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"}, ac-off
+
+        // FIXME: bug 1392947 - this is a compound cc-exp field rather than the
+        // separated ones below. the birthday fields are misdetected as
+        // cc-exp-year and cc-exp-month.
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp"}, // select
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"},
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"},
+
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"},
       ],
       [
         {"section": "", "addressType": "", "contactType": "", "fieldName": "email"},
       ],
     ],
   }, {
     fixturePath: "SignIn.html",
--- a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Sears.js
+++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Sears.js
@@ -48,37 +48,48 @@ runHeuristicsTest([
       ],
     ],
   }, {
     fixturePath: "PaymentOptions.html",
     expectedResult: [
       [],
       [], // search
       [ // credit card
-//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"},
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"},
+        // FIXME: bug 1392958 - Cardholder name field should be detected as cc-name
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-name"},
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"},
-//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"},
-//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"},
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"},
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"},
       ],
       [ // Another billing address
         {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line1"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-line2"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level2"}, // city
         {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // state
         {"section": "", "addressType": "", "contactType": "", "fieldName": "postal-code"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "tel"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-extension"},
       ],
       [ // check out
         {"section": "", "addressType": "", "contactType": "", "fieldName": "given-name"},
         {"section": "", "addressType": "", "contactType": "", "fieldName": "family-name"},
-        {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"}, // TODO: Wrong. This is for Driver's license.
+
+        // FIXME: bug 1392950 - the bank routing number should not be detected
+        // as cc-number.
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"},
+
+        // FIXME: bug 1392934 - this should be detected as address-level1 since
+        // it's for Driver's license or state identification.
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "address-level1"},
+
+        // FIXME: bug 1392947 - this is for birthday actually.
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"},
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "bday-month"},
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "bday-day"},
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "bday-year"},
       ],
       [
         {"section": "", "addressType": "", "contactType": "", "fieldName": "email"},
       ],
     ],
--- a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Staples.js
+++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Staples.js
@@ -33,16 +33,19 @@ runHeuristicsTest([
     fixturePath: "PaymentBilling.html",
     expectedResult: [
       [],
     ],
   }, {
     fixturePath: "PaymentBilling_ac_on.html",
     expectedResult: [
       [
-//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"},
-//      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp"},
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"},
+
+        // Since this is a custom fixture with force autocomplete="on", we can
+        // fix this later even this should be detected as cc-exp.
+        {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"},
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"},
       ],
     ],
   },
 ], "../../../fixtures/third_party/Staples/");
 
--- a/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Walmart.js
+++ b/browser/extensions/formautofill/test/unit/heuristics/third_party/test_Walmart.js
@@ -28,17 +28,18 @@ runHeuristicsTest([
       [
       ],
       [
         {"section": "section-payment", "addressType": "", "contactType": "", "fieldName": "given-name"},
         {"section": "section-payment", "addressType": "", "contactType": "", "fieldName": "family-name"},
         {"section": "section-payment", "addressType": "", "contactType": "", "fieldName": "cc-number"},
         {"section": "section-payment", "addressType": "", "contactType": "", "fieldName": "cc-exp-month"},
         {"section": "section-payment", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"},
-        // FIXME The following field shouldn't be recognized as "tel-extension".
+        // FIXME bug 1392932 - the following field shouldn't be recognized as
+        // "tel-extension".
         // The wrong prediction is caused by the name attr "brwsrAutofillText"
         // which matches the regexp "ext\\b".
         {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-extension"},
 //      {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"},
         {"section": "section-payment", "addressType": "", "contactType": "", "fieldName": "tel"},
       ],
     ],
   }, {