Bug 1581033 - Fix browser_console_open_or_focus intermittent. r=Honza.

Differential Revision: https://phabricator.services.mozilla.com/D45801

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Chevobbe 2019-09-13 08:22:50 +00:00
parent 730793a2ef
commit d31e32951a
2 changed files with 14 additions and 10 deletions

View File

@ -177,9 +177,6 @@ skip-if = os == "linux" # Bug 1440059, disabled for all build types
[browser_console_jsterm_await.js]
[browser_console_nsiconsolemessage.js]
[browser_console_open_or_focus.js]
skip-if =
(verify && debug && (os == 'mac' || os == 'linux')) ||
(fission && debug) # Fails intermittently.
[browser_console_restore.js]
skip-if = verify
[browser_console_webconsole_console_api_calls.js]

View File

@ -5,32 +5,37 @@
// the console window instead of toggling it open/close.
"use strict";
requestLongerTimeout(2);
const TEST_MESSAGE = "testmessage";
const { Tools } = require("devtools/client/definitions");
add_task(async function() {
let currWindow, hud;
info("Get main browser window");
const mainWindow = Services.wm.getMostRecentWindow(null);
info("Open the Browser Console");
await BrowserConsoleManager.openBrowserConsoleOrFocus();
hud = BrowserConsoleManager.getBrowserConsole();
ok(hud.ui.document.hasFocus(), "Focus in the document");
let hud = BrowserConsoleManager.getBrowserConsole();
await waitFor(() => hud.ui.document.hasFocus());
ok(true, "Focus is in the Browser Console");
info("Emit a log message to display it in the Browser Console");
console.log(TEST_MESSAGE);
await waitFor(() => findMessage(hud, TEST_MESSAGE));
currWindow = Services.wm.getMostRecentWindow(null);
let currWindow = Services.wm.getMostRecentWindow(null);
is(
currWindow.document.documentURI,
Tools.webConsole.url,
"The Browser Console is open and has focus"
);
info("Focus the main browser window");
mainWindow.focus();
info("Focus the Browser Console window");
await BrowserConsoleManager.openBrowserConsoleOrFocus();
currWindow = Services.wm.getMostRecentWindow(null);
is(
@ -38,6 +43,8 @@ add_task(async function() {
Tools.webConsole.url,
"The Browser Console is open and has focus"
);
info("Close the Browser Console");
await BrowserConsoleManager.toggleBrowserConsole();
hud = BrowserConsoleManager.getBrowserConsole();
ok(!hud, "Browser Console has been closed");