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