summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorZhaofeng Li <hello@zhaofeng.li>2022-08-02 12:34:37 -0700
committerRick van Schijndel <Mindavi@users.noreply.github.com>2022-11-19 06:55:25 +0100
commit3d185562b59e0a6cf7559fecf7edb4ef52fa1007 (patch)
treec9f2c8aab34349304a7930427d17e82e3ac39c9b /nixos/tests
parent8b2d34fa5eecb1303a3d73679cb6d4c2a43b4442 (diff)
downloadnixpkgs-3d185562b59e0a6cf7559fecf7edb4ef52fa1007.tar
nixpkgs-3d185562b59e0a6cf7559fecf7edb4ef52fa1007.tar.gz
nixpkgs-3d185562b59e0a6cf7559fecf7edb4ef52fa1007.tar.bz2
nixpkgs-3d185562b59e0a6cf7559fecf7edb4ef52fa1007.tar.lz
nixpkgs-3d185562b59e0a6cf7559fecf7edb4ef52fa1007.tar.xz
nixpkgs-3d185562b59e0a6cf7559fecf7edb4ef52fa1007.tar.zst
nixpkgs-3d185562b59e0a6cf7559fecf7edb4ef52fa1007.zip
nixos/tests/phosh: init
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/phosh.nix65
2 files changed, 66 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index b238c438495..6cb4eb9f5e4 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -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; };
diff --git a/nixos/tests/phosh.nix b/nixos/tests/phosh.nix
new file mode 100644
index 00000000000..6c6357f5809
--- /dev/null
+++ b/nixos/tests/phosh.nix
@@ -0,0 +1,65 @@
+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")
+  '';
+})