forked from mirrors/gecko-dev
Bug 1831347 - Refactoring formautofill test data structure r=credential-management-reviewers,sgalich
Differential Revision: https://phabricator.services.mozilla.com/D177167
This commit is contained in:
parent
47aaf13047
commit
7c43289aa2
27 changed files with 1278 additions and 3166 deletions
|
|
@ -286,6 +286,7 @@ browser/components/pocket/content/panels/js/vendor/
|
|||
browser/components/storybook/node_modules/
|
||||
browser/extensions/formautofill/content/third-party/
|
||||
browser/extensions/formautofill/test/fixtures/third_party/
|
||||
browser/extensions/formautofill/test/unit/heuristics/
|
||||
browser/extensions/screenshots/build/raven.js
|
||||
devtools/client/inspector/markup/test/lib_*
|
||||
devtools/client/jsonview/lib/require.js
|
||||
|
|
|
|||
|
|
@ -182,34 +182,53 @@ async function initProfileStorage(
|
|||
return profileStorage;
|
||||
}
|
||||
|
||||
function verifySectionFieldDetails(sections, expectedResults) {
|
||||
Assert.equal(
|
||||
sections.length,
|
||||
expectedResults.length,
|
||||
"Expected section count."
|
||||
);
|
||||
sections.forEach((sectionInfo, sectionIndex) => {
|
||||
let expectedSectionInfo = expectedResults[sectionIndex];
|
||||
info("FieldName Prediction Results: " + sectionInfo.map(i => i.fieldName));
|
||||
function verifySectionFieldDetails(sections, expectedSectionsInfo) {
|
||||
sections.map((section, index) => {
|
||||
const expectedSection = expectedSectionsInfo[index];
|
||||
|
||||
const fieldDetails = section.fieldDetails;
|
||||
const expectedFieldDetails = expectedSection.fields;
|
||||
|
||||
info(`section[${index}] ${expectedSection.description ?? ""}:`);
|
||||
info(`FieldName Prediction Results: ${fieldDetails.map(i => i.fieldName)}`);
|
||||
info(
|
||||
"FieldName Expected Results: " +
|
||||
expectedSectionInfo.map(i => i.fieldName)
|
||||
`FieldName Expected Results: ${expectedFieldDetails.map(
|
||||
detail => detail.fieldName
|
||||
)}`
|
||||
);
|
||||
Assert.equal(
|
||||
sectionInfo.length,
|
||||
expectedSectionInfo.length,
|
||||
"Expected field count."
|
||||
fieldDetails.length,
|
||||
expectedFieldDetails.length,
|
||||
`Expected field count.`
|
||||
);
|
||||
|
||||
sectionInfo.forEach((field, fieldIndex) => {
|
||||
let expectedField = expectedSectionInfo[fieldIndex];
|
||||
if (!("part" in expectedField)) {
|
||||
expectedField.part = null;
|
||||
}
|
||||
delete field.reason;
|
||||
fieldDetails.forEach((field, fieldIndex) => {
|
||||
const expectedFieldDetail = expectedFieldDetails[fieldIndex];
|
||||
|
||||
const expected = {
|
||||
...{
|
||||
part: null,
|
||||
reason: "autocomplete",
|
||||
section: "",
|
||||
contactType: "",
|
||||
addressType: "",
|
||||
},
|
||||
...expectedSection.default,
|
||||
...expectedFieldDetail,
|
||||
};
|
||||
|
||||
delete field.elementWeakRef;
|
||||
delete field.confidence;
|
||||
Assert.deepEqual(field, expectedField);
|
||||
const keys = new Set([...Object.keys(field), ...Object.keys(expected)]);
|
||||
for (const key of keys) {
|
||||
const expectedValue = expected[key];
|
||||
const actualValue = field[key];
|
||||
Assert.equal(
|
||||
expectedValue,
|
||||
actualValue,
|
||||
`${key} should be equal, expect ${expectedValue}, got ${actualValue}`
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
@ -217,6 +236,48 @@ function verifySectionFieldDetails(sections, expectedResults) {
|
|||
var FormAutofillHeuristics, LabelUtils;
|
||||
var AddressDataLoader, FormAutofillUtils;
|
||||
|
||||
function autofillFieldSelector(doc) {
|
||||
return doc.querySelectorAll("input, select");
|
||||
}
|
||||
|
||||
// The `patterns.expectedResult` array contains test data for different address or credit card sections.
|
||||
// Each section in the array is represented by an object and can include the following properties:
|
||||
// - description (optional): A string describing the section, primarily used for debugging purposes.
|
||||
// - default (optional): An object that sets the default values for the fields within this section.
|
||||
// The default object contains the same keys as the individual field objects.
|
||||
// - fields: An array of field objects within the section.
|
||||
//
|
||||
// Each field object can have the following keys:
|
||||
// - fieldName: The name of the field (e.g., "street-name", "cc-name" or "cc-number").
|
||||
// - reason: The reason for the field value (e.g., "autocomplete", "regex-heuristic" or "fathom").
|
||||
// - section: The section to which the field belongs (e.g., "billing", "shipping").
|
||||
// - part: The part of the field.
|
||||
// - contactType: The contact type of the field.
|
||||
// - addressType: The address type of the field.
|
||||
//
|
||||
// For more information on the field object properties, refer to the FieldDetails class.
|
||||
//
|
||||
// Example test data:
|
||||
// expectedResult: [
|
||||
// {
|
||||
// description: "address form with only two address fields"
|
||||
// fields: [
|
||||
// { fieldName: "organization", reason: "autocomplete" },
|
||||
// { fieldName: "street-address", reason: "regex-heuristic" },
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// default: {
|
||||
// reason: "regex-heuristic",
|
||||
// section: "billing",
|
||||
// },
|
||||
// fields: [
|
||||
// { fieldName: "cc-number", reason: "fathom" },
|
||||
// { fieldName: "cc-nane" },
|
||||
// { fieldName: "cc-exp" },
|
||||
// ],
|
||||
// },
|
||||
//
|
||||
async function runHeuristicsTest(patterns, fixturePathPrefix) {
|
||||
add_setup(async () => {
|
||||
({ FormAutofillHeuristics } = ChromeUtils.importESModule(
|
||||
|
|
@ -233,34 +294,34 @@ async function runHeuristicsTest(patterns, fixturePathPrefix) {
|
|||
patterns.forEach(testPattern => {
|
||||
add_task(async function() {
|
||||
info("Starting test fixture: " + testPattern.fixturePath);
|
||||
let file = do_get_file(fixturePathPrefix + testPattern.fixturePath);
|
||||
let doc = MockDocument.createTestDocumentFromFile(
|
||||
const file = do_get_file(fixturePathPrefix + testPattern.fixturePath);
|
||||
const doc = MockDocument.createTestDocumentFromFile(
|
||||
"http://localhost:8080/test/",
|
||||
file
|
||||
);
|
||||
|
||||
let forms = [];
|
||||
|
||||
for (let field of FormAutofillUtils.autofillFieldSelector(doc)) {
|
||||
let formLike = FormLikeFactory.createFromField(field);
|
||||
if (!forms.some(form => form.rootElement === formLike.rootElement)) {
|
||||
forms.push(formLike);
|
||||
}
|
||||
}
|
||||
|
||||
Assert.equal(
|
||||
forms.length,
|
||||
testPattern.expectedResult.length,
|
||||
"Expected form count."
|
||||
let forms = [...doc.querySelectorAll("input, select")].reduce(
|
||||
(acc, field) => {
|
||||
const formLike = FormLikeFactory.createFromField(field);
|
||||
if (!acc.some(form => form.rootElement === formLike.rootElement)) {
|
||||
acc.push(formLike);
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
forms.forEach((form, formIndex) => {
|
||||
let sections = FormAutofillHeuristics.getFormInfo(form);
|
||||
verifySectionFieldDetails(
|
||||
sections.map(section => section.fieldDetails),
|
||||
testPattern.expectedResult[formIndex]
|
||||
);
|
||||
const sections = forms.flatMap(form => {
|
||||
return FormAutofillHeuristics.getFormInfo(form);
|
||||
});
|
||||
|
||||
Assert.equal(
|
||||
sections.length,
|
||||
testPattern.expectedResult.length,
|
||||
"Expected section count."
|
||||
);
|
||||
|
||||
verifySectionFieldDetails(sections, testPattern.expectedResult);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,172 +12,61 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "autocomplete_off_on_form.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "organization",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "street-address",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "postal-code",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "country",
|
||||
},
|
||||
{ section: "", addressType: "", contactType: "", fieldName: "tel" },
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "organization" },
|
||||
{ fieldName: "street-address" },
|
||||
{ fieldName: "address-level2" },
|
||||
{ fieldName: "address-level1" },
|
||||
{ fieldName: "postal-code" },
|
||||
{ fieldName: "country" },
|
||||
{ fieldName: "tel" },
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "organization",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line3",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "postal-code",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "country",
|
||||
},
|
||||
{ section: "", addressType: "", contactType: "", fieldName: "tel" },
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "organization" },
|
||||
{ fieldName: "address-line1" },
|
||||
{ fieldName: "address-line2" },
|
||||
{ fieldName: "address-line3" },
|
||||
{ fieldName: "address-level2" },
|
||||
{ fieldName: "address-level1" },
|
||||
{ fieldName: "postal-code" },
|
||||
{ fieldName: "country" },
|
||||
{ fieldName: "tel" },
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-month",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-year",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-number" },
|
||||
{ fieldName: "cc-name" },
|
||||
{ fieldName: "cc-exp-month" },
|
||||
{ fieldName: "cc-exp-year" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "organization",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line3",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "address-line1" },
|
||||
{ fieldName: "address-level2" },
|
||||
{ fieldName: "address-line2" },
|
||||
{ fieldName: "organization" },
|
||||
{ fieldName: "address-line3" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -12,257 +12,89 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "autocomplete_off_on_inputs.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "organization",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "street-address",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "postal-code",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "country",
|
||||
},
|
||||
{ section: "", addressType: "", contactType: "", fieldName: "tel" },
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
{
|
||||
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" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "organization",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line3",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "postal-code",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "country",
|
||||
},
|
||||
{ section: "", addressType: "", contactType: "", fieldName: "tel" },
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "organization" },
|
||||
{ fieldName: "address-line1" },
|
||||
{ fieldName: "address-line2" },
|
||||
{ fieldName: "address-line3" },
|
||||
{ fieldName: "address-level2" },
|
||||
{ fieldName: "address-level1" },
|
||||
{ fieldName: "postal-code" },
|
||||
{ fieldName: "country" },
|
||||
{ fieldName: "tel" },
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-month",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-year",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-number", reason: "fathom" },
|
||||
{ fieldName: "cc-name", reason: "fathom" },
|
||||
{ fieldName: "cc-exp-month" },
|
||||
{ fieldName: "cc-exp-year" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "organization",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line3",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "address-line1" },
|
||||
{ fieldName: "address-level2" },
|
||||
{ fieldName: "address-line2" },
|
||||
{ fieldName: "organization" },
|
||||
{ fieldName: "address-line3" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "organization",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line3",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "postal-code",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "country",
|
||||
},
|
||||
{ section: "", addressType: "", contactType: "", fieldName: "tel" },
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "organization" },
|
||||
{ fieldName: "address-line1", reason: "regex-heuristic" },
|
||||
{ fieldName: "address-line2", reason: "regex-heuristic" },
|
||||
{ fieldName: "address-line3", reason: "regex-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" },
|
||||
],
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-month",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-year",
|
||||
},
|
||||
},
|
||||
{
|
||||
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" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -7,172 +7,61 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "autocomplete_basic.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "organization",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "street-address",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "postal-code",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "country",
|
||||
},
|
||||
{ section: "", addressType: "", contactType: "", fieldName: "tel" },
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "organization" },
|
||||
{ fieldName: "street-address" },
|
||||
{ fieldName: "address-level2" },
|
||||
{ fieldName: "address-level1" },
|
||||
{ fieldName: "postal-code" },
|
||||
{ fieldName: "country" },
|
||||
{ fieldName: "tel" },
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "organization",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line3",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "postal-code",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "country",
|
||||
},
|
||||
{ section: "", addressType: "", contactType: "", fieldName: "tel" },
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "organization" },
|
||||
{ fieldName: "address-line1" },
|
||||
{ fieldName: "address-line2" },
|
||||
{ fieldName: "address-line3" },
|
||||
{ fieldName: "address-level2" },
|
||||
{ fieldName: "address-level1" },
|
||||
{ fieldName: "postal-code" },
|
||||
{ fieldName: "country" },
|
||||
{ fieldName: "tel" },
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-month",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-year",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-number" },
|
||||
{ fieldName: "cc-name" },
|
||||
{ fieldName: "cc-exp-month" },
|
||||
{ fieldName: "cc-exp-year" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "organization",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line3",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "address-line1" },
|
||||
{ fieldName: "address-level2" },
|
||||
{ fieldName: "address-line2" },
|
||||
{ fieldName: "organization" },
|
||||
{ fieldName: "address-line3" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -7,104 +7,50 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "heuristics_cc_exp.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-month",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-year",
|
||||
},
|
||||
{
|
||||
description: "form1",
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-name" },
|
||||
{ fieldName: "cc-number" },
|
||||
{ fieldName: "cc-exp-month" },
|
||||
{ fieldName: "cc-exp-year" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "form2",
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-number" },
|
||||
{ fieldName: "cc-exp" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "form3",
|
||||
fields: [
|
||||
{ fieldName: "cc-number", reason: "autocomplete" },
|
||||
{ fieldName: "cc-exp", reason: "regex-heuristic" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-month",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-year",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "form4",
|
||||
fields: [
|
||||
{ fieldName: "cc-number", reason: "autocomplete" },
|
||||
{ fieldName: "cc-exp-month", reason: "regex-heuristic" },
|
||||
{ fieldName: "cc-exp-year", reason: "regex-heuristic" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-month",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-year",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "form5",
|
||||
fields: [
|
||||
{ fieldName: "cc-exp-month", reason: "regex-heuristic" },
|
||||
{ fieldName: "cc-exp-year", reason: "regex-heuristic" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -7,74 +7,24 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "heuristics_de_fields.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-name",
|
||||
},
|
||||
{
|
||||
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",
|
||||
},
|
||||
{
|
||||
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" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-name",
|
||||
},
|
||||
{
|
||||
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",
|
||||
},
|
||||
},
|
||||
{
|
||||
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" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -10,28 +10,16 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "heuristics_fr_fields.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-name",
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-number", reason: "fathom" },
|
||||
{ fieldName: "cc-exp" },
|
||||
{ fieldName: "cc-name" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -7,32 +7,15 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "multiple_section.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "organization",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "work",
|
||||
fieldName: "tel",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "work",
|
||||
fieldName: "email",
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "name" },
|
||||
{ fieldName: "organization" },
|
||||
{ fieldName: "tel", contactType: "work" },
|
||||
{ fieldName: "email", contactType: "work" },
|
||||
|
||||
// Even the `contactType` of these two fields are different with the
|
||||
// above two, we still consider they are identical until supporting
|
||||
|
|
@ -40,239 +23,96 @@ runHeuristicsTest(
|
|||
// {"section": "", "addressType": "", "contactType": "home", "fieldName": "tel"},
|
||||
// {"section": "", "addressType": "", "contactType": "home", "fieldName": "email"},
|
||||
],
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "shipping",
|
||||
contactType: "",
|
||||
fieldName: "street-address",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "shipping",
|
||||
contactType: "",
|
||||
fieldName: "address-level2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "shipping",
|
||||
contactType: "",
|
||||
fieldName: "address-level1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "shipping",
|
||||
contactType: "",
|
||||
fieldName: "postal-code",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "shipping",
|
||||
contactType: "",
|
||||
fieldName: "country",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
addressType: "shipping",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "street-address" },
|
||||
{ fieldName: "address-level2" },
|
||||
{ fieldName: "address-level1" },
|
||||
{ fieldName: "postal-code" },
|
||||
{ fieldName: "country" },
|
||||
],
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "billing",
|
||||
contactType: "",
|
||||
fieldName: "street-address",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "billing",
|
||||
contactType: "",
|
||||
fieldName: "address-level2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "billing",
|
||||
contactType: "",
|
||||
fieldName: "address-level1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "billing",
|
||||
contactType: "",
|
||||
fieldName: "postal-code",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "billing",
|
||||
contactType: "",
|
||||
fieldName: "country",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
addressType: "billing",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "street-address" },
|
||||
{ fieldName: "address-level2" },
|
||||
{ fieldName: "address-level1" },
|
||||
{ fieldName: "postal-code" },
|
||||
{ fieldName: "country" },
|
||||
],
|
||||
[
|
||||
{
|
||||
section: "section-my",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "street-address",
|
||||
},
|
||||
{
|
||||
section: "section-my",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level2",
|
||||
},
|
||||
{
|
||||
section: "section-my",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level1",
|
||||
},
|
||||
{
|
||||
section: "section-my",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "postal-code",
|
||||
},
|
||||
{
|
||||
section: "section-my",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "country",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
section: "section-my",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "street-address" },
|
||||
{ fieldName: "address-level2" },
|
||||
{ fieldName: "address-level1" },
|
||||
{ fieldName: "postal-code" },
|
||||
{ fieldName: "country" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "organization",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "street-address",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "postal-code",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "country",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "name" },
|
||||
{ fieldName: "organization" },
|
||||
{ fieldName: "street-address" },
|
||||
{ fieldName: "address-level2" },
|
||||
{ fieldName: "address-level1" },
|
||||
{ fieldName: "postal-code" },
|
||||
{ fieldName: "country" },
|
||||
],
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "street-address",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "postal-code",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "country",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "street-address" },
|
||||
{ fieldName: "address-level2" },
|
||||
{ fieldName: "address-level1" },
|
||||
{ fieldName: "postal-code" },
|
||||
{ fieldName: "country" },
|
||||
],
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "street-address",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level2",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "postal-code",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "country",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "work",
|
||||
fieldName: "tel",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "work",
|
||||
fieldName: "email",
|
||||
},
|
||||
},
|
||||
{
|
||||
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" },
|
||||
],
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "home",
|
||||
fieldName: "tel",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "home",
|
||||
fieldName: "email",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
contactType: "home",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "tel" },
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -7,155 +7,88 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "Checkout_ShippingAddress.html",
|
||||
expectedResult: [
|
||||
[], // Search form
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "given-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "family-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "street-address",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level2",
|
||||
}, // city
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level1",
|
||||
}, // state
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "postal-code",
|
||||
},
|
||||
{
|
||||
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" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
// Sign up
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
// unknown
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
{ section: "", addressType: "", contactType: "", fieldName: "tel" },
|
||||
{ fieldName: "email" },
|
||||
{ fieldName: "tel" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
fixturePath: "Checkout_Payment.html",
|
||||
expectedResult: [
|
||||
[], // Search form
|
||||
[
|
||||
[
|
||||
// Sign up
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "given-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "family-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "street-address",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level2",
|
||||
}, // city
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level1",
|
||||
}, // state
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "postal-code",
|
||||
},
|
||||
},
|
||||
{
|
||||
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" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
// unknown
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
{ section: "", addressType: "", contactType: "", fieldName: "tel" },
|
||||
{ fieldName: "email" },
|
||||
{ fieldName: "tel" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
fixturePath: "SignIn.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
// Sign in
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -7,162 +7,62 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "Checkout_ShippingInfo.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
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: "email",
|
||||
},
|
||||
{ section: "", addressType: "", contactType: "", fieldName: "tel" },
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "tel-extension",
|
||||
},
|
||||
{
|
||||
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: "email" },
|
||||
{ fieldName: "tel" },
|
||||
{ fieldName: "tel-extension" },
|
||||
],
|
||||
],
|
||||
[],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
fixturePath: "Checkout_BillingPaymentInfo.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
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",
|
||||
},
|
||||
{
|
||||
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" },
|
||||
],
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-type",
|
||||
}, // 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"},
|
||||
},
|
||||
{
|
||||
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: [[], [], []],
|
||||
expectedResult: [
|
||||
],
|
||||
},
|
||||
],
|
||||
"../../../fixtures/third_party/CDW/"
|
||||
|
|
|
|||
|
|
@ -7,440 +7,162 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "ShippingAddress.html",
|
||||
expectedResult: [
|
||||
[],
|
||||
[],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "given-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "additional-name",
|
||||
}, // middle-name initial
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "family-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "organization",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "country",
|
||||
},
|
||||
{
|
||||
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: "email",
|
||||
},
|
||||
{
|
||||
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" },
|
||||
{ fieldName: "address-level2" }, // city
|
||||
{ fieldName: "address-level1" }, // state
|
||||
{ fieldName: "postal-code" },
|
||||
{ fieldName: "tel" },
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "given-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "additional-name",
|
||||
}, // middle-name initial
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "family-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "organization",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "country",
|
||||
},
|
||||
{
|
||||
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: "email",
|
||||
},
|
||||
},
|
||||
{
|
||||
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" },
|
||||
{ fieldName: "address-level2" }, // city
|
||||
{ fieldName: "address-level1" }, // state
|
||||
{ fieldName: "postal-code" },
|
||||
{ fieldName: "tel" },
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
[],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
[],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
fixturePath: "Payment.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-type",
|
||||
}, // 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"}, // ac-off
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-name",
|
||||
}, // ac-off
|
||||
{
|
||||
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
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
}, // ac-off
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "fathom",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-number" }, // ac-off
|
||||
],
|
||||
],
|
||||
[],
|
||||
[],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "given-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "additional-name",
|
||||
}, // middle-name initial
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "family-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "organization",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "country",
|
||||
},
|
||||
{
|
||||
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: "email",
|
||||
},
|
||||
},
|
||||
{
|
||||
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" },
|
||||
{ fieldName: "address-level2" }, // city
|
||||
{ fieldName: "address-level1" }, // state
|
||||
{ fieldName: "postal-code" },
|
||||
{ fieldName: "tel" },
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "given-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "additional-name",
|
||||
}, // middle-name initial
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "family-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "organization",
|
||||
},
|
||||
{
|
||||
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: "email",
|
||||
},
|
||||
},
|
||||
{
|
||||
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" },
|
||||
{ fieldName: "address-level2" },
|
||||
{ fieldName: "address-level1" }, // state
|
||||
{ fieldName: "postal-code" },
|
||||
{ fieldName: "tel" },
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
[],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
[],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
fixturePath: "SignIn.html",
|
||||
expectedResult: [
|
||||
[],
|
||||
[],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
{
|
||||
fields: [
|
||||
{ fieldName: "email", reason: "regex-heuristic" },
|
||||
],
|
||||
],
|
||||
[],
|
||||
[
|
||||
[
|
||||
},
|
||||
{
|
||||
fields: [
|
||||
// Forgot password
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
{ fieldName: "email", reason: "regex-heuristic" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
},
|
||||
{
|
||||
fields: [
|
||||
{ fieldName: "email", reason: "regex-heuristic" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
// {"section": "", "addressType": "", "contactType": "", "fieldName": "password"},
|
||||
},
|
||||
{
|
||||
fields: [
|
||||
{ fieldName: "email", reason: "regex-heuristic" },
|
||||
// {fieldName: "password"},
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
},
|
||||
{
|
||||
fields: [
|
||||
// Sign up
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
{ fieldName: "email", reason: "regex-heuristic" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
},
|
||||
{
|
||||
fields: [
|
||||
{ fieldName: "email", reason: "regex-heuristic" },
|
||||
],
|
||||
],
|
||||
[],
|
||||
}
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -7,34 +7,17 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "Payment.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-name"
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-month"
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-year"
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "fathom",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-number" },
|
||||
{ fieldName: "cc-name" },
|
||||
{ fieldName: "cc-exp-month", reason: "regex-heuristic" },
|
||||
{ fieldName: "cc-exp-year", reason: "regex-heuristic" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -7,34 +7,17 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "Checkout_Payment_FR.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp"
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-given-name"
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-family-name"
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-number" },
|
||||
{ fieldName: "cc-exp" },
|
||||
{ fieldName: "cc-given-name" },
|
||||
{ fieldName: "cc-family-name" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -7,28 +7,16 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "Payment.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-month"
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-year"
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-number", reason: "fathom" },
|
||||
{ fieldName: "cc-exp-month" },
|
||||
{ fieldName: "cc-exp-year" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -7,102 +7,66 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "Checkout_ShippingPayment.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
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: "street-address",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "postal-code",
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "given-name" },
|
||||
{ fieldName: "family-name" },
|
||||
{ fieldName: "email" },
|
||||
{ fieldName: "tel" },
|
||||
{ fieldName: "street-address" },
|
||||
{ fieldName: "postal-code" },
|
||||
],
|
||||
[
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
},
|
||||
fields: [
|
||||
// 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-exp-month"},
|
||||
// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-exp-year"},
|
||||
|
||||
// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"},
|
||||
{ fieldName: "cc-exp-month" },
|
||||
{ fieldName: "cc-exp-year" },
|
||||
{ fieldName: "cc-number", reason: "fathom" },
|
||||
// {fieldName: "cc-csc"},
|
||||
],
|
||||
[
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
addressType: "billing",
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
section: "",
|
||||
addressType: "billing",
|
||||
contactType: "",
|
||||
fieldName: "street-address",
|
||||
}, // <select>
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
fixturePath: "SignIn.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -7,56 +7,20 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "Checkout_Payment.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-type",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
part: 1,
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
part: 2,
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
part: 3,
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
part: 4,
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-month",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-year",
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "fathom",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-type", reason: "regex-heuristic" },
|
||||
{ fieldName: "cc-number", part: 1 },
|
||||
{ fieldName: "cc-number", part: 2 },
|
||||
{ fieldName: "cc-number", part: 3 },
|
||||
{ fieldName: "cc-number", part: 4 },
|
||||
{ fieldName: "cc-exp-month", reason: "regex-heuristic" },
|
||||
{ fieldName: "cc-exp-year", reason: "regex-heuristic" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -7,48 +7,23 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "index.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "fathom",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-name" },
|
||||
{ fieldName: "cc-number" },
|
||||
],
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-month",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-year",
|
||||
},
|
||||
},
|
||||
{
|
||||
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" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -7,182 +7,86 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "Checkout_ShippingAddress.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
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" },
|
||||
{
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "given-name" },
|
||||
{ fieldName: "family-name" },
|
||||
{ fieldName: "address-line1" },
|
||||
{ fieldName: "address-line2" },
|
||||
{ fieldName: "address-level2" }, // city
|
||||
{ fieldName: "address-level1" }, // state
|
||||
{ fieldName: "postal-code" },
|
||||
{ fieldName: "tel" },
|
||||
],
|
||||
],
|
||||
[],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
fixturePath: "Checkout_Payment.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
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: "email",
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "given-name" },
|
||||
{ fieldName: "family-name" },
|
||||
{ fieldName: "address-line1" },
|
||||
{ fieldName: "address-line2" },
|
||||
{ fieldName: "address-level2" }, // city
|
||||
{ fieldName: "address-level1" }, // state
|
||||
{ fieldName: "postal-code" },
|
||||
{ fieldName: "tel" },
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-type",
|
||||
}, // ac-off
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
}, // ac-off
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-month",
|
||||
}, // ac-off
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-year",
|
||||
}, // ac-off
|
||||
// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"}, // ac-off
|
||||
// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"}, // ac-off
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-type" }, // ac-off
|
||||
{ fieldName: "cc-number", reason: "fathom" }, // ac-off
|
||||
{ fieldName: "cc-exp-month" }, // ac-off
|
||||
{ fieldName: "cc-exp-year" }, // ac-off
|
||||
// {fieldName: "cc-csc"}, // ac-off
|
||||
],
|
||||
],
|
||||
[],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
fixturePath: "SignIn.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
// Sign in
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
// {"section": "", "addressType": "", "contactType": "", "fieldName": "password"},
|
||||
{ fieldName: "email" },
|
||||
// {fieldName: "password"},
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
// Forgot password
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
[],
|
||||
[],
|
||||
[],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -7,224 +7,104 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "ShippingInfo.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "given-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "family-name",
|
||||
},
|
||||
{
|
||||
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: "email",
|
||||
},
|
||||
{
|
||||
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: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
}, // ac-off
|
||||
{
|
||||
default: {
|
||||
reason: "fathom",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-name" },
|
||||
{ fieldName: "cc-number" }, // ac-off
|
||||
],
|
||||
[
|
||||
{
|
||||
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" },
|
||||
},
|
||||
{
|
||||
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" },
|
||||
],
|
||||
[
|
||||
{
|
||||
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-csc"},
|
||||
},
|
||||
{
|
||||
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"},
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
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",
|
||||
},
|
||||
},
|
||||
{
|
||||
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" },
|
||||
],
|
||||
],
|
||||
[],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
}, // ac-off
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "fathom",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-name" },
|
||||
{ fieldName: "cc-number" }, // ac-off
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
fixturePath: "Login.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
[],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -7,219 +7,77 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "ShippingAddress.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
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",
|
||||
},
|
||||
{
|
||||
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" },
|
||||
{ fieldName: "address-level1" }, // state
|
||||
{ fieldName: "tel-area-code" },
|
||||
{ fieldName: "tel-local-prefix" },
|
||||
{ fieldName: "tel-local-suffix" },
|
||||
{ fieldName: "tel-extension" },
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
[],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
fixturePath: "Payment.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
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",
|
||||
},
|
||||
{
|
||||
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" },
|
||||
{ fieldName: "address-level1" }, // state
|
||||
{ fieldName: "tel-area-code" },
|
||||
{ fieldName: "tel-local-prefix" },
|
||||
{ fieldName: "tel-local-suffix" },
|
||||
{ fieldName: "tel-extension" },
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-month",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp-year",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-exp-month" },
|
||||
{ fieldName: "cc-exp-year" },
|
||||
// FIXME: bug 1392950 - the membership number should not be detected
|
||||
// as cc-number.
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{ fieldName: "cc-number" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
fixturePath: "SignIn.html",
|
||||
expectedResult: [
|
||||
[
|
||||
// ac-off
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email"
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
// ac-off
|
||||
{ fieldName: "email" }
|
||||
]
|
||||
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -7,140 +7,103 @@ 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"},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "tel"}, // ac-off
|
||||
{ fieldName: "email" },
|
||||
// { fieldName: "bday-month"}, // select
|
||||
// { fieldName: "bday-day"}, // select
|
||||
// { fieldName: "bday-year"},
|
||||
],
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-type",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp",
|
||||
},
|
||||
// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "fathom",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-type", reason: "regex-heuristic" },
|
||||
{ fieldName: "cc-number" },
|
||||
{ fieldName: "cc-exp", reason: "regex-heuristic" },
|
||||
// { fieldName: "cc-csc"},
|
||||
],
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number", // txtQvcGiftCardNumber
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-number" }, // txtQvcGiftCardNumber
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ 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
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "tel" }, // ac-off
|
||||
{ fieldName: "email" },
|
||||
// { fieldName: "bday-month"}, // select
|
||||
// { fieldName: "bday-day"}, // select
|
||||
// { fieldName: "bday-year"}, // select
|
||||
],
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-type",
|
||||
}, // ac-off
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
}, // ac-off
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp",
|
||||
},
|
||||
// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "fathom",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-type", reason: "regex-heuristic" }, // ac-off
|
||||
{ fieldName: "cc-number" }, // ac-off
|
||||
{ fieldName: "cc-exp", reason: "regex-heuristic" },
|
||||
// { fieldName: "cc-csc"},
|
||||
],
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number", // txtQvcGiftCardNumber
|
||||
}, // ac-off
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-number" }, // txtQvcGiftCardNumbe, ac-off
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
fixturePath: "SignIn.html",
|
||||
expectedResult: [
|
||||
[],
|
||||
[
|
||||
[
|
||||
// Sign in
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
{
|
||||
// Sign in
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
[],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -7,301 +7,137 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "ShippingAddress.html",
|
||||
expectedResult: [
|
||||
[],
|
||||
[], // search form, ac-off
|
||||
[
|
||||
// ac-off
|
||||
[ {"section": "", "addressType": "", "contactType": "", "fieldName": "email"},]
|
||||
|
||||
],
|
||||
[
|
||||
// check-out, ac-off
|
||||
[
|
||||
{
|
||||
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"
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level1"
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "postal-code"
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "tel"
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "tel-extension"
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email"
|
||||
},
|
||||
],
|
||||
// ac-off
|
||||
[
|
||||
// {"section": "", "addressType": "", "contactType": "", "fieldName": "email"},
|
||||
{
|
||||
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"
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-level1"
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "postal-code"
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "tel"},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "tel-extension"
|
||||
},
|
||||
// {"section": "", "addressType": "", "contactType": "", "fieldName": "new-password"},
|
||||
],
|
||||
],
|
||||
[
|
||||
],
|
||||
[
|
||||
// ac-off
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email"
|
||||
},
|
||||
{
|
||||
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" },
|
||||
{ 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" },
|
||||
// { fieldName: "new-password"},
|
||||
],
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
// ac-off
|
||||
[
|
||||
{
|
||||
section: "", addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email"
|
||||
},
|
||||
{ fieldName: "email" },
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
// ac-off
|
||||
{ fieldName: "email" },
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
fixturePath: "PaymentOptions.html",
|
||||
expectedResult: [
|
||||
[],
|
||||
[], // search
|
||||
[
|
||||
[
|
||||
// credit card
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{
|
||||
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",
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "fathom",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-number" },
|
||||
{ fieldName: "cc-name" },
|
||||
// {fieldName: "cc-csc"},
|
||||
{ fieldName: "cc-exp-month", reason: "regex-heuristic" },
|
||||
{ fieldName: "cc-exp-year", reason: "regex-heuristic" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
// 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",
|
||||
},
|
||||
{ fieldName: "given-name" },
|
||||
{ fieldName: "family-name" },
|
||||
{ fieldName: "address-line1" },
|
||||
{ fieldName: "address-line2" },
|
||||
{ fieldName: "address-level2" }, // city
|
||||
{ fieldName: "address-level1" }, // state
|
||||
{ fieldName: "postal-code" },
|
||||
{ fieldName: "tel" },
|
||||
{ fieldName: "tel-extension" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
// check out
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "given-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "family-name",
|
||||
},
|
||||
|
||||
{ fieldName: "given-name" },
|
||||
{ fieldName: "family-name" },
|
||||
// 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",
|
||||
},
|
||||
|
||||
// {"section": "", "addressType": "", "contactType": "", "fieldName": "bday-month"},
|
||||
// {"section": "", "addressType": "", "contactType": "", "fieldName": "bday-day"},
|
||||
// {"section": "", "addressType": "", "contactType": "", "fieldName": "bday-year"},
|
||||
{ fieldName: "address-level1" },
|
||||
// { fieldName: "bday-month"},
|
||||
// { fieldName: "bday-day"},
|
||||
// { fieldName: "bday-year"},
|
||||
],
|
||||
[
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "fathom",
|
||||
},
|
||||
fields: [
|
||||
// FIXME: bug 1392950 - the bank routing number should not be detected
|
||||
// as cc-number.
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{ fieldName: "cc-number" },
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "email" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -7,138 +7,70 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "Basic.html",
|
||||
expectedResult: [
|
||||
[
|
||||
{
|
||||
// ac-off
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "given-name"
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "family-name"
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line1"
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email"
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "tel"
|
||||
},
|
||||
// {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-extension"},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "organization"
|
||||
},
|
||||
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: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "given-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "family-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "address-line1",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "tel"
|
||||
},
|
||||
// {"section": "", "addressType": "", "contactType": "", "fieldName": "tel-extension"},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "organization",
|
||||
},
|
||||
{
|
||||
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: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp",
|
||||
},
|
||||
// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-number", reason: "fathom" },
|
||||
{ fieldName: "cc-exp" },
|
||||
// {fieldName: "cc-csc"},
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
fixturePath: "PaymentBilling_ac_on.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-number",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "cc-exp",
|
||||
},
|
||||
// {"section": "", "addressType": "", "contactType": "", "fieldName": "cc-csc"},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "cc-number", reason: "fathom" },
|
||||
{ fieldName: "cc-exp" },
|
||||
// { fieldName: "cc-csc"},
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -7,165 +7,91 @@ runHeuristicsTest(
|
|||
{
|
||||
fixturePath: "Checkout.html",
|
||||
expectedResult: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "postal-code",
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "postal-code" },
|
||||
],
|
||||
],
|
||||
[],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email",
|
||||
},
|
||||
// {"section": "", "addressType": "", "contactType": "", "fieldName": "password"}, // ac-off
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "email" },
|
||||
// { fieldName: "password"}, // ac-off
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "given-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "family-name",
|
||||
},
|
||||
// ac-off
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "email"
|
||||
},
|
||||
// {"section": "", "addressType": "", "contactType": "", "fieldName": "password"},
|
||||
// {"section": "", "addressType": "", "contactType": "", "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: [
|
||||
[],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "section-payment",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "given-name",
|
||||
},
|
||||
{
|
||||
section: "section-payment",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "family-name",
|
||||
},
|
||||
{
|
||||
section: "section-payment",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "tel",
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "autocomplete",
|
||||
section: "section-payment",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "given-name" },
|
||||
{ fieldName: "family-name" },
|
||||
{ fieldName: "tel" },
|
||||
],
|
||||
[
|
||||
{
|
||||
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",
|
||||
},
|
||||
// {"section": "section-payment", "addressType": "", "contactType": "", "fieldName": "cc-csc"},
|
||||
},
|
||||
{
|
||||
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: [
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "postal-code",
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "postal-code" },
|
||||
],
|
||||
],
|
||||
[],
|
||||
[
|
||||
[
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "given-name",
|
||||
},
|
||||
{
|
||||
section: "",
|
||||
addressType: "",
|
||||
contactType: "",
|
||||
fieldName: "family-name",
|
||||
},
|
||||
{ section: "", addressType: "", contactType: "", fieldName: "tel" },
|
||||
{
|
||||
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",
|
||||
},
|
||||
},
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{ fieldName: "given-name" },
|
||||
{ fieldName: "family-name" },
|
||||
{ fieldName: "tel" },
|
||||
{ fieldName: "address-line1" },
|
||||
{ fieldName: "address-line2" },
|
||||
{ fieldName: "address-level2" }, // city
|
||||
{ fieldName: "address-level1" }, // state
|
||||
{ fieldName: "postal-code" },
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ skip-if = (os == "linux") && ccov # bug 1614100
|
|||
skip-if = (os == "linux") && ccov # bug 1614100
|
||||
[test_DirectAsda.js]
|
||||
skip-if = (os == "linux") && ccov # bug 1614100
|
||||
[test_Ebay.js]
|
||||
skip-if = (os == "linux") && ccov # bug 1614100
|
||||
[test_GlobalDirectAsda.js]
|
||||
skip-if = (os == "linux") && ccov # bug 1614100
|
||||
[test_HomeDepot.js]
|
||||
|
|
|
|||
|
|
@ -56,6 +56,9 @@ export class FieldDetail {
|
|||
* from the backend. There cannot be multiple fields which have
|
||||
* the same exact combination of these values.
|
||||
*/
|
||||
|
||||
// Which section the field belongs to. The value comes from autocomplete attribute.
|
||||
// See https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill-detail-tokens for more details
|
||||
section = "";
|
||||
addressType = "";
|
||||
contactType = "";
|
||||
|
|
|
|||
Loading…
Reference in a new issue