Bug 1570524 - Fix browser_webconsole_cached_messages intermittent. r=Honza.

Wait for the messages to be displayed, and requestLongerTimeout,
as test failures logs seem to indicate that slower machine take
more than 30s to run the test.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Chevobbe 2019-11-04 09:53:31 +00:00
Родитель d4714f6b29
Коммит 9c0b3f6b24
1 изменённых файлов: 20 добавлений и 14 удалений

Просмотреть файл

@ -1,15 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Test to see if the cached messages are displayed when the console UI is
// opened.
// Test to see if the cached messages are displayed when the console UI is opened.
"use strict";
// See Bug 1570524.
requestLongerTimeout(2);
const TEST_URI =
"http://example.com/browser/devtools/client/webconsole/" +
"test/browser/" +
"test-webconsole-error-observer.html";
"test/browser/test-webconsole-error-observer.html";
add_task(async function() {
// On e10s, the exception is triggered in child process
@ -25,31 +26,36 @@ add_task(async function() {
info("Open the console");
let hud = await openConsole();
await testMessagesVisibility(hud, true);
await testMessagesVisibility(hud);
info("Close the toolbox");
await closeToolbox();
info("Open the console again");
hud = await openConsole();
await testMessagesVisibility(hud, false);
await testMessagesVisibility(hud);
});
async function testMessagesVisibility(hud, waitForCSSMessage) {
let message = findMessage(hud, "log Bazzle", ".message.log");
async function testMessagesVisibility(hud) {
let message = await waitFor(() =>
findMessage(hud, "log Bazzle", ".message.log")
);
ok(message, "console.log message is visible");
message = findMessage(hud, "error Bazzle", ".message.error");
message = await waitFor(() =>
findMessage(hud, "error Bazzle", ".message.error")
);
ok(message, "console.error message is visible");
message = findMessage(hud, "bazBug611032", ".message.error");
message = await waitFor(() =>
findMessage(hud, "bazBug611032", ".message.error")
);
ok(message, "exception message is visible");
// The CSS message arrives lazily, so spin a bit for it unless it should be
// cached.
if (waitForCSSMessage) {
await waitForMessage(hud, "cssColorBug611032");
}
message = findMessage(hud, "cssColorBug611032", ".message.warn.css");
message = await waitFor(() =>
findMessage(hud, "cssColorBug611032", ".message.warn.css")
);
ok(message, "css warning message is visible");
}