about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorDoron Behar <doron.behar@gmail.com>2024-06-03 02:28:26 +0300
committerDoron Behar <doron.behar@gmail.com>2024-06-03 03:16:47 +0300
commit138ad7b73ac34a289403ba9bf4d5b0da691ab3e4 (patch)
tree483360260cbbb04ed0785259e575097649035180 /nixos
parentcb4edfcc55ab74dcdac4214aaf166558cef88ac0 (diff)
nixos.tests.musescore: fix and improve
- Use the print dialog to create a sample score.
- Copy also the sample score from the vm to $out of the test.
- Create a bit more screenshots
- Only use machine.wait_for_window, never machine.wait_for_text which
  requires OCR which is slow.
- Set XDG_RUNTIME_DIR so it won't dump core.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/musescore.nix34
1 files changed, 12 insertions, 22 deletions
diff --git a/nixos/tests/musescore.nix b/nixos/tests/musescore.nix
index 0720631ed284b..559c91ed8e550 100644
--- a/nixos/tests/musescore.nix
+++ b/nixos/tests/musescore.nix
@@ -43,13 +43,10 @@ in
     )
 
     # Start MuseScore window
-    machine.execute("DISPLAY=:0.0 mscore >&2 &")
+    machine.execute("env XDG_RUNTIME_DIR=$PWD DISPLAY=:0.0 mscore >&2 &")
 
     # Wait until MuseScore has launched
-    machine.wait_for_window("MuseScore 4")
-
-    # Wait until the window has completely initialised
-    machine.wait_for_text("MuseScore 4")
+    machine.wait_for_window("MuseScore Studio")
 
     machine.screenshot("MuseScore0")
 
@@ -75,29 +72,22 @@ in
     machine.screenshot("MuseScore2")
 
     # Go to the export dialogue and create a PDF
-    machine.send_key("alt-f")
-    machine.sleep(1)
-    machine.send_key("e")
-
-    # Wait until the export dialogue appears.
-    machine.wait_for_text("Export")
+    machine.send_key("ctrl-p")
 
-    machine.screenshot("MuseScore3")
+    # Wait until the Print dialogue appears.
+    machine.wait_for_window("Print")
 
-    machine.send_key("shift-tab")
-    machine.sleep(1)
-    machine.send_key("ret")
+    machine.screenshot("MuseScore4")
+    machine.send_key("alt-p")
     machine.sleep(1)
-    machine.send_key("ret")
 
-    machine.screenshot("MuseScore4")
+    machine.screenshot("MuseScore5")
 
     # Wait until PDF is exported
-    machine.wait_for_file('"/root/Documents/MuseScore4/Scores/Untitled score.pdf"')
+    machine.wait_for_file('"/root/Untitled score.pdf"')
 
-    # Check that it contains the title of the score
-    machine.succeed('pdfgrep "Untitled score" "/root/Documents/MuseScore4/Scores/Untitled score.pdf"')
-
-    machine.screenshot("MuseScore5")
+    ## Check that it contains the title of the score
+    machine.succeed('pdfgrep "Untitled score" "/root/Untitled score.pdf"')
+    machine.copy_from_vm("/root/Untitled score.pdf")
   '';
 })