equal
deleted
inserted
replaced
|
1 """ This test opens, modifies, builds and runs exemple project named "python". |
|
2 Test succeeds if runtime's stdout behaves as expected |
|
3 """ |
|
4 |
|
5 import os |
|
6 import time |
|
7 |
|
8 # allow module import from current test directory's parent |
|
9 addImportPath(os.path.dirname(getBundlePath())) |
|
10 |
|
11 # common test definitions module |
|
12 from sikuliberemiz import * |
|
13 |
|
14 # Start the app |
|
15 proc,app = StartBeremizApp(exemple="python") |
|
16 |
|
17 # To detect when actions did finish because IDE content isn't changing |
|
18 # idle = IDEIdleObserver(app) |
|
19 # screencap based idle detection was making many false positive. Test is more stable with stdout based idle detection |
|
20 |
|
21 doubleClick("1646062660770.png") |
|
22 |
|
23 click("1646066794902.png") |
|
24 |
|
25 type(Key.DOWN * 10, Key.CTRL) |
|
26 |
|
27 doubleClick("1646066996620.png") |
|
28 |
|
29 type(Key.TAB*3) # select text content |
|
30 |
|
31 type("'sys.stdout.write(\"EDIT TEST OK\")'") |
|
32 |
|
33 type(Key.ENTER) |
|
34 |
|
35 stdoutIdle = stdoutIdleObserver(proc) |
|
36 |
|
37 # To send keyboard shortuts |
|
38 k = KBDShortcut(app) |
|
39 |
|
40 k.Clean() |
|
41 |
|
42 stdoutIdle.Wait(2,15) |
|
43 |
|
44 k.Save() |
|
45 k.Build() |
|
46 |
|
47 stdoutIdle.Wait(2,15) |
|
48 |
|
49 k.Connect() |
|
50 |
|
51 stdoutIdle.Wait(2,15) |
|
52 |
|
53 k.Transfer() |
|
54 |
|
55 stdoutIdle.Wait(2,15) |
|
56 |
|
57 #del idle |
|
58 |
|
59 del stdoutIdle |
|
60 |
|
61 k.Run() |
|
62 |
|
63 # wait 10 seconds for 10 Grumpfs |
|
64 found = waitPatternInStdout(proc, "EDIT TEST OK", 10) |
|
65 |
|
66 app.close() |
|
67 |
|
68 if found: |
|
69 exit(0) |
|
70 else: |
|
71 exit(1) |
|
72 |