def main(): #SETUP try: BaseAPI().unlock() BaseAPI().setup() except Exception, msg: logger.debug('FAILED:%s' % msg)
def main(): try: BaseAPI().unlock() BaseAPI().setup() BaseAPI().find_setting() BTbase().disable_airplane() except Exception, msg: logger.debug('FAILED:%s' % msg)
def video_set_up(self, *args): status = True try: BaseAPI().unlock() BaseAPI().setup() videobase().push_video_file(*args) BaseAPI().reboot_version1() except Exception, msg: logger.debug('FAILED:%s' % msg) status = False exit(1)
def main(): stauts = True try: ########set up BaseAPI().unlock() BaseAPI().setup() ###recorder sounds Recorbase().launch_recor_package() Recorbase().recorder_cycle(3) except Exception, msg: logger.debug('Exception:%s' % msg) stauts = False
def main(): try: BaseAPI().unlock() BaseAPI().setup() i = 0 while i < 30: BaseAPI().find_setting() BTbase().disable_airplane() ##Turn on the airplane mode and Turn off the airplane mode BaseAPI().find_setting() BTbase().enable_bt() time.sleep(1) BaseAPI().back() BTbase().enable_airplane() status = BTbase().bt() if status == True: logger.info('BT is still opened') logger.debug('open the airplane, cannot disable the bluetooth') exit(1) else: BaseAPI().back() time.sleep(1) BTbase().disable_airplane() status = BTbase().bt() if status == True: logger.info( 'closed the airplane, opened the bluetooth is success') BaseAPI().back() BaseAPI().exit_app() i += 1 except Exception, msg: logger.debug('Exception:%s' % msg)
def main(): stauts = True try: Audiobase().audio_set_up() ####playaudio BaseAPI().unlock() Audiobase().open_audio() Audiobase().check_audio() Audiobase().play_all() ##change volume BaseAPI().change_vloume() except Exception, msg: logger.debug('Exception:%s' % msg) stauts = False
def main(): stauts = True try: ########set up BaseAPI().unlock() BaseAPI().setup() ###recorder sounds i = 0 while i < 30: Recorbase().launch_recor_package() Recorbase().recorder_cycle(20) i += 1 logger.info("Recorder is try: %d" % (i)) except Exception, msg: logger.debug('Exception:%s' % msg) stauts = False
def pause_resume(self, count): i = 0 while i < count: status, output, error = Command(Video_Comm['PAUSE_RESUME']).start() BaseAPI().check_adb_command('ret = true', output) time.sleep(1) i += 1 logger.info('pause and play video try: %d' % (i))
def main(): stauts = True try: Audiobase().audio_set_up() ####playaudio BaseAPI().unlock() Audiobase().open_audio() Audiobase().check_audio() Audiobase().play_all() i = 0 while i < 50: BaseAPI().change_vloume() i += 1 logger.info('current cycle is %d' % i) except Exception, msg: logger.debug('Exception:%s' % msg) stauts = False
def seek_video(self,count): i = 0 while i < count: Command(Video_Comm['SEEK_START_LOCAL']).start() status,output,error=Command(Video_Comm['SEEK_RETURN_LOCAL']).start() BaseAPI().check_adb_command('ret = true',output) i+=1 logger.info("seek the video try: %d" %(i))
def click_adapter_name(self): try: checkfile.check_stauts('text="点击更改设备名称"') Command(BT_Comm['CHANGE_ADAPTER_NAME']).start() time.sleep(1) Command(BT_Comm['DEVICE_NAME']).start() BaseAPI().longpress_delete() except Exception, msg: logger.debug('Exception:%s' % msg) exit(1)
def recorder_cycle(self, count): i = 0 while i < 2: self.start_stop_recorder() time.sleep(count) i += 1 count = 0 self.save_recorder() self.play_recorder(2) BaseAPI().back()
def finished_newlist(self): self.video_list() time.sleep(1) self.creat_newlist() time.sleep(1) Command('adb -host shell input tap 700 400').start() time.sleep(2) status = checkfile.check_stauts('总时长') if status == False: raise Exception('Create new video list Failed') else: BaseAPI().back()
def delete_recorder(self): self.launch_recor_package() status = checkfile.check_stauts('text="录音列表"') if status == False: count = 3 else: count = 2 for i in range(count): Command(Recorder_Comm['RECORDER_LIST']).start() Command(Recorder_Comm['DELETE']).start() status, output, error = Command( Recorder_Comm['CONFRIM_DELETE']).start() BaseAPI().check_adb_command('ret = true', output)
def delete_audio_file(self): Command(Audio_Comm['DELETE_CHOICE']).start() time.sleep(1) Command(Audio_Comm['DELETE_CLICK']).start() Command(Audio_Comm['DELETE_AUDIO']).start() time.sleep(1) Command(Audio_Comm['CONFIRM_DELETE']).start() BaseAPI().back() status = checkfile.check_stauts('text="无音乐"') time.sleep(2) if status == True: logger.info('Delete the audio file is success') return True else: logger.debug('Delete the audio file is failed') return False
def delete_audio_file(self): checkfile.click('管理') time.sleep(2) Command(Audio_Comm['DELETE_CLICK']).start() time.sleep(2) Command(Audio_Comm['DELETE_AUDIO']).start() time.sleep(1) Command('adb -host shell input tap 700 450').start() time.sleep(2) BaseAPI().back() status = checkfile.check_stauts('text="暂无音乐"') time.sleep(2) if status == True: logger.info('Delete the audio file is success') return True else: logger.debug('Delete the audio file is failed') return False
def main(): #SETUP try: BaseAPI().unlock() BaseAPI().setup() BaseAPI().recover_system_new() time.sleep(300) ### tear down BaseAPI().screen_on() BaseAPI().unlock() BaseAPI().setup() except Exception, msg: logger.debug('Tear_down_Exception:%s' % msg)
def main(): try: BaseAPI().unlock() BaseAPI().setup() i = 0 while i < 30: BaseAPI().find_setting() BTbase().disable_airplane() #Turn on the airplane mode and Turn off the airplane mode BaseAPI().find_setting() BTbase().disable_bt() time.sleep(1) BaseAPI().back() BTbase().enable_airplane() status = BTbase().bt() if status == False: logger.info('BT is still closed') BaseAPI().back() time.sleep(1) BTbase().disable_airplane() status = BTbase().bt() if status == False: logger.info( 'Success:closed the airplane, The bluetooth is still closed' ) BaseAPI().back() else: logger.debug( 'Failed:closed the airplane, The bluetooth is opened') exit(1) else: logger.debug( 'Failed:opened the airplane mode, bluetooth is opened') exit(1) BaseAPI().exit_app() i += 1 except Exception, msg: logger.debug('Exception:%s' % msg)
def play_recorder(self, count): Command(Recorder_Comm['RECORDER_LIST']).start() status, output, error = Command(Recorder_Comm['PLAY_RECODER']).start() BaseAPI().check_adb_command('ret = true', output) time.sleep(count)
stauts = True try: ########set up BaseAPI().unlock() BaseAPI().setup() ###recorder sounds Recorbase().launch_recor_package() Recorbase().recorder_cycle(3) except Exception, msg: logger.debug('Exception:%s' % msg) stauts = False return stauts ##check result try: main_test = main() check = Check_system().check_test_result('page://recorder.yunos.com') time.sleep(2) del_recor = Recorbase().delete_recorder() if main_test == True and check == True: VERDICT = SUCCESS else: VERDICT = FAILURE except Exception, msg: logger.debug('Exception:%s' % msg) ###clear finally: BaseAPI().exit_app()
import time from base.logger import logger def main(): #SETUP try: BaseAPI().unlock() BaseAPI().setup() except Exception, msg: logger.debug('Set_up_FAILED:%s' % msg) #system_restore try: BaseAPI().recover_system() time.sleep(120) except Exception, msg: logger.debug('system_restore_Exception:%s' % msg) ### tear down try: BaseAPI().setting_afterflash() BaseAPI().unlock() BaseAPI().setup() BaseAPI().back() except Exception, msg: logger.debug('Tear_down_Exception:%s' % msg) try:
from btbase import BTbase def main(): #SETUP try: BaseAPI().unlock() BaseAPI().setup() except Exception, msg: logger.debug('FAILED:%s' % msg) #Change the adapter name. try: BaseAPI().find_setting() BTbase().enable_bt() BTbase().change_adapter_name('PEACOCK', 'YUNOS', '测试1') BTbase().revert_adapter_name() except Exception, msg: logger.debug('Exception:%s' % msg) try: main() VERDICT = SUCCESS except Exception as msg: VERDICT = FAILURE finally: BaseAPI().exit_app()
def volume_up(self): BaseAPI().find_setting() Command(Audio_Comm['VOLUME_SETTING']).start() status = checkfile.check_stauts('text="静音"') if not status == True: raise Exception('open the volume is failed')
def audio_set_up(self): BaseAPI().unlock() BaseAPI().setup() Audiobase().push_audiofile() BaseAPI().reboot() logger.info('setup audio test')
def save_recorder(self): status, output, error = Command(Recorder_Comm['SAVE_RECORDER']).start() BaseAPI().check_adb_command('ret = true', output)
def launch_recor_package(self): status, output, error = Command(Recorder_Comm['OPEN_RECORDER']).start() BaseAPI().check_adb_command('SUCCESS', output)