1
0
Fork 0
firefox/devtools/client/debugger/test/mochitest/browser_dbg-pretty-print-console.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

47 lines
1.5 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
// The test has a lot of interactions between debugger and console panels which
// might take more than 30s to complete on a slow machine.
"use strict";
requestLongerTimeout(2);
// Tests that pretty-printing updates console messages.
add_task(async function () {
const dbg = await initDebugger("doc-minified.html");
invokeInTab("arithmetic");
info("Switch to console and check message");
const minifiedLink = await waitForConsoleMessageLink(
dbg.toolbox,
"arithmetic",
"math.min.js:4:73"
);
info("Click on the link to open the debugger");
minifiedLink.click();
await waitForSelectedSource(dbg, "math.min.js");
await waitForSelectedLocation(dbg, 4, 73);
info("Click on pretty print button and wait for the file to be formatted");
clickElement(dbg, "prettyPrintButton");
await waitForSelectedSource(dbg, "math.min.js:formatted");
info("Switch back to console and check message");
const formattedLink = await waitForConsoleMessageLink(
dbg.toolbox,
"arithmetic",
"math.min.js:formatted:31:25"
);
ok(true, "Message location was updated as expected");
info(
"Click on the link again and check the debugger opens in formatted file"
);
formattedLink.click();
await selectSource(dbg, "math.min.js:formatted");
await waitForSelectedLocation(dbg, 31, 25);
});