1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
7 * Test if request and response body logging stays on after opening the console.
10 add_task(async
function () {
13 } = require("resource://devtools/client/netmonitor/src/utils/l10n.js");
15 const { tab
, monitor
} = await
initNetMonitor(JSON_LONG_URL
, {
18 info("Starting test... ");
20 const { document
, store
, windowRequire
} = monitor
.panelWin
;
21 const Actions
= windowRequire("devtools/client/netmonitor/src/actions/index");
22 const { getDisplayedRequests
, getSortedRequests
} = windowRequire(
23 "devtools/client/netmonitor/src/selectors/index"
26 store
.dispatch(Actions
.batchEnable(false));
28 // Perform first batch of requests.
29 await
performRequests(monitor
, tab
, 1);
31 await
verifyRequest(0);
33 // Switch to the webconsole.
34 const onWebConsole
= monitor
.toolbox
.once("webconsole-selected");
35 monitor
.toolbox
.selectTool("webconsole");
38 // Switch back to the netmonitor.
39 const onNetMonitor
= monitor
.toolbox
.once("netmonitor-selected");
40 monitor
.toolbox
.selectTool("netmonitor");
44 const wait
= waitForNetworkEvents(monitor
, 1);
45 await
reloadBrowser();
48 // Perform another batch of requests.
49 await
performRequests(monitor
, tab
, 1);
51 await
verifyRequest(1);
53 return teardown(monitor
);
55 async
function verifyRequest(index
) {
56 const requestItems
= document
.querySelectorAll(".request-list-item");
57 for (const requestItem
of requestItems
) {
58 requestItem
.scrollIntoView();
59 const requestsListStatus
= requestItem
.querySelector(".status-code");
60 EventUtils
.sendMouseEvent({ type
: "mouseover" }, requestsListStatus
);
61 await
waitUntil(() => requestsListStatus
.title
);
62 await
waitForDOMIfNeeded(requestItem
, ".requests-list-timings-total");
64 verifyRequestItemTarget(
66 getDisplayedRequests(store
.getState()),
67 getSortedRequests(store
.getState())[index
],
69 CONTENT_TYPE_SJS
+ "?fmt=json-long",
74 fullMimeType
: "text/json; charset=utf-8",
75 size
: L10N
.getFormatStr(
76 "networkMenu.size.kB",
77 L10N
.numberWithDecimals(85975 / 1000, 2)