Bug 1454123 - Wait for checkToolboxUI and send the key event to the target window. r?birtles draft
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Tue, 22 May 2018 03:13:57 +0900
changeset 797800 c8437b926df2d6dee1454f604e92c61e752fa1ae
parent 797745 77c06979d9e88979ec96263eccdbd750cb9221a4
push id110578
push userbmo:mantaroh@gmail.com
push dateMon, 21 May 2018 18:14:31 +0000
reviewersbirtles
bugs1454123
milestone62.0a1
Bug 1454123 - Wait for checkToolboxUI and send the key event to the target window. r?birtles The browser_webconsole_split.js will need to wait for finishing the checkToolboxUI function since we should wait to toggle the split console. And we will need to send ESCAPE key event to the target window due to test the WINDOW host type. MozReview-Commit-ID: Jakhs3RrdTI
devtools/client/webconsole/test/mochitest/browser.ini
devtools/client/webconsole/test/mochitest/browser_webconsole_split.js
--- a/devtools/client/webconsole/test/mochitest/browser.ini
+++ b/devtools/client/webconsole/test/mochitest/browser.ini
@@ -336,17 +336,16 @@ subsuite = clipboard
 [browser_webconsole_shows_reqs_from_netmonitor.js]
 [browser_webconsole_shows_reqs_in_netmonitor.js]
 [browser_webconsole_sidebar_object_expand_when_message_pruned.js]
 [browser_webconsole_sourcemap_css.js]
 [browser_webconsole_sourcemap_error.js]
 [browser_webconsole_sourcemap_invalid.js]
 [browser_webconsole_sourcemap_nosource.js]
 [browser_webconsole_split.js]
-skip-if = (os == 'mac') || (os == 'linux' && !debug && bits == 64) || (os == 'win') # Bug 1454123 disabled on OS X, Windows and Linux64 for frequent failures
 [browser_webconsole_split_close_button.js]
 [browser_webconsole_split_escape_key.js]
 [browser_webconsole_split_focus.js]
 [browser_webconsole_split_persist.js]
 [browser_webconsole_stacktrace_location_debugger_link.js]
 [browser_webconsole_stacktrace_location_scratchpad_link.js]
 [browser_webconsole_strict_mode_errors.js]
 [browser_webconsole_string.js]
--- a/devtools/client/webconsole/test/mochitest/browser_webconsole_split.js
+++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_split.js
@@ -19,31 +19,31 @@ add_task(async function() {
 
   await addTab(TEST_URI);
   await testConsoleLoadOnDifferentPanel();
   await testKeyboardShortcuts();
   await checkAllTools();
 
   info("Testing host types");
   checkHostType(Toolbox.HostType.BOTTOM);
-  checkToolboxUI();
+  await checkToolboxUI();
   await toolbox.switchHost(Toolbox.HostType.SIDE);
   checkHostType(Toolbox.HostType.SIDE);
-  checkToolboxUI();
+  await 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 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");
     const webconsoleReady = toolbox.once("webconsole-ready");
     await toolbox.toggleSplitConsole();
@@ -111,17 +111,17 @@ add_task(async function() {
               ? "hide"
               : "split";
         }
 
         // Wait for menu to close
         toolbox.doc.addEventListener("popuphidden", () => {
           resolve(label);
         }, { once: true });
-        EventUtils.synthesizeKey("KEY_Escape");
+        EventUtils.sendKey("ESCAPE", toolbox.win);
       }, { once: true });
     });
   }
 
   async function checkWebconsolePanelOpened() {
     info("About to check special cases when webconsole panel is open.");
 
     // Start with console split, so we can test for transition to main panel.