Bug 1445350 - fix browser_panelUINotifications_multiWindow.js so it doesn't fail on win10, r?dthayer
MozReview-Commit-ID: Jk3ah2Xtr58
--- a/browser/components/customizableui/test/browser_panelUINotifications_multiWindow.js
+++ b/browser/components/customizableui/test/browser_panelUINotifications_multiWindow.js
@@ -12,16 +12,17 @@ add_task(async function testDoesNotShowD
gBrowser: window.gBrowser,
url: "about:blank"
};
await BrowserTestUtils.withNewTab(options, async function(browser) {
let doc = browser.ownerDocument;
let win = await BrowserTestUtils.openNewBrowserWindow();
+ await SimpleTest.promiseFocus(win);
let mainActionCalled = false;
let mainAction = {
callback: () => { mainActionCalled = true; }
};
AppMenuNotifications.showNotification("update-manual", mainAction);
is(PanelUI.notificationPanel.state, "closed", "The background window's doorhanger is closed.");
is(PanelUI.menuButton.hasAttribute("badge-status"), true, "The background window has a badge.");
@@ -50,16 +51,17 @@ add_task(async function testDoesNotShowD
add_task(async function testBackgroundWindowNotificationsAreRemovedByForeground() {
let options = {
gBrowser: window.gBrowser,
url: "about:blank"
};
await BrowserTestUtils.withNewTab(options, async function(browser) {
let win = await BrowserTestUtils.openNewBrowserWindow();
+ await SimpleTest.promiseFocus(win);
AppMenuNotifications.showNotification("update-manual", {callback() {}});
let doc = win.gBrowser.ownerDocument;
let notifications = [...win.PanelUI.notificationPanel.children].filter(n => !n.hidden);
is(notifications.length, 1, "PanelUI doorhanger is only displaying one notification.");
let doorhanger = notifications[0];
let button = doc.getAnonymousElementByAttribute(doorhanger, "anonid", "button");
button.click();
@@ -80,16 +82,17 @@ add_task(async function testBackgroundWi
add_task(async function testBackgroundWindowNotificationsAreDismissedByForeground() {
let options = {
gBrowser: window.gBrowser,
url: "about:blank"
};
await BrowserTestUtils.withNewTab(options, async function(browser) {
let win = await BrowserTestUtils.openNewBrowserWindow();
+ await SimpleTest.promiseFocus(win);
AppMenuNotifications.showNotification("update-manual", {callback() {}});
let doc = win.gBrowser.ownerDocument;
let notifications = [...win.PanelUI.notificationPanel.children].filter(n => !n.hidden);
is(notifications.length, 1, "PanelUI doorhanger is only displaying one notification.");
let doorhanger = notifications[0];
let button = doc.getAnonymousElementByAttribute(doorhanger, "anonid", "secondarybutton");
button.click();
@@ -107,16 +110,17 @@ add_task(async function testBackgroundWi
/**
* Tests that when we open a new window while a notification is showing, the
* notification also shows on the new window.
*/
add_task(async function testOpenWindowAfterShowingNotification() {
AppMenuNotifications.showNotification("update-manual", {callback() {}});
let win = await BrowserTestUtils.openNewBrowserWindow();
+ await SimpleTest.promiseFocus(win);
let doc = win.gBrowser.ownerDocument;
let notifications = [...win.PanelUI.notificationPanel.children].filter(n => !n.hidden);
is(notifications.length, 1, "PanelUI doorhanger is only displaying one notification.");
let doorhanger = notifications[0];
let button = doc.getAnonymousElementByAttribute(doorhanger, "anonid", "secondarybutton");
button.click();
await BrowserTestUtils.closeWindow(win);