at master 2.6 kB view raw
1{ 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 { 14 imports = [ 15 ./common/user-account.nix 16 ./common/x11.nix 17 ]; 18 19 services.xserver.enable = true; 20 programs.dconf.enable = true; 21 22 # for better OCR 23 environment.etc."icewm/prefoverride".text = '' 24 ColorActiveTitleBar = "rgb:FF/FF/FF" 25 ''; 26 27 # Regression test for https://github.com/NixOS/nixpkgs/issues/163482 28 qt = { 29 enable = true; 30 platformTheme = "gnome"; 31 style = "adwaita-dark"; 32 }; 33 34 test-support.displayManager.auto.user = "alice"; 35 environment.systemPackages = with pkgs; [ 36 keepassxc 37 xdotool 38 ]; 39 }; 40 41 enableOCR = true; 42 43 testScript = 44 { nodes, ... }: 45 let 46 aliceDo = cmd: ''machine.succeed("su - alice -c '${cmd}' >&2 &");''; 47 in 48 '' 49 with subtest("Ensure X starts"): 50 start_all() 51 machine.wait_for_x() 52 53 with subtest("Can create database and entry with CLI"): 54 ${aliceDo "keepassxc-cli db-create --set-key-file foo.keyfile foo.kdbx"} 55 ${aliceDo "keepassxc-cli add --no-password -k foo.keyfile foo.kdbx bar"} 56 57 with subtest("Ensure KeePassXC starts"): 58 # start KeePassXC window 59 ${aliceDo "keepassxc >&2 &"} 60 61 machine.wait_for_text("KeePassXC ${pkgs.keepassxc.version}") 62 machine.screenshot("KeePassXC") 63 64 with subtest("Can open existing database"): 65 machine.send_key("ctrl-o") 66 machine.sleep(5) 67 # Regression #163482: keepassxc did not crash 68 machine.succeed("ps -e | grep keepassxc") 69 machine.wait_for_text("Open database") 70 machine.send_key("ret") 71 72 # Wait for the enter password screen to appear. 73 machine.wait_for_text("/home/alice/foo.kdbx") 74 75 # Click on "I have key file" button to open keyfile dialog 76 machine.send_key("tab") 77 machine.send_key("tab") 78 machine.send_key("tab") 79 machine.send_key("ret") 80 81 # Select keyfile 82 machine.wait_for_text("Select key file") 83 machine.send_chars("/home/alice/foo.keyfile") 84 machine.send_key("ret") 85 86 # Open database 87 machine.wait_for_text("foo.kdbx \\[Locked] - KeePassXC") 88 machine.send_key("ret") 89 90 # Database is unlocked (doesn't have "[Locked]" in the title anymore) 91 machine.wait_for_text("foo.kdbx - KeePassXC") 92 ''; 93}