Tests: add an IDE test that relies on image matching. wxPython4
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Mon, 28 Feb 2022 21:53:14 +0100
branchwxPython4
changeset 3436 ccaabb9da623
parent 3435 c17155fd8573
child 3437 ce366d67a5b7
Tests: add an IDE test that relies on image matching.
tests/ide_tests/edit_project.sikuli/1646062660770.png
tests/ide_tests/edit_project.sikuli/1646066794902.png
tests/ide_tests/edit_project.sikuli/1646066996620.png
tests/ide_tests/edit_project.sikuli/edit_project.py
tests/ide_tests/new_project.sikuli/new_project.py
Binary file tests/ide_tests/edit_project.sikuli/1646062660770.png has changed
Binary file tests/ide_tests/edit_project.sikuli/1646066794902.png has changed
Binary file tests/ide_tests/edit_project.sikuli/1646066996620.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/ide_tests/edit_project.sikuli/edit_project.py	Mon Feb 28 21:53:14 2022 +0100
@@ -0,0 +1,72 @@
+""" This test opens, modifies, builds and runs exemple project named "python".
+Test succeeds if runtime's stdout behaves as expected
+"""
+
+import os
+import time
+
+# allow module import from current test directory's parent
+addImportPath(os.path.dirname(getBundlePath()))
+
+# common test definitions module
+from sikuliberemiz import *
+
+# Start the app
+proc,app = StartBeremizApp(exemple="python")
+
+# To detect when actions did finish because IDE content isn't changing
+# idle = IDEIdleObserver(app)
+# screencap based idle detection was making many false positive. Test is more stable with stdout based idle detection
+
+doubleClick("1646062660770.png")
+
+click("1646066794902.png")
+
+type(Key.DOWN * 10, Key.CTRL)
+
+doubleClick("1646066996620.png")
+
+type(Key.TAB*3)  # select text content
+
+type("'sys.stdout.write(\"EDIT TEST OK\")'")
+
+type(Key.ENTER)
+
+stdoutIdle = stdoutIdleObserver(proc)
+
+# To send keyboard shortuts
+k = KBDShortcut(app)
+
+k.Clean()
+
+stdoutIdle.Wait(2,15)
+
+k.Save()
+k.Build()
+
+stdoutIdle.Wait(2,15)
+
+k.Connect()
+
+stdoutIdle.Wait(2,15)
+
+k.Transfer()
+
+stdoutIdle.Wait(2,15)
+
+#del idle
+
+del stdoutIdle
+
+k.Run()
+
+# wait 10 seconds for 10 Grumpfs
+found = waitPatternInStdout(proc, "EDIT TEST OK", 10)
+
+app.close()
+
+if found:
+    exit(0)
+else:
+    exit(1)
+
--- a/tests/ide_tests/new_project.sikuli/new_project.py	Mon Feb 28 21:46:37 2022 +0100
+++ b/tests/ide_tests/new_project.sikuli/new_project.py	Mon Feb 28 21:53:14 2022 +0100
@@ -1,4 +1,4 @@
-""" This test opens, builds and runs exemple project named "python".
+""" This test opens, builds and runs a new project.
 Test succeeds if runtime's stdout behaves as expected
 """