Closed Bug 1753733 Opened 3 years ago Closed 3 years ago

Replace arbitrary timeouts in tests with waitForCondition

Categories

(Toolkit :: Form Autofill, task, P3)

task

Tracking

()

RESOLVED DUPLICATE of bug 1655600

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.

Severity: -- → N/A
Component: about:logins → Form Autofill
Priority: -- → P3
Product: Firefox → Toolkit

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.

(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!

Blocks: 1752570
Assignee: nobody → sgalich
Status: NEW → ASSIGNED
Attachment #9264292 - Attachment description: WIP: Bug 1753733 - Replace arbitrary timeouts in tests with waitForCondition → Bug 1753733 - Replace arbitrary timeouts in tests with waitForCondition
Attachment #9264292 - Attachment description: Bug 1753733 - Replace arbitrary timeouts in tests with waitForCondition → WIP: Bug 1753733 - Replace arbitrary timeouts in tests with waitForCondition
Attachment #9264292 - Attachment description: WIP: Bug 1753733 - Replace arbitrary timeouts in tests with waitForCondition → Bug 1753733 - Replace arbitrary timeouts in tests with waitForCondition
Attachment #9264292 - Attachment description: Bug 1753733 - Replace arbitrary timeouts in tests with waitForCondition → WIP: Bug 1753733 - Replace arbitrary timeouts in tests with waitForCondition
Attachment #9264292 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: