Bug 1324497 - Wait for popupshow to fix intermittent in browser_popupNotification_checkbox.js. r=past, a=test-only
authorJohann Hofmann <jhofmann@mozilla.com>
Tue, 07 Feb 2017 20:27:53 +0100
changeset 366963 59b7226fcd5eb199441096639ac586718bb01bae
parent 366962 af422c1e8f80521e4c95a22878b0e7733d1674b0
child 366964 206efe33df435f532bdfbad8ecfe635dbc9f13c8
push id6900
push userryanvm@gmail.com
push dateThu, 09 Feb 2017 17:25:15 +0000
treeherdermozilla-beta@15d8f9d49bfe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast, test-only
bugs1324497
milestone52.0
Bug 1324497 - Wait for popupshow to fix intermittent in browser_popupNotification_checkbox.js. r=past, a=test-only MozReview-Commit-ID: 3EvJ5Sr7vTM
browser/base/content/test/popupNotifications/browser_popupNotification_checkbox.js
browser/base/content/test/popupNotifications/head.js
--- a/browser/base/content/test/popupNotifications/browser_popupNotification_checkbox.js
+++ b/browser/base/content/test/popupNotifications/browser_popupNotification_checkbox.js
@@ -144,19 +144,21 @@ var tests = [
       checkPopup(popup, this.notifyObj);
       let notification = popup.childNodes[0];
       let checkbox = notification.checkbox;
       checkCheckbox(checkbox, "This is a checkbox");
       yield promiseElementVisible(checkbox);
       EventUtils.synthesizeMouseAtCenter(checkbox, {});
       dismissNotification(popup);
     },
-    onHidden: function (popup) {
+    onHidden: function* (popup) {
       let icon = document.getElementById("default-notification-icon");
+      let shown = waitForNotificationPanel();
       EventUtils.synthesizeMouseAtCenter(icon, {});
+      yield shown;
       let notification = popup.childNodes[0];
       let checkbox = notification.checkbox;
       checkCheckbox(checkbox, "This is a checkbox", true);
       checkMainAction(notification, true);
       gNotification.remove();
     }
   },
 ];
--- a/browser/base/content/test/popupNotifications/head.js
+++ b/browser/base/content/test/popupNotifications/head.js
@@ -97,18 +97,18 @@ function* runNextTest() {
     onPopupEvent("popupshown", function () {
       shownState = true;
       info("[" + nextTest.id + "] popup shown");
       Task.spawn(() => nextTest.onShown(this))
           .then(undefined, ex => Assert.ok(false, "onShown failed: " + ex));
     });
     onPopupEvent("popuphidden", function () {
       info("[" + nextTest.id + "] popup hidden");
-      nextTest.onHidden(this);
-      goNext();
+      Task.spawn(() => nextTest.onHidden(this))
+          .then(() => goNext(), ex => Assert.ok(false, "onHidden failed: " + ex));
     }, () => shownState);
     info("[" + nextTest.id + "] added listeners; panel is open: " + PopupNotifications.isPanelOpen);
   }
 
   info("[" + nextTest.id + "] running test");
   yield nextTest.run();
 }