at 24.11-pre 4.3 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 # We don't ship gnome-text-editor in Cinnamon module, we add this line mainly 12 # to catch eval issues related to this option. 13 environment.cinnamon.excludePackages = [ pkgs.gnome-text-editor ]; 14 15 # For the sessionPath subtest. 16 services.xserver.desktopManager.cinnamon.sessionPath = [ pkgs.gnome.gpaste ]; 17 }; 18 19 enableOCR = true; 20 21 testScript = { nodes, ... }: 22 let 23 user = nodes.machine.users.users.alice; 24 env = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${toString user.uid}/bus DISPLAY=:0"; 25 su = command: "su - ${user.name} -c '${env} ${command}'"; 26 27 # Call javascript in cinnamon (the shell), returns a tuple (success, output), 28 # where `success` is true if the dbus call was successful and `output` is what 29 # the javascript evaluates to. 30 eval = name: su "gdbus call --session -d org.Cinnamon -o /org/Cinnamon -m org.Cinnamon.Eval ${name}"; 31 in 32 '' 33 machine.wait_for_unit("display-manager.service") 34 35 with subtest("Test if we can see username in slick-greeter"): 36 machine.wait_for_text("${user.description}") 37 machine.screenshot("slick_greeter_lightdm") 38 39 with subtest("Login with slick-greeter"): 40 machine.send_chars("${user.password}\n") 41 machine.wait_for_x() 42 machine.wait_for_file("${user.home}/.Xauthority") 43 machine.succeed("xauth merge ${user.home}/.Xauthority") 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", "cinnamon-killer-daemon", "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("Lock the screen"): 70 machine.succeed("${su "cinnamon-screensaver-command -l >&2 &"}") 71 machine.wait_until_succeeds("${su "cinnamon-screensaver-command -q"} | grep 'The screensaver is active'") 72 machine.sleep(2) 73 machine.screenshot("cinnamon_screensaver") 74 machine.send_chars("${user.password}\n", delay=0.2) 75 machine.wait_until_succeeds("${su "cinnamon-screensaver-command -q"} | grep 'The screensaver is inactive'") 76 machine.sleep(2) 77 78 with subtest("Open GNOME Terminal"): 79 machine.succeed("${su "gnome-terminal"}") 80 machine.wait_until_succeeds("${eval "global.display.focus_window.wm_class"} | grep -i 'gnome-terminal'") 81 machine.sleep(2) 82 83 with subtest("Open virtual keyboard"): 84 machine.succeed("${su "dbus-send --print-reply --dest=org.Cinnamon /org/Cinnamon org.Cinnamon.ToggleKeyboard"}") 85 machine.wait_for_text('(Ctrl|Alt)') 86 machine.sleep(2) 87 machine.screenshot("cinnamon_virtual_keyboard") 88 89 with subtest("Check if Cinnamon has ever coredumped"): 90 machine.fail("coredumpctl --json=short | grep -E 'cinnamon|nemo'") 91 ''; 92})