1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
7 * Tests that the netmonitor UI is not broken after toggling to another panel.
10 add_task(async
function () {
11 const { monitor
, toolbox
} = await
initNetMonitor(HTTPS_SIMPLE_URL
, {
14 ok(monitor
, "The network monitor was opened");
16 const onNetworkEvent
= waitForNetworkEvents(monitor
, 1);
17 await
navigateTo(HTTPS_SIMPLE_URL
);
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");
46 () => getRequestsListHeight(document
) == requestsListHeight
,
47 "Requests list height is the same after switching to another panel"
49 await
teardown(monitor
);
52 function getRequestsListHeight(document
) {
53 return document
.querySelector(".requests-list-scroll").offsetHeight
;