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