コード例 #1
0
    def test_tap_element_using_text(self):
        print "TEST TAP ELEMENT USING TEXT"
        self.device.tap(mappedText='OpenMenu')
        StormTest.WaitSec(4)

        isPressed = self.device.tap(text='Cinema')
        colorMatch = StormTest.WaitColorMatch((0, 0, 68),
                                              tolerances=(16, 16, 16),
                                              flatness=90,
                                              peakError=50,
                                              includedAreas=[600, 140, 10, 10],
                                              timeToWait=10)
        isCinema = colorMatch[0][1]
        print "Open cinema " + str(colorMatch)

        StormTest.WaitSec(1)

        self.device.tap(mappedText='Home')
        #colorNoMatch = StormTest.WaitColorNoMatch((0,0,68), tolerances=(16,16,16), flatness=90, peakError=50, includedAreas=[400,430,10,10], timeToWait=15)
        colorMatch = StormTest.WaitColorMatch(
            (40, 120, 178),
            tolerances=(16, 16, 16),
            flatness=90,
            peakError=50,
            includedAreas=[1000, 750, 10, 10],
            timeToWait=10)
        StormTest.CaptureImageEx((0, 0, 1920, 1080), "Screenshot")
        isHome = colorMatch[0][1]
        print "Return to Home " + str(colorMatch)
        #StormTest.WaitSec(6)

        self.assertTrue(isPressed, "Tap on Cinema failed")
        self.assertTrue(isCinema, "Tap on Cinema failed")
        pass
コード例 #2
0
    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
コード例 #3
0
def colorMatch(color, tolerances, flatness, peakError, includedAreas,
               timeToWait, imageName, comment):
    match = StormTest.WaitColorMatch(color=color,
                                     tolerances=tolerances,
                                     flatness=flatness,
                                     peakError=peakError,
                                     includedAreas=includedAreas,
                                     timeToWait=timeToWait)
    image = StormTest.CaptureImageEx(None, imageName, slotNo=True)[2]
    comment = comment + '{0}'.format(match)
    matched = match[0][1]

    _logColorMatch(matched, comment)
    return matched, comment, image
コード例 #4
0
    def setUpClass(self):
        super(Test, self).setUpClass()
        self.device = AndroidDevice("samsung_galaxy_tab_3")
        self.device.start("it.sky.river")

        appLoaded = StormTest.WaitColorMatch((207, 209, 207),
                                             tolerances=(16, 16, 16),
                                             flatness=90,
                                             peakError=50,
                                             includedAreas=[1000, 750, 10, 10],
                                             timeToWait=15)
        if not appLoaded:
            return False
        pass
コード例 #5
0
    def openMenu(self):
        self._device.tap(mappedText='OpenMenu')
        match = StormTest.WaitColorMatch((41, 100, 168),
                                         tolerances=(16, 16, 16),
                                         flatness=90,
                                         peakError=10,
                                         includedAreas=[400, 430, 10, 10],
                                         timeToWait=30)

        if not match[0][1]:
            log.error(
                'Match color failed on opening the menu {0}'.format(match))
            return False

        log.info(
            'Match color successful on opening the menu {0}'.format(match))
        return True
コード例 #6
0
    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
コード例 #7
0
    def findSelectedVideo(self, videoName):
        self._device.enterText(videoName)
        self._device.tap(mappedText='Find')

        match = StormTest.WaitColorMatch((233, 235, 233), (16, 16, 16),
                                         flatness=95,
                                         peakError=50,
                                         includedAreas=[404, 633, 8, 7],
                                         timeToWait=60)
        StormTest.CaptureImageEx(None, 'PlayVideo', slotNo=True)[2]

        if not match[0][1]:
            comment = 'Match color failed on playing the video {0}'.format(
                match)
            log.error(comment)
            return False

        comment = 'Match color successful on playing the video {0}'.format(
            match)
        log.info(comment)
        return True
コード例 #8
0
    def openSkyTG24(self, catalogName):
        self._device.tap(text=catalogName)

        match = StormTest.WaitColorMatch(color=(233, 235, 233),
                                         tolerances=(16, 16, 16),
                                         flatness=95,
                                         peakError=15,
                                         includedAreas=[322, 362, 7, 7],
                                         timeToWait=60)
        image = StormTest.CaptureImageEx(None, 'Catalog', slotNo=True)[2]

        if not match[0][1]:
            comment = 'Match color failed on opening {0} catalog {1}'.format(
                catalogName, match)
            log.error(comment)
            return False, comment, image

        comment = 'Match color successful on opening {0} catalog {1}'.format(
            catalogName, match)
        log.info(comment)
        return True, comment, image
コード例 #9
0
    def openCatalogFind(self):
        self._device.tap(text="Cerca nel catalogo. Double tap to edit.")

        StormTest.WaitSec(5)

        match = StormTest.WaitColorMatch((197, 199, 200),
                                         tolerances=(16, 16, 16),
                                         flatness=80,
                                         peakError=85,
                                         includedAreas=[1200, 1000, 10, 10],
                                         timeToWait=60)
        StormTest.CaptureImageEx(None, 'Keyboard', slotNo=True)[2]

        if not match[0][1]:
            comment = 'Match color failed on opening the keyboard {0}'.format(
                match)
            log.error(comment)
            return False

        comment = 'Match color successful on opening the keyboard catalog {0}'.format(
            match)
        log.info(comment)
        return True