1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
7 * Tests if empty JSON responses are properly displayed.
10 add_task(async
function () {
11 const { tab
, monitor
} = await
initNetMonitor(
12 JSON_EMPTY_URL
+ "?name=empty",
15 info("Starting test... ");
17 const { document
, store
, windowRequire
} = monitor
.panelWin
;
18 const { L10N
} = windowRequire("devtools/client/netmonitor/src/utils/l10n");
19 const Actions
= windowRequire("devtools/client/netmonitor/src/actions/index");
21 store
.dispatch(Actions
.batchEnable(false));
24 await
performRequests(monitor
, tab
, 1);
26 const onResponsePanelReady
= waitForDOM(
28 "#response-panel .data-header"
31 store
.dispatch(Actions
.toggleNetworkDetails());
32 clickOnSidebarTab(document
, "response");
34 await onResponsePanelReady
;
36 const codeMirrorReady
= waitForDOM(
38 "#response-panel .CodeMirror-code"
41 const header
= document
.querySelector(
42 "#response-panel .raw-data-toggle-input .devtools-checkbox-toggle"
44 clickElement(header
, monitor
);
46 await codeMirrorReady
;
48 const tabpanel
= document
.querySelector("#response-panel");
50 tabpanel
.querySelectorAll(".empty-notice").length
,
52 "The empty notice should not be displayed in this tabpanel."
56 tabpanel
.querySelector(".response-error-header") === null,
58 "The response error header doesn't have the intended visibility."
61 tabpanel
.querySelector(".CodeMirror-code") === null,
63 "The response editor has the intended visibility."
66 tabpanel
.querySelector(".response-image-box") === null,
68 "The response image box doesn't have the intended visibility."
71 const jsonView
= tabpanel
.querySelector(".data-label") || {};
73 jsonView
.textContent
=== L10N
.getStr("jsonScopeName"),
75 "The response json view has the intended visibility."
78 await
teardown(monitor
);