Skip to content

Commit

Permalink
nixos/tests/phosh: init
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaofengli committed Jun 21, 2022
1 parent 9863d55 commit 0a1ce91
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,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; };
Expand Down
69 changes: 69 additions & 0 deletions nixos/tests/phosh.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
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;
};
};
};

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")
with subtest("Check that we can launch an app"):
phone.send_chars("settings\n\n", delay=0.2)
phone.wait_for_text("Network")
phone.screenshot("04settings")
with subtest("Check that we can summon the on-screen keyboard"):
phone.succeed("busctl call [email protected] --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true")
phone.wait_for_text("123") # Button label for the number layer
phone.screenshot("05keyboard")
'';
})
3 changes: 3 additions & 0 deletions pkgs/applications/window-managers/phosh/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
, networkmanager
, polkit
, libsecret
, nixosTests
}:

stdenv.mkDerivation rec {
Expand Down Expand Up @@ -115,6 +116,8 @@ stdenv.mkDerivation rec {
providedSessions = [
"sm.puri.Phosh"
];

tests.moonraker = nixosTests.phosh;
};

meta = with lib; {
Expand Down

0 comments on commit 0a1ce91

Please sign in to comment.