summary refs log tree commit diff
path: root/nixos/tests/freetube.nix
blob: f285384b68e0ac97b44d7c8ed24eb7fe3b36ddf9 (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
40
41
let
  tests = {
    wayland = { pkgs, ... }: {
      imports = [ ./common/wayland-cage.nix ];
      services.cage.program = "${pkgs.freetube}/bin/freetube";
      virtualisation.memorySize = 2047;
      environment.variables.NIXOS_OZONE_WL = "1";
      environment.variables.DISPLAY = "do not use";
    };
    xorg = { pkgs, ... }: {
      imports = [ ./common/user-account.nix ./common/x11.nix ];
      virtualisation.memorySize = 2047;
      services.xserver.enable = true;
      services.xserver.displayManager.sessionCommands = ''
        ${pkgs.freetube}/bin/freetube
      '';
      test-support.displayManager.auto.user = "alice";
    };
  };

  mkTest = name: machine:
    import ./make-test-python.nix ({ pkgs, ... }: {
      inherit name;
      nodes = { "${name}" = machine; };
      meta.maintainers = with pkgs.lib.maintainers; [ kirillrdy ];
      enableOCR = true;

      testScript = ''
        start_all()
        machine.wait_for_unit('graphical.target')
        machine.wait_for_text('Your Subscription list is currently empty')
        machine.send_key("ctrl-r")
        machine.wait_for_text('Your Subscription list is currently empty')
        machine.screenshot("main.png")
        machine.send_key("ctrl-comma")
        machine.wait_for_text('General Settings', timeout=30)
        machine.screenshot("preferences.png")
      '';
    });
in
builtins.mapAttrs (k: v: mkTest k v { }) tests