browser_webconsole_close_groups_after_navigation.js (1007B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html><script>console.group('hello')</script>`; 6 7 add_task(async function () { 8 // Enable persist logs 9 await pushPref("devtools.webconsole.persistlog", true); 10 11 info( 12 "Open the console and wait for the console.group message to be rendered" 13 ); 14 const hud = await openNewTabAndConsole(TEST_URI); 15 await waitFor(() => findConsoleAPIMessage(hud, "hello", ".startGroup")); 16 17 info("Refresh tab several times and check for correct message indentation"); 18 for (let i = 0; i < 5; i++) { 19 await reloadBrowserAndCheckIndent(hud); 20 } 21 }); 22 23 async function reloadBrowserAndCheckIndent(hud) { 24 const onMessage = waitForMessageByType(hud, "hello", ".startGroup"); 25 await reloadBrowser(); 26 const { node } = await onMessage; 27 28 is( 29 node.getAttribute("data-indent"), 30 "0", 31 "The message has the expected indent" 32 ); 33 }