summaryrefslogtreecommitdiffstats
path: root/browser/components/shell/test/browser_headless_screenshot_3.js
blob: b55635652d1a56a3995fc491d481ca64c08794e1 (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
49
50
51
52
53
54
55
56
57
58
59
"use strict";

add_task(async function () {
  const cwdScreenshotPath = PathUtils.join(
    Services.dirsvc.get("CurWorkD", Ci.nsIFile).path,
    "screenshot.png"
  );

  // Test invalid URL arguments (either no argument or too many arguments).
  await testFileCreationNegative(["-screenshot"], cwdScreenshotPath);
  await testFileCreationNegative(
    [
      "http://mochi.test:8888/browser/browser/components/shell/test/headless.html",
      "http://mochi.test:8888/headless.html",
      "-screenshot",
    ],
    cwdScreenshotPath
  );

  // Test all four basic variations of the "window-size" argument.
  await testFileCreationPositive(
    [
      "-url",
      "http://mochi.test:8888/browser/browser/components/shell/test/headless.html",
      "-screenshot",
      "-window-size",
      "800",
    ],
    cwdScreenshotPath
  );
  await testFileCreationPositive(
    [
      "-url",
      "http://mochi.test:8888/browser/browser/components/shell/test/headless.html",
      "-screenshot",
      "-window-size=800",
    ],
    cwdScreenshotPath
  );
  await testFileCreationPositive(
    [
      "-url",
      "http://mochi.test:8888/browser/browser/components/shell/test/headless.html",
      "-screenshot",
      "--window-size",
      "800",
    ],
    cwdScreenshotPath
  );
  await testFileCreationPositive(
    [
      "-url",
      "http://mochi.test:8888/browser/browser/components/shell/test/headless.html",
      "-screenshot",
      "--window-size=800",
    ],
    cwdScreenshotPath
  );
});