Replace arbitrary timeouts in tests with waitForCondition
Categories
(Toolkit :: Form Autofill, task, P3)
Tracking
()
People
(Reporter: serg, Assigned: serg)
References
(Blocks 1 open bug)
Details
Attachments
(1 obsolete file)
We have too many places like this one https://searchfox.org/mozilla-central/source/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_doorhanger.js#189 when we wait 1 second for focus or change of value happen in the element. Even when test runs fast, we lose almost 1 second just waiting. It accumulates to at least 30 seconds of test runs for no benefit.
Lets replace multiple copy/paste lines of code with a specialized function to focus-element-and-wait or change-element-value-and-wait. We can use waitForCondition() to reduce time loss.
Assignee | ||
Updated•3 years ago
|
Comment 1•3 years ago
|
||
See the eslint-disable mozilla/no-arbitrary-setTimeout
which disables the lint error the setTimeout would normally produce. We could probably watch input events and resolve a promise when we get the expected value. waitForCondition
is a bit of a blunt tool but would still be an improvement here.
Assignee | ||
Comment 2•3 years ago
|
||
(In reply to Sam Foster [:sfoster] (he/him) from comment #1)
See the
eslint-disable mozilla/no-arbitrary-setTimeout
which disables the lint error the setTimeout would normally produce. We could probably watch input events and resolve a promise when we get the expected value.waitForCondition
is a bit of a blunt tool but would still be an improvement here.
Thanks Sam, that is helpful!
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 3•3 years ago
|
||
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Assignee | ||
Updated•3 years ago
|
Description
•