summary refs log tree commit diff
path: root/nixos/tests/firefox.nix
blob: 7071baceba7399b24df41f6ff39e06d8e354b96e (plain) (blame)
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
import ./make-test-python.nix ({ pkgs, esr ? false, ... }: {
  name = "firefox";
  meta = with pkgs.stdenv.lib.maintainers; {
    maintainers = [ eelco shlevy ];
  };

  machine =
    { pkgs, ... }:

    { imports = [ ./common/x11.nix ];
      environment.systemPackages =
        (if esr then [ pkgs.firefox-esr ] else [ pkgs.firefox ])
        ++ [ pkgs.xdotool ];
    };

  testScript = ''
      machine.wait_for_x()

      with subtest("wait until Firefox has finished loading the Valgrind docs page"):
          machine.execute(
              "xterm -e 'firefox file://${pkgs.valgrind.doc}/share/doc/valgrind/html/index.html' &"
          )
          machine.wait_for_window("Valgrind")
          machine.sleep(40)

      with subtest("Close default browser prompt"):
          machine.execute("xdotool key space")

      with subtest("Hide default browser window"):
          machine.sleep(2)
          machine.execute("xdotool key F12")

      with subtest("wait until Firefox draws the developer tool panel"):
          machine.sleep(10)
          machine.succeed("xwininfo -root -tree | grep Valgrind")
          machine.screenshot("screen")
    '';

})