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