nixpkgs/nixos/tests/qownnotes.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

89 lines
2.7 KiB
Nix
Raw Normal View History

2023-06-16 06:19:47 +00:00
import ./make-test-python.nix (
{ lib, pkgs, ... }:
{
name = "qownnotes";
meta.maintainers = [ lib.maintainers.pbek ];
2023-06-16 06:19:47 +00:00
nodes.machine =
{ ... }:
{
2023-06-16 06:19:47 +00:00
imports = [
./common/user-account.nix
./common/x11.nix
];
2023-06-16 06:19:47 +00:00
test-support.displayManager.auto.user = "alice";
environment.systemPackages = [
pkgs.qownnotes
pkgs.xdotool
];
};
2023-06-16 06:19:47 +00:00
enableOCR = true;
2024-02-16 12:08:22 +00:00
# https://nixos.org/manual/nixos/stable/#ssec-machine-objects
2023-06-16 06:19:47 +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()
2023-06-16 06:19:47 +00:00
with subtest("Check QOwnNotes version on CLI"):
${aliceDo "qownnotes --version"}
2023-06-16 06:19:47 +00:00
machine.wait_for_console_text("QOwnNotes ${pkgs.qownnotes.version}")
2023-06-16 06:19:47 +00:00
with subtest("Ensure QOwnNotes starts"):
# start QOwnNotes window
${aliceDo "qownnotes"}
2023-06-16 06:19:47 +00:00
machine.wait_for_text("Welcome to QOwnNotes")
machine.screenshot("QOwnNotes-Welcome")
2023-06-16 06:19:47 +00:00
with subtest("Finish first-run wizard"):
# The wizard should show up now
machine.wait_for_text("Note folder")
machine.send_key("ret")
machine.wait_for_console_text("Note path '/home/alice/Notes' was now created.")
machine.wait_for_text("Panel layout")
machine.send_key("ret")
machine.wait_for_text("Nextcloud")
machine.send_key("ret")
machine.wait_for_text("App metric")
machine.send_key("ret")
2024-02-16 12:08:22 +00:00
# Doesn't work for non-root
#machine.wait_for_window("QOwnNotes - ${pkgs.qownnotes.version}")
2024-02-16 12:08:22 +00:00
# OCR doesn't seem to be able any more to handle the main window
#machine.wait_for_text("QOwnNotes - ${pkgs.qownnotes.version}")
2023-06-16 06:19:47 +00:00
# The main window should now show up
machine.wait_for_open_port(22222)
machine.wait_for_console_text("QOwnNotes server listening on port 22222")
2023-06-16 06:19:47 +00:00
machine.screenshot("QOwnNotes-DemoNote")
2023-06-16 06:19:47 +00:00
with subtest("Create a new note"):
machine.send_key("ctrl-n")
machine.sleep(1)
machine.send_chars("This is a NixOS test!\n")
2024-02-16 12:08:22 +00:00
machine.wait_until_succeeds("find /home/alice/Notes -type f | grep -qi 'Note 2'")
2024-02-16 12:08:22 +00:00
# OCR doesn't seem to be able any more to handle the main window
#machine.wait_for_text("This is a NixOS test!")
2024-02-16 12:08:22 +00:00
# Doesn't work for non-root
#machine.wait_for_window("- QOwnNotes - ${pkgs.qownnotes.version}")
2023-06-16 06:19:47 +00:00
machine.screenshot("QOwnNotes-NewNote")
'';
}
)