summaryrefslogtreecommitdiffstats
path: root/nixos/tests/mindustry.nix
blob: d140520b1d19c9600ab0d4cfda274317d6ec0694 (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
{ pkgs, ... }:
{
  name = "mindustry";
  meta = with pkgs.lib.maintainers; {
    maintainers = [ fgaz ];
  };

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

      services.xserver.enable = true;
      environment.systemPackages = [ pkgs.mindustry ];
    };

  enableOCR = true;

  testScript = ''
    machine.wait_for_x()
    machine.execute("mindustry >&2 &")
    machine.wait_for_window("Mindustry")
    # Loading can take a while. Avoid wasting cycles on OCR during that time
    machine.sleep(60)
    machine.wait_for_text(r"(Play|Database|Editor|Mods|Settings|Quit)")
    machine.screenshot("screen")
  '';
}