Commit 3d185562 authored by Zhaofeng Li's avatar Zhaofeng Li Committed by Rick van Schijndel
Browse files

nixos/tests/phosh: init

parent 8b2d34fa
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -491,6 +491,7 @@ in {
  pgadmin4-standalone = handleTest ./pgadmin4-standalone.nix {};
  pgjwt = handleTest ./pgjwt.nix {};
  pgmanage = handleTest ./pgmanage.nix {};
  phosh = handleTest ./phosh.nix {};
  php = handleTest ./php {};
  php80 = handleTest ./php { php = pkgs.php80; };
  php81 = handleTest ./php { php = pkgs.php81; };

nixos/tests/phosh.nix

0 → 100644
+65 −0
Original line number Diff line number Diff line
import ./make-test-python.nix ({ pkgs, ...}: let
  pin = "1234";
in {
  name = "phosh";
  meta = with pkgs.lib.maintainers; {
    maintainers = [ zhaofengli ];
  };

  nodes = {
    phone = { config, pkgs, ... }: {
      users.users.nixos = {
        isNormalUser = true;
        password = pin;
      };

      services.xserver.desktopManager.phosh = {
        enable = true;
        user = "nixos";
        group = "users";

        phocConfig = {
          outputs.Virtual-1 = {
            scale = 2;
          };
        };
      };

      systemd.services.phosh = {
        environment = {
          # Accelerated graphics fail on phoc 0.20 (wlroots 0.15)
          "WLR_RENDERER" = "pixman";
        };
      };

      virtualisation.resolution = { x = 720; y = 1440; };
      virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci,xres=720,yres=1440" ];
    };
  };

  enableOCR = true;

  testScript = ''
    import time

    start_all()
    phone.wait_for_unit("phosh.service")

    with subtest("Check that we can see the lock screen info page"):
        # Saturday, January 1
        phone.succeed("timedatectl set-time '2022-01-01 07:00'")

        phone.wait_for_text("Saturday")
        phone.screenshot("01lockinfo")

    with subtest("Check that we can unlock the screen"):
        phone.send_chars("${pin}", delay=0.2)
        time.sleep(1)
        phone.screenshot("02unlock")

        phone.send_chars("\n")

        phone.wait_for_text("All Apps")
        phone.screenshot("03launcher")
  '';
})
+3 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
, polkit
, libsecret
, evolution-data-server
, nixosTests
}:

stdenv.mkDerivation rec {
@@ -122,6 +123,8 @@ stdenv.mkDerivation rec {
    providedSessions = [
      "sm.puri.Phosh"
    ];

    tests.phosh = nixosTests.phosh;
  };

  meta = with lib; {