def test_tap_using_mapped_text(self): print "TEST TAP MAPPED TEXT" isOpenPressed = self.device.tap(mappedText='OpenMenu') colorMatch = StormTest.WaitColorMatch((66, 171, 159), tolerances=(16, 16, 16), flatness=90, peakError=50, includedAreas=[420, 300, 10, 10], timeToWait=10) isOpen = colorMatch[0][1] print "Open menu " + str(colorMatch) StormTest.WaitSec(1) isClosePressed = self.device.tap(mappedText='CloseMenu') colorNoMatch = StormTest.WaitColorNoMatch( (41, 100, 168), tolerances=(16, 16, 16), flatness=90, peakError=50, includedAreas=[400, 430, 10, 10], timeToWait=10) isClose = colorNoMatch[0][1] print "Close menu " + str(colorNoMatch) self.assertTrue(isOpenPressed, "Tap failed") self.assertTrue(isOpen, "Tap failed") self.assertTrue(isClosePressed, "Tap failed") self.assertTrue(isClose, "Tap failed") pass
def colorNoMatch(color, tolerances, flatness, peakError, includedAreas, timeToWait, imageName, comment): noMatch = StormTest.WaitColorNoMatch(color=color, tolerances=tolerances, flatness=flatness, peakError=peakError, includedAreas=includedAreas, timeToWait=timeToWait) image = StormTest.CaptureImageEx(None, imageName, slotNo=True)[2] comment = comment + '{0}'.format(noMatch) noMatched = noMatch[0][1] _logColorMatch(noMatched, comment + str(noMatch)) return noMatched, comment, image
def openCatalog(self, catalogName): self._device.tap(text=catalogName) StormTest.WaitSec(5) match1 = StormTest.WaitColorNoMatch(color=(41, 116, 168), tolerances=(16, 16, 16), flatness=10, peakError=85, includedAreas=[495, 280, 663, 445], timeToWait=60) image = StormTest.CaptureImageEx(None, 'Catalog', slotNo=True)[2] if not match1[0][1]: comment = 'No match color of the poster failed on opening {0} catalog {1}'.format( catalogName, match1) log.error(comment) return False, comment, image comment = 'No match color of the poster successful on opening {0} catalog {1}'.format( catalogName, match1) log.info(comment) # match color sulla barra del menu blu match2 = StormTest.WaitColorMatch(color=(15, 15, 75), tolerances=(16, 16, 16), flatness=95, peakError=20, includedAreas=[1770, 140, 10, 10], timeToWait=60) image = StormTest.CaptureImageEx(None, 'Catalog2', slotNo=True)[2] if not match2[0][1]: comment = 'Match color of the dark blue menu failed on opening {0} catalog {1}'.format( catalogName, match2) log.error(comment) return False, comment, image comment = 'Match color of the dark blue menu successful on opening {0} catalog {1}'.format( catalogName, match2) log.info(comment) if match1 and match2: return True, comment, image else: return False, comment, image