nixosTests.pantheon: Extend the test

- Ensure greeter-compositor starts
- Ensure various environment variables are set
- Ensure multitasking view triggers
- Misc updates
This commit is contained in:
Bobby Rong 2024-01-12 23:31:57 +08:00
parent 9b19f5e77d
commit 40bec35947
No known key found for this signature in database

View File

@ -26,6 +26,7 @@ import ./make-test-python.nix ({ pkgs, lib, ...} :
with subtest("Test we can see usernames in elementary-greeter"):
machine.wait_for_text("${user.description}")
machine.wait_until_succeeds("pgrep -f io.elementary.greeter-compositor")
# OCR was struggling with this one.
# machine.wait_for_text("${bob.description}")
# Ensure the password box is focused by clicking it.
@ -39,21 +40,29 @@ import ./make-test-python.nix ({ pkgs, lib, ...} :
machine.wait_for_x()
machine.wait_for_file("${user.home}/.Xauthority")
machine.succeed("xauth merge ${user.home}/.Xauthority")
machine.wait_until_succeeds('journalctl -t gnome-session-binary --grep "Entering running state"')
with subtest("Check that logging in has given the user ownership of devices"):
machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}")
with subtest("Check if pantheon session components actually start"):
machine.wait_until_succeeds("pgrep gala")
machine.wait_for_window("gala")
machine.wait_until_succeeds("pgrep -f io.elementary.wingpanel")
machine.wait_for_window("io.elementary.wingpanel")
machine.wait_until_succeeds("pgrep plank")
machine.wait_for_window("plank")
machine.wait_until_succeeds("pgrep -f gsd-media-keys")
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)
machine.wait_for_unit("bamfdaemon.service", "${user.name}")
machine.wait_for_unit("io.elementary.files.xdg-desktop-portal.service", "${user.name}")
with subtest("Check if various environment variables are set"):
cmd = "xargs --null --max-args=1 echo < /proc/$(pgrep -xf /run/current-system/sw/bin/gala)/environ"
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'")
with subtest("Open elementary videos"):
machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.videos >&2 &'")
machine.sleep(2)
@ -61,6 +70,7 @@ import ./make-test-python.nix ({ pkgs, lib, ...} :
machine.wait_for_text("No Videos Open")
with subtest("Open elementary calendar"):
machine.wait_until_succeeds("pgrep -f evolution-calendar-factory")
machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.calendar >&2 &'")
machine.sleep(2)
machine.wait_for_window("io.elementary.calendar")
@ -75,6 +85,14 @@ import ./make-test-python.nix ({ pkgs, lib, ...} :
machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.terminal >&2 &'")
machine.wait_for_window("io.elementary.terminal")
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}'")
machine.sleep(3)
machine.screenshot("multitasking")
machine.succeed(f"su - ${user.name} -c '{env} {cmd}'")
with subtest("Check if gala has ever coredumped"):
machine.fail("coredumpctl --json=short | grep gala")
# So you can see the dock in the below screenshot.