1 import ./make-test-python.nix ({ pkgs, lib, ...} : {
4 maintainers = teams.gnome.members;
10 { imports = [ ./common/user-account.nix ];
12 services.xserver.enable = true;
14 services.xserver.displayManager = {
23 services.xserver.desktopManager.gnome.enable = true;
24 services.xserver.desktopManager.gnome.debug = true;
25 programs.gnome-terminal.enable = true;
27 environment.systemPackages = [
28 (pkgs.makeAutostartItem {
29 name = "org.gnome.Terminal";
30 package = pkgs.gnome.gnome-terminal;
34 systemd.user.services = {
35 "org.gnome.Shell@wayland" = {
38 # Clear the list before overriding it.
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"
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}'";
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";
64 # False when startup is done
65 startingUp = su "${gdbus} ${eval} Main.layoutManager._startingUp";
67 # Start gnome-terminal
68 gnomeTerminalCommand = su "${bus} gnome-terminal";
70 # Hopefully gnome-terminal's wm class
71 wmClass = su "${gdbus} ${eval} global.display.focus_window.wm_class";
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")
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'"
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'"
95 machine.screenshot("screen")