tor-browser

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

browser_aboutdebugging_sidebar_network_runtimes.js (1269B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 const networkLocationsModule = require("resource://devtools/client/aboutdebugging/src/modules/network-locations.js");
      7 
      8 /**
      9 * Test the sidebar is updated correctly when network runtimes are added/removed.
     10 */
     11 
     12 add_task(async function () {
     13  const { document, tab } = await openAboutDebugging();
     14 
     15  const noDevicesElement = document.querySelector(".qa-sidebar-no-devices");
     16  ok(noDevicesElement, "Sidebar shows the 'no devices' element");
     17 
     18  info("Add a network location");
     19  networkLocationsModule.addNetworkLocation("localhost:6080");
     20 
     21  info("Wait for 'no devices' element to disappear");
     22  waitUntil(() => !document.querySelector(".qa-sidebar-no-devices"));
     23  ok(
     24    findSidebarItemByText("localhost:6080", document),
     25    "Found a sidebar item for localhost:6080"
     26  );
     27 
     28  info("Remove the network location");
     29  networkLocationsModule.removeNetworkLocation("localhost:6080");
     30 
     31  info("Wait for 'no devices' element to reappear");
     32  waitUntil(() => document.querySelector(".qa-sidebar-no-devices"));
     33  ok(
     34    !findSidebarItemByText("localhost:6080", document),
     35    "Sidebar item for localhost:6080 removed"
     36  );
     37 
     38  await removeTab(tab);
     39 });