Open
Bug 1767531
Opened 4 years ago
Fix "test_autofillFormFields.js" test cases so that the expectedResult is more clear
Categories
(Toolkit :: Form Autofill, task, P3)
Toolkit
Form Autofill
Tracking
()
NEW
People
(Reporter: tgiles, Unassigned)
Details
Currently in test_autofillFormFields, it can be difficult to determine what each test case is actually testing. For example, given this test case, it is not immediately clear which value is being tested in expectedResult:
{
description:
"Form with a disabled input and non-disabled inputs. The 'country' field should not change",
document: `<form>
<input id="given-name" autocomplete="given-name">
<input id="family-name" autocomplete="family-name">
<input id="street-addr" autocomplete="street-address">
<input id="country" autocomplete="country" disabled value="DE">
</form>`,
focusedInputId: "given-name",
profileData: {
guid: "123",
"given-name": "John",
"family-name": "Doe",
"street-address": "100 Main Street",
country: "CA",
},
expectedResult: {
"given-name": "John",
"family-name": "Doe",
"street-addr": "100 Main Street",
country: "DE",
},
},
Luckily the description helps describe what is being tested, but most test cases in this file do not have that kind of description. We should determine a way to make the tested properties of expectedResult stand out more from the other incidental properties we are verifying. For example, if we were able to do something like:
{
profileData: {
guid: "123",
"given-name": "John",
"family-name": "Doe",
"street-address": "100 Main Street",
country: "CA",
},
expectedResult: {
...profileData,
country: "DE",
},
}
that would be ideal. However, it appears we cannot spread data like that since there's no way to access the profileData property from expectedResult since the test case is an anonymous object.
You need to log in
before you can comment on or make changes to this bug.
Description
•