tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_net_statistics-01.js (1756B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 /**
      7 * Tests if the statistics panel displays correctly.
      8 */
      9 
     10 add_task(async function () {
     11  const { monitor } = await initNetMonitor(STATISTICS_URL, { requestCount: 1 });
     12  info("Starting test... ");
     13 
     14  const panel = monitor.panelWin;
     15  const { document, store, windowRequire, connector } = panel;
     16  const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
     17 
     18  ok(
     19    document.querySelector(".monitor-panel"),
     20    "The current main panel is correct."
     21  );
     22 
     23  info("Displaying statistics panel");
     24  store.dispatch(Actions.openStatistics(connector, true));
     25 
     26  ok(
     27    document.querySelector(".statistics-panel"),
     28    "The current main panel is correct."
     29  );
     30 
     31  info("Waiting for placeholder to display");
     32 
     33  await waitUntil(
     34    () =>
     35      document.querySelectorAll(".pie-chart-container[placeholder=true]")
     36        .length == 2
     37  );
     38  ok(true, "Two placeholder pie charts appear to be rendered correctly.");
     39 
     40  await waitUntil(
     41    () =>
     42      document.querySelectorAll(".table-chart-container[placeholder=true]")
     43        .length == 2
     44  );
     45  ok(true, "Two placeholde table charts appear to be rendered correctly.");
     46 
     47  info("Waiting for chart to display");
     48 
     49  await waitUntil(
     50    () =>
     51      document.querySelectorAll(".pie-chart-container:not([placeholder=true])")
     52        .length == 2
     53  );
     54  ok(true, "Two real pie charts appear to be rendered correctly.");
     55 
     56  await waitUntil(
     57    () =>
     58      document.querySelectorAll(
     59        ".table-chart-container:not([placeholder=true])"
     60      ).length == 2
     61  );
     62  ok(true, "Two real table charts appear to be rendered correctly.");
     63 
     64  await teardown(monitor);
     65 });