Bug 951965 - Make sure checking PanelUI.panel state after the popuphidden event, r?MattN draft
authorFischer.json <fischer.json@gmail.com>
Sun, 17 Sep 2017 18:02:53 +0800
changeset 666193 373ec97511d046351352e18d9560fc35e5bef938
parent 666127 ae39864562c6048fdc2950c5dfedb48e247c3300
child 732005 5f917d1e8942e9ccfe843ee40e8d115d59263f9c
push id80305
push userbmo:fliu@mozilla.com
push dateMon, 18 Sep 2017 06:27:06 +0000
reviewersMattN
bugs951965
milestone57.0a1
Bug 951965 - Make sure checking PanelUI.panel state after the popuphidden event, r?MattN This commit makes sure checking PanelUI.panel state is "closed" after the popuphidden event so as to avoid the intermittent fialure because of the too early checking. MozReview-Commit-ID: LinQbytw0lC
browser/components/uitour/test/browser_UITour.js
--- a/browser/components/uitour/test/browser_UITour.js
+++ b/browser/components/uitour/test/browser_UITour.js
@@ -128,23 +128,26 @@ var tests = [
   },
   function test_highlight_customize_auto_open_close(done) {
     let highlight = document.getElementById("UITourHighlight");
     gContentAPI.showHighlight("customize");
     waitForElementToBeVisible(highlight, function checkPanelIsOpen() {
       isnot(PanelUI.panel.state, "closed", "Panel should have opened");
       isnot(highlight.classList.contains("rounded-highlight"), true, "Highlight should not be round-rectangle styled.");
 
+      let hiddenPromise = promisePanelElementHidden(window, PanelUI.panel);
       // Move the highlight outside which should close the app menu.
       gContentAPI.showHighlight("appMenu");
-      waitForElementToBeVisible(highlight, function checkPanelIsClosed() {
-        isnot(PanelUI.panel.state, "open",
-              "Panel should have closed after the highlight moved elsewhere.");
-        done();
-      }, "Highlight should move to the appMenu button");
+      hiddenPromise.then(() => {
+        waitForElementToBeVisible(highlight, function checkPanelIsClosed() {
+          isnot(PanelUI.panel.state, "open",
+                "Panel should have closed after the highlight moved elsewhere.");
+          done();
+        }, "Highlight should move to the appMenu button");
+      });
     }, "Highlight should be shown after showHighlight() for fixed panel items");
   },
   function test_highlight_customize_manual_open_close(done) {
     let highlight = document.getElementById("UITourHighlight");
     // Manually open the app menu then show a highlight there. The menu should remain open.
     let shownPromise = promisePanelShown(window);
     gContentAPI.showMenu("appMenu");
     shownPromise.then(() => {