Bug 1499474 - Check if the element has textContent before falling back to TestUtils.waitForCondition. r=MattN
authorJared Wein <jwein@mozilla.com>
Tue, 16 Oct 2018 20:04:38 +0000
changeset 489884 4c98e1b28c388eed1ce835038f570cc0169ef389
parent 489883 af0263577e4d16da5c44df23ef5a44685c07a4d0
child 489885 de6fb9a3d7a5dcf98798c833994c68f2ac83526c
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersMattN
bugs1499474
milestone64.0a1
Bug 1499474 - Check if the element has textContent before falling back to TestUtils.waitForCondition. r=MattN This patch reduced the time to run from 2 minutes to 15 seconds. Differential Revision: https://phabricator.services.mozilla.com/D8895
browser/extensions/formautofill/test/browser/browser_editAddressDialog.js
--- a/browser/extensions/formautofill/test/browser/browser_editAddressDialog.js
+++ b/browser/extensions/formautofill/test/browser/browser_editAddressDialog.js
@@ -319,18 +319,21 @@ add_task(async function test_countryFiel
         delete labelEl.dataset.localization;
       }
 
       info(`Selecting '${countryOption.label}' (${countryOption.value})`);
       EventUtils.synthesizeKey(countryOption.label, {}, win);
 
       // Check that the labels were filled
       for (let labelEl of mutatableLabels) {
-        await TestUtils.waitForCondition(() => labelEl.textContent,
-                                         "Wait for label to be populated by the mutation observer");
+        if (!labelEl.textContent) {
+          await TestUtils.waitForCondition(() => labelEl.textContent,
+                                           "Wait for label to be populated by the mutation observer",
+                                           10);
+        }
         isnot(labelEl.textContent, "",
               "Ensure textContent is non-empty for: " + countryOption.value);
         is(labelEl.dataset.localization, undefined,
            "Ensure data-localization was removed: " + countryOption.value);
       }
     }
 
     doc.querySelector("#cancel").click();