1import ./make-test-python.nix (
2 { pkgs, lib, ... }:
3
4 {
5 name = "pantheon";
6
7 meta.maintainers = lib.teams.pantheon.members;
8
9 nodes.machine =
10 { ... }:
11
12 {
13 imports = [ ./common/user-account.nix ];
14
15 # Workaround ".gala-wrapped invoked oom-killer"
16 virtualisation.memorySize = 2047;
17
18 services.xserver.enable = true;
19 services.xserver.desktopManager.pantheon.enable = true;
20
21 # We ship pantheon.appcenter by default when this is enabled.
22 services.flatpak.enable = true;
23
24 # We don't ship gnome-text-editor in Pantheon module, we add this line mainly
25 # to catch eval issues related to this option.
26 environment.pantheon.excludePackages = [ pkgs.gnome-text-editor ];
27
28 environment.systemPackages = [ pkgs.xdotool ];
29 };
30
31 enableOCR = true;
32
33 testScript =
34 { nodes, ... }:
35 let
36 user = nodes.machine.users.users.alice;
37 bob = nodes.machine.users.users.bob;
38 in
39 ''
40 machine.wait_for_unit("display-manager.service")
41
42 with subtest("Test we can see usernames in elementary-greeter"):
43 machine.wait_for_text("${user.description}")
44 machine.wait_until_succeeds("pgrep -f io.elementary.greeter-compositor")
45 # OCR was struggling with this one.
46 # machine.wait_for_text("${bob.description}")
47 # Ensure the password box is focused by clicking it.
48 # Workaround for https://github.com/NixOS/nixpkgs/issues/211366.
49 machine.succeed("XAUTHORITY=/var/lib/lightdm/.Xauthority DISPLAY=:0 xdotool mousemove 512 505 click 1")
50 machine.sleep(2)
51 machine.screenshot("elementary_greeter_lightdm")
52
53 with subtest("Login with elementary-greeter"):
54 machine.send_chars("${user.password}\n")
55 machine.wait_for_x()
56 machine.wait_for_file("${user.home}/.Xauthority")
57 machine.succeed("xauth merge ${user.home}/.Xauthority")
58 machine.wait_until_succeeds('journalctl -t gnome-session-binary --grep "Entering running state"')
59
60 with subtest("Check that logging in has given the user ownership of devices"):
61 machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}")
62
63 with subtest("Check if Pantheon components actually start"):
64 for i in ["gala", "io.elementary.wingpanel", "io.elementary.dock", "gsd-media-keys", "io.elementary.desktop.agent-polkit"]:
65 machine.wait_until_succeeds(f"pgrep -f {i}")
66 for i in ["gala", "io.elementary.wingpanel", "io.elementary.dock"]:
67 machine.wait_for_window(i)
68 machine.wait_until_succeeds("pgrep -xf ${pkgs.pantheon.elementary-files}/libexec/io.elementary.files.xdg-desktop-portal")
69
70 with subtest("Check if various environment variables are set"):
71 cmd = "xargs --null --max-args=1 echo < /proc/$(pgrep -xf ${pkgs.pantheon.gala}/bin/gala)/environ"
72 machine.succeed(f"{cmd} | grep 'XDG_CURRENT_DESKTOP' | grep 'Pantheon'")
73 # Hopefully from the sessionPath option.
74 machine.succeed(f"{cmd} | grep 'XDG_DATA_DIRS' | grep 'gsettings-schemas/pantheon-agent-geoclue2'")
75 # Hopefully from login shell.
76 machine.succeed(f"{cmd} | grep '__NIXOS_SET_ENVIRONMENT_DONE' | grep '1'")
77
78 with subtest("Open elementary videos"):
79 machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.videos >&2 &'")
80 machine.sleep(2)
81 machine.wait_for_window("io.elementary.videos")
82 machine.wait_for_text("No Videos Open")
83
84 with subtest("Open elementary calendar"):
85 machine.wait_until_succeeds("pgrep -f evolution-calendar-factory")
86 machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.calendar >&2 &'")
87 machine.sleep(2)
88 machine.wait_for_window("io.elementary.calendar")
89
90 with subtest("Open system settings"):
91 machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.settings >&2 &'")
92 # Wait for all plugins to be loaded before we check if the window is still there.
93 machine.sleep(5)
94 machine.wait_for_window("io.elementary.settings")
95
96 with subtest("Open elementary terminal"):
97 machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.terminal >&2 &'")
98 machine.wait_for_window("io.elementary.terminal")
99
100 with subtest("Trigger multitasking view"):
101 cmd = "dbus-send --session --dest=org.pantheon.gala --print-reply /org/pantheon/gala org.pantheon.gala.PerformAction int32:1"
102 env = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${toString user.uid}/bus DISPLAY=:0"
103 machine.succeed(f"su - ${user.name} -c '{env} {cmd}'")
104 machine.sleep(5)
105 machine.screenshot("multitasking")
106 machine.succeed(f"su - ${user.name} -c '{env} {cmd}'")
107
108 with subtest("Check if gala has ever coredumped"):
109 machine.fail("coredumpctl --json=short | grep gala")
110 # So you can see the dock in the below screenshot.
111 machine.succeed("su - ${user.name} -c 'DISPLAY=:0 xdotool mousemove 450 1000 >&2 &'")
112 machine.sleep(10)
113 machine.screenshot("screen")
114 '';
115 }
116)