1import ./make-test-python.nix ({ pkgs, ...}: let
2 pin = "1234";
3in {
4 name = "phosh";
5 meta = with pkgs.lib.maintainers; {
6 maintainers = [ tomfitzhenry zhaofengli ];
7 };
8
9 nodes = {
10 phone = { config, pkgs, ... }: {
11 users.users.nixos = {
12 isNormalUser = true;
13 password = pin;
14 };
15
16 services.xserver.desktopManager.phosh = {
17 enable = true;
18 user = "nixos";
19 group = "users";
20
21 phocConfig = {
22 outputs.Virtual-1 = {
23 scale = 2;
24 };
25 };
26 };
27
28 systemd.services.phosh = {
29 environment = {
30 # Accelerated graphics fail on phoc 0.20 (wlroots 0.15)
31 "WLR_RENDERER" = "pixman";
32 };
33 };
34
35 virtualisation.resolution = { x = 720; y = 1440; };
36 virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci,xres=720,yres=1440" ];
37 };
38 };
39
40 enableOCR = true;
41
42 testScript = ''
43 import time
44
45 start_all()
46 phone.wait_for_unit("phosh.service")
47
48 with subtest("Check that we can see the lock screen info page"):
49 # Saturday, January 1
50 phone.succeed("timedatectl set-time '2022-01-01 07:00'")
51
52 phone.wait_for_text("Saturday")
53 phone.screenshot("01lockinfo")
54
55 with subtest("Check that we can unlock the screen"):
56 phone.send_chars("${pin}", delay=0.2)
57 time.sleep(1)
58 phone.screenshot("02unlock")
59
60 phone.send_chars("\n")
61
62 phone.wait_for_text("All Apps")
63 phone.screenshot("03launcher")
64
65 with subtest("Check the on-screen keyboard shows"):
66 phone.send_chars("setting", delay=0.2)
67 phone.wait_for_text("123") # A button on the OSK
68 phone.screenshot("04osk")
69 '';
70})