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