Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
 def reboot_version1(self):
     Command(Comm['REBOOT']).start()
     time.sleep(230)
     check_adb_device()
     time.sleep(3)
     base.screen_on()
     time.sleep(2)
Ejemplo n.º 4
0
 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
Ejemplo n.º 5
0
 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)
Ejemplo n.º 6
0
    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')
Ejemplo n.º 7
0
 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')
Ejemplo n.º 8
0
 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)
Ejemplo n.º 9
0
 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
Ejemplo n.º 10
0
 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')
Ejemplo n.º 11
0
 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)
Ejemplo n.º 12
0
 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()
Ejemplo n.º 13
0
 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
Ejemplo n.º 14
0
    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)
Ejemplo n.º 15
0
    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()
Ejemplo n.º 16
0
 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
Ejemplo n.º 17
0
 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)
Ejemplo n.º 18
0
 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
Ejemplo n.º 19
0
    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)
Ejemplo n.º 20
0
    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)
Ejemplo n.º 21
0
    def back(self):

        Command(Comm['BACK']).start()
        logger.info('back to next')
Ejemplo n.º 22
0
 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)
Ejemplo n.º 23
0
 def create_dump(self):
     return Command(Comm['C_DUMP']).start()
     time.sleep(1)
Ejemplo n.º 24
0
 def longpress_delete(self):
     Command(Comm['DELETE']).start()
Ejemplo n.º 25
0
 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)
Ejemplo n.º 26
0
 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()
Ejemplo n.º 27
0
 def unlock(self):
     check_adb_device()
     Command(Comm['UNLOCK']).start()
     logger.info('unlock the screen is successed')
     time.sleep(2)