Bug 1445350 - fix browser_panelUINotifications_multiWindow.js so it doesn't fail on win10, r=dthayer, a=test-only
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 14 Mar 2018 13:18:35 +0000
changeset 463028 c34e02643aa93b1332ac0a76c385f3e79d0ca132
parent 463027 679cd6648004bb0114259b05955296fd172bf68f
child 463029 1e486882e7662a41cd8cc7d83eb29cd52c1181b2
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdthayer, test-only
bugs1445350
milestone60.0
Bug 1445350 - fix browser_panelUINotifications_multiWindow.js so it doesn't fail on win10, r=dthayer, a=test-only 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);