1import ./make-test-python.nix (
2 { pkgs, lib, ... }:
3 {
4 name = "cinnamon-wayland";
5
6 meta.maintainers = lib.teams.cinnamon.members;
7
8 nodes.machine =
9 { nodes, ... }:
10 {
11 imports = [ ./common/user-account.nix ];
12 services.xserver.enable = true;
13 services.xserver.desktopManager.cinnamon.enable = true;
14 services.displayManager = {
15 autoLogin.enable = true;
16 autoLogin.user = nodes.machine.users.users.alice.name;
17 defaultSession = "cinnamon-wayland";
18 };
19
20 # For the sessionPath subtest.
21 services.xserver.desktopManager.cinnamon.sessionPath = [ pkgs.gpaste ];
22 };
23
24 enableOCR = true;
25
26 testScript =
27 { nodes, ... }:
28 let
29 user = nodes.machine.users.users.alice;
30 env = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${toString user.uid}/bus";
31 su = command: "su - ${user.name} -c '${env} ${command}'";
32
33 # Call javascript in cinnamon (the shell), returns a tuple (success, output),
34 # where `success` is true if the dbus call was successful and `output` is what
35 # the javascript evaluates to.
36 eval =
37 name: su "gdbus call --session -d org.Cinnamon -o /org/Cinnamon -m org.Cinnamon.Eval ${name}";
38 in
39 ''
40 machine.wait_for_unit("display-manager.service")
41
42 with subtest("Wait for wayland server"):
43 machine.wait_for_file("/run/user/${toString user.uid}/wayland-0")
44
45 with subtest("Check that logging in has given the user ownership of devices"):
46 machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}")
47
48 with subtest("Wait for the Cinnamon shell"):
49 # Correct output should be (true, '2')
50 # https://github.com/linuxmint/cinnamon/blob/5.4.0/js/ui/main.js#L183-L187
51 machine.wait_until_succeeds("${eval "Main.runState"} | grep -q 'true,..2'")
52
53 with subtest("Check if Cinnamon components actually start"):
54 for i in ["csd-media-keys", "xapp-sn-watcher", "nemo-desktop"]:
55 machine.wait_until_succeeds(f"pgrep -f {i}")
56 machine.wait_until_succeeds("journalctl -b --grep 'Loaded applet menu@cinnamon.org'")
57 machine.wait_until_succeeds("journalctl -b --grep 'calendar@cinnamon.org: Calendar events supported'")
58
59 with subtest("Check if sessionPath option actually works"):
60 machine.succeed("${eval "imports.gi.GIRepository.Repository.get_search_path\\(\\)"} | grep gpaste")
61
62 with subtest("Open Cinnamon Settings"):
63 machine.succeed("${su "cinnamon-settings themes >&2 &"}")
64 machine.wait_until_succeeds("${eval "global.display.focus_window.wm_class"} | grep -i 'cinnamon-settings'")
65 machine.wait_for_text('(Style|Appearance|Color)')
66 machine.sleep(2)
67 machine.screenshot("cinnamon_settings")
68
69 with subtest("Check if screensaver works"):
70 # This is not supported at the moment.
71 # https://trello.com/b/HHs01Pab/cinnamon-wayland
72 machine.execute("${su "cinnamon-screensaver-command -l >&2 &"}")
73 machine.wait_until_succeeds("journalctl -b --grep 'cinnamon-screensaver is disabled in wayland sessions'")
74
75 with subtest("Open GNOME Terminal"):
76 machine.succeed("${su "dbus-launch gnome-terminal"}")
77 machine.wait_until_succeeds("${eval "global.display.focus_window.wm_class"} | grep -i 'gnome-terminal'")
78 machine.sleep(2)
79
80 with subtest("Check if Cinnamon has ever coredumped"):
81 machine.fail("coredumpctl --json=short | grep -E 'cinnamon|nemo'")
82 '';
83 }
84)