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