summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/test/browser_inspector_highlighter-reload.js
blob: ac3dac4e2cf16cd128db0b872f74405bb21c3464 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* 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/. */

"use strict";

// Test that the node picker continues to work after page reload

const TEST_URL = URL_ROOT_SSL + "doc_inspector_highlighter_dom.html";

add_task(async function () {
  const { inspector, toolbox } = await openInspectorForURL(TEST_URL);

  await startPicker(toolbox);

  info("Selecting the simple-div1 DIV");
  await hoverElement(inspector, "#simple-div1");

  // Reload the current page (navigate to the same URL)
  await navigateTo(TEST_URL);

  // hoverElement() resolves after both the "picker-node-hovered" event
  // and the "highlighter-shown" event are triggered. If this test doesn't timeout,
  // it means node picking and node highlighting continue to work as expected.
  info("Selecting the simple-div2 DIV after reload");
  await hoverElement(inspector, "#simple-div2");

  info("Picking the simple-div2 DIV after reload");
  await pickElement(inspector, "#simple-div2", 0, 0);

  is(
    inspector.selection.nodeFront.id,
    "simple-div2",
    "The simple-div2 DIV has been picked after reload"
  );
});