summaryrefslogtreecommitdiffstats
path: root/nixos/tests/teleports.nix
blob: 84a880f9ad509a1f5e430b2ca7fd36f216aa9264 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{ pkgs, lib, ... }:
{
  name = "teleports-standalone";
  meta.maintainers = lib.teams.lomiri.members;

  nodes.machine =
    { config, pkgs, ... }:
    {
      imports = [ ./common/x11.nix ];

      services.xserver.enable = true;

      environment = {
        systemPackages = with pkgs.lomiri; [
          suru-icon-theme
          teleports
        ];
        variables = {
          UITK_ICON_THEME = "suru";
        };
      };

      i18n.supportedLocales = [ "all" ];

      fonts.packages = with pkgs; [
        # Intended font & helps with OCR
        ubuntu-classic
      ];
    };

  enableOCR = true;

  testScript = ''
    machine.wait_for_x()

    with subtest("teleports launches"):
        machine.succeed("teleports >&2 &")
        machine.wait_for_console_text("authorizationStateWaitPhoneNumber")
        # Not fullscreening, because main app colour makes OCR stuck
        machine.sleep(2)
        machine.wait_for_text(r"(TELEports|Phone Number)")
        machine.screenshot("teleports_open")

    machine.succeed("pkill -f teleports")

    with subtest("teleports localisation works"):
        machine.succeed("env LANG=de_DE.UTF-8 teleports >&2 &")
        machine.wait_for_console_text("authorizationStateWaitPhoneNumber")
        # Not fullscreening, because main app colour makes OCR stuck
        machine.sleep(2)
        machine.wait_for_text("Telefonnummer")
        machine.screenshot("teleports_localised")
  '';
}