Backed out 2 changesets (bug 1943998) for causing wd failures @ phases.py CLOSED...
[gecko.git] / devtools / client / netmonitor / test / browser_net_layout_after_toggle.js
blob12af4c72be47f8692a4370bc66f77d0f6f0e1965
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 "use strict";
6 /**
7 * Tests that the netmonitor UI is not broken after toggling to another panel.
8 */
10 add_task(async function () {
11 const { monitor, toolbox } = await initNetMonitor(HTTPS_SIMPLE_URL, {
12 requestCount: 1,
13 });
14 ok(monitor, "The network monitor was opened");
16 const onNetworkEvent = waitForNetworkEvents(monitor, 1);
17 await navigateTo(HTTPS_SIMPLE_URL);
18 await onNetworkEvent;
20 const { document } = monitor.panelWin;
22 info("Select the first request to show the details side panel");
23 const firstRequest = document.querySelectorAll(".request-list-item")[0];
24 EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest);
26 // Wait for a reflow before measuring the request list height.
27 await new Promise(r =>
28 window.requestAnimationFrame(() => TestUtils.executeSoon(r))
30 const requestsListHeight = getRequestsListHeight(document);
32 info("Select the inspector");
33 await toolbox.selectTool("inspector");
35 info("Wait for Net panel to be hidden");
36 await waitUntil(() => document.visibilityState == "hidden");
38 info("Select the Net panel again");
39 await toolbox.selectTool("netmonitor");
41 info("Wait for Net panel to be hidden");
42 await waitUntil(() => document.visibilityState == "visible");
44 ("Wait until the requests list has the same height as before");
45 await waitFor(
46 () => getRequestsListHeight(document) == requestsListHeight,
47 "Requests list height is the same after switching to another panel"
49 await teardown(monitor);
50 });
52 function getRequestsListHeight(document) {
53 return document.querySelector(".requests-list-scroll").offsetHeight;