nixos/tests/mate: init

This commit is contained in:
Bobby Rong 2023-01-08 23:44:00 +08:00
parent a518c77148
commit 76c0fad164
No known key found for this signature in database
2 changed files with 59 additions and 0 deletions

View file

@ -376,6 +376,7 @@ in {
man = handleTest ./man.nix {};
mariadb-galera = handleTest ./mysql/mariadb-galera.nix {};
mastodon = discoverTests (import ./web-apps/mastodon { inherit handleTestOn; });
mate = handleTest ./mate.nix {};
matomo = handleTest ./matomo.nix {};
matrix-appservice-irc = handleTest ./matrix/appservice-irc.nix {};
matrix-conduit = handleTest ./matrix/conduit.nix {};

58
nixos/tests/mate.nix Normal file
View file

@ -0,0 +1,58 @@
import ./make-test-python.nix ({ pkgs, lib, ... }: {
name = "mate";
meta = {
maintainers = lib.teams.mate.members;
};
nodes.machine = { ... }: {
imports = [
./common/user-account.nix
];
services.xserver.enable = true;
services.xserver.displayManager = {
lightdm.enable = true;
autoLogin = {
enable = true;
user = "alice";
};
};
services.xserver.desktopManager.mate.enable = true;
# Silence log spam due to no sound drivers loaded:
# ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
hardware.pulseaudio.enable = true;
};
testScript = { nodes, ... }:
let
user = nodes.machine.users.users.alice;
in
''
with subtest("Wait for login"):
machine.wait_for_x()
machine.wait_for_file("${user.home}/.Xauthority")
machine.succeed("xauth merge ${user.home}/.Xauthority")
with subtest("Check that logging in has given the user ownership of devices"):
machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}")
with subtest("Check if MATE session components actually start"):
machine.wait_until_succeeds("pgrep marco")
machine.wait_for_window("marco")
machine.wait_until_succeeds("pgrep mate-panel")
machine.wait_for_window("Top Panel")
machine.wait_for_window("Bottom Panel")
machine.wait_until_succeeds("pgrep caja")
machine.wait_for_window("Caja")
with subtest("Open MATE terminal"):
machine.succeed("su - ${user.name} -c 'DISPLAY=:0.0 mate-terminal >&2 &'")
machine.wait_for_window("Terminal")
machine.sleep(20)
machine.screenshot("screen")
'';
})