author | Edouard Tisserant <edouard@beremiz.fr> |
Tue, 16 Jul 2024 09:41:45 +0200 | |
changeset 3989 | 987c69b1582f |
parent 3853 | e1cfb03e6582 |
permissions | -rw-r--r-- |
3840
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
1 |
""" This test opens, builds and runs exemple project named "python". |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
2 |
Test succeeds if runtime's stdout behaves as expected |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
3 |
""" |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
4 |
|
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
5 |
import os |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
6 |
import time |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
7 |
|
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
8 |
# allow module import from current test directory's parent |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
9 |
addImportPath(os.path.dirname(getBundlePath())) |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
10 |
|
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
11 |
# common test definitions module |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
12 |
from sikuliberemiz import * |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
13 |
|
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
14 |
def test(app): |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
15 |
# Start the app |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
16 |
|
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
17 |
app.k.Clean() |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
18 |
|
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
19 |
app.waitForChangeAndIdleStdout() |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
20 |
|
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
21 |
app.k.Build() |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
22 |
|
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
23 |
app.waitPatternInStdout("Successfully built.", 10) |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
24 |
|
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
25 |
app.k.Connect() |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
26 |
|
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
27 |
app.waitForChangeAndIdleStdout() |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
28 |
|
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
29 |
app.k.Transfer() |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
30 |
|
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
31 |
app.waitForChangeAndIdleStdout() |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
32 |
|
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
33 |
app.k.Run() |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
34 |
|
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
35 |
app.waitForChangeAndIdleStdout() |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
36 |
# app.WaitIdleUI() |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
37 |
|
3853
e1cfb03e6582
Tests: more OCR tuning
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3840
diff
changeset
|
38 |
app.ocropts.fontSize(20) |
e1cfb03e6582
Tests: more OCR tuning
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
3840
diff
changeset
|
39 |
#app.ocropts.textHeight(25) |
3840
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
40 |
app.click("OFF") |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
41 |
|
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
42 |
# wait 10 seconds for 10 Grumpfs |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
43 |
return app.waitPatternInStdout("ALL GREEN LIGHTS", 10) |
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
44 |
|
c2b6354f036f
Tests: Add minimal SVGHMI test
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
45 |
run_test(test, testproject="svghmi_basic") |