Bug 1361237 - Part 2: Fix all Credit Card related test cases.; r=MattN

MozReview-Commit-ID: IkwKaNWr1fO

--HG--
extra : rebase_source : 4951ee36564b3d67192b04c27760c3727cc11aa1
This commit is contained in:
Sean Lee 2017-06-06 00:42:42 +08:00
Родитель c74ccdfb62
Коммит 52b5f25c36
9 изменённых файлов: 89 добавлений и 43 удалений

Просмотреть файл

@ -15,10 +15,12 @@ runHeuristicsTest([
{"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"},
],
@ -36,17 +38,19 @@ runHeuristicsTest([
{"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
],
[
/* TODO: Credit Card
{"section": "", "addressType": "", "contactType": "", "fieldName": "cc-type"},
{"section": "", "addressType": "", "contactType": "", "fieldName": "cc-number"},
// 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"},
{"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"},
{"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"},
*/
// 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"},
],
[],
],
}, {
fixturePath: "Checkout_Logon.html",

Просмотреть файл

@ -46,14 +46,15 @@ runHeuristicsTest([
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
],
[],
[],

Просмотреть файл

@ -14,9 +14,17 @@ runHeuristicsTest([
{"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"},
],
],

Просмотреть файл

@ -24,16 +24,11 @@ runHeuristicsTest([
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"},
@ -41,14 +36,18 @@ runHeuristicsTest([
{"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",

Просмотреть файл

@ -29,8 +29,8 @@ runHeuristicsTest([
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"},
@ -46,6 +46,10 @@ runHeuristicsTest([
{"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"},
],
],
}, {

Просмотреть файл

@ -9,12 +9,20 @@ runHeuristicsTest([
[
// {"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"},
@ -30,8 +38,15 @@ runHeuristicsTest([
// {"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"},
],
[

Просмотреть файл

@ -53,11 +53,12 @@ runHeuristicsTest([
[],
[], // 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"},
@ -73,7 +74,17 @@ runHeuristicsTest([
[ // 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"},

Просмотреть файл

@ -38,8 +38,11 @@ runHeuristicsTest([
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"},
],
],

Просмотреть файл

@ -33,7 +33,8 @@ runHeuristicsTest([
{"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"},