Bug 1319247 - Fix devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_batching.js intermittent; r=bgrins draft
authorNicolas Chevobbe <chevobbe.nicolas@gmail.com>
Thu, 24 Nov 2016 20:19:44 +0100
changeset 445470 7b1e3ab8925e4cb77119d1f007761d51879959ba
parent 444725 8387a4ada9a5c4cab059d8fafe0f8c933e83c149
child 538513 db75b42acbd3cc234af1c7552518db6ff1571770
push id37505
push userchevobbe.nicolas@gmail.com
push dateTue, 29 Nov 2016 16:35:27 +0000
reviewersbgrins
bugs1319247
milestone53.0a1
Bug 1319247 - Fix devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_batching.js intermittent; r=bgrins Adjust `waitFor` default interval and retries in head.js to speed things up for the better case. In the test, remove the logging when the state changes saves a lot of time. MozReview-Commit-ID: LWdClmzzJ3P
devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_batching.js
devtools/client/webconsole/new-console-output/test/mochitest/head.js
--- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_batching.js
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_batching.js
@@ -7,34 +7,16 @@
 
 // Check adding console calls as batch keep the order of the message.
 
 const TEST_URI = "http://example.com/browser/devtools/client/webconsole/new-console-output/test/mochitest/test-batching.html";
 const { l10n } = require("devtools/client/webconsole/new-console-output/utils/messages");
 
 add_task(function* () {
   let hud = yield openNewTabAndConsole(TEST_URI);
-
-  const store = hud.ui.newConsoleOutput.getStore();
-  // Adding loggin each time the store is modified in order to check
-  // the store state in case of failure.
-  store.subscribe(() => {
-    const messages = store.getState().messages.messagesById.toJS()
-      .map(message => {
-        return {
-          id: message.id,
-          type: message.type,
-          parameters: message.parameters,
-          messageText: message.messageText
-        };
-      }
-    );
-    info("messages : " + JSON.stringify(messages));
-  });
-
   const messageNumber = 100;
   yield testSimpleBatchLogging(hud, messageNumber);
   yield testBatchLoggingAndClear(hud, messageNumber);
 });
 
 function* testSimpleBatchLogging(hud, messageNumber) {
   yield ContentTask.spawn(gBrowser.selectedBrowser, messageNumber,
     function (numMessages) {
--- a/devtools/client/webconsole/new-console-output/test/mochitest/head.js
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/head.js
@@ -90,17 +90,17 @@ function waitForMessages({ hud, messages
  *        true in order to return the value.
  * @param string message [optional]
  *        A message to output if the condition failes.
  * @param number interval [optional]
  *        How often the predicate is invoked, in milliseconds.
  * @return object
  *         A promise that is resolved with the result of the condition.
  */
-function* waitFor(condition, message = "waitFor", interval = 100, maxTries = 50) {
+function* waitFor(condition, message = "waitFor", interval = 10, maxTries = 500) {
   return new Promise(resolve => {
     BrowserTestUtils.waitForCondition(condition, message, interval, maxTries)
       .then(() => resolve(condition()));
   });
 }
 
 /**
  * Find a message in the output.