browser_aboutdebugging_devtoolstoolbox_navigate_reload_button.js (1900B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 function clickReload(devtoolsDocument) { 7 devtoolsDocument.querySelector(".qa-reload-button").click(); 8 } 9 10 // Test that ensures the remote page is reloaded when the button is clicked 11 add_task(async function () { 12 const debug_tab = await addTab("about:home"); 13 14 const { document, tab, window } = await openAboutDebugging(); 15 16 // go to This Firefox and inspect the new tab 17 info("Inspecting a new tab in This Firefox"); 18 await selectThisFirefoxPage(document, window.AboutDebugging.store); 19 const { devtoolsDocument, devtoolsTab, devtoolsWindow } = 20 await openAboutDevtoolsToolbox(document, tab, window, "about:home"); 21 22 info("Clicking reload button and waiting for requests to complete"); 23 const toolbox = getToolbox(devtoolsWindow); 24 const { onDomCompleteResource } = 25 await waitForNextTopLevelDomCompleteResource(toolbox.commands); 26 27 // Watch for navigation promises. 28 const refreshes = Promise.all([ 29 onDomCompleteResource, 30 toolbox.commands.client.waitForRequestsToSettle(), 31 waitForAboutDebuggingRequests(window.AboutDebugging.store), 32 ]); 33 34 // We cannot include this one in the Promise.all array, as it needs to be 35 // explicitly called after navigation started. 36 const waitForLoadedPanelsReload = await watchForLoadedPanelsReload(toolbox); 37 38 clickReload(devtoolsDocument); 39 await refreshes; 40 await waitForLoadedPanelsReload(); 41 42 ok(true, "Clicked refresh; both page and devtools reloaded"); 43 44 await closeAboutDevtoolsToolbox(document, devtoolsTab, window); 45 46 info("Remove the debugged tab"); 47 await removeTab(debug_tab); 48 await waitUntil(() => !findDebugTargetByText("about:home", document)); 49 await waitForAboutDebuggingRequests(window.AboutDebugging.store); 50 51 info("Remove the about:debugging tab."); 52 await removeTab(tab); 53 });