Ejemplo n.º 1
0
def exitmenus():
    StormTest.PressButton(EXIT)
    StormTest.WaitSec(3)
    StormTest.PressButton(SELECT)  #in case there is an error on screen
    StormTest.WaitSec(3)
    StormTest.PressButton(EXIT)
    StormTest.WaitSec(3)
Ejemplo n.º 2
0
def pauseplay():
    exitmenus()
    StormTest.PressButton(PAUSE)
    StormTest.WaitSec(3)
    StormTest.PressButton(PLAY)
    StormTest.WaitSec(3)
    SThelperNew.takeScreenshot("Play Live", "Live TV should be playing")
Ejemplo n.º 3
0
def replayfeed(takeShot):
    if takeShot != True:
        StormTest.PressButton(REPLAY)
        StormTest.WaitSec(3)
    else:
        StormTest.PressButton(REPLAY)
        StormTest.WaitSec(3)
        SThelperNew.takeScreenshot('Replay test', 'Feed is replayed')
Ejemplo n.º 4
0
def wakebox():
    StormTest.PressButton(INFO)
    StormTest.WaitSec(3)
    StormTest.PressButton(INFO)
    StormTest.WaitSec(3)
    exitmenus()
    exitmenus()
    SThelperNew.takeScreenshot('Wake up Boxes',
                               'Are boxes awake? (Live TV Displays)')
Ejemplo n.º 5
0
def changechannel(cnumber):
    maxchannel = 9999
    try:
        if cnumber > maxchannel: cnumber = maxchannel
        StormTest.PressButton(cnumber)
        StormTest.PressButton(ENTER)
        StormTest.WaitSec(3)
        SThelperNew.takeScreenshot('Tune to channel' + str(cnumber),
                                   'Tuned to channel ' + str(cnumber))
    except:
        SThelperNew.takeScreenshot(
            'Change Channel',
            'Invalid channel given, input correct channel (1-9999)')
        return
Ejemplo n.º 6
0
def rewind(rvelocity):
    rspeed = [1, 2, 3, 4]
    ivarr = 0  #iteration variable for loop

    #if the specified velocity is invalid, spill error and exit function
    if rvelocity not in rspeed:
        return SThelperNew.takeScreenshot(
            'No Rewind',
            'No rewind occured, ensure valid input is added (1-4).')
    try:
        #iterate through rspeed list
        for rnum in range(len(rspeed)):
            #check whether rvelocity matches rspeed at rnum index
            if rspeed[rnum] == rvelocity:
                #Send IR commands until reaching the specified rvelocity
                while ivarr < rvelocity:
                    StormTest.PressButton(REWIND)
                    StormTest.WaitSec(3)
                    ivarr += 1
                #print out test case with corresponding rvelocity
                SThelperNew.takeScreenshot(
                    'Rewind test at x' + str(rvelocity),
                    'Box is rewinding at x' + str(rvelocity) + ' speed.')
                #break loop after this to save computation time
                break
    except:
        SThelperNew.takeScreenshot(
            'No Rewind',
            'Valid Input given but no rewind occured, check body of rewind function'
        )
        return
Ejemplo n.º 7
0
def forward(fvelocity):
    fspeed = [1, 2, 3, 4]
    ivarf = 0  #loop iteration variable

    #if the specified fvelocity is not in fspeed, error out and exit function
    if fvelocity not in fspeed:
        return SThelperNew.takeScreenshot(
            'No Forward',
            'No forward occured, ensure valid input is added (1-4)')
    try:
        #iterate through fspeed list
        for fnum in range(len(fspeed)):
            #check whether fvelocity matches fspeed at fnum index
            if fspeed[fnum] == fvelocity:
                #send IR commands until reaching the specified fvelocity
                while ivarf < fvelocity:
                    StormTest.PressButton(FORWARD)
                    StormTest.WaitSec(3)
                    ivarf += 1
                #print out test case with corresponding fvelocity
                SThelperNew.takeScreenshot(
                    'Forward test at x' + str(fvelocity),
                    'Box is forwarding at x' + str(fvelocity) + ' speed.')
                #break out of loop to save computation time
                break
    except:
        SThelperNew.takeScreenshot(
            'No Forward',
            'Valid input given but no forward occured, check main body of forward function'
        )
        return
Ejemplo n.º 8
0
def _tapWithMappedText(commands, mappedText):
    log.info("Tap on mapped text {0} {1}".format(mappedText,
                                                 commands[mappedText]))

    command = commands[mappedText]
    return StormTest.PressButton('TAP:{0}:{1}:{2}'.format(
        command['x'], command['y'], command['time']))
Ejemplo n.º 9
0
 def recharge(self, rechargeTime):
     time = str(rechargeTime)
     StormTest.PressButton("LOCK:{0}".format(time))
     StormTest.WaitSec(rechargeTime + 20)
     #StormTest.PressButton('SWIPE:1000:400:500:400')
     self.swipe([1000,400,300,400], 2)
     StormTest.WaitSec(1)
     pass
Ejemplo n.º 10
0
 def start(self, appName=''):
     self._appName = appName
     self._appCommands = _loadAppCommands(self, appName, self._commandsModuleName)
                          
     self.connect('')
                       
     self._userActionLog.info("Started application %s" % self._appName)
     return StormTest.PressButton("START-ANDROID:" + self._appName)
Ejemplo n.º 11
0
def advance(avelocity):
    #dictionary for every state of the advance feature, where key is the input (how many times advanced is pressed), and value is the corresponding advance time.
    adict = {
        1: '30s',
        2: '1m',
        3: '1m30s',
        4: '2m',
        5: '2m30s',
        6: '3m',
        7: '3m30s',
        8: '4m',
        9: '4m30s',
        10: '5m',
        11: '5m30s',
        12: '6m',
        13: '6m30s',
        14: '7m',
        15: '7m30s',
        16: '8m',
        17: '8m30s',
        18: '9m',
        19: '9m30s',
        20: '10m'
    }
    ivara = 0  #loop iteration variable
    #if the specified avelocity is not a valid key in adic, quit out of function
    if avelocity not in adict:
        return SThelperNew.takeScreenshot(
            'No Advance',
            'No advance occured, ensure valid input is added (1-20)')
    try:
        #iterate through adic dictionary. items() returns a tuple, hence the for loop has key, value pair
        for key, value in adict.items():
            #find the correct key corresponding with avelocity
            if key == avelocity:
                #send IR commands for advance until desired input is reached
                while ivara < avelocity:
                    StormTest.PressButton(ADVANCE)
                    StormTest.WaitSec(1)
                    ivara += 1
                #print out test case with corresponding key and value pair
                SThelperNew.takeScreenshot(
                    'Advance test' + str(key), 'Advance forward ' +
                    str(value) + ' at ' + str(key) + ' input.')
                #break out of loop to save computation time
                break
    except:
        SThelperNew.takeScreenshot(
            'No Advance',
            'Valid input given but advance did not occur, check main body of advance function'
        )
        return
Ejemplo n.º 12
0
 def stop(self):
     self._userActionLog.info("Stopped application %s" % self._appName)
     if not StormTest.PressButton("STOP-ANDROID"):
         self._userActionLog.error("Stop application failed. Disconnection will continue")
     pass
Ejemplo n.º 13
0
def _tapWithText(text):
    log.info("Tap on element with text {0}".format(text))
    return StormTest.PressButton("TAPELEMENT:text:{0}".format(text))
Ejemplo n.º 14
0
def openguide():
    StormTest.PressButton(GUIDE)
    StormTest.WaitSec(3)
    SThelperNew.takeScreenshot('Guide Test', 'Guide UI Elements appear as BAU')
Ejemplo n.º 15
0
def replayfeed():
    StormTest.PressButton(REPLAY)
    StormTest.WaitSec(3)
    SThelperNew.takeScreenshot('Replay test', 'Feed is replayed')
Ejemplo n.º 16
0
 def settings(self):
     StormTest.PressButton("TAP:1125:515:0")
     StormTest.WaitSec(1)
     pass
Ejemplo n.º 17
0
def doTest():
    i = 0

    for i in range(5):
        '''1st step: Go to DTT ch.031'''
        step_name = "Step" + str(5 * i + 1) + ": Go to DTT ch.031"
        StormTest.BeginTestStep(step_name)

        StormTest.PressButton('Stop')
        StormTest.PressDigits(031, waitSec=0.5)

        ret_motion = StormTest.DetectMotionEx((559, 179, 655, 301), 5)
        if ret_motion[0][1]:
            step_comment = "Go to DTT ch.31 is success"
            print ret_motion
            StormTest.EndTestStep(step_name, StormTest.TM.PASS, step_comment)
        else:
            step_comment = "Go to DTT ch.31 is failed"
            StormTest.EndTestStep(step_name, StormTest.TM.FAIL, step_comment)

        print step_comment
        StormTest.CaptureImageEx(None, "Step1.png")
        '''2st step: Go to DTT Duide'''
        step_name = "Step " + str(5 * i + 2) + ": Go to DTT Duide"
        StormTest.BeginTestStep(step_name)
        StormTest.PressButton('TV_Guide')
        StormTest.WaitSec(5)

        ret = [83, 34, 230, 58]
        ocr_result = StormTest.OCRSlot(ret)
        print ocr_result
        if ocr_result[4][0][1].strip() == 'DTT GUIDE':
            step_comment = "Go to DTT Guide success"
            print ocr_result
            StormTest.EndTestStep(step_name, StormTest.TM.PASS, step_comment)
        else:
            step_comment = "Go to DTT Guide is failed"
            StormTest.EndTestStep(step_name, StormTest.TM.FAIL, step_comment)

        print step_comment
        StormTest.CaptureImageEx(None, "Step2.png")
        '''3rd step: Check program name'''
        step_name = "Step" + str(5 * i + 3) + ": Check program name"
        StormTest.BeginTestStep(step_name)

        ret_name = [420, 643, 414, 37]
        ocr_result_name = StormTest.OCRSlot(ret_name)
        print ocr_result_name
        if ocr_result_name[4][0][1] != '':
            step_comment = "Program name is correct"
            print ocr_result_name
            StormTest.EndTestStep(step_name, StormTest.TM.PASS, step_comment)
        else:
            step_comment = "Program name is incorrect"
            StormTest.EndTestStep(step_name, StormTest.TM.FAIL, step_comment)

        print step_comment
        StormTest.CaptureImageEx(None, "Step3.png")
        '''4th step: Exit to Live'''
        step_name = "Step " + str(5 * i + 4) + ": Exit to Live"
        StormTest.BeginTestStep(step_name)

        StormTest.PressButton('Ok')
        ret_motion_live = StormTest.DetectMotionEx((359, 163, 1135, 371), 5)
        if ret_motion_live[0][1]:
            step_comment = "Exit to Live success"
            print ret_motion_live
            StormTest.EndTestStep(step_name, StormTest.TM.PASS, step_comment)
        else:
            step_comment = "Exit to Live is failed"
            StormTest.EndTestStep(step_name, StormTest.TM.FAIL, step_comment)

        print step_comment
        StormTest.CaptureImageEx(None, "Step4.png")
        '''5th step: Check program name on Mini-Guide'''
        step_name = "Step " + str(5 * i +
                                  5) + ": Check program name on Mini-Guide"
        StormTest.BeginTestStep(step_name)

        ret_name = [222, 678, 448, 41]
        ocr_result_name_step_5 = StormTest.OCRSlot(ret_name)
        print ocr_result_name_step_5
        if ocr_result[4][0][1].strip() == ocr_result_name[4][0][1]:
            step_comment = "Program name is correct"
            print ocr_result_name
            StormTest.EndTestStep(step_name, StormTest.TM.PASS, step_comment)
        else:
            step_comment = "Program name is incorrect"
            StormTest.EndTestStep(step_name, StormTest.TM.FAIL, step_comment)

        print step_comment
        StormTest.CaptureImageEx(None, "Step5.png")

        StormTest.PressButton('Channel+')

    return StormTest.TM.PASS
Ejemplo n.º 18
0
 def back(self):
     StormTest.PressButton("TAP:1125:515:0")
     StormTest.WaitSec(1)
     pass
Ejemplo n.º 19
0
 def down(self):
     StormTest.PressButton("TAP:1225:535:0")
     StormTest.WaitSec(1)
     pass
Ejemplo n.º 20
0
def playfeed():
    StormTest.PressButton(PLAY)
    StormTest.WaitSec(3)
    SThelperNew.takeScreenshot('Play Feed', 'Box is in a playing state')
Ejemplo n.º 21
0
def pausefeed():
    StormTest.PressButton(PAUSE)
    StormTest.WaitSec(3)
    SThelperNew.takeScreenshot('Feed Pause', 'Box is in a Paused state')
Ejemplo n.º 22
0
def _tapWithIndex(index):
    log.info("Tap on element with index {0}".format(index))
    return StormTest.PressButton("TAPELEMENT:index:{0}".format(index))
Ejemplo n.º 23
0
 def open(self):
     StormTest.PressButton("TAP:1230:435:0")
     StormTest.WaitSec(1)
     pass
Ejemplo n.º 24
0
 def close(self):
     StormTest.PressButton("TAP:1270:450:0")
     StormTest.WaitSec(1)
     pass
Ejemplo n.º 25
0
 def swipe(self, coordinates=[0, 0, 0, 0], time=0):
     log.info("Swipe from ({0}, {1}) to ({2}, {3}) with time {4}".format(coordinates[0], coordinates[1], coordinates[2], coordinates[3], time))
     return StormTest.PressButton("SWIPE:{0}:{1}:{2}:{3}:{4}".format(coordinates[0], coordinates[1], coordinates[2], coordinates[3], time))
Ejemplo n.º 26
0
def _tapWithDesc(desc):
    log.info("Tap on element with desc {0}".format(desc))
    return StormTest.PressButton("TAPELEMENT:desc:{0}".format(desc))
Ejemplo n.º 27
0
 def up(self):
     StormTest.PressButton("TAP:1225:360:0")
     StormTest.WaitSec(1)
     pass