Release NixOS 23.11
[NixPkgs.git] / nixos / tests / qownnotes.nix
blob93801cb987027cf1fdb4c6b52efd3aab8bb9b05e
1 import ./make-test-python.nix ({ lib, pkgs, ...} :
4   name = "qownnotes";
5   meta.maintainers = [ lib.maintainers.pbek ];
7   nodes.machine = { ... }:
9   {
10     imports = [
11       ./common/user-account.nix
12       ./common/x11.nix
13     ];
15     test-support.displayManager.auto.user = "alice";
16     environment.systemPackages = [
17       pkgs.qownnotes
18       pkgs.xdotool
19     ];
20   };
22   enableOCR = true;
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()
31     with subtest("Check QOwnNotes version on CLI"):
32         ${aliceDo "qownnotes --version"}
34         machine.wait_for_console_text("QOwnNotes ${pkgs.qownnotes.version}")
36     with subtest("Ensure QOwnNotes starts"):
37         # start QOwnNotes window
38         ${aliceDo "qownnotes"}
40         machine.wait_for_text("Welcome to QOwnNotes")
41         machine.screenshot("QOwnNotes-Welcome")
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")
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")
60         machine.screenshot("QOwnNotes-DemoNote")
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!")
68         machine.screenshot("QOwnNotes-NewNote")
69   '';