nixpkgs/nixos/tests/cinnamon.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

100 lines
4.4 KiB
Nix
Raw Normal View History

2022-09-05 07:40:17 +00:00
import ./make-test-python.nix (
{ pkgs, lib, ... }:
{
name = "cinnamon";
meta.maintainers = lib.teams.cinnamon.members;
nodes.machine =
{ ... }:
{
2022-09-05 07:40:17 +00:00
imports = [ ./common/user-account.nix ];
services.xserver.enable = true;
services.xserver.desktopManager.cinnamon.enable = true;
# We don't ship gnome-text-editor in Cinnamon module, we add this line mainly
# to catch eval issues related to this option.
environment.cinnamon.excludePackages = [ pkgs.gnome-text-editor ];
# For the sessionPath subtest.
services.xserver.desktopManager.cinnamon.sessionPath = [ pkgs.gpaste ];
2022-09-05 07:40:17 +00:00
};
2022-09-05 07:40:17 +00:00
enableOCR = true;
2022-09-05 07:40:17 +00:00
testScript =
{ nodes, ... }:
let
user = nodes.machine.users.users.alice;
2023-10-31 13:54:26 +00:00
env = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${toString user.uid}/bus DISPLAY=:0";
2022-09-05 07:40:17 +00:00
su = command: "su - ${user.name} -c '${env} ${command}'";
2022-09-05 07:40:17 +00:00
# Call javascript in cinnamon (the shell), returns a tuple (success, output),
# where `success` is true if the dbus call was successful and `output` is what
# the javascript evaluates to.
2023-10-31 13:54:26 +00:00
eval =
name: su "gdbus call --session -d org.Cinnamon -o /org/Cinnamon -m org.Cinnamon.Eval ${name}";
2022-09-05 07:40:17 +00:00
in
''
machine.wait_for_unit("display-manager.service")
2022-09-05 07:40:17 +00:00
with subtest("Test if we can see username in slick-greeter"):
machine.wait_for_text("${user.description}")
machine.screenshot("slick_greeter_lightdm")
2022-09-05 07:40:17 +00:00
with subtest("Login with slick-greeter"):
machine.send_chars("${user.password}\n")
machine.wait_for_x()
machine.wait_for_file("${user.home}/.Xauthority")
machine.succeed("xauth merge ${user.home}/.Xauthority")
2022-09-05 07:40:17 +00:00
with subtest("Check that logging in has given the user ownership of devices"):
machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}")
2022-09-05 07:40:17 +00:00
with subtest("Wait for the Cinnamon shell"):
# Correct output should be (true, '2')
2023-10-31 13:54:26 +00:00
# https://github.com/linuxmint/cinnamon/blob/5.4.0/js/ui/main.js#L183-L187
machine.wait_until_succeeds("${eval "Main.runState"} | grep -q 'true,..2'")
2023-10-31 13:54:26 +00:00
with subtest("Check if Cinnamon components actually start"):
for i in ["csd-media-keys", "cinnamon-killer-daemon", "xapp-sn-watcher", "nemo-desktop"]:
machine.wait_until_succeeds(f"pgrep -f {i}")
machine.wait_until_succeeds("journalctl -b --grep 'Loaded applet menu@cinnamon.org'")
machine.wait_until_succeeds("journalctl -b --grep 'calendar@cinnamon.org: Calendar events supported'")
with subtest("Check if sessionPath option actually works"):
machine.succeed("${eval "imports.gi.GIRepository.Repository.get_search_path\\(\\)"} | grep gpaste")
2023-10-31 13:54:26 +00:00
with subtest("Open Cinnamon Settings"):
machine.succeed("${su "cinnamon-settings themes >&2 &"}")
machine.wait_until_succeeds("${eval "global.display.focus_window.wm_class"} | grep -i 'cinnamon-settings'")
machine.wait_for_text('(Style|Appearance|Color)')
machine.sleep(2)
machine.screenshot("cinnamon_settings")
2023-10-31 13:54:26 +00:00
with subtest("Lock the screen"):
machine.succeed("${su "cinnamon-screensaver-command -l >&2 &"}")
machine.wait_until_succeeds("${su "cinnamon-screensaver-command -q"} | grep 'The screensaver is active'")
machine.sleep(2)
machine.screenshot("cinnamon_screensaver")
machine.send_chars("${user.password}\n", delay=0.2)
machine.wait_until_succeeds("${su "cinnamon-screensaver-command -q"} | grep 'The screensaver is inactive'")
machine.sleep(2)
2022-09-05 07:40:17 +00:00
with subtest("Open GNOME Terminal"):
2023-10-31 13:54:26 +00:00
machine.succeed("${su "gnome-terminal"}")
machine.wait_until_succeeds("${eval "global.display.focus_window.wm_class"} | grep -i 'gnome-terminal'")
machine.sleep(2)
2023-10-31 13:54:26 +00:00
with subtest("Open virtual keyboard"):
machine.succeed("${su "dbus-send --print-reply --dest=org.Cinnamon /org/Cinnamon org.Cinnamon.ToggleKeyboard"}")
machine.wait_for_text('(Ctrl|Alt)')
machine.sleep(2)
machine.screenshot("cinnamon_virtual_keyboard")
2023-10-31 13:54:26 +00:00
with subtest("Check if Cinnamon has ever coredumped"):
machine.fail("coredumpctl --json=short | grep -E 'cinnamon|nemo'")
2022-09-05 07:40:17 +00:00
'';
}
)