Пример #1
0
 def _testChangeLetvScreenRate(self):        
     """切换直播台的画面比例|进入乐视直播台菜单,切换画面比例"""
     try:
         self.launchLetv() 
         time.sleep(4)
         self.a.input.menu()
         time.sleep(2)
         self.a.input.up()
         self.a.input.right(2)
         self.a.input.center()
         time.sleep(2)
         w = self.a.ui.screen()
         if 'displaySwitcher' not in w.ids():
             self.error = 'cannot open menu in letv live screen'
             runtests.log_screenshot(self.a, '', 'fail_open_menu', 'Liveplay')
             raise Exception
         self.a.input.up(2)
         self.a.input.down()
         time.sleep(2)
         for i in range(3):
             self.a.input.center()
             time.sleep(5)
             if not self.isPlaying():
                 raise Exception
         
     except Exception, e :
         self.a.log.debug("", "\n testStabLetvUpToDownSomeChannel")
         self.fail("Error happened: %s %s" % ( self.error, e))
Пример #2
0
    def testSTAB_connect_disconnect(self):
        """Bluetooth test| connect and disconnect bluetooth """
        try:
            '''if not self.launchBT():
                runtests.log_screenshot(self.a, '', 'screenshot', 'bluetooth_01')
                self.error = 'failed to find bluetooth'
                raise Exception'''
            self.a.device.sh('input keyevent 176')
            time.sleep(2)
            self.a.input.up()
            self.a.input.left(8)
            self.a.input.right(3)
            self.a.input.down()
            self.a.input.center()
            time.sleep(2)
            self.a.input.up(2)
            self.a.input.down()
            self.a.input.center()
            time.sleep(2)
            for i in range(0, self.loop):
                if not self.turnOnBT():
                    runtests.log_screenshot(self.a, '', 'screenshot',
                                            'bluetooth_02')
                    print "failed at %s" % i
                    raise Exception

        except Exception, e:
            self.a.log.debug("", "\n bluetooth")
            self.fail("Error happened: %s" % (self.error))
Пример #3
0
 def playFiles(self):
     self.getPlayFiles()
     self.loop=len(self.play_urls)   
     #self.loop=1   
     for j in range(1, self.outloop+1):
         for i in range (0,self.loop):
             print "play: %s" %self.play_urls[i]
             cmd = "am start -a android.intent.action.VIEW -d \'%s\' -n com.letv.videoplayer/.MainActivity" %self.play_urls[i]
             #cmd = "am start -n letv.lcworld.player/.MainActivity -d \'%s\' -a android.intent.action.VIEW"%self.play_urls[i]
             self.a.device.sh(cmd)
             time.sleep(10)
             runtests.log_screenshot(self.a, '', self.play_urls[i], 'playfiles')
             if self.isNoError(): # Playing right
                 self.a.log.debug("","This link: %s is played successfully."%self.play_urls[i])
                 self.seek()
                 self.a.input.back()
                 
             else:  # Playing error
                 self.error_urls.append(self.play_urls[i])
                 print "Failed: %s" %self.play_urls[i]
                 self.a.log.debug("","Error: %s This link can not be played."%self.play_urls[i])                   
             
             time.sleep(1)
                                       
         self.a.input.back(2)
         time.sleep(5)
     if self.error_urls!=[]:
         raise Exception
Пример #4
0
 def _testChangeLetvDisplay(self):
     """切换直播台的清晰度|进入乐视直播台菜单,切换清晰度"""
     try:
         self.a.input.home()
         self.launchLetv() 
         time.sleep(5)
         self.a.input.menu()
         time.sleep(2)
         self.a.input.up()
         self.a.input.right(2)
         self.a.input.center()
         time.sleep(2)
         w = self.a.ui.screen()
         if 'displaySwitcher' not in w.ids():
             self.error = 'cannot open menu in letv live screen'
             runtests.log_screenshot(self.a, '', 'fail_open_menu', 'Liveplay')
             raise Exception
         self.a.input.down(2)
         for i in range(3):
             self.a.input.center()
             time.sleep(5)
             if not self.isPlaying():
                 runtests.log_screenshot(self.a, '', 'change_display_fail', 'Liveplay')
                 raise Exception
             else:pass
     except Exception, e :
         self.a.log.debug("", "\n testChangeLetvDisplay")
         self.fail("Error happened: %s %s" % ( self.error, e))
Пример #5
0
 def testSTAB_connect_disconnect(self):
     """Bluetooth test| connect and disconnect bluetooth """
     try :
         '''if not self.launchBT():
             runtests.log_screenshot(self.a, '', 'screenshot', 'bluetooth_01')
             self.error = 'failed to find bluetooth'
             raise Exception'''
         self.a.device.sh('input keyevent 176')
         time.sleep(2)
         self.a.input.up()
         self.a.input.left(8)
         self.a.input.right(3)
         self.a.input.down()
         self.a.input.center()
         time.sleep(2)
         self.a.input.up(2)
         self.a.input.down()
         self.a.input.center()
         time.sleep(2)
         for i in range(0, self.loop):
             if not self.turnOnBT():
                 runtests.log_screenshot(self.a, '', 'screenshot', 'bluetooth_02')
                 print "failed at %s" %i
                 raise Exception
        
     except Exception, e :
         self.a.log.debug("", "\n bluetooth")
         self.fail("Error happened: %s" % (self.error))
Пример #6
0
 def _testLaunchCNTVTime(self):
     """CNTV启动时间|操作步骤:;1. 启动CNTV"""
     try:
         times = self.launchCNTV()
         self.a.log.debug("", "raise self.failureException('CNTV启动时间: %.3f s')" % times)
         self.exitCNTV()
     except Exception, e:
         runtests.log_screenshot(self.a, "", "fail_testLaunchCNTVTime", "testNetworkTesting")
         self.a.log.debug("", "\n testLaunchCNTVTime")
         self.fail("Error happened: %s %s" % (self.error, e))
Пример #7
0
 def _testLaunchCNTVTime(self):
     """CNTV启动时间|操作步骤:;1. 启动CNTV"""
     try:
         times = self.launchCNTV()
         self.a.log.debug(
             "", "raise self.failureException('CNTV启动时间: %.3f s')" % times)
         self.exitCNTV()
     except Exception, e:
         runtests.log_screenshot(self.a, '', 'fail_testLaunchCNTVTime',
                                 'testNetworkTesting')
         self.a.log.debug("", "\n testLaunchCNTVTime")
         self.fail("Error happened: %s %s" % (self.error, e))
Пример #8
0
    def testNetworkTesting(self):
        """网络测速|操作步骤:;1. 设置中进行网络测试"""
        try:
            self.a.device.sh("input keyevent 176")
            time.sleep(2)
            self.a.input.up()
            self.a.input.left(8)
            self.a.input.down()
            self.a.input.right(2)
            self.a.input.center()
            time.sleep(2)
            w = self.a.ui.screen()
            if 'title' not in w.ids():
                self.error = 'cannot enter network page'
                raise Exception
            self.a.input.center()
            time.sleep(5)

            start_time = time.time()
            during = time.time() - start_time
            while 'text_cur_speed' in self.a.ui.screen().ids(
            ) and during < 180:
                print 'network testing ...'
                time.sleep(5)
                during = time.time() - start_time
            if during >= 120:
                self.error = 'network testing timeout'
                runtests.log_screenshot(self.a, '', 'fail_testNetworkTesting',
                                        'testNetworkTesting')
                raise Exception
            try:
                l = self.a.ui.waitfor(id='text_speed').text()
                print '平均速度:%s' % l
                self.a.log.debug(
                    "", "raise self.failureException('网络平均速度: %s')" % l)
            except:
                self.error = 'cannot get speed'
                runtests.log_screenshot(self.a, '', 'fail_testNetworkTesting',
                                        'testNetworkTesting')
                raise Exception
            self.a.input.back(4)
        except Exception, e:
            self.a.log.debug("", "\n testNetworkTesting")
            self.fail("Error happened: %s %s" % (self.error, e))
Пример #9
0
 def playFile(self, url):
     print "play ", url
     cmd = "am start -a android.intent.action.VIEW -d \'%s\' -n com.letv.videoplayer/.MainActivity" %url
     self.a.device.sh(cmd)
     time.sleep(10)
     runtests.log_screenshot(self.a, '', url, 'playfiles')
     w = self.a.ui.screen()
     status = "successfully"
     if "file_browse_frame" in w.ids():
         print "type error"
         status =  "type error"
     elif "player_error_info_tv" in w.ids():
         print "cannot play"
         status =  'cannot play'
     else:
         print "play successfully"
         pass
     self.results[url] = status
     self.a.input.back()
     time.sleep(3)
Пример #10
0
 def playFile(self, url):
     print "play ", url
     cmd = "am start -a android.intent.action.VIEW -d \'%s\' -n com.letv.videoplayer/.MainActivity" % url
     self.a.device.sh(cmd)
     time.sleep(10)
     runtests.log_screenshot(self.a, '', url, 'playfiles')
     w = self.a.ui.screen()
     status = "successfully"
     if "file_browse_frame" in w.ids():
         print "type error"
         status = "type error"
     elif "player_error_info_tv" in w.ids():
         print "cannot play"
         status = 'cannot play'
     else:
         print "play successfully"
         pass
     self.results[url] = status
     self.a.input.back()
     time.sleep(3)
Пример #11
0
    def testNetworkTesting(self):
        """网络测速|操作步骤:;1. 设置中进行网络测试"""
        try:
            self.a.device.sh("input keyevent 176")
            time.sleep(2)
            self.a.input.up()
            self.a.input.left(8)
            self.a.input.down()
            self.a.input.right(2)
            self.a.input.center()
            time.sleep(2)
            w = self.a.ui.screen()
            if "title" not in w.ids():
                self.error = "cannot enter network page"
                raise Exception
            self.a.input.center()
            time.sleep(5)

            start_time = time.time()
            during = time.time() - start_time
            while "text_cur_speed" in self.a.ui.screen().ids() and during < 180:
                print "network testing ..."
                time.sleep(5)
                during = time.time() - start_time
            if during >= 120:
                self.error = "network testing timeout"
                runtests.log_screenshot(self.a, "", "fail_testNetworkTesting", "testNetworkTesting")
                raise Exception
            try:
                l = self.a.ui.waitfor(id="text_speed").text()
                print "平均速度:%s" % l
                self.a.log.debug("", "raise self.failureException('网络平均速度: %s')" % l)
            except:
                self.error = "cannot get speed"
                runtests.log_screenshot(self.a, "", "fail_testNetworkTesting", "testNetworkTesting")
                raise Exception
            self.a.input.back(4)
        except Exception, e:
            self.a.log.debug("", "\n testNetworkTesting")
            self.fail("Error happened: %s %s" % (self.error, e))
Пример #12
0
 def tearDown(self):
     try:
         runtests.log_screenshot(self.a, "", "screenshot", "Liveplay")
     except:
         pass
Пример #13
0
 def tearDown(self):
     try :
         runtests.log_screenshot(self.a, '', 'screenshot', 'Liveplay')
     except:
         pass
Пример #14
0
 def tearDown(self):
     try:
         runtests.log_screenshot(self.a, '', 'screenshot', 'Liveplay')
     except:
         pass