Determine pattern for handling test prefs in Form Autofill
Categories
(Toolkit :: Form Autofill, task, P3)
Tracking
()
People
(Reporter: tgiles, Unassigned)
References
(Blocks 1 open bug)
Details
Currently in Form Autofill, we sometimes establish prefs as const
s in the head.js
files of the various test suites, sometimes we just use the pref string in various tests. We should determine a strategy for how we want to address this papercut.
On one hand, we could create a test_prefs.js
file that exports each const into the various head.js
files so that we can utilize one const in our tests (especially if there's IDE support for this reference, to help prevent typos and all that). On the other hand, we could use the full pref string everywhere we need it so that we don't need to remember a pref variable.
There's probably other ways to deal with this, but these are the two I immediately recall throughout our conversations.
Reporter | ||
Updated•3 years ago
|
Reporter | ||
Updated•3 years ago
|
Comment 1•3 years ago
|
||
My preference would be to stop using const 😱 for pref names. Here is my rationale:
- There is no compile time validation that const name has no typos. Same as for pref name string has, so no win by using const.
- Many files defining same consts is a mess. We better keep it in one file, but even then we still need these names in test config files.
- The chance we need to change const value is very low. We are most likely to create a new pref instead of renaming existing.
- Using same string everywhere enables "Find in All Files".
Today I'm trying to find browser.search.region
and I hit 32 search results. Some of them are:
const BROWSER_SEARCH_REGION_PREF = "browser.search.region";
const SEARCH_REGION_PREF = "browser.search.region";
const REGION_PREF = "browser.search.region";
browser.search.region='DE'
I will need to search for BROWSER_SEARCH_REGION_PREF
, SEARCH_REGION_PREF
and REGION_PREF
. Then I'll need to combine results of 4 searchers to see places where we use that pref. I could search by REGION_PREF in this particular case, but that's still many searches vs one.
Updated•3 years ago
|
Description
•