1import ./make-test-python.nix (
2 { pkgs, lib, ... }:
3 {
4 name = "mate";
5
6 meta = {
7 maintainers = lib.teams.mate.members;
8 };
9
10 nodes.machine =
11 { ... }:
12 {
13 imports = [
14 ./common/user-account.nix
15 ];
16
17 services.xserver.enable = true;
18
19 services.xserver.displayManager = {
20 lightdm.enable = true;
21 autoLogin = {
22 enable = true;
23 user = "alice";
24 };
25 };
26
27 services.xserver.desktopManager.mate.enable = true;
28 };
29
30 enableOCR = true;
31
32 testScript =
33 { nodes, ... }:
34 let
35 user = nodes.machine.users.users.alice;
36 env = "DISPLAY=:0.0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${toString user.uid}/bus";
37 in
38 ''
39 with subtest("Wait for login"):
40 machine.wait_for_x()
41 machine.wait_for_file("${user.home}/.Xauthority")
42 machine.succeed("xauth merge ${user.home}/.Xauthority")
43
44 with subtest("Check that logging in has given the user ownership of devices"):
45 machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}")
46
47 with subtest("Check if MATE session components actually start"):
48 machine.wait_until_succeeds("pgrep marco")
49 machine.wait_for_window("marco")
50 machine.wait_until_succeeds("pgrep mate-panel")
51 machine.wait_for_window("Top Panel")
52 machine.wait_for_window("Bottom Panel")
53 machine.wait_until_succeeds("pgrep caja")
54 machine.wait_for_window("Caja")
55 machine.wait_for_text('(Applications|Places|System)')
56 machine.wait_for_text('(Computer|Home|Trash)')
57
58 with subtest("Check if various environment variables are set"):
59 machine.succeed("xargs --null --max-args=1 echo < /proc/$(pgrep -xf marco)/environ | grep 'XDG_CURRENT_DESKTOP' | grep 'MATE'")
60 # From mate-panel-with-applets packaging
61 machine.succeed("xargs --null --max-args=1 echo < /proc/$(pgrep -xf mate-panel)/environ | grep 'MATE_PANEL_APPLETS_DIR' | grep '${pkgs.mate.mate-panel-with-applets.pname}'")
62
63 with subtest("Check if applets are built with in-process support"):
64 # This is needed for Wayland support
65 machine.fail("pgrep -fa clock-applet")
66
67 with subtest("Lock the screen"):
68 machine.wait_until_succeeds("su - ${user.name} -c '${env} mate-screensaver-command -q' | grep 'The screensaver is inactive'")
69 machine.succeed("su - ${user.name} -c '${env} mate-screensaver-command -l >&2 &'")
70 machine.wait_until_succeeds("su - ${user.name} -c '${env} mate-screensaver-command -q' | grep 'The screensaver is active'")
71 machine.sleep(2)
72 machine.send_chars("${user.password}", delay=0.2)
73 machine.wait_for_text("${user.description}")
74 machine.screenshot("screensaver")
75 machine.send_chars("\n")
76 machine.wait_until_succeeds("su - ${user.name} -c '${env} mate-screensaver-command -q' | grep 'The screensaver is inactive'")
77
78 with subtest("Open MATE control center"):
79 machine.succeed("su - ${user.name} -c '${env} mate-control-center >&2 &'")
80 machine.wait_for_window("Control Center")
81 machine.wait_for_text('(Groups|Administration|Hardware)')
82
83 with subtest("Open MATE terminal"):
84 machine.succeed("su - ${user.name} -c '${env} mate-terminal >&2 &'")
85 machine.wait_for_window("Terminal")
86
87 with subtest("Check if MATE has ever coredumped"):
88 machine.fail("coredumpctl --json=short | grep -E 'mate|marco|caja'")
89 machine.screenshot("screen")
90 '';
91 }
92)