Merge pull request #163608 from turion/dev_fix_keepassxc_163482

nixosTests.keepassxc: Add regression test for #163482
This commit is contained in:
Manuel Bärenz 2022-03-21 12:24:32 +01:00 committed by GitHub
commit 9046ecff84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 9 deletions

View file

@ -15,20 +15,54 @@ import ./make-test-python.nix ({ pkgs, ...} :
];
services.xserver.enable = true;
# Regression test for https://github.com/NixOS/nixpkgs/issues/163482
qt5 = {
enable = true;
platformTheme = "gnome";
style = "adwaita-dark";
};
test-support.displayManager.auto.user = "alice";
environment.systemPackages = [ pkgs.keepassxc ];
environment.systemPackages = with pkgs; [
keepassxc
xdotool
];
};
enableOCR = true;
testScript = { nodes, ... }: ''
start_all()
machine.wait_for_x()
testScript = { nodes, ... }: let
aliceDo = cmd: ''machine.succeed("su - alice -c '${cmd}' >&2 &");'';
in ''
with subtest("Ensure X starts"):
start_all()
machine.wait_for_x()
# start KeePassXC window
machine.execute("su - alice -c keepassxc >&2 &")
with subtest("Can create database and entry with CLI"):
${aliceDo "keepassxc-cli db-create -k foo.keyfile foo.kdbx"}
${aliceDo "keepassxc-cli add --no-password -k foo.keyfile foo.kdbx bar"}
machine.wait_for_text("KeePassXC ${pkgs.keepassxc.version}")
machine.screenshot("KeePassXC")
with subtest("Ensure KeePassXC starts"):
# start KeePassXC window
${aliceDo "keepassxc >&2 &"}
machine.wait_for_text("KeePassXC ${pkgs.keepassxc.version}")
machine.screenshot("KeePassXC")
with subtest("Can open existing database"):
machine.send_key("ctrl-o")
machine.sleep(5)
# Regression #163482: keepassxc did not crash
machine.succeed("ps -e | grep keepassxc")
machine.wait_for_text("foo.kdbx")
machine.send_key("ret")
machine.sleep(1)
# Click on "Browse" button to select keyfile
machine.send_key("tab")
machine.send_chars("/home/alice/foo.keyfile")
machine.send_key("ret")
# Passwords folder is displayed
machine.wait_for_text("Passwords")
'';
})

View file

@ -22,6 +22,7 @@
, qtx11extras
, quazip
, readline
, wrapGAppsHook
, wrapQtAppsHook
, yubikey-personalization
, zlib
@ -90,7 +91,7 @@ stdenv.mkDerivation rec {
runHook postCheck
'';
nativeBuildInputs = [ asciidoctor cmake wrapQtAppsHook qttools pkg-config ];
nativeBuildInputs = [ asciidoctor cmake wrapGAppsHook wrapQtAppsHook qttools pkg-config ];
buildInputs = [
curl