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