at 23.11-beta 3.8 kB view raw
1import ./make-test-python.nix ({ pkgs, lib, ... }: { 2 name = "cinnamon"; 3 4 meta.maintainers = lib.teams.cinnamon.members; 5 6 nodes.machine = { ... }: { 7 imports = [ ./common/user-account.nix ]; 8 services.xserver.enable = true; 9 services.xserver.desktopManager.cinnamon.enable = true; 10 }; 11 12 enableOCR = true; 13 14 testScript = { nodes, ... }: 15 let 16 user = nodes.machine.users.users.alice; 17 env = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${toString user.uid}/bus DISPLAY=:0"; 18 su = command: "su - ${user.name} -c '${env} ${command}'"; 19 20 # Call javascript in cinnamon (the shell), returns a tuple (success, output), 21 # where `success` is true if the dbus call was successful and `output` is what 22 # the javascript evaluates to. 23 eval = name: su "gdbus call --session -d org.Cinnamon -o /org/Cinnamon -m org.Cinnamon.Eval ${name}"; 24 in 25 '' 26 machine.wait_for_unit("display-manager.service") 27 28 with subtest("Test if we can see username in slick-greeter"): 29 machine.wait_for_text("${user.description}") 30 machine.screenshot("slick_greeter_lightdm") 31 32 with subtest("Login with slick-greeter"): 33 machine.send_chars("${user.password}\n") 34 machine.wait_for_x() 35 machine.wait_for_file("${user.home}/.Xauthority") 36 machine.succeed("xauth merge ${user.home}/.Xauthority") 37 38 with subtest("Check that logging in has given the user ownership of devices"): 39 machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}") 40 41 with subtest("Wait for the Cinnamon shell"): 42 # Correct output should be (true, '2') 43 # https://github.com/linuxmint/cinnamon/blob/5.4.0/js/ui/main.js#L183-L187 44 machine.wait_until_succeeds("${eval "Main.runState"} | grep -q 'true,..2'") 45 46 with subtest("Check if Cinnamon components actually start"): 47 for i in ["csd-media-keys", "cinnamon-killer-daemon", "xapp-sn-watcher", "nemo-desktop"]: 48 machine.wait_until_succeeds(f"pgrep -f {i}") 49 machine.wait_until_succeeds("journalctl -b --grep 'Loaded applet menu@cinnamon.org'") 50 machine.wait_until_succeeds("journalctl -b --grep 'calendar@cinnamon.org: Calendar events supported'") 51 52 with subtest("Open Cinnamon Settings"): 53 machine.succeed("${su "cinnamon-settings themes >&2 &"}") 54 machine.wait_until_succeeds("${eval "global.display.focus_window.wm_class"} | grep -i 'cinnamon-settings'") 55 machine.wait_for_text('(Style|Appearance|Color)') 56 machine.sleep(2) 57 machine.screenshot("cinnamon_settings") 58 59 with subtest("Lock the screen"): 60 machine.succeed("${su "cinnamon-screensaver-command -l >&2 &"}") 61 machine.wait_until_succeeds("${su "cinnamon-screensaver-command -q"} | grep 'The screensaver is active'") 62 machine.sleep(2) 63 machine.screenshot("cinnamon_screensaver") 64 machine.send_chars("${user.password}\n", delay=0.2) 65 machine.wait_until_succeeds("${su "cinnamon-screensaver-command -q"} | grep 'The screensaver is inactive'") 66 machine.sleep(2) 67 68 with subtest("Open GNOME Terminal"): 69 machine.succeed("${su "gnome-terminal"}") 70 machine.wait_until_succeeds("${eval "global.display.focus_window.wm_class"} | grep -i 'gnome-terminal'") 71 machine.sleep(2) 72 73 with subtest("Open virtual keyboard"): 74 machine.succeed("${su "dbus-send --print-reply --dest=org.Cinnamon /org/Cinnamon org.Cinnamon.ToggleKeyboard"}") 75 machine.wait_for_text('(Ctrl|Alt)') 76 machine.sleep(2) 77 machine.screenshot("cinnamon_virtual_keyboard") 78 79 with subtest("Check if Cinnamon has ever coredumped"): 80 machine.fail("coredumpctl --json=short | grep -E 'cinnamon|nemo'") 81 ''; 82})