Commit 3a788099 authored by OPNA2608's avatar OPNA2608
Browse files

tests/lomiri: Add polkit agent test

parent 916ba54f
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -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"):