Bug 1211092 - Wait for the editItemOverlay to be initialised before continuing with browser_bookmarksProperties.js to avoid intermittents. r?mak draft
authorMark Banner <standard8@mozilla.com>
Mon, 03 Jul 2017 16:36:47 +0100
changeset 603335 c3f0f2b462ae1c71f41847f9f9298cdbe80f86e1
parent 603265 283debe8155accfec5812c66e33384ce217d02c2
child 635903 ec8e05e5b89b978838a4048e5d125c099cdd8006
push id66757
push userbmo:standard8@mozilla.com
push dateMon, 03 Jul 2017 19:20:56 +0000
reviewersmak
bugs1211092
milestone56.0a1
Bug 1211092 - Wait for the editItemOverlay to be initialised before continuing with browser_bookmarksProperties.js to avoid intermittents. r?mak MozReview-Commit-ID: AvTCWGFGuqf
browser/components/places/tests/browser/browser_bookmarksProperties.js
--- a/browser/components/places/tests/browser/browser_bookmarksProperties.js
+++ b/browser/components/places/tests/browser/browser_bookmarksProperties.js
@@ -393,28 +393,26 @@ function open_properties_dialog() {
        "We have a places node selected: " + tree.selectedNode.title);
 
     // Wait for the Properties dialog.
     function windowObserver(aSubject, aTopic, aData) {
       if (aTopic != "domwindowopened")
         return;
       ww.unregisterNotification(windowObserver);
       let observerWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
-      waitForFocus(() => {
-        // Windows has been loaded, execute our test now.
-        executeSoon(function() {
-          // Ensure overlay is loaded
-          ok(observerWindow.gEditItemOverlay.initialized, "EditItemOverlay is initialized");
-          gCurrentTest.window = observerWindow;
-          try {
-            gCurrentTest.run();
-          } catch (ex) {
-            ok(false, "An error occured during test run: " + ex.message);
-          }
-        });
+      waitForFocus(async () => {
+        // Ensure overlay is loaded
+        await BrowserTestUtils.waitForCondition(
+          () => observerWindow.gEditItemOverlay.initialized, "EditItemOverlay is initialized");
+        gCurrentTest.window = observerWindow;
+        try {
+          gCurrentTest.run();
+        } catch (ex) {
+          ok(false, "An error occured during test run: " + ex.message);
+        }
       }, observerWindow);
     }
     ww.registerNotification(windowObserver);
 
     var command = null;
     switch (gCurrentTest.action) {
       case ACTION_EDIT:
         command = "placesCmd_show:info";