def playVideo(device, serviceInfo): StormTest.BeginLogRegion('Play Video') if serviceInfo['name'] == 'Sky TG24': isPlayed = _playSkyTG24(device) StormTest.EndLogRegion('Play Video') return isPlayed videoName = _pickRandomVideo(device) isPlayed = False if _findVideo(device, videoName): isPlayed = _startVideo(device) StormTest.EndLogRegion('Play Video') return isPlayed
def closeApp(device): StormTest.BeginLogRegion('Close App') StormTest.WaitSec(2) device.tap(mappedText='Home') result = colorMatch(color=(233, 235, 233), tolerances=(16, 16, 16), flatness=95, peakError=15, includedAreas=[940, 990, 10, 10], timeToWait=60, imageName='CloseApp', comment='Match color on returning to home') if not result: device.tap(mappedText='Home') colorMatch(color=(233, 235, 233), tolerances=(16, 16, 16), flatness=95, peakError=15, includedAreas=[940, 990, 10, 10], timeToWait=60, imageName='CloseApp', comment='Match color on returning to home') device.stop() StormTest.EndLogRegion('Close App') return result
def disconnect(self): StormTest.BeginLogRegion('Close Connection') self._connectionLog.info("Closing connection with the server\n") logging.shutdown() isClosed = StormTest.ReleaseServerConnection() StormTest.EndLogRegion('Close Connection') return isClosed
def __logReserveSlotResult(slot, isReserved): if isReserved is 0: StormTest.EndLogRegion('Open Connection', StormTest.LogRegionStyle.Fail, comment='Failed to reserve slot %d' % slot) log.error('Failed to reserve slot %d' % slot) else: log.info("Slot %d reserved" % slot) pass
def __logRemainingCharsResult(remainingChars): log.info("Remaining OCR chars in license: %d" % remainingChars) if remainingChars is 0: StormTest.EndLogRegion( 'Open Connection', StormTest.LogRegionStyle.Fail, comment='OCR licenses has ran out. Not possible to run tests') log.error("OCR licenses has ran out. Not possible to run tests") pass
def audioPresent(galaxyTab3, serviceInfo): StormTest.BeginLogRegion('audioPresent') video = _startTest('audioPresent') result, comment = _audioPresentTest() _endTest('audioPresent', serviceInfo, result, video, comment) StormTest.EndLogRegion('audioPresent') return result
def videoPresent(galaxyTab3, serviceInfo): StormTest.BeginLogRegion('videoPresent') video = _startTest('videoPresent') result, comment, image = _videoPresentTest() _endTest('videoPresent', serviceInfo, result, video, comment, image) StormTest.EndLogRegion('videoPresent') return result
def __openConnection(server, description): try: log.info("Opening connection to server: '%s'" % server) StormTest.ConnectToServer(server, description) except SystemExit: log.error("Failed to connect to server") StormTest.EndLogRegion('Open Connection', StormTest.LogRegionStyle.Fail, comment='Failed to connect to server (%s)' % server) return False log.info("Connection established with the server") return True
def catalogAvailability(galaxyTab3, serviceInfo): if _connectionError(galaxyTab3): log.error("App connection error: test aborted") return False StormTest.BeginLogRegion('catalogBrowsing') video = _startTest('catalogBrowsing') catalogName = serviceInfo['name'] result, comment, image = goToCatalog(galaxyTab3, catalogName) _endTest('catalogBrowsing', serviceInfo, result, video, comment, image) StormTest.EndLogRegion('catalogBrowsing') return result
def stopVideo(device): StormTest.BeginLogRegion('Stop Video') device.tap(mappedText='closeVideo') device.tap(mappedText='closeVideo') device.tap(text='No') result = colorMatch(color=(50, 114, 167), tolerances=(16, 16, 16), flatness=90, peakError=80, includedAreas=[430, 80, 10, 10], timeToWait=60, imageName='StopVideo', comment='Match color on closing the video') StormTest.EndLogRegion('Stop Video') checkCrash(device) return result
def __isConnectionOk(isServerConnected, isSlotReserved): isConnectionOk = False if isServerConnected and isSlotReserved: isConnectionOk = __OCRCheckRemainingChars() log.info("Connection established and slot reserved" ) if isConnectionOk else log.info("Connection failed") if isConnectionOk: log.info("Connection established and slot reserved") StormTest.EndLogRegion( 'Open Connection', StormTest.LogRegionStyle.Pass, comment='Connection with the server established') else: log.error("Connection failed") return isConnectionOk