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 = {
21 services.xserver.desktopManager.gnome.enable = true;
22 services.xserver.desktopManager.gnome.debug = true;
24 systemd.user.services = {
25 "org.gnome.Shell@wayland" = {
28 # Clear the list before overriding it.
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"
41 testScript = { nodes, ... }: let
42 # Keep line widths somewhat manageable
43 user = nodes.machine.users.users.alice;
44 uid = toString user.uid;
45 bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${uid}/bus";
46 # Run a command in the appropriate user environment
47 run = command: "su - ${user.name} -c '${bus} ${command}'";
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 = command: run "gdbus call --session -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval ${command}";
54 # False when startup is done
55 startingUp = eval "Main.layoutManager._startingUp";
58 launchConsole = run "gapplication launch org.gnome.Console";
60 # Hopefully Console's wm class
61 wmClass = eval "global.display.focus_window.wm_class";
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")
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'"
79 with subtest("Open Console"):
80 # Close the Activities view so that Shell can correctly track the focused window.
81 machine.send_key("esc")
86 # correct output should be (true, '"org.gnome.Console"')
87 machine.wait_until_succeeds(
88 "${wmClass} | grep -q 'true,...org.gnome.Console'"
91 machine.screenshot("screen")