Closed Bug 1776876 Opened 2 years ago Closed 2 years ago

Make the use of `setTimeout` more clear in formautofill testcase

Categories

(Toolkit :: Form Autofill, task, P3)

task

Tracking

()

RESOLVED FIXED
104 Branch
Tracking Status
firefox104 --- fixed

People

(Reporter: dimi, Assigned: janikaneuberger)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Some refactoring work we can do to make using setTimeout in formautofill testcase more explicit

  • When a setTimeout is needed in the testcase, we can add a utility function (ex. ensureNoAutocompletePopup to make the usage more clear
  • We don't use setTimeout in browser_first_time_use_doorhanger.js, so eslint-disable mozilla/no-arbitrary-setTimeout can be removed from browser_first_time_use_doorhanger.js
Assignee: nobody → jneuberger
Status: NEW → ASSIGNED
Keywords: good-first-bug
Summary: Remove eslint-disable mozilla/no-arbitrary-setTimeout from browser_first_time_use_doorhanger.js → Make the use of `setTimeout` more clear in formautofill testcase
Attachment #9283371 - Attachment description: Bug 1776876 - Relocate the method call of setTimeout from browser_submission_in_private_mode.js to the method ensureNoProfileSaved(browser) in head.js r=dimi! → Bug 1776876 - Relocate the method call of setTimeout from browser_submission_in_private_mode.js to the method ensureNoProfileSaved(browser) in head.js
Attachment #9283371 - Attachment description: Bug 1776876 - Relocate the method call of setTimeout from browser_submission_in_private_mode.js to the method ensureNoProfileSaved(browser) in head.js → WIP: Bug 1776876 - Make the use of setTimeout clearer and relocate it to head.js

The use of setTimeout in browser_editCreditCardDialog.js could be refactored but is a workaround for Bug 1700685 anyway. Refactoring might be unnecessary here?

// This test used to rely on the implied initial timer of
// TestUtils.waitForCondition. See bug 1700685.
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
          await new Promise(resolve => setTimeout(resolve, 10));

          await TestUtils.waitForCondition(
            () => labelEl.textContent,
            "Wait for label to be populated by the mutation observer",
            10
          );

(In reply to Janika Neuberger (:jneuberger) from comment #2)

The use of setTimeout in browser_editCreditCardDialog.js could be refactored but is a workaround for Bug 1700685 anyway. Refactoring might be unnecessary here?

I guess you mean browser_editAddressDialog.js? If yes, then yes, I agree refactoring is unnecessary.

Attachment #9283371 - Attachment description: WIP: Bug 1776876 - Make the use of setTimeout clearer and relocate it to head.js → Bug 1776876 - Make the use of setTimeout clearer and relocate it to head.js
Pushed by dlee@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/493e6cb4ba70
Make the use of setTimeout clearer and relocate it to head.js r=dimi
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: