1import ./make-test-python.nix (
2 { pkgs, ... }:
3 {
4 name = "wmderland";
5 meta = with pkgs.lib.maintainers; {
6 maintainers = [ takagiy ];
7 };
8
9 nodes.machine =
10 { lib, ... }:
11 {
12 imports = [
13 ./common/x11.nix
14 ./common/user-account.nix
15 ];
16 test-support.displayManager.auto.user = "alice";
17 services.displayManager.defaultSession = lib.mkForce "none+wmderland";
18 services.xserver.windowManager.wmderland.enable = true;
19
20 systemd.services.setupWmderlandConfig = {
21 wantedBy = [ "multi-user.target" ];
22 before = [ "multi-user.target" ];
23 environment = {
24 HOME = "/home/alice";
25 };
26 unitConfig = {
27 type = "oneshot";
28 RemainAfterExit = true;
29 user = "alice";
30 };
31 script =
32 let
33 config = pkgs.writeText "config" ''
34 set $Mod = Mod1
35 bindsym $Mod+Return exec ${pkgs.xterm}/bin/xterm -cm -pc
36 '';
37 in
38 ''
39 mkdir -p $HOME/.config/wmderland
40 cp ${config} $HOME/.config/wmderland/config
41 '';
42 };
43 };
44
45 testScript =
46 { ... }:
47 ''
48 with subtest("ensure x starts"):
49 machine.wait_for_x()
50 machine.wait_for_file("/home/alice/.Xauthority")
51 machine.succeed("xauth merge ~alice/.Xauthority")
52
53 with subtest("ensure we can open a new terminal"):
54 machine.send_key("alt-ret")
55 machine.wait_until_succeeds("pgrep xterm")
56 machine.wait_for_window(r"alice.*?machine")
57 machine.screenshot("terminal")
58
59 with subtest("ensure we can communicate through ipc with wmderlandc"):
60 # Kills the previously open xterm
61 machine.succeed("pgrep xterm")
62 machine.execute("DISPLAY=:0 wmderlandc kill")
63 machine.fail("pgrep xterm")
64 '';
65 }
66)