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