def add_hidden_ssd_stress_mode(self): Command('adb -host shell input swipe 900 700 900 100').start() checkfile.click('text="添加网络"') time.sleep(1) Command('adb -host shell input text "ITFLEX_YUNOS_H"').start() time.sleep(1) checkfile.click('text="安全性"') time.sleep(1) #click security mode set wep checkfile.click('text="WEP"') Command('adb -host shell input tap 600 300').start() Command('adb -host shell input text 12345678').start() Command(WIFI_Comm['SELECT_RITHT']).start() stauts = checkfile.check_stauts('text="网络名称"') if stauts == False: raise Exception('click security mode set WEP is failed') #click security mode set none time.sleep(1) checkfile.click('text="安全性"') checkfile.click('text="无"') time.sleep(1) Command(WIFI_Comm['SELECT_RITHT']).start() stauts = checkfile.check_stauts('text="已连接"') if stauts == True: raise Exception('click security mode set none is failed')
def play_video_assign(self, args): checkfile.click(args) time.sleep(5) status = checkfile.check_stauts('resource-id="playerView"') if status == True: logger.info('play video is success') else: raise Exception('play video is failed')
def input_address(self): try: self.lanuch_browser() checkfile.click('text="请输入网址或搜索"') time.sleep(1) except Exception, msg: logger.debug("Exception: %s" % msg) exit(1)
def switch_ap(): wifi.connect_wifi('text="YUNOS_Auto_Test_2G"') time.sleep(1) wifi.swtich_ap_connect('text="YUNOS_Auto_Test_5G"') wifi.check_ap_status() checkfile.click('text="YUNOS_Auto_Test_2G"') time.sleep(5) checkfile.click('text="YUNOS_Auto_Test_5G"') time.sleep(5)
def clear_history(self): self.input_address() checkfile.click('resource-id="historyClearView"') time.sleep(2) checkfile.click('text="清除"') status =checkfile.check_stauts('resource-id="historyClearView"') if status == True: raise Exception('clear the history is failed') else: logger.info('clear the history is success') base.exit_app()
def input_address(self): try: self.lanuch_browser() status=checkfile.check_stauts('text="允许"') if status == True: checkfile.click('text="允许"') checkfile.click('text="搜索或输入网址"') time.sleep(1) except Exception,msg: logger.debug("Exception: %s" % msg) exit(1)
def delete_videolist(self): self.video_list() time.sleep(1) checkfile.click('ic_b_more_normal') time.sleep(1) checkfile.click('删除') time.sleep(1) Command('adb -host shell input tap 700 450').start() time.sleep(1) status = checkfile.check_stauts('总时长') if status == True: raise Exception('Delete video list failed')
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() checkfile.click('text="确定"')
def disable_wifi(self): status = checkfile.check_stauts('checked="false"') if status == False: checkfile.click('checked="true"') time.sleep(1) new_status = checkfile.check_stauts('checked="false"') if new_status == False: raise Exception('disable wifi is failed') else: logger.info('disable wifi is success') else: logger.info('wifi is enabled')
def swtich_ap_connect(self, args): checkfile.click(args) time.sleep(2) Command(WIFI_Comm['PASSWORD']).start() time.sleep(2) checkfile.click('text="确定"') time.sleep(10) status = checkfile.check_stauts('text="已连接"') if status == False: raise Exception('connect the wifi is failed') else: logger.info('connect the wifi is success')
def disconnect_wifi(self, args): count = 0 self.launch_wifi() while count < 3: time.sleep(2) checkfile.long_click(args) time.sleep(1) status = checkfile.check_stauts('text="取消保存"') if status == False: logger.info('try more one times %d' % count) count += 1 time.sleep(1) else: time.sleep(1) checkfile.click('text="取消保存"') logger.info('disconnect is success') break
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 connect_wifi(self, args): status = checkfile.check_stauts('text="已连接"') if status == False: time.sleep(2) checkfile.click(args) time.sleep(2) Command(WIFI_Comm['PASSWORD']).start() time.sleep(2) checkfile.long_click('text="确定"') # Command(WIFI_Comm['SELECT_RITHT']).start() time.sleep(10) status = checkfile.check_stauts('text="已连接"') if status == False: raise Exception('connect the wifi is failed') else: logger.info('connect the wifi is success') else: logger.info('Connect the wifi is success')
def change_ipv4_stress(self): self.check_info() time.sleep(2) # checkfile.click('text="高级选项"') # time.sleep(1) checkfile.click('text="IPv4设置"') time.sleep(1) ################静态 # Command(WIFI_Comm['STATIC']).start() checkfile.click('text="静态"') time.sleep(1) ##########IPV4 Command(WIFI_Comm['IPV4_ADDRESS']).start() base.longpress_delete() Command(WIFI_Comm['SELECT_RITHT']).start() time.sleep(1) status = checkfile.check_stauts('text="子网掩码"') if status == True: base.longpress_delete() logger.info('detel one input box ') Command('adb -host shell input text "130.112.1.100"') Command(WIFI_Comm['SELECT_RITHT']).start() status = checkfile.check_stauts('text="子网掩码"') if status == True: base.longpress_delete() Command('adb -host shell input tex "acv中"') new_stauts = checkfile.check_stauts('text="acv中""') if new_stauts == False: logger.info('All test pass') else: raise Exception('input int type reuslt is failed') else: raise Exception('input wrong ip result is failed') else: raise Exception('input null ip result is failed') base.longpress_delete() Command(WIFI_Comm['IPV4_INPUT']).start() Command(WIFI_Comm['SELECT_RITHT']).start() time.sleep(10) status = checkfile.check_stauts('text="已连接"') if status == False: raise Exception('connect the wifi is failed') else: logger.info('connect the wifi is success')
def main(): stauts = True try: base.unlock() base.setup() wifi.wifi_setup() wifi.connect_wifi('text="YUNOS_Auto_Test_2G"') time.sleep(1) wifi.swtich_ap_connect('text="YUNOS_Auto_Test_5G"') wifi.check_ap_status() checkfile.click('text="YUNOS_Auto_Test_2G"') time.sleep(5) checkfile.click('text="YUNOS_Auto_Test_5G"') time.sleep(5) base.back() ########################## except Exception,msg: logger.debug('Exception:%s'%msg) stauts = False
def change_ipv4(self): self.check_info() time.sleep(2) checkfile.click('text="高级选项"') time.sleep(1) checkfile.click('text="IPv4设置"') time.sleep(1) ################静态 Command(WIFI_Comm['STATIC']).start() time.sleep(1) ##########IPV4 Command(WIFI_Comm['IPV4_ADDRESS']).start() base.longpress_delete() Command(WIFI_Comm['IPV4_INPUT']).start() Command(WIFI_Comm['SELECT_RITHT']).start() time.sleep(10) status=checkfile.check_stauts('text="已连接"') if status == False: raise Exception('connect the wifi is failed') else: logger.info('connect the wifi is success')
def add_hidden_ssd(self): Command('adb -host shell input swipe 900 700 900 100').start() checkfile.click('text="添加网络"') time.sleep(1) Command('adb -host shell input text "ITFLEX_YUNOS_H"').start() time.sleep(1) checkfile.click('text="安全性"') time.sleep(1) checkfile.click('text="PSK"') time.sleep(1) Command('adb -host shell input tap 600 300').start() Command('adb -host shell input text 12345678').start() Command(WIFI_Comm['SELECT_RITHT']).start() time.sleep(10) base.back() self.check_connect_enable()
def add_hidden_ssd_stress_wrongpw(self): Command('adb -host shell input swipe 900 700 900 100').start() checkfile.click('text="添加网络"') time.sleep(1) Command('adb -host shell input text "ITFLEX_YUNOS_H"').start() time.sleep(1) checkfile.click('text="安全性"') time.sleep(1) checkfile.click('text="PSK"') time.sleep(1) Command(WIFI_Comm['SELECT_RITHT']).start() stauts = checkfile.check_stauts('text="添加网络"') if stauts == False: raise Exception('add none password is failed') Command('adb -host shell input tap 600 300').start() Command('adb -host shell input text 123456').start() Command(WIFI_Comm['SELECT_RITHT']).start() stauts = checkfile.check_stauts('text="添加网络"') if stauts == False: raise Exception('add none password is failed')
def creat_newlist(self): checkfile.click('新建播放列表')
def video_player_cycle(self, *args): for i in args: self.check_videolist() Command('adb host shell input longtap 1200 1000').start() checkfile.click(i) time.sleep(10)
def address_3(self): self.input_address() Command(GFX_Comm['ADDRESS_3']).start() checkfile.click('text="进入"')
def add_videolist(self): self.edit_video() checkfile.click('加入播放列表') time.sleep(5) checkfile.click('总时长') time.sleep(3)
def address_4(self): self.input_address() Command(GFX_Comm['ADDRESS_4']).start() checkfile.click('text="进入"') time.sleep(20)
def add_web_package(self): checkfile.click('resource-id="pageBtn"') time.sleep(2) checkfile.click('resource-id="addBtn"')
def video_list(self): time.sleep(2) checkfile.click('ic_w_list_normal')
def add_web_package(self): checkfile.click('resource-id="toolbar.toolBarView.openTabSelectorButton"') time.sleep(1) checkfile.click('resource-id="YunOSBrowser::TabSelector:Footer:AddButton"')