tor-browser

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

browser_headless_screenshot_1.js (1792B)


      1 "use strict";
      2 
      3 add_task(async function () {
      4  // Test all four basic variations of the "screenshot" argument
      5  // when a file path is specified.
      6  await testFileCreationPositive(
      7    [
      8      "-url",
      9      "http://mochi.test:8888/browser/browser/components/shell/test/headless.html",
     10      "-screenshot",
     11      screenshotPath,
     12    ],
     13    screenshotPath
     14  );
     15  await testFileCreationPositive(
     16    [
     17      "-url",
     18      "http://mochi.test:8888/browser/browser/components/shell/test/headless.html",
     19      `-screenshot=${screenshotPath}`,
     20    ],
     21    screenshotPath
     22  );
     23  await testFileCreationPositive(
     24    [
     25      "-url",
     26      "http://mochi.test:8888/browser/browser/components/shell/test/headless.html",
     27      "--screenshot",
     28      screenshotPath,
     29    ],
     30    screenshotPath
     31  );
     32  await testFileCreationPositive(
     33    [
     34      "-url",
     35      "http://mochi.test:8888/browser/browser/components/shell/test/headless.html",
     36      `--screenshot=${screenshotPath}`,
     37    ],
     38    screenshotPath
     39  );
     40 
     41  // Test when the requested URL redirects
     42  await testFileCreationPositive(
     43    [
     44      "-url",
     45      "http://mochi.test:8888/browser/browser/components/shell/test/headless_redirect.html",
     46      "-screenshot",
     47      screenshotPath,
     48    ],
     49    screenshotPath
     50  );
     51 
     52  // Test with additional command options
     53  await testFileCreationPositive(
     54    [
     55      "-url",
     56      "http://mochi.test:8888/browser/browser/components/shell/test/headless.html",
     57      "-screenshot",
     58      screenshotPath,
     59      "-attach-console",
     60    ],
     61    screenshotPath
     62  );
     63  await testFileCreationPositive(
     64    [
     65      "-url",
     66      "http://mochi.test:8888/browser/browser/components/shell/test/headless.html",
     67      "-attach-console",
     68      "-screenshot",
     69      screenshotPath,
     70      "-headless",
     71    ],
     72    screenshotPath
     73  );
     74 });