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