author | Edouard Tisserant <edouard.tisserant@gmail.com> |
Tue, 29 Mar 2022 08:50:01 +0200 | |
branch | wxPython4 |
changeset 3446 | de8cc85b688a |
parent 3442 | 29dbdb09da2e |
child 3447 | 65c5f66e9298 |
permissions | -rw-r--r-- |
3436
ccaabb9da623
Tests: add an IDE test that relies on image matching.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3424
diff
changeset
|
1 |
""" This test opens, modifies, builds and runs exemple project named "python". |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
2 |
Test succeeds if runtime's stdout behaves as expected |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
3 |
""" |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
4 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
5 |
import os |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
6 |
import time |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
7 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
8 |
# allow module import from current test directory's parent |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
9 |
addImportPath(os.path.dirname(getBundlePath())) |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
10 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
11 |
# common test definitions module |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
12 |
from sikuliberemiz import * |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
13 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
14 |
# Start the app |
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
15 |
app = BeremizApp(exemple="python") |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
16 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
17 |
app.doubleClick("1646062660770.png") |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
18 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
19 |
app.WaitIdleUI() |
3436
ccaabb9da623
Tests: add an IDE test that relies on image matching.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3424
diff
changeset
|
20 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
21 |
app.click("example") |
3437
ce366d67a5b7
Tests: Enhance robustness of stdout driven waiting state in Sikuli based tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3436
diff
changeset
|
22 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
23 |
app.WaitIdleUI() |
3436
ccaabb9da623
Tests: add an IDE test that relies on image matching.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3424
diff
changeset
|
24 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
25 |
app.type(Key.DOWN * 10, Key.CTRL) |
3437
ce366d67a5b7
Tests: Enhance robustness of stdout driven waiting state in Sikuli based tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3436
diff
changeset
|
26 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
27 |
app.WaitIdleUI() |
3436
ccaabb9da623
Tests: add an IDE test that relies on image matching.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3424
diff
changeset
|
28 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
29 |
app.doubleClick("1646066996620.png") |
3437
ce366d67a5b7
Tests: Enhance robustness of stdout driven waiting state in Sikuli based tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3436
diff
changeset
|
30 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
31 |
app.WaitIdleUI() |
3436
ccaabb9da623
Tests: add an IDE test that relies on image matching.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3424
diff
changeset
|
32 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
33 |
app.type(Key.TAB*3) # select text content |
3437
ce366d67a5b7
Tests: Enhance robustness of stdout driven waiting state in Sikuli based tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3436
diff
changeset
|
34 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
35 |
app.type("'sys.stdout.write(\"EDIT TEST OK\\n\")'") |
3436
ccaabb9da623
Tests: add an IDE test that relies on image matching.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3424
diff
changeset
|
36 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
37 |
app.type(Key.ENTER) |
3436
ccaabb9da623
Tests: add an IDE test that relies on image matching.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3424
diff
changeset
|
38 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
39 |
app.WaitIdleUI() |
3436
ccaabb9da623
Tests: add an IDE test that relies on image matching.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3424
diff
changeset
|
40 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
41 |
app.k.Save() |
3437
ce366d67a5b7
Tests: Enhance robustness of stdout driven waiting state in Sikuli based tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3436
diff
changeset
|
42 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
43 |
app.k.Clean() |
3437
ce366d67a5b7
Tests: Enhance robustness of stdout driven waiting state in Sikuli based tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3436
diff
changeset
|
44 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
45 |
app.waitForChangeAndIdleStdout() |
3437
ce366d67a5b7
Tests: Enhance robustness of stdout driven waiting state in Sikuli based tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3436
diff
changeset
|
46 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
47 |
app.k.Build() |
3437
ce366d67a5b7
Tests: Enhance robustness of stdout driven waiting state in Sikuli based tests.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3436
diff
changeset
|
48 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
49 |
app.waitForChangeAndIdleStdout() |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
50 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
51 |
app.k.Connect() |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
52 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
53 |
app.waitForChangeAndIdleStdout() |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
54 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
55 |
app.k.Transfer() |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
56 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
57 |
app.waitForChangeAndIdleStdout() |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
58 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
59 |
app.k.Run() |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
60 |
|
3446
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
61 |
# wait 10 seconds for 10 patterns |
de8cc85b688a
Tests: refactored sikuli based test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3442
diff
changeset
|
62 |
found = app.waitPatternInStdout("EDIT TEST OK", 10) |
3424
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
63 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
64 |
app.close() |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
65 |
|
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
66 |
if found: |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
67 |
exit(0) |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
68 |
else: |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
69 |
exit(1) |
7db96e011fe7
Tests: added tests/Makefile and a first test in tests/ide_tests. Test requires sikuli and Xvfb or Xnest.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
70 |