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 378329 ca9697c035cd267b723ba04315a61c7ae28efdb9
parent 378328 1ba573ebea51aa5c0d30f52e0900e1247929f0e1
child 378330 e382a8cc7883ef90ce352c74151440864484358b
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast, test-only
bugs1324497
milestone53.0a2
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
@@ -143,19 +143,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(popup) {
+    *onHidden(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
@@ -96,18 +96,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();
 }