tor-browser

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

browser_net_response_node-expanded.js (1772B)


      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 node that was expanded is still expanded when we are filtering
      8 * in the Response Panel.
      9 */
     10 
     11 add_task(async function () {
     12  const { tab, monitor } = await initNetMonitor(JSON_LONG_URL, {
     13    requestCount: 1,
     14  });
     15  info("Starting test... ");
     16 
     17  const { document, store, windowRequire } = monitor.panelWin;
     18  const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
     19 
     20  store.dispatch(Actions.batchEnable(false));
     21 
     22  await performRequests(monitor, tab, 1);
     23 
     24  info("selecting first request");
     25  const firstRequestItem = document.querySelectorAll(".request-list-item")[0];
     26  EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequestItem);
     27 
     28  info("switching to response panel");
     29  const waitForRespPanel = waitForDOM(
     30    document,
     31    "#response-panel .properties-view"
     32  );
     33  const respPanelButton = document.querySelector("#response-tab");
     34  respPanelButton.click();
     35  await waitForRespPanel;
     36 
     37  const firstRow = document.querySelector(
     38    "#response-panel tr.treeRow.objectRow"
     39  );
     40  const waitOpenNode = waitForDOM(document, "tr#\\/0\\/greeting");
     41  const toggleButton = firstRow.querySelector("td span.treeIcon");
     42 
     43  toggleButton.click();
     44  await waitOpenNode;
     45 
     46  is(firstRow.classList.contains("opened"), true, "the node is open");
     47 
     48  document.querySelector("#response-panel .devtools-filterinput").focus();
     49  EventUtils.sendString("greeting");
     50 
     51  // Wait till there are 2048 resources rendered in the results.
     52  await waitForDOMIfNeeded(document, "#response-panel tr.treeRow", 2048);
     53 
     54  is(firstRow.classList.contains("opened"), true, "the node remains open");
     55 
     56  await teardown(monitor);
     57 });