From 3a788099cdc2d143e734e2c3c60546b37cab05dd Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sat, 6 Jul 2024 20:03:26 +0200 Subject: [PATCH] tests/lomiri: Add polkit agent test --- nixos/tests/lomiri.nix | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/nixos/tests/lomiri.nix b/nixos/tests/lomiri.nix index 35e8dcf52b721..912f4564ef7b2 100644 --- a/nixos/tests/lomiri.nix +++ b/nixos/tests/lomiri.nix @@ -74,6 +74,24 @@ in { inherit (alacritty) meta; }) + + # Polkit requests eventually time out. + # Keep triggering them until we signal detection success + (writeShellApplication { + name = "lpa-check"; + text = '' + while [ ! -f /tmp/lpa-checked ]; do + pkexec echo a + done + ''; + }) + # Signal detection success + (writeShellApplication { + name = "lpa-signal"; + text = '' + touch /tmp/lpa-checked + ''; + }) ]; }; @@ -201,7 +219,15 @@ in { machine.wait_for_text(r"(/build/source|hub.cpp|handler.cpp|void|virtual|const)") # awaiting log messages from content-hub machine.send_key("ctrl-c") - machine.send_key("alt-f4") + # Doing this here, since we need an in-session shell & separately starting a terminal again wastes time + with subtest("polkit agent works"): + machine.send_chars("exec lpa-check\n") + machine.wait_for_text(r"(Elevated permissions|Login)") + machine.screenshot("polkit_agent") + machine.execute("lpa-signal") + + # polkit test will quit terminal when agent request times out after OCR success + machine.wait_until_fails("pgrep -u ${user} -f lomiri-terminal-app") # We want the ability to launch applications with subtest("starter menu works"):