1import ./make-test-python.nix (
2 { pkgs, ... }:
3
4 {
5 name = "input-remapper";
6 meta = {
7 maintainers = with pkgs.lib.maintainers; [ LunNova ];
8 };
9
10 nodes.machine =
11 { config, ... }:
12 let
13 user = config.users.users.sybil;
14 in
15 {
16 imports = [
17 ./common/user-account.nix
18 ./common/x11.nix
19 ];
20
21 services.xserver.enable = true;
22 services.input-remapper.enable = true;
23 users.users.sybil = {
24 isNormalUser = true;
25 group = "wheel";
26 };
27 test-support.displayManager.auto.user = user.name;
28 # workaround for pkexec not working in the test environment
29 # Error creating textual authentication agent:
30 # Error opening current controlling terminal for the process (`/dev/tty'):
31 # No such device or address
32 # passwordless pkexec with polkit module also doesn't work
33 # to allow the program to run, we replace pkexec with sudo
34 # and turn on passwordless sudo
35 # this is not correct in general but good enough for this test
36 security.sudo = {
37 enable = true;
38 wheelNeedsPassword = false;
39 };
40 security.wrappers.pkexec = pkgs.lib.mkForce {
41 setuid = true;
42 owner = "root";
43 group = "root";
44 source = "${pkgs.sudo}/bin/sudo";
45 };
46 };
47
48 enableOCR = true;
49
50 testScript =
51 { nodes, ... }:
52 ''
53 start_all()
54 machine.wait_for_x()
55
56 machine.succeed("systemctl status input-remapper.service")
57 machine.execute("su - sybil -c input-remapper-gtk >&2 &")
58
59 machine.wait_for_text("Input Remapper")
60 machine.wait_for_text("Device")
61 machine.wait_for_text("Presets")
62 machine.wait_for_text("Editor")
63 '';
64 }
65)