nixos/tests/phosh: init

This commit is contained in:
Zhaofeng Li 2022-08-02 12:34:37 -07:00 committed by Rick van Schijndel
parent 8b2d34fa5e
commit 3d185562b5
3 changed files with 69 additions and 0 deletions

View file

@ -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; };

65
nixos/tests/phosh.nix Normal file
View file

@ -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")
'';
})

View file

@ -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; {