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
54 with subtest("Open system settings"):
55 machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.switchboard >&2 &'")
56 # Wait for all plugins to be loaded before we check if the window is still there.
57 machine.sleep(5)
58 machine.wait_for_window("io.elementary.switchboard")
59
60 with subtest("Open elementary terminal"):
61 machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.terminal >&2 &'")
62 machine.wait_for_window("io.elementary.terminal")
63 machine.sleep(20)
64 machine.screenshot("screen")
65 '';
66})