def test_case4(self): self.driver.screenshot(path.src_path + "file.png") get_ROIimg() time.sleep(1) ret_bef = get_str() play('你好小西', path.wake_up_file) wake_finish_time = self.GDL.get_local_time() get_mic_status.get_mic_status(self.driver) play("下一个频道", path.men_qa_file) print("wake_finish_time",wake_finish_time) time.sleep(0.5) self.driver.screenshot(path.Cache_img_path2) time.sleep(9) self.driver.screenshot(path.src_path + "file.png") get_ROIimg() time.sleep(1) ret_aft = get_str() print(ret_bef,ret_aft) if float(ret_aft)>float(ret_bef) and ret_aft!="0" and ret_bef!="0": result = True else: result = False # result = img_match.picture_match(self.driver,"radio88.png",0.99) self.GDL.get_device_log() start_time, new_result = self.GDL.get_device_wake() print("start_time",start_time) check_time = abs(wake_finish_time-start_time) print(check_time) ck.check(check_time, result, 'radio_case4')
def test_case2(self): play('你好小西', path.wake_up_file) wake_finish_time = self.GDL.get_local_time() print("wake_finish_time",wake_finish_time) get_mic_status.get_mic_status(self.driver) play("调幅九百", path.men_qa_file) time.sleep(0.5) self.driver.screenshot(path.Cache_img_path2) time.sleep(9) self.driver.screenshot(path.src_path + "file.png") get_ROIimg() time.sleep(1) ret = get_str() print(ret) if ret == "900": result = True else: result = False # result = img_match.picture_match(self.driver,"radio900.png",0.99) self.GDL.get_device_log() start_time, new_result = self.GDL.get_device_wake() print("start_time",start_time) check_time = abs(wake_finish_time-start_time) print(check_time) ck.check(check_time, result, 'radio_case2')
def test_case2(self): play('你好小西', path.wake_up_file) wake_finish_time = self.GDL.get_local_time() print("wake_finish_time", wake_finish_time) time.sleep(2) play("调幅九百", path.men_qa_file) time.sleep(6) self.driver.screenshot("file.png") get_ROIimg() time.sleep(1) ret = get_str() print(ret) if ret == "900": result = True else: result = False # result = img_match.picture_match(self.driver,"radio900.png",0.99) self.GDL.get_device_log() start_time, new_result = self.GDL.get_device_wake() print("start_time", start_time) check_time = abs(wake_finish_time - start_time) print(check_time) if check_time >= 5: print("\033[7;44mcase2唤醒失败\033[0m") else: print("\033[7;31mcase2唤醒成功\033[0m") if result: print("\033[7;31mcase2测试通过\033[0m") else: print("\033[7;44mcase2测试失败\033[0m") fail_dir_name = time.strftime("%y_%m_%d_%H_%M_%S") cmd = "adb pull sdcard/txz/log " + path.DIR_PATH + "\\report\\error_log\\" + fail_dir_name + "case2\\" subprocess.call(cmd)
def test_case8(self): self.driver.screenshot("file.png") get_ROIimg() time.sleep(1) ret_bef = get_str() play('你好小西', path.wake_up_file) wake_finish_time = self.GDL.get_local_time() print("wake_finish_time", wake_finish_time) time.sleep(2) play("换台", path.men_qa_file) time.sleep(10) self.driver.screenshot("file.png") get_ROIimg() time.sleep(1) ret_aft = get_str() print(ret_bef, ret_aft) # result = img_match.picture_match(self.driver,"radio88.png",0.99) self.GDL.get_device_log() start_time, new_result = self.GDL.get_device_wake() print("start_time", start_time) check_time = abs(wake_finish_time - start_time) print(check_time) if check_time >= 5: print("\033[7;44mcase8唤醒失败\033[0m") else: print("\033[7;31mcase8唤醒成功\033[0m") if float(ret_aft) > float( ret_bef) and ret_aft != "0" and ret_bef != "0": print("\033[7;31mcase8测试通过\033[0m") else: print("\033[7;44mcase8测试失败\033[0m") fail_dir_name = time.strftime("%y_%m_%d_%H_%M_%S") cmd = "adb pull sdcard/txz/log " + path.DIR_PATH + "\\report\\error_log\\" + fail_dir_name + "case8\\" subprocess.call(cmd)
def test_case9(self): self.driver.screenshot(path.src_path + "file.png") get_ROIimg() time.sleep(1) ret_bef = get_str() play('你好小西', path.wake_up_file) wake_finish_time = self.GDL.get_local_time() print("wake_finish_time",wake_finish_time) get_mic_status.get_mic_status(self.driver) play("上一个电台", path.men_qa_file) time.sleep(0.5) self.driver.screenshot(path.Cache_img_path2) time.sleep(9) self.driver.screenshot(path.src_path + "file.png") get_ROIimg() time.sleep(1) ret_aft = get_str() print(ret_bef,ret_aft) if float(ret_aft)<float(ret_bef) and ret_aft!="0" and ret_bef!="0": result = True else: result = False # result = img_match.picture_match(self.driver,"radio88.png",0.99) self.GDL.get_device_log() start_time, new_result = self.GDL.get_device_wake() print("start_time",start_time) check_time = abs(wake_finish_time-start_time) print(check_time) ck.check(check_time, result, 'radio_case9') # # if __name__ == "__main__": # ask = Music_ask() # ask.test_case1() # ask.test_case2() # ask.test_case3() # ask.test_case4() # ask.test_case5() # ask.test_case6() # ask.test_case7() # ask.test_case8()