2021-02-02 11:35:46 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, ...} :
|
|
|
|
|
|
|
|
{
|
|
|
|
name = "keepassxc";
|
|
|
|
meta = with pkgs.lib.maintainers; {
|
|
|
|
maintainers = [ turion ];
|
2023-02-20 17:38:39 +00:00
|
|
|
timeout = 1800;
|
2021-02-02 11:35:46 +00:00
|
|
|
};
|
|
|
|
|
2022-03-20 23:15:30 +00:00
|
|
|
nodes.machine = { ... }:
|
2021-02-02 11:35:46 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
./common/user-account.nix
|
|
|
|
./common/x11.nix
|
|
|
|
];
|
|
|
|
|
|
|
|
services.xserver.enable = true;
|
2022-03-10 20:31:10 +00:00
|
|
|
|
|
|
|
# Regression test for https://github.com/NixOS/nixpkgs/issues/163482
|
2022-12-24 09:59:15 +00:00
|
|
|
qt = {
|
2022-03-10 20:31:10 +00:00
|
|
|
enable = true;
|
|
|
|
platformTheme = "gnome";
|
|
|
|
style = "adwaita-dark";
|
|
|
|
};
|
|
|
|
|
2021-02-02 11:35:46 +00:00
|
|
|
test-support.displayManager.auto.user = "alice";
|
2022-03-10 20:31:10 +00:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
keepassxc
|
|
|
|
xdotool
|
|
|
|
];
|
2021-02-02 11:35:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enableOCR = true;
|
|
|
|
|
2022-03-10 20:31:10 +00:00
|
|
|
testScript = { nodes, ... }: let
|
|
|
|
aliceDo = cmd: ''machine.succeed("su - alice -c '${cmd}' >&2 &");'';
|
|
|
|
in ''
|
|
|
|
with subtest("Ensure X starts"):
|
|
|
|
start_all()
|
|
|
|
machine.wait_for_x()
|
|
|
|
|
|
|
|
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"}
|
|
|
|
|
|
|
|
with subtest("Ensure KeePassXC starts"):
|
|
|
|
# start KeePassXC window
|
|
|
|
${aliceDo "keepassxc >&2 &"}
|
2021-02-02 11:35:46 +00:00
|
|
|
|
2022-03-10 20:31:10 +00:00
|
|
|
machine.wait_for_text("KeePassXC ${pkgs.keepassxc.version}")
|
|
|
|
machine.screenshot("KeePassXC")
|
2021-02-02 11:35:46 +00:00
|
|
|
|
2022-03-10 20:31:10 +00:00
|
|
|
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")
|
2023-02-20 17:38:39 +00:00
|
|
|
machine.wait_for_text("Open database")
|
2022-03-10 20:31:10 +00:00
|
|
|
machine.send_key("ret")
|
2023-02-20 17:38:39 +00:00
|
|
|
|
|
|
|
# Wait for the enter password screen to appear.
|
|
|
|
machine.wait_for_text("/home/alice/foo.kdbx")
|
|
|
|
|
2022-03-10 20:31:10 +00:00
|
|
|
# Click on "Browse" button to select keyfile
|
|
|
|
machine.send_key("tab")
|
|
|
|
machine.send_chars("/home/alice/foo.keyfile")
|
|
|
|
machine.send_key("ret")
|
2022-05-16 09:37:16 +01:00
|
|
|
# Database is unlocked (doesn't have "[Locked]" in the title anymore)
|
|
|
|
machine.wait_for_text("foo.kdbx - KeePassXC")
|
2021-02-02 11:35:46 +00:00
|
|
|
'';
|
|
|
|
})
|