tor-browser

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

browser_jsonview_copy_headers.js (1028B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 const TEST_JSON_URL = URL_ROOT + "valid_json.json";
      7 
      8 add_task(async function () {
      9  info("Test valid JSON started");
     10 
     11  await addJsonViewTab(TEST_JSON_URL);
     12 
     13  // Select the RawData tab
     14  await selectJsonViewContentTab("headers");
     15 
     16  // Check displayed headers
     17  const count = await getElementCount(".headersPanelBox .netHeadersGroup");
     18  is(count, 2, "There must be two header groups");
     19 
     20  const text = await getElementText(".headersPanelBox .netInfoHeadersTable");
     21  isnot(text, "", "Headers text must not be empty");
     22 
     23  const browser = gBrowser.selectedBrowser;
     24 
     25  // Verify JSON copy into the clipboard.
     26  await waitForClipboardPromise(
     27    function setup() {
     28      BrowserTestUtils.synthesizeMouseAtCenter(
     29        ".headersPanelBox .toolbar button.copy",
     30        {},
     31        browser
     32      );
     33    },
     34    function validator(value) {
     35      return value.indexOf("application/json") > 0;
     36    }
     37  );
     38 });