simple.nix

 1{
 2  pkgs,
 3  zed,
 4  ...
 5}: let
 6  user = "alice";
 7  run = command: "sudo -u ${user} ${command}";
 8in
 9  pkgs.testers.runNixOSTest {
10    name = "simple file reading";
11
12    # sshBackdoor.enable = true;
13    # enableDebugHook = true;
14    enableOCR = true;
15
16    nodes.machine = {config, ...}: {
17      imports = [./common.nix];
18
19      test-support.user = user;
20      test-support.desktop-environment = "icewm";
21
22      environment.systemPackages = [zed];
23    };
24
25    testScript =
26      /*
27      python
28      */
29      ''
30        machine.wait_for_x()
31
32        machine.succeed("${run "zeditor /home/${user}/foo.md"}")
33        machine.wait_for_text("foo.md")
34
35        machine.send_chars("hello world\n");
36        machine.wait_for_text("hello world");
37
38        machine.send_key("ctrl-s");
39        machine.wait_for_file("/home/${user}/foo.md");
40      '';
41  }