browser_dbg-pretty-print-console.js (1465B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */ 4 5 // The test has a lot of interactions between debugger and console panels which 6 // might take more than 30s to complete on a slow machine. 7 8 "use strict"; 9 10 requestLongerTimeout(2); 11 12 // Tests that pretty-printing updates console messages. 13 add_task(async function () { 14 const dbg = await initDebugger("doc-minified.html"); 15 invokeInTab("arithmetic"); 16 17 info("Switch to console and check message"); 18 const minifiedLink = await waitForConsoleMessageLink( 19 dbg.toolbox, 20 "arithmetic", 21 "math.min.js:4:73" 22 ); 23 24 info("Click on the link to open the debugger"); 25 minifiedLink.click(); 26 await waitForSelectedSource(dbg, "math.min.js"); 27 await waitForSelectedLocation(dbg, 4, 73); 28 29 info("Click on pretty print button and wait for the file to be formatted"); 30 await togglePrettyPrint(dbg); 31 32 info("Switch back to console and check message"); 33 const formattedLink = await waitForConsoleMessageLink( 34 dbg.toolbox, 35 "arithmetic", 36 "math.min.js:formatted:31:25" 37 ); 38 ok(true, "Message location was updated as expected"); 39 40 info( 41 "Click on the link again and check the debugger opens in formatted file" 42 ); 43 formattedLink.click(); 44 await selectSource(dbg, "math.min.js:formatted"); 45 await waitForSelectedLocation(dbg, 31, 25); 46 });