Backed out changeset b71c8c052463 (bug 1943846) for causing mass failures. CLOSED...
[gecko.git] / devtools / client / netmonitor / test / browser_net_statistics-01.js
blob5a0c5f661e6c25a58204c17d137ba9e2103f199a
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 "use strict";
6 /**
7 * Tests if the statistics panel displays correctly.
8 */
10 add_task(async function () {
11 const { monitor } = await initNetMonitor(STATISTICS_URL, { requestCount: 1 });
12 info("Starting test... ");
14 const panel = monitor.panelWin;
15 const { document, store, windowRequire, connector } = panel;
16 const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
18 ok(
19 document.querySelector(".monitor-panel"),
20 "The current main panel is correct."
23 info("Displaying statistics panel");
24 store.dispatch(Actions.openStatistics(connector, true));
26 ok(
27 document.querySelector(".statistics-panel"),
28 "The current main panel is correct."
31 info("Waiting for placeholder to display");
33 await waitUntil(
34 () =>
35 document.querySelectorAll(".pie-chart-container[placeholder=true]")
36 .length == 2
38 ok(true, "Two placeholder pie charts appear to be rendered correctly.");
40 await waitUntil(
41 () =>
42 document.querySelectorAll(".table-chart-container[placeholder=true]")
43 .length == 2
45 ok(true, "Two placeholde table charts appear to be rendered correctly.");
47 info("Waiting for chart to display");
49 await waitUntil(
50 () =>
51 document.querySelectorAll(".pie-chart-container:not([placeholder=true])")
52 .length == 2
54 ok(true, "Two real pie charts appear to be rendered correctly.");
56 await waitUntil(
57 () =>
58 document.querySelectorAll(
59 ".table-chart-container:not([placeholder=true])"
60 ).length == 2
62 ok(true, "Two real table charts appear to be rendered correctly.");
64 await teardown(monitor);
65 });