at 23.11-pre 2.5 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 = { nodes, ... }: { 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.config.users.users.alice; 17 uid = toString user.uid; 18 bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${uid}/bus"; 19 display = "DISPLAY=:0.0"; 20 env = "${bus} ${display}"; 21 gdbus = "${env} gdbus"; 22 su = command: "su - ${user.name} -c '${env} ${command}'"; 23 24 # Call javascript in cinnamon (the shell), returns a tuple (success, output), 25 # where `success` is true if the dbus call was successful and `output` is what 26 # the javascript evaluates to. 27 eval = "call --session -d org.Cinnamon -o /org/Cinnamon -m org.Cinnamon.Eval"; 28 29 # Should be 2 (RunState.RUNNING) when startup is done. 30 # https://github.com/linuxmint/cinnamon/blob/5.4.0/js/ui/main.js#L183-L187 31 getRunState = su "${gdbus} ${eval} Main.runState"; 32 33 # Start gnome-terminal. 34 gnomeTerminalCommand = su "gnome-terminal"; 35 36 # Hopefully gnome-terminal's wm class. 37 wmClass = su "${gdbus} ${eval} global.display.focus_window.wm_class"; 38 in 39 '' 40 machine.wait_for_unit("display-manager.service") 41 42 with subtest("Test if we can see username in slick-greeter"): 43 machine.wait_for_text("${user.description}") 44 machine.screenshot("slick_greeter_lightdm") 45 46 with subtest("Login with slick-greeter"): 47 machine.send_chars("${user.password}\n") 48 machine.wait_for_x() 49 machine.wait_for_file("${user.home}/.Xauthority") 50 machine.succeed("xauth merge ${user.home}/.Xauthority") 51 52 with subtest("Check that logging in has given the user ownership of devices"): 53 machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}") 54 55 with subtest("Wait for the Cinnamon shell"): 56 # Correct output should be (true, '2') 57 machine.wait_until_succeeds("${getRunState} | grep -q 'true,..2'") 58 59 with subtest("Open GNOME Terminal"): 60 machine.succeed("${gnomeTerminalCommand}") 61 # Correct output should be (true, '"Gnome-terminal"') 62 machine.wait_until_succeeds("${wmClass} | grep -q 'true,...Gnome-terminal'") 63 machine.sleep(20) 64 machine.screenshot("screen") 65 ''; 66})