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