Bug 1454123 - Wait a moment after moving toolbox to a window before triggering its menu; r?bgrins draft
authorBrian Birtles <birtles@gmail.com>
Wed, 25 Apr 2018 09:55:04 +0900
changeset 787599 d246837d5e4d3049c9bdca9493df798744d9a713
parent 787539 6eeb97ca94f40189d5aa552da9e0b0b11bfa0441
push id107756
push userbmo:bbirtles@mozilla.com
push dateWed, 25 Apr 2018 00:55:59 +0000
reviewersbgrins
bugs1454123
milestone61.0a1
Bug 1454123 - Wait a moment after moving toolbox to a window before triggering its menu; r?bgrins MozReview-Commit-ID: 839Z65WTjpC
devtools/client/webconsole/test/mochitest/browser_webconsole_split.js
--- a/devtools/client/webconsole/test/mochitest/browser_webconsole_split.js
+++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_split.js
@@ -24,16 +24,24 @@ add_task(async function() {
 
   info("Testing host types");
   checkHostType(Toolbox.HostType.BOTTOM);
   checkToolboxUI();
   await toolbox.switchHost(Toolbox.HostType.SIDE);
   checkHostType(Toolbox.HostType.SIDE);
   checkToolboxUI();
   await toolbox.switchHost(Toolbox.HostType.WINDOW);
+
+  // checkHostType, below,  will open the meatball menu to read the "Split
+  // console" menu item label. However, if we've just opened a new window then
+  // on some platforms when we switch focus to the new window we might end up
+  // triggering the auto-close behavior on the menu popup. To avoid that, wait
+  // a moment before querying the menu.
+  await new Promise(resolve => requestIdleCallback(resolve));
+
   checkHostType(Toolbox.HostType.WINDOW);
   checkToolboxUI();
   await toolbox.switchHost(Toolbox.HostType.BOTTOM);
 
   async function testConsoleLoadOnDifferentPanel() {
     info("About to check console loads even when non-webconsole panel is open");
 
     await openPanel("inspector");