2021-09-22 10:59:09 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, lib, ...} :
|
2018-08-20 20:31:18 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
name = "pantheon";
|
2019-11-07 01:38:23 +00:00
|
|
|
|
2023-04-30 01:17:05 +00:00
|
|
|
meta.maintainers = lib.teams.pantheon.members;
|
2018-08-20 20:31:18 +00:00
|
|
|
|
2022-03-20 23:15:30 +00:00
|
|
|
nodes.machine = { ... }:
|
2018-08-20 20:31:18 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
imports = [ ./common/user-account.nix ];
|
|
|
|
|
|
|
|
services.xserver.enable = true;
|
|
|
|
services.xserver.desktopManager.pantheon.enable = true;
|
|
|
|
|
2024-04-10 13:27:31 +00:00
|
|
|
# We ship pantheon.appcenter by default when this is enabled.
|
|
|
|
services.flatpak.enable = true;
|
|
|
|
|
|
|
|
# We don't ship gnome-text-editor in Pantheon module, we add this line mainly
|
|
|
|
# to catch eval issues related to this option.
|
|
|
|
environment.pantheon.excludePackages = [ pkgs.gnome-text-editor ];
|
|
|
|
|
2023-03-07 15:16:33 +00:00
|
|
|
environment.systemPackages = [ pkgs.xdotool ];
|
2018-08-20 20:31:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enableOCR = true;
|
|
|
|
|
|
|
|
testScript = { nodes, ... }: let
|
2023-01-21 15:41:23 +00:00
|
|
|
user = nodes.machine.users.users.alice;
|
|
|
|
bob = nodes.machine.users.users.bob;
|
2018-08-20 20:31:18 +00:00
|
|
|
in ''
|
2019-11-07 01:38:23 +00:00
|
|
|
machine.wait_for_unit("display-manager.service")
|
2019-11-07 01:20:16 +00:00
|
|
|
|
2019-11-25 17:03:51 +00:00
|
|
|
with subtest("Test we can see usernames in elementary-greeter"):
|
|
|
|
machine.wait_for_text("${user.description}")
|
2024-01-12 15:31:57 +00:00
|
|
|
machine.wait_until_succeeds("pgrep -f io.elementary.greeter-compositor")
|
2019-11-26 14:24:10 +00:00
|
|
|
# OCR was struggling with this one.
|
|
|
|
# machine.wait_for_text("${bob.description}")
|
2023-03-07 15:16:33 +00:00
|
|
|
# Ensure the password box is focused by clicking it.
|
|
|
|
# Workaround for https://github.com/NixOS/nixpkgs/issues/211366.
|
|
|
|
machine.succeed("XAUTHORITY=/var/lib/lightdm/.Xauthority DISPLAY=:0 xdotool mousemove 512 505 click 1")
|
|
|
|
machine.sleep(2)
|
2019-11-25 17:03:51 +00:00
|
|
|
machine.screenshot("elementary_greeter_lightdm")
|
|
|
|
|
|
|
|
with subtest("Login with elementary-greeter"):
|
|
|
|
machine.send_chars("${user.password}\n")
|
|
|
|
machine.wait_for_x()
|
|
|
|
machine.wait_for_file("${user.home}/.Xauthority")
|
|
|
|
machine.succeed("xauth merge ${user.home}/.Xauthority")
|
2024-01-12 15:31:57 +00:00
|
|
|
machine.wait_until_succeeds('journalctl -t gnome-session-binary --grep "Entering running state"')
|
2019-11-25 17:03:51 +00:00
|
|
|
|
|
|
|
with subtest("Check that logging in has given the user ownership of devices"):
|
|
|
|
machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}")
|
|
|
|
|
2024-01-12 15:31:57 +00:00
|
|
|
with subtest("Check if Pantheon components actually start"):
|
|
|
|
for i in ["gala", "io.elementary.wingpanel", "plank", "gsd-media-keys", "io.elementary.desktop.agent-polkit"]:
|
|
|
|
machine.wait_until_succeeds(f"pgrep -f {i}")
|
|
|
|
for i in ["gala", "io.elementary.wingpanel", "plank"]:
|
|
|
|
machine.wait_for_window(i)
|
2024-04-05 13:23:11 +00:00
|
|
|
for i in ["bamfdaemon.service", "io.elementary.files.xdg-desktop-portal.service"]:
|
2024-01-27 08:41:51 +00:00
|
|
|
machine.wait_for_unit(i, "${user.name}")
|
2023-10-08 16:04:29 +00:00
|
|
|
|
2024-01-12 15:31:57 +00:00
|
|
|
with subtest("Check if various environment variables are set"):
|
2024-01-14 09:47:44 +00:00
|
|
|
cmd = "xargs --null --max-args=1 echo < /proc/$(pgrep -xf ${pkgs.pantheon.gala}/bin/gala)/environ"
|
2024-01-12 15:31:57 +00:00
|
|
|
machine.succeed(f"{cmd} | grep 'XDG_CURRENT_DESKTOP' | grep 'Pantheon'")
|
|
|
|
# Hopefully from the sessionPath option.
|
|
|
|
machine.succeed(f"{cmd} | grep 'XDG_DATA_DIRS' | grep 'gsettings-schemas/pantheon-agent-geoclue2'")
|
|
|
|
# Hopefully from login shell.
|
|
|
|
machine.succeed(f"{cmd} | grep '__NIXOS_SET_ENVIRONMENT_DONE' | grep '1'")
|
|
|
|
# See elementary-session-settings packaging.
|
|
|
|
machine.succeed(f"{cmd} | grep 'XDG_CONFIG_DIRS' | grep 'elementary-default-settings'")
|
|
|
|
|
2023-10-08 16:04:29 +00:00
|
|
|
with subtest("Open elementary videos"):
|
|
|
|
machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.videos >&2 &'")
|
|
|
|
machine.sleep(2)
|
|
|
|
machine.wait_for_window("io.elementary.videos")
|
|
|
|
machine.wait_for_text("No Videos Open")
|
|
|
|
|
|
|
|
with subtest("Open elementary calendar"):
|
2024-01-12 15:31:57 +00:00
|
|
|
machine.wait_until_succeeds("pgrep -f evolution-calendar-factory")
|
2023-10-08 16:04:29 +00:00
|
|
|
machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.calendar >&2 &'")
|
|
|
|
machine.sleep(2)
|
|
|
|
machine.wait_for_window("io.elementary.calendar")
|
2019-11-25 17:03:51 +00:00
|
|
|
|
2023-01-21 15:23:51 +00:00
|
|
|
with subtest("Open system settings"):
|
|
|
|
machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.switchboard >&2 &'")
|
|
|
|
# Wait for all plugins to be loaded before we check if the window is still there.
|
|
|
|
machine.sleep(5)
|
|
|
|
machine.wait_for_window("io.elementary.switchboard")
|
|
|
|
|
2019-11-25 17:03:51 +00:00
|
|
|
with subtest("Open elementary terminal"):
|
2021-11-05 20:13:36 +00:00
|
|
|
machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.terminal >&2 &'")
|
2019-11-25 17:03:51 +00:00
|
|
|
machine.wait_for_window("io.elementary.terminal")
|
2023-08-16 13:40:34 +00:00
|
|
|
|
2024-01-12 15:31:57 +00:00
|
|
|
with subtest("Trigger multitasking view"):
|
|
|
|
cmd = "dbus-send --session --dest=org.pantheon.gala --print-reply /org/pantheon/gala org.pantheon.gala.PerformAction int32:1"
|
|
|
|
env = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${toString user.uid}/bus DISPLAY=:0"
|
|
|
|
machine.succeed(f"su - ${user.name} -c '{env} {cmd}'")
|
2024-07-27 03:31:50 +00:00
|
|
|
machine.sleep(5)
|
2024-01-12 15:31:57 +00:00
|
|
|
machine.screenshot("multitasking")
|
|
|
|
|
2023-08-16 13:40:34 +00:00
|
|
|
with subtest("Check if gala has ever coredumped"):
|
|
|
|
machine.fail("coredumpctl --json=short | grep gala")
|
2023-10-08 16:04:29 +00:00
|
|
|
# So you can see the dock in the below screenshot.
|
|
|
|
machine.succeed("su - ${user.name} -c 'DISPLAY=:0 xdotool mousemove 450 1000 >&2 &'")
|
|
|
|
machine.sleep(10)
|
2019-11-25 17:03:51 +00:00
|
|
|
machine.screenshot("screen")
|
2018-08-20 20:31:18 +00:00
|
|
|
'';
|
|
|
|
})
|