1import ./make-test-python.nix ({ pkgs, lib, ...} :
2
3{
4 name = "pantheon";
5
6 meta.maintainers = lib.teams.pantheon.members;
7
8 nodes.machine = { ... }:
9
10 {
11 imports = [ ./common/user-account.nix ];
12
13 services.xserver.enable = true;
14 services.xserver.desktopManager.pantheon.enable = true;
15
16 environment.systemPackages = [ pkgs.xdotool ];
17 };
18
19 enableOCR = true;
20
21 testScript = { nodes, ... }: let
22 user = nodes.machine.users.users.alice;
23 bob = nodes.machine.users.users.bob;
24 in ''
25 machine.wait_for_unit("display-manager.service")
26
27 with subtest("Test we can see usernames in elementary-greeter"):
28 machine.wait_for_text("${user.description}")
29 # OCR was struggling with this one.
30 # machine.wait_for_text("${bob.description}")
31 # Ensure the password box is focused by clicking it.
32 # Workaround for https://github.com/NixOS/nixpkgs/issues/211366.
33 machine.succeed("XAUTHORITY=/var/lib/lightdm/.Xauthority DISPLAY=:0 xdotool mousemove 512 505 click 1")
34 machine.sleep(2)
35 machine.screenshot("elementary_greeter_lightdm")
36
37 with subtest("Login with elementary-greeter"):
38 machine.send_chars("${user.password}\n")
39 machine.wait_for_x()
40 machine.wait_for_file("${user.home}/.Xauthority")
41 machine.succeed("xauth merge ${user.home}/.Xauthority")
42
43 with subtest("Check that logging in has given the user ownership of devices"):
44 machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}")
45
46 with subtest("Check if pantheon session components actually start"):
47 machine.wait_until_succeeds("pgrep gala")
48 machine.wait_for_window("gala")
49 machine.wait_until_succeeds("pgrep -f io.elementary.wingpanel")
50 machine.wait_for_window("io.elementary.wingpanel")
51 machine.wait_until_succeeds("pgrep plank")
52 machine.wait_for_window("plank")
53 machine.wait_until_succeeds("pgrep -f gsd-media-keys")
54 machine.wait_for_unit("bamfdaemon.service", "${user.name}")
55 machine.wait_for_unit("io.elementary.files.xdg-desktop-portal.service", "${user.name}")
56
57 with subtest("Open elementary videos"):
58 machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.videos >&2 &'")
59 machine.sleep(2)
60 machine.wait_for_window("io.elementary.videos")
61 machine.wait_for_text("No Videos Open")
62
63 with subtest("Open elementary calendar"):
64 machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.calendar >&2 &'")
65 machine.sleep(2)
66 machine.wait_for_window("io.elementary.calendar")
67
68 with subtest("Open system settings"):
69 machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.switchboard >&2 &'")
70 # Wait for all plugins to be loaded before we check if the window is still there.
71 machine.sleep(5)
72 machine.wait_for_window("io.elementary.switchboard")
73
74 with subtest("Open elementary terminal"):
75 machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.terminal >&2 &'")
76 machine.wait_for_window("io.elementary.terminal")
77
78 with subtest("Check if gala has ever coredumped"):
79 machine.fail("coredumpctl --json=short | grep gala")
80 # So you can see the dock in the below screenshot.
81 machine.succeed("su - ${user.name} -c 'DISPLAY=:0 xdotool mousemove 450 1000 >&2 &'")
82 machine.sleep(10)
83 machine.screenshot("screen")
84 '';
85})