Bug 1547855 - use waitForCondition instead of waitForEvent. r=bytesized
authorRobert Strong <robert.bugzilla@gmail.com>
Wed, 01 May 2019 16:18:58 +0000
changeset 530946 62b63caf1a90ddb85d4ce1057cc7647a25ecd0d0
parent 530945 626173a3383d697d59629ba869142c60a7f41bbe
child 530947 0ec1e2ef404db0cafa7a670ca20b01c8e0e60dd6
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbytesized
bugs1547855
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1547855 - use waitForCondition instead of waitForEvent. r=bytesized There is a race between adding the event listener and showing the UI so just wait until the UI is shown Differential Revision: https://phabricator.services.mozilla.com/D29453
toolkit/mozapps/update/tests/browser/head.js
--- a/toolkit/mozapps/update/tests/browser/head.js
+++ b/toolkit/mozapps/update/tests/browser/head.js
@@ -523,17 +523,28 @@ function getPatchOfType(type) {
 function runDoorhangerUpdateTest(updateParams, checkAttempts, steps) {
   function processDoorhangerStep(step) {
     if (typeof(step) == "function") {
       return step();
     }
 
     const {notificationId, button, checkActiveUpdate, pageURLs} = step;
     return (async function() {
-      await BrowserTestUtils.waitForEvent(PanelUI.notificationPanel, "popupshown");
+      await TestUtils.waitForCondition(() =>
+        (PanelUI.notificationPanel.state == "open"),
+        "Waiting on PanelUI.notificationPanel.state to equal open",
+        undefined, 200
+      ).catch(e => {
+        // Instead of throwing let the check below fail the test so the
+        // notification ID and the expected notification ID is printed in the
+        // log.
+        logTestInfo(e);
+      });
+      is(PanelUI.notificationPanel.state, "open",
+         "The PanelUI.notificationPanel.state should equal open");
       const shownNotificationId = AppMenuNotifications.activeNotification.id;
       is(shownNotificationId, notificationId,
          "The right notification showed up.");
 
       if (checkActiveUpdate) {
         ok(!!gUpdateManager.activeUpdate,
            "There should be an active update");
         is(gUpdateManager.activeUpdate.state, checkActiveUpdate.state,