コード例 #1
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
    def vloume_change_up_down(self):
        self.find_setting()
        Command(Comm['VOLUME']).start()
        volume_states = checkfile.check_stauts('text="静音"')
        if volume_states == True:
            logger.info('open volume is success')

        else:
            logger.debug('open volume is failed')
            exit(1)
        Command(Comm['VOLUME_DOWN']).start()
        Command(Comm['VOLUME_UP_TO_DOWN']).start()
        time.sleep(5)
        Command(Comm['VOLUME_DOWN_TO_UP']).start()
        time.sleep(5)
コード例 #2
0
ファイル: checkcrash.py プロジェクト: serena4231/my_test_yun
 def check_package_status(self,package):
     status = False
     output = Command('adb -host shell \"ps -ef| grep %s"'%package).start()
     if len(output)> 0:
        logger.info('package is still alive')
        status = True
     return status
コード例 #3
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
 def reboot_version1(self):
     Command(Comm['REBOOT']).start()
     time.sleep(230)
     check_adb_device()
     time.sleep(3)
     base.screen_on()
     time.sleep(2)
コード例 #4
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
 def pull_file(self):
     timestamp= time.strftime("%Y-%m-%d-%H-%M-%S")
     creat_logname=os.path.join(log_path,'{1}_dump_{0}.log'.format(timestamp,self.filename))
     time.sleep(1)
     Command(Comm['P_DUMP']+ creat_logname).start()
     print(creat_logname)
     return creat_logname
コード例 #5
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
 def long_press_vloumeup(self):
     result = r'ret = true'
     tates,output,error =Command(Comm['KEY_VOLUME_LONG_UP']).start()
     output = output.rstrip().rsplit(',')
     if not result == output[1]:
         raise Exception('long press volume up is failed')
     logger.info('ong press volume up is success')
     time.sleep(1)
コード例 #6
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
    def home(self):
        Command(Comm['HOME']).start()
        status=checkfile.check_stauts('text="应用中心"')

        if status == True:
            logger.info('return to home is successed')
        else:
            raise Exception('return to home is failed')
コード例 #7
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
 def find_setting(self):
     Command(Comm['OPENSETTING']).start()
     time.sleep(2)
     status =checkfile.check_stauts('text="蓝牙"')
     if status == True:
         logger.info('open setting is successed')
     else:
         raise Exception('open setting is failed')
コード例 #8
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
 def mute_sound(self):
     result = r'ret = true'
     states,output,error =Command(Comm['KEY_VOLUME_MUTE']).start()
     output = output.rstrip().rsplit(',')
     if not result == output[1]:
         raise Exception('mute the sound is failed')
     logger.info('mute the sound is success')
     time.sleep(1)
コード例 #9
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
 def screen_on(self):
     try:
         Command(Comm['SCREEN_ON']).start()
         logger.info('screen_on_off_screen')
         return True
     except Exception,msg:
         logger.debug('Exception:%s'%msg)
         return False
コード例 #10
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
 def reboot(self):
     Command(Comm['REBOOT']).start()
     time.sleep(60)
     check_adb_device()
     status =checkfile.check_stauts('text="滑动解锁"')
     if status == True:
         logger.info('Reboot DUT is Success')
     else:
         raise Exception('Reboot DUT is Failed')
コード例 #11
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
 def exit_app(self):
     try:
         i = 0
         while i < 5:
             Command(Comm['BACK']).start()
             i+=1
         logger.info('back to home and exit app')
     except Exception,msg:
         logger.debug('Exception:%s'%msg)
         exit(1)
コード例 #12
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
 def recover_system_new(self):
     Command(Comm['OPENSETTING']).start()
     checkfile.check_stauts('text="云服务"')
     Command(Comm['SWIPE_SETTING']).start()
     Command(Comm['SYSTEM_STTING']).start()
     Command('adb -host shell input tap 140 200').start()
     #choose unistall app and format store
     Command(Comm['CHOOSE_UNINSTALL_RECOVERY']).start()
     Command(Comm['CHOOSE_FORMAT_RECOVERY']).start()
     #确认恢复出厂设置
     Command(Comm['RECOVER']).start()
     Command(Comm['FINISH_RECOVER']).start()
コード例 #13
0
ファイル: checkcrash.py プロジェクト: serena4231/my_test_yun
 def check_device_status(self):
     status =False
     count =0
     logger.info("Checking device status")
     while count < 3:
         # check host-dut adb status
         ex_status,output,error = Command("adb -host get-state").start(timeout=3)
         if output.rstrip() != r"device":
             logger.info("adb device state: %s try: %d" %(output,count))
         else:
             # check if adb is working
             logger.info("adb device state: %s" % output)
             exec_status, output,error = Command("adb -host shell getprop ro.yunos.build.id").start()
             output=output.rstrip()
             if len(output) > 0:
                 logger.info("Output of 'adb shell getprop ro.yunos.build.id' is (%s)" % output)
                 status=True
                 break
         count += 1
     return status
コード例 #14
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
    def setting_afterflash(self):
        try:
            i =0
            while i < 5:
                Command(Comm['START_SETTING']).start()
                i+=1
                time.sleep(1)
            logger.info('finished the setting')

        except Exception,msg:
            logger.debug('Exception:%s'%msg)
            exit(1)
コード例 #15
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
    def recover_system(self):
        Command(Comm['OPENSETTING']).start()
        checkfile.check_stauts('text="云服务"')
        Command(Comm['SWIPE_SETTING']).start()
        Command(Comm['SYSTEM_STTING']).start()
        Command(Comm['RECOVERY_SYSTEM']).start()
        checkfile.check_stauts('text="格式化内部存储"')
        #choose unistall app and format store

        Command(Comm['CHOOSE_UNINSTALL_RECOVERY']).start()
        Command(Comm['CHOOSE_FORMAT_RECOVERY']).start()
        #确认恢复出厂设置
        Command(Comm['RECOVER']).start()
        Command(Comm['FINISH_RECOVER']).start()
コード例 #16
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
 def check_stauts(self,*args):
     self.create_dump()
     states,out,error=Command('adb -host shell cat /var/log/uidump.txt').start()
     status = True
     for i in args:
         search = re.compile(i)
         d=search.findall(out)
         if d ==[]:
             logger.debug('cannot find matched content:%s'%i)
             status=False
         else:
             logger.info('keyword matched in file:%s'%i)
     return status
コード例 #17
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
 def setup(self):
     # Checkpath().create_newlog_path()
     # logger.info('create the dump log')
     Command(Comm['OPENSETTING']).start()
     time.sleep(2)
     # Command(Comm['DISPLAY']).start()
     checkfile.click('显示')
     time.sleep(2)
     checkfile.click('锁屏休眠')
     time.sleep(1)
     checkfile.click('永不')
     # Command(Comm['LOCK_DISPLAY']).start()
     # Command(Comm['DISPLAY_NEVER']).start()
     status=checkfile.check_stauts('text="永不"')
     if status == True:
         logger.info('opened the display never lock')
         self.exit_app()
     else:
         logger.debug('cannot open the display never lock')
         exit(1)
コード例 #18
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
 def position(self,args):
     self.create_dump()
     states,f,error=Command('adb -host shell cat /var/log/uidump.txt').start()
     for line in f.splitlines():
         serach = re.compile(args)
         d= serach.findall(line)
         if d ==[]:
             pass
         else:
             spl = line.strip()
             # rtn =re.search(r'(\d+)\,(\d+)\]\[(\d+)\,(\d+)',spl).groups()
             rtn = re.search(r'(\d+[.\d]*)\,(\d+[.\d]*)\]\[(\d+[.\d]*)\,(\d+[.\d]*)',spl)
             rtn_x1=int(rtn.group(1).split('.')[0])
             rtn_y1=int(rtn.group(2).split('.')[0])
             rtn_x2=int(rtn.group(3).split('.')[0])
             rtn_y2=int(rtn.group(4).split('.')[0])
             x = random.randint(rtn_x1,rtn_x2)
             print(x)
             y = random.randint(rtn_y1,rtn_y2)
             print(y)
             return x,y
コード例 #19
0
ファイル: checkcrash.py プロジェクト: serena4231/my_test_yun
    def remove_tomstones(self):

        logger.info("Removing already present TOMBSTONES")
        Command("adb -host shell rm -rf /mnt/data/yunos/var/tools/apr/log/c_tombstone/*").start(10)
コード例 #20
0
ファイル: checkcrash.py プロジェクト: serena4231/my_test_yun
    def remove_panic_file(self):

        logger.info("Removing already present PANIC")
        Command("adb -host shell rm -rf /mnt/data/yunos/var/tools/apr/log/panic/*").start(10)
コード例 #21
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
    def back(self):

        Command(Comm['BACK']).start()
        logger.info('back to next')
コード例 #22
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
 def long_click(self,args):
     x,y=self.position(args)
     time.sleep(1)
     status,output,error=Command('adb -host shell input longtap {0} {1}'.format(x,y)).start()
     base.check_adb_command('ret = true',output)
コード例 #23
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
 def create_dump(self):
     return Command(Comm['C_DUMP']).start()
     time.sleep(1)
コード例 #24
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
 def longpress_delete(self):
     Command(Comm['DELETE']).start()
コード例 #25
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
 def up_down(self):
     Command(Comm['VOLUME_DOWN']).start()
     Command(Comm['VOLUME_UP_TO_DOWN']).start()
     time.sleep(5)
     Command(Comm['VOLUME_DOWN_TO_UP']).start()
     time.sleep(5)
コード例 #26
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
 def change_vloume(self):
     Command('adb -host shell input keyevent --longpress 24').start()
     time.sleep(5)
     Command('adb -host shell input keyevent --longpress 25').start()
コード例 #27
0
ファイル: dumbase.py プロジェクト: serena4231/my_test_yun
 def unlock(self):
     check_adb_device()
     Command(Comm['UNLOCK']).start()
     logger.info('unlock the screen is successed')
     time.sleep(2)