Bug 1445350 - fix browser_panelUINotifications_multiWindow.js so it doesn't fail on win10, r?dthayer draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 14 Mar 2018 13:18:35 +0000
changeset 767388 b193071bc3f96a1ec382b377fbc96ee6a1276323
parent 767347 80b4777a6421d8df4bb27ac23fb607c318a3006c
push id102576
push userbmo:gijskruitbosch+bugs@gmail.com
push dateWed, 14 Mar 2018 13:29:25 +0000
reviewersdthayer
bugs1445350
milestone61.0a1
Bug 1445350 - fix browser_panelUINotifications_multiWindow.js so it doesn't fail on win10, r?dthayer MozReview-Commit-ID: Jk3ah2Xtr58
browser/components/customizableui/test/browser_panelUINotifications_multiWindow.js
--- 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);