1import ./make-test-python.nix ({ lib, pkgs, ...} :
2
3{
4 name = "qownnotes";
5 meta.maintainers = [ lib.maintainers.pbek ];
6
7 nodes.machine = { ... }:
8
9 {
10 imports = [
11 ./common/user-account.nix
12 ./common/x11.nix
13 ];
14
15 test-support.displayManager.auto.user = "alice";
16 environment.systemPackages = [
17 pkgs.qownnotes
18 pkgs.xdotool
19 ];
20 };
21
22 enableOCR = true;
23
24 testScript = { nodes, ... }: let
25 aliceDo = cmd: ''machine.succeed("su - alice -c '${cmd}' >&2 &");'';
26 in ''
27 with subtest("Ensure X starts"):
28 start_all()
29 machine.wait_for_x()
30
31 with subtest("Check QOwnNotes version on CLI"):
32 ${aliceDo "qownnotes --version"}
33
34 machine.wait_for_console_text("QOwnNotes ${pkgs.qownnotes.version}")
35
36 with subtest("Ensure QOwnNotes starts"):
37 # start QOwnNotes window
38 ${aliceDo "qownnotes"}
39
40 machine.wait_for_text("Welcome to QOwnNotes")
41 machine.screenshot("QOwnNotes-Welcome")
42
43 with subtest("Finish first-run wizard"):
44 # The wizard should show up now
45 machine.wait_for_text("Note folder")
46 machine.send_key("ret")
47 machine.wait_for_console_text("Note path '/home/alice/Notes' was now created.")
48 machine.wait_for_text("Panel layout")
49 machine.send_key("ret")
50 machine.wait_for_text("Nextcloud")
51 machine.send_key("ret")
52 machine.wait_for_text("App metric")
53 machine.send_key("ret")
54
55 # The main window should now show up
56 machine.wait_for_text("QOwnNotes - ${pkgs.qownnotes.version}")
57 machine.wait_for_open_port(22222)
58 machine.wait_for_console_text("QOwnNotes server listening on port 22222")
59
60 machine.screenshot("QOwnNotes-DemoNote")
61
62 with subtest("Create a new note"):
63 machine.send_key("ctrl-n")
64 machine.sleep(1)
65 machine.send_chars("This is a NixOS test!\n")
66 machine.wait_for_text("This is a NixOS test!")
67
68 machine.screenshot("QOwnNotes-NewNote")
69 '';
70})