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