Bug 1570524 - Fix browser_webconsole_cached_messages intermittent. r=Honza.
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Mon, 04 Nov 2019 09:53:31 +0000
changeset 500326 3166ca8e8d9cd2fbf143b3266ab85d60630d1d7c
parent 500325 18389b50e525a6a97a3f99f48b016af1cc2082f6
child 500327 2b857b37df75125d7f12b46bfe6c28eac38593a3
push id114164
push useraiakab@mozilla.com
push dateTue, 05 Nov 2019 10:06:15 +0000
treeherdermozilla-inbound@4d585c7edc76 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersHonza
bugs1570524
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
devtools/client/webconsole/test/browser/browser_webconsole_cached_messages.js
--- a/devtools/client/webconsole/test/browser/browser_webconsole_cached_messages.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_cached_messages.js
@@ -1,55 +1,61 @@
 /* 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
   // and is ignored by test harness
   if (!Services.appinfo.browserTabsRemoteAutostart) {
     expectUncaughtException();
   }
   // Enable CSS filter for the test.
   await pushPref("devtools.webconsole.filter.css", true);
 
   await addTab(TEST_URI);
 
   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");
 }