def push_audiofile(self): try: Command(Audio_Comm['PUSHAUDIO']).start() logger.info('push audio file in devices') except Exception, msg: logger.debug('Exception:%s' % msg) exit(1)
def main(): stauts = True try: ########setup video.video_set_up('dayu.mp4') #####play video base.unlock() time.sleep(3) video.launch_video() time.sleep(1) video.check_push_video() video.play_video() time.sleep(5) video.cyclic_video() i = 0 while i < 100: time.sleep(1) base.screen_on() time.sleep(1) base.screen_on() base.unlock() i += 1 logger.info('poweroff_screen try: %d' % (i)) ########## except Exception, msg: logger.debug('Exception:%s' % msg) stauts = False
def main(): stauts = True try: base.unlock() base.setup() camera.opencamera() camera.camera_button() time.sleep(1) camera.check_camera_size() time.sleep(2) camera.teardown() base.exit_app() ###########take one minute video camera.opencamera() camera.video_button(90) i = 0 while i <30: Command('adb -host shell input tap 623 700').start() logger.info('click the video button') time.sleep(60) Command('adb -host shell input tap 623 700').start() time.sleep(1) i+=1 # camera.check_video_size() except Exception,msg: logger.debug('FAILED:%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 load_ini(self, file_path): logger.info("加载 {} 文件......".format(file_path)) config = MyConfigParser() config.read(file_path, encoding="UTF-8") data = dict(config._sections) # print("读到数据 ==>> {} ".format(data)) return data
def start_address_4(self,count): i = 0 while i < count: Command(GFX_Comm['START_4']).start() time.sleep(60) i+=1 logger.info('start times is %d'%i)
def check_push_video(self): time.sleep(3) status = checkfile.check_stauts('text="暂无视频"') if status == False: logger.info('SUCCESS:push video file is success') else: raise Exception('Fail:push video file is failed')
def check_info(self): Command('adb -host shell input longtap 60 180').start() status = checkfile.check_stauts('text="详细信息"') if status == True: time.sleep(2) Command('adb -host shell input tap 100 630').start() logger.info('check the wlan info')
def check_singal(self,args): Command('adb -host shell input longtap 60 180').start() status = checkfile.check_stauts(args) if status == False: raise Exception('show signal strength is failed') else: logger.info('show signal strength is success')
def main(): stauts = True try: base.unlock() base.setup() wifi.wifi_setup() wifi.connect_wifi('YUNOS_Auto_Test_2G') for i in range(50): wifi.disable_wifi() time.sleep(5) wifi.enable_wifi() time.sleep(5) base.back() time.sleep(10) wifi.check_connect_enable() time.sleep(2) wifi.wlan_info() logger.info('************stress times is************ %d' % i) ########################## except Exception, msg: logger.debug('Exception:%s' % msg) stauts = False
def play_video(self): Command(Video_Comm['PLAYVIDEO']).start() status =checkfile.check_stauts('resource-id="playerView"') if status == True: logger.info('play video is success') else: raise Exception('play video is failed')
def check_ifconfig(self): Command('adb -host shell input longtap 60 180').start() status = checkfile.check_stauts('text="192.168.1.100"') if status == True: logger.info('ifconfig changed is success') else: raise Exception('ifconfig changed is failed')
def main(): stauts = True try: base.unlock() base.setup() base.find_setting() bt.disable_airplane() time.sleep(3) i = 0 while i < 50: wifi.wifi_setup() wifi.connect_wifi('YUNOS_Auto_Test_2G') base.back() bt.enable_airplane() time.sleep(10) wifi.check_connect_disable() bt.disable_airplane() time.sleep(10) wifi.check_connect_enable() base.exit_app() i += 1 logger.info('stress times is %d' % i) ########################## except Exception, msg: logger.debug('Exception:%s' % msg) stauts = False
def add_post(self, title: str, body: str, user_id: int): self.inner[TITLE] = title self.inner[BODY] = body self.inner[USER_ID] = user_id body = self.from_json("inner") logger.info(REQUEST_BODY.format(body)) return body
def main(): try: i = 0 while i < 5: base.unlock() base.setup() base.find_setting() BTbase().enable_bt() #Reboot the DUT,enter the Bluetooth setting base.setting_reboot_version1() newstatus =BTbase().bt() if newstatus== False: logger.debug('bluetooth is closed after reboot ') exit(1) else: BTbase().disable_bt() base.setting_reboot_version1() newstatus =BTbase().bt() if newstatus == False: logger.info('Success:bluetooth still is closed') else: logger.debug('Failed:bluetooth is opened') exit(1) logger.info('try times is %d'%i) base.exit_app() i+=1 except Exception,msg: logger.debug('Exception:%s'%msg)
def main(): stauts = True try: ########setup video.video_set_up('dayu.mp4') #####play video base.unlock() time.sleep(3) video.launch_video() time.sleep(1) video.check_push_video() i = 0 while i < 100: video.play_video() video.cyclic_video() time.sleep(5) base.back() time.sleep(2) i += 1 logger.info('current cycle is %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 play_all(self): Command(Audio_Comm['PLAY_ALL']).start() time.sleep(3) status = checkfile.check_stauts('text="00:03/01:00"') if status == True: logger.info('Play audio is success') else: logger.error('Play audio is failed')
def launch_video(self): Command(Video_Comm['OPENVIDEO']).start() time.sleep(2) status=checkfile.check_stauts('page://videoplayer.yunos.com/videoplayer') if status == True: logger.info('open the video app is success') else: raise Exception("Launch video player is failed")
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 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 check_connect_enable(self): Command(WIFI_Comm['LANCH_WIFI']).start() time.sleep(2) status = checkfile.check_stauts('text="已连接"') if status == True: logger.info('enable connect is success') base.back() else: raise Exception('enable connect is failed')
def push_video_file(self,*args): try: for i in args: Command('adb -host push {0} {1}'.format(os.path.join(path_local,i),path_devcices)).start() time.sleep(5) logger.info('push video file in devices') except Exception,msg: logger.debug('Exception:%s'%msg) exit(1)
def test_add_post_method_works(self, api_client): allure.step("Verify that response is not empty and status code is 201") _response = api_client.post_service.add_post("Test", "Test Post", 8888) assert _response[0] is not None assert _response[1].status_code == 201 assert _response[1].reason == "Created" logger.info(TEST_RESULT.format(test_case, 1, "PASSED"))
def test_get_posts_method_works(self, api_client): allure.step("Verify that response is not empty and status code is 200") _response = api_client.post_service.get_posts() assert _response[0] is not None assert _response[1].status_code == 200 assert _response[1].reason == "OK" logger.info(TEST_RESULT.format(test_case, 1, "PASSED"))
def open_audio(self): Command(Audio_Comm['OPENAUDIO']).start() status = checkfile.check_stauts('text="音乐"') if status == True: logger.info('SUCCESS:open audio package is success') else: logger.debug('Failed:open audio package is failed') exit(1)
def seek_player_mid(self): Command(Audio_Comm['SEEK_MID']).start() time.sleep(3) status = checkfile.check_stauts('text="00:34/01:00"') if status == True: logger.info('Seek the audio to middle is success') else: logger.error('Seek the audio to middle is failed') exit(1)
def play_video(self): time.sleep(5) Command(Video_Comm['PLAYVIDEO']).start() status = checkfile.check_stauts('resource-id="playerView"') if status == True: Command('adb -host shell input tap 500 600').start() logger.info('play video is success') else: raise Exception('play video is failed')
def check_audio(self): time.sleep(2) status = checkfile.check_stauts('text="无音乐"') if status == False: logger.info('SUCCESS:push audio file is success') else: logger.debug('Fail:push audio file is failed') exit(1)
def test_get_most_popular_movies(self, api_client): allure.step("Verify that status code is 200 OK.") res = api_client.get_most_popular_movies() assert res[0] is not None assert res[1].status_code == 200 assert res[1].reason == "OK" logger.info( F"============ TEST CASE {test_case} / 1 PASSED ===========")