1 import ./make-test-python.nix ({ lib, pkgs, ...} :
5 meta.maintainers = [ lib.maintainers.pbek ];
7 nodes.machine = { ... }:
11 ./common/user-account.nix
15 test-support.displayManager.auto.user = "alice";
16 environment.systemPackages = [
24 # https://nixos.org/manual/nixos/stable/#ssec-machine-objects
25 testScript = { nodes, ... }: let
26 aliceDo = cmd: ''machine.succeed("su - alice -c '${cmd}' >&2 &");'';
28 with subtest("Ensure X starts"):
32 with subtest("Check QOwnNotes version on CLI"):
33 ${aliceDo "qownnotes --version"}
35 machine.wait_for_console_text("QOwnNotes ${pkgs.qownnotes.version}")
37 with subtest("Ensure QOwnNotes starts"):
38 # start QOwnNotes window
39 ${aliceDo "qownnotes"}
41 machine.wait_for_text("Welcome to QOwnNotes")
42 machine.screenshot("QOwnNotes-Welcome")
44 with subtest("Finish first-run wizard"):
45 # The wizard should show up now
46 machine.wait_for_text("Note folder")
47 machine.send_key("ret")
48 machine.wait_for_console_text("Note path '/home/alice/Notes' was now created.")
49 machine.wait_for_text("Panel layout")
50 machine.send_key("ret")
51 machine.wait_for_text("Nextcloud")
52 machine.send_key("ret")
53 machine.wait_for_text("App metric")
54 machine.send_key("ret")
56 # Doesn't work for non-root
57 #machine.wait_for_window("QOwnNotes - ${pkgs.qownnotes.version}")
59 # OCR doesn't seem to be able any more to handle the main window
60 #machine.wait_for_text("QOwnNotes - ${pkgs.qownnotes.version}")
62 # The main window should now show up
63 machine.wait_for_open_port(22222)
64 machine.wait_for_console_text("QOwnNotes server listening on port 22222")
66 machine.screenshot("QOwnNotes-DemoNote")
68 with subtest("Create a new note"):
69 machine.send_key("ctrl-n")
71 machine.send_chars("This is a NixOS test!\n")
72 machine.wait_until_succeeds("find /home/alice/Notes -type f | grep -qi 'Note 2'")
74 # OCR doesn't seem to be able any more to handle the main window
75 #machine.wait_for_text("This is a NixOS test!")
77 # Doesn't work for non-root
78 #machine.wait_for_window("- QOwnNotes - ${pkgs.qownnotes.version}")
80 machine.screenshot("QOwnNotes-NewNote")