at 24.11-pre 2.0 kB view raw
1import ./make-test-python.nix ({ pkgs, ...} : 2 3{ 4 name = "keepassxc"; 5 meta = with pkgs.lib.maintainers; { 6 maintainers = [ turion ]; 7 timeout = 1800; 8 }; 9 10 nodes.machine = { ... }: 11 12 { 13 imports = [ 14 ./common/user-account.nix 15 ./common/x11.nix 16 ]; 17 18 services.xserver.enable = true; 19 20 # Regression test for https://github.com/NixOS/nixpkgs/issues/163482 21 qt = { 22 enable = true; 23 platformTheme = "gnome"; 24 style = "adwaita-dark"; 25 }; 26 27 test-support.displayManager.auto.user = "alice"; 28 environment.systemPackages = with pkgs; [ 29 keepassxc 30 xdotool 31 ]; 32 }; 33 34 enableOCR = true; 35 36 testScript = { nodes, ... }: let 37 aliceDo = cmd: ''machine.succeed("su - alice -c '${cmd}' >&2 &");''; 38 in '' 39 with subtest("Ensure X starts"): 40 start_all() 41 machine.wait_for_x() 42 43 with subtest("Can create database and entry with CLI"): 44 ${aliceDo "keepassxc-cli db-create -k foo.keyfile foo.kdbx"} 45 ${aliceDo "keepassxc-cli add --no-password -k foo.keyfile foo.kdbx bar"} 46 47 with subtest("Ensure KeePassXC starts"): 48 # start KeePassXC window 49 ${aliceDo "keepassxc >&2 &"} 50 51 machine.wait_for_text("KeePassXC ${pkgs.keepassxc.version}") 52 machine.screenshot("KeePassXC") 53 54 with subtest("Can open existing database"): 55 machine.send_key("ctrl-o") 56 machine.sleep(5) 57 # Regression #163482: keepassxc did not crash 58 machine.succeed("ps -e | grep keepassxc") 59 machine.wait_for_text("Open database") 60 machine.send_key("ret") 61 62 # Wait for the enter password screen to appear. 63 machine.wait_for_text("/home/alice/foo.kdbx") 64 65 # Click on "Browse" button to select keyfile 66 machine.send_key("tab") 67 machine.send_chars("/home/alice/foo.keyfile") 68 machine.send_key("ret") 69 # Database is unlocked (doesn't have "[Locked]" in the title anymore) 70 machine.wait_for_text("foo.kdbx - KeePassXC") 71 ''; 72})