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
--- 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(() => {