diff options
Diffstat (limited to 'devtools/client/webconsole/test/browser/browser_webconsole_logs_exceptions_order.js')
-rw-r--r-- | devtools/client/webconsole/test/browser/browser_webconsole_logs_exceptions_order.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_logs_exceptions_order.js b/devtools/client/webconsole/test/browser/browser_webconsole_logs_exceptions_order.js new file mode 100644 index 0000000000..13ff9a843a --- /dev/null +++ b/devtools/client/webconsole/test/browser/browser_webconsole_logs_exceptions_order.js @@ -0,0 +1,41 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Tests that (cached and live) logs and errors are displayed in the expected order +// in the console output. See Bug 1483662. + +"use strict"; + +const TEST_URI = + "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-logs-exceptions-order.html"; + +add_task(async function () { + const hud = await openNewTabAndConsole(TEST_URI); + await checkConsoleOutput(hud); + + info("Reload the content window"); + await reloadBrowser(); + await checkConsoleOutput(hud); +}); + +async function checkConsoleOutput(hud) { + await waitFor( + () => + findConsoleAPIMessage(hud, "First") && + findErrorMessage(hud, "Second") && + findConsoleAPIMessage(hud, "Third") && + findErrorMessage(hud, "Fourth") + ); + + const messagesText = Array.from( + hud.ui.outputNode.querySelectorAll(".message .message-body") + ).map(n => n.textContent); + + Assert.deepEqual( + messagesText, + ["First", "Uncaught Second", "Third", "Uncaught Fourth"], + "Errors are displayed in the expected order" + ); +} |