at 23.11-pre 3.2 kB view raw
1import ./make-test-python.nix ({ pkgs, lib, ...} : { 2 name = "gnome"; 3 meta.maintainers = lib.teams.gnome.members; 4 5 nodes.machine = 6 { ... }: 7 8 { imports = [ ./common/user-account.nix ]; 9 10 services.xserver.enable = true; 11 12 services.xserver.displayManager = { 13 gdm.enable = true; 14 gdm.debug = true; 15 autoLogin = { 16 enable = true; 17 user = "alice"; 18 }; 19 }; 20 21 services.xserver.desktopManager.gnome.enable = true; 22 services.xserver.desktopManager.gnome.debug = true; 23 24 systemd.user.services = { 25 "org.gnome.Shell@wayland" = { 26 serviceConfig = { 27 ExecStart = [ 28 # Clear the list before overriding it. 29 "" 30 # Eval API is now internal so Shell needs to run in unsafe mode. 31 # TODO: improve test driver so that it supports openqa-like manipulation 32 # that would allow us to drop this mess. 33 "${pkgs.gnome.gnome-shell}/bin/gnome-shell --unsafe-mode" 34 ]; 35 }; 36 }; 37 }; 38 39 }; 40 41 testScript = { nodes, ... }: let 42 # Keep line widths somewhat manageable 43 user = nodes.machine.config.users.users.alice; 44 uid = toString user.uid; 45 bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${uid}/bus"; 46 gdbus = "${bus} gdbus"; 47 su = command: "su - ${user.name} -c '${command}'"; 48 49 # Call javascript in gnome shell, returns a tuple (success, output), where 50 # `success` is true if the dbus call was successful and output is what the 51 # javascript evaluates to. 52 eval = "call --session -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval"; 53 54 # False when startup is done 55 startingUp = su "${gdbus} ${eval} Main.layoutManager._startingUp"; 56 57 # Start Console 58 launchConsole = su "${bus} gapplication launch org.gnome.Console"; 59 60 # Hopefully Console's wm class 61 wmClass = su "${gdbus} ${eval} global.display.focus_window.wm_class"; 62 in '' 63 with subtest("Login to GNOME with GDM"): 64 # wait for gdm to start 65 machine.wait_for_unit("display-manager.service") 66 # wait for the wayland server 67 machine.wait_for_file("/run/user/${uid}/wayland-0") 68 # wait for alice to be logged in 69 machine.wait_for_unit("default.target", "${user.name}") 70 # check that logging in has given the user ownership of devices 71 assert "alice" in machine.succeed("getfacl -p /dev/snd/timer") 72 73 with subtest("Wait for GNOME Shell"): 74 # correct output should be (true, 'false') 75 machine.wait_until_succeeds( 76 "${startingUp} | grep -q 'true,..false'" 77 ) 78 79 with subtest("Open Console"): 80 # Close the Activities view so that Shell can correctly track the focused window. 81 machine.send_key("esc") 82 83 machine.succeed( 84 "${launchConsole}" 85 ) 86 # correct output should be (true, '"org.gnome.Console"') 87 machine.wait_until_succeeds( 88 "${wmClass} | grep -q 'true,...org.gnome.Console'" 89 ) 90 machine.sleep(20) 91 machine.screenshot("screen") 92 ''; 93})