at 25.11-pre 2.8 kB view raw
1import ./make-test-python.nix ( 2 { lib, pkgs, ... }: 3 4 { 5 name = "qownnotes"; 6 meta.maintainers = [ lib.maintainers.pbek ]; 7 8 nodes.machine = 9 { ... }: 10 11 { 12 imports = [ 13 ./common/user-account.nix 14 ./common/x11.nix 15 ]; 16 17 test-support.displayManager.auto.user = "alice"; 18 environment.systemPackages = [ 19 pkgs.qownnotes 20 pkgs.xdotool 21 ]; 22 }; 23 24 enableOCR = true; 25 26 # https://nixos.org/manual/nixos/stable/#ssec-machine-objects 27 testScript = 28 { nodes, ... }: 29 let 30 aliceDo = cmd: ''machine.succeed("su - alice -c '${cmd}' >&2 &");''; 31 in 32 '' 33 with subtest("Ensure X starts"): 34 start_all() 35 machine.wait_for_x() 36 37 with subtest("Check QOwnNotes version on CLI"): 38 ${aliceDo "qownnotes --version"} 39 40 machine.wait_for_console_text("QOwnNotes ${pkgs.qownnotes.version}") 41 42 with subtest("Ensure QOwnNotes starts"): 43 # start QOwnNotes window 44 ${aliceDo "qownnotes"} 45 46 machine.wait_for_text("Welcome to QOwnNotes") 47 machine.screenshot("QOwnNotes-Welcome") 48 49 with subtest("Finish first-run wizard"): 50 # The wizard should show up now 51 machine.wait_for_text("Note folder") 52 machine.send_key("ret") 53 machine.wait_for_console_text("Note path '/home/alice/Notes' was now created.") 54 machine.wait_for_text("Panel layout") 55 machine.send_key("ret") 56 machine.wait_for_text("Nextcloud") 57 machine.send_key("ret") 58 machine.wait_for_text("App metric") 59 machine.send_key("ret") 60 61 # Doesn't work for non-root 62 #machine.wait_for_window("QOwnNotes - ${pkgs.qownnotes.version}") 63 64 # OCR doesn't seem to be able any more to handle the main window 65 #machine.wait_for_text("QOwnNotes - ${pkgs.qownnotes.version}") 66 67 # The main window should now show up 68 machine.wait_for_open_port(22222) 69 machine.wait_for_console_text("QOwnNotes server listening on port 22222") 70 71 machine.screenshot("QOwnNotes-DemoNote") 72 73 with subtest("Create a new note"): 74 machine.send_key("ctrl-n") 75 machine.sleep(1) 76 machine.send_chars("This is a NixOS test!\n") 77 machine.wait_until_succeeds("find /home/alice/Notes -type f | grep -qi 'Note 2'") 78 79 # OCR doesn't seem to be able any more to handle the main window 80 #machine.wait_for_text("This is a NixOS test!") 81 82 # Doesn't work for non-root 83 #machine.wait_for_window("- QOwnNotes - ${pkgs.qownnotes.version}") 84 85 machine.screenshot("QOwnNotes-NewNote") 86 ''; 87 } 88)