tests/ide_tests/run_python_exemple.sikuli/run_python_exemple.py
branchwxPython4
changeset 3424 7db96e011fe7
child 3446 de8cc85b688a
equal deleted inserted replaced
3423:84afcc0ebadd 3424:7db96e011fe7
       
     1 """ This test opens, 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 stdoutIdle = stdoutIdleObserver(proc)
       
    22 
       
    23 # To send keyboard shortuts
       
    24 k = KBDShortcut(app)
       
    25 
       
    26 k.Clean()
       
    27 
       
    28 stdoutIdle.Wait(2,15)
       
    29 
       
    30 k.Build()
       
    31 
       
    32 stdoutIdle.Wait(2,15)
       
    33 
       
    34 k.Connect()
       
    35 
       
    36 stdoutIdle.Wait(2,15)
       
    37 
       
    38 k.Transfer()
       
    39 
       
    40 stdoutIdle.Wait(2,15)
       
    41 
       
    42 #del idle
       
    43 
       
    44 del stdoutIdle
       
    45 
       
    46 k.Run()
       
    47 
       
    48 # wait 10 seconds for 10 Grumpfs
       
    49 found = waitPatternInStdout(proc, "Grumpf", 10, 10)
       
    50 
       
    51 app.close()
       
    52 
       
    53 if found:
       
    54     exit(0)
       
    55 else:
       
    56     exit(1)
       
    57