summaryrefslogtreecommitdiffstats
path: root/browser/components/shell/test/browser_headless_screenshot_2.js
blob: 063fcfe01ecbbc34d3f3e8ff38fabc5a20024b01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"use strict";
add_task(async function() {
  const cwdScreenshotPath = PathUtils.join(
    Services.dirsvc.get("CurWorkD", Ci.nsIFile).path,
    "screenshot.png"
  );

  // Test variations of the "screenshot" argument when a file path
  // isn't specified.
  await testFileCreationPositive(
    [
      "-screenshot",
      "http://mochi.test:8888/browser/browser/components/shell/test/headless.html",
    ],
    cwdScreenshotPath
  );
  await testFileCreationPositive(
    [
      "http://mochi.test:8888/browser/browser/components/shell/test/headless.html",
      "-screenshot",
    ],
    cwdScreenshotPath
  );
  await testFileCreationPositive(
    [
      "--screenshot",
      "http://mochi.test:8888/browser/browser/components/shell/test/headless.html",
    ],
    cwdScreenshotPath
  );
  await testFileCreationPositive(
    [
      "http://mochi.test:8888/browser/browser/components/shell/test/headless.html",
      "--screenshot",
    ],
    cwdScreenshotPath
  );

  // Test with additional command options
  await testFileCreationPositive(
    [
      "--screenshot",
      "http://mochi.test:8888/browser/browser/components/shell/test/headless.html",
      "-attach-console",
    ],
    cwdScreenshotPath
  );
});