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