browser_inspector_highlighter-reload.js (1240B)
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 "use strict"; 6 7 // Test that the node picker continues to work after page reload 8 9 const TEST_URL = URL_ROOT_SSL + "doc_inspector_highlighter_dom.html"; 10 11 add_task(async function () { 12 const { inspector, toolbox } = await openInspectorForURL(TEST_URL); 13 14 await startPicker(toolbox); 15 16 info("Selecting the simple-div1 DIV"); 17 await hoverElement(inspector, "#simple-div1"); 18 19 // Reload the current page (navigate to the same URL) 20 await navigateTo(TEST_URL); 21 22 // hoverElement() resolves after both the "picker-node-hovered" event 23 // and the "highlighter-shown" event are triggered. If this test doesn't timeout, 24 // it means node picking and node highlighting continue to work as expected. 25 info("Selecting the simple-div2 DIV after reload"); 26 await hoverElement(inspector, "#simple-div2"); 27 28 info("Picking the simple-div2 DIV after reload"); 29 await pickElement(inspector, "#simple-div2", 0, 0); 30 31 is( 32 inspector.selection.nodeFront.id, 33 "simple-div2", 34 "The simple-div2 DIV has been picked after reload" 35 ); 36 });