at 22.05-pre 1.4 kB view raw
1import ./make-test-python.nix ({ pkgs, ...} : { 2 name = "nano"; 3 meta = with pkgs.lib.maintainers; { 4 maintainers = [ nequissimus ]; 5 }; 6 7 machine = { lib, ... }: { 8 environment.systemPackages = [ pkgs.nano ]; 9 }; 10 11 testScript = { ... }: '' 12 start_all() 13 14 with subtest("Create user and log in"): 15 machine.wait_for_unit("multi-user.target") 16 machine.wait_until_succeeds("pgrep -f 'agetty.*tty1'") 17 machine.succeed("useradd -m alice") 18 machine.succeed("(echo foobar; echo foobar) | passwd alice") 19 machine.wait_until_tty_matches(1, "login: ") 20 machine.send_chars("alice\n") 21 machine.wait_until_tty_matches(1, "login: alice") 22 machine.wait_until_succeeds("pgrep login") 23 machine.wait_until_tty_matches(1, "Password: ") 24 machine.send_chars("foobar\n") 25 machine.wait_until_succeeds("pgrep -u alice bash") 26 machine.screenshot("prompt") 27 28 with subtest("Use nano"): 29 machine.send_chars("nano /tmp/foo") 30 machine.send_key("ret") 31 machine.sleep(2) 32 machine.send_chars("42") 33 machine.sleep(1) 34 machine.send_key("ctrl-x") 35 machine.sleep(1) 36 machine.send_key("y") 37 machine.sleep(1) 38 machine.screenshot("nano") 39 machine.sleep(1) 40 machine.send_key("ret") 41 machine.wait_for_file("/tmp/foo") 42 assert "42" in machine.succeed("cat /tmp/foo") 43 ''; 44})