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
--- 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.