提交 a53882ab authored 作者: 陈泽健's avatar 陈泽健

调整讯飞语音转录的流程,登录讯飞语音转录系统后先判断客户端盒子是否在线,如果在线就进行后续的转录文字提取判断。config.json配置文件增加展厅讯飞系统配置项。

上级 7fcfff68
...@@ -9,5 +9,8 @@ ...@@ -9,5 +9,8 @@
"展厅运维巡检": "http://192.168.5.200:8081/#/login", "展厅运维巡检": "http://192.168.5.200:8081/#/login",
"_comment_exhibit_unified_platform": "这是展厅统一平台系统的URL", "_comment_exhibit_unified_platform": "这是展厅统一平台系统的URL",
"展厅统一平台巡检": "http://192.168.5.200:38083/#/login" "展厅统一平台巡检": "http://192.168.5.200:38083/#/login",
"_comment_exhibit_operation_platform": "这是展厅讯飞系统的URL",
"展厅讯飞系统巡检": "http://192.168.5.201:8080/#/login"
} }
\ No newline at end of file
...@@ -1053,7 +1053,6 @@ def play_cloud_voice(app_id, app_secret, device_sn): ...@@ -1053,7 +1053,6 @@ def play_cloud_voice(app_id, app_secret, device_sn):
# 根据响应状态码判断请求是否成功 # 根据响应状态码判断请求是否成功
if response.status_code == 200: if response.status_code == 200:
logging.info(f"请求成功: {response.json()}") logging.info(f"请求成功: {response.json()}")
sleep(20)
else: else:
logging.error(f"请求失败: 状态码 {response.status_code}, 响应内容 {response.text}") logging.error(f"请求失败: 状态码 {response.status_code}, 响应内容 {response.text}")
......
...@@ -235,3 +235,4 @@ ...@@ -235,3 +235,4 @@
62. 2025-03-05 62. 2025-03-05
- 排查展厅巡检报告中的异常,处理会场名称变动,导致会场搜索失败问题,改为模糊查询与CSS定位,处理腾讯软终端元素变动问题。 - 排查展厅巡检报告中的异常,处理会场名称变动,导致会场搜索失败问题,改为模糊查询与CSS定位,处理腾讯软终端元素变动问题。
- 排查展厅巡检报告中讯飞语音转录为空的问题。 - 排查展厅巡检报告中讯飞语音转录为空的问题。
- 调整讯飞语音转录的流程,登录讯飞语音转录系统后先判断客户端盒子是否在线,如果在线就进行后续的转录文字提取判断。config.json配置文件增加展厅讯飞系统配置项。
\ No newline at end of file
...@@ -26,6 +26,7 @@ def suite_setup(): ...@@ -26,6 +26,7 @@ def suite_setup():
browser_init("展厅预定巡检") browser_init("展厅预定巡检")
wd = GSTORE['wd'] wd = GSTORE['wd']
admin_login("Test02", "ubains@123")
def suite_teardown(): def suite_teardown():
device_ip = '192.168.5.142' device_ip = '192.168.5.142'
......
...@@ -10,7 +10,7 @@ class Exhibition_Meeting_Control_0001: ...@@ -10,7 +10,7 @@ class Exhibition_Meeting_Control_0001:
""" """
执行指令: 执行指令:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 会议预约测试报告 --report_url_prefix http://192.168.1.225 --tag 展厅会议室中控屏 2.hytest --report_title 会议预约测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 展厅会议室中控屏
""" """
tags = ['展厅会议室中控屏','展厅巡检','讯飞转录流程测试'] tags = ['展厅会议室中控屏','展厅巡检','讯飞转录流程测试']
...@@ -20,6 +20,7 @@ class Exhibition_Meeting_Control_0001: ...@@ -20,6 +20,7 @@ class Exhibition_Meeting_Control_0001:
该方法初始化应用驱动,等待应用加载,定位并点击会议按钮,加入会议,并截取会议画面。 该方法初始化应用驱动,等待应用加载,定位并点击会议按钮,加入会议,并截取会议画面。
""" """
app_drive = None app_drive = None
wd = GSTORE['wd']
try: try:
# 初始化应用驱动,连接到指定的设备和应用 # 初始化应用驱动,连接到指定的设备和应用
app_drive = app_setup_driver("Android", "5.1.1", "UT-12", "com.ubains.gviewer.develop", app_drive = app_setup_driver("Android", "5.1.1", "UT-12", "com.ubains.gviewer.develop",
...@@ -102,22 +103,24 @@ class Exhibition_Meeting_Control_0001: ...@@ -102,22 +103,24 @@ class Exhibition_Meeting_Control_0001:
"/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout[5]/android.widget.Button[1]") "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout[5]/android.widget.Button[1]")
INFO("点击左上角logo进入后台") INFO("点击左上角logo进入后台")
enter_back_button.click() enter_back_button.click()
sleep(5) sleep(3)
INFO("尝试定位麦克风按钮") INFO("尝试定位麦克风按钮")
mic_on_button = app_drive.find_element(AppiumBy.XPATH, mic_on_button = app_drive.find_element(AppiumBy.XPATH,
"/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout[6]/android.widget.Button[2]") "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout[6]/android.widget.Button[2]")
INFO("开启麦克风") INFO("开启麦克风")
mic_on_button.click() mic_on_button.click()
sleep(5) sleep(2)
# 云喇叭参数 # 云喇叭参数
app_id = os.getenv("APP_ID", "a98a124c6c3252f6612fc544a0d0fa79") app_id = os.getenv("APP_ID", "a98a124c6c3252f6612fc544a0d0fa79")
app_secret = os.getenv("APP_SECRET", "88bc1ec4eba624f47b2200a4ce8c3852") app_secret = os.getenv("APP_SECRET", "88bc1ec4eba624f47b2200a4ce8c3852")
device_sn = os.getenv("DEVICE_SN", "W703BB44444") device_sn = os.getenv("DEVICE_SN", "W703BB44444")
play_cloud_voice(app_id, app_secret, device_sn) play_cloud_voice(app_id, app_secret, device_sn)
# mic_off_button = app_drive.find_element(AppiumBy.XPATH, sleep(20)
# "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout[6]/android.widget.Button[3]") # 关闭麦克风
# mic_off_button.click() mic_off_button = app_drive.find_element(AppiumBy.XPATH,
sleep(5) "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout/android.widget.RelativeLayout[5]/android.widget.Button[3]")
INFO("关闭麦克风")
mic_off_button.click()
# 关闭左摄像头 # 关闭左摄像头
left_camera_off_button = app_drive.find_element(AppiumBy.XPATH, left_camera_off_button = app_drive.find_element(AppiumBy.XPATH,
...@@ -126,13 +129,25 @@ class Exhibition_Meeting_Control_0001: ...@@ -126,13 +129,25 @@ class Exhibition_Meeting_Control_0001:
left_camera_off_button.click() left_camera_off_button.click()
sleep(20) sleep(20)
# 进入“已预定列表”界面,结束这场会议
safe_click((By.XPATH, "//span[contains(text(),'已预订会议')]"), wd)
# 搜索会议
safe_send_keys((By.XPATH, "//input[@placeholder='输入关键字搜索']"), "展厅巡检", wd)
sleep(1)
send_keyboard((By.XPATH, "//input[@placeholder='输入关键字搜索']"), wd)
# 点击【更多操作】
safe_click((By.XPATH, "//span[contains(text(),'更多操作')]"), wd)
sleep(3)
# 点击【会议状态】按钮
safe_click((By.XPATH, "//li[contains(text(),'会议状态')]"), wd)
sleep(3)
# 点击【结束会议】按钮,并点击【确定】按钮结束这场会议
safe_click((By.XPATH, "//span[contains(text(),'提前结束')]"), wd)
sleep(2)
safe_click((By.XPATH, "//div[@slot='footer']//span[contains(text(),'确定')]"), wd)
except Exception as e: except Exception as e:
# 捕获并记录任何发生的错误 # 捕获并记录任何发生的错误
logging.error(f"发生错误: {e}", exc_info=True) logging.error(f"发生错误: {e}", exc_info=True)
\ No newline at end of file
# finally:
# 确保驱动程序在测试结束后正确关闭
# if app_drive:
# app_drive.quit()
# IN("驱动程序已退出。")
\ No newline at end of file
...@@ -18,12 +18,16 @@ except ModuleNotFoundError as e: ...@@ -18,12 +18,16 @@ except ModuleNotFoundError as e:
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
# 传入系统类型,展厅预定巡检 == 192.168.5.200 # 传入系统类型,初始化浏览器,并打开讯飞系统
browser_init("展厅预定巡检") browser_init("展厅讯飞系统巡检")
wd = GSTORE['wd'] wd = GSTORE['wd']
admin_login("Test02", "ubains@123") # 输入账号密码登录系统
sleep(5) safe_send_keys((By.XPATH, "//input[@placeholder='请输入用户名']"), "admin", wd)
safe_send_keys((By.XPATH, "//input[@placeholder='请输入密码']"), "ubains666", wd)
sleep(1)
safe_click((By.XPATH, "//button[contains(text(),'登录')]"), wd)
sleep(2)
def suite_teardown(): def suite_teardown():
browser_quit() browser_quit()
\ No newline at end of file
...@@ -15,42 +15,40 @@ class XF_Meeting_0001: ...@@ -15,42 +15,40 @@ class XF_Meeting_0001:
def teststeps(self): def teststeps(self):
wd = GSTORE['wd'] wd = GSTORE['wd']
safe_click((By.XPATH, "//span[contains(text(),'已预订会议')]"), wd) notify_text = ""
sleep(1) # 进入后台
safe_send_keys((By.XPATH, "//input[@placeholder='输入关键字搜索']"), "展厅巡检测试", wd) safe_click((By.XPATH, "//img[@title='后台']"), wd)
send_keyboard((By.XPATH, "//input[@placeholder='输入关键字搜索']"), wd) # 进入【系统信息】模块,查看“客户端是否正常在线”
sleep(5) safe_click((By.XPATH, "//span[contains(text(),'系统信息')]"), wd)
safe_click((By.XPATH, "//span[contains(text(),'更多操作')]"),wd) # 截屏查看获取“客户端是否正常在线”
sleep(5) sleep(10)
safe_click((By.XPATH, "//li[contains(text(),'讯飞纪要')]"), wd)
sleep(3)
wd.switch_to.window(wd.window_handles[1])
sleep(5)
app_id = os.getenv("APP_ID", "a98a124c6c3252f6612fc544a0d0fa79")
app_secret = os.getenv("APP_SECRET", "88bc1ec4eba624f47b2200a4ce8c3852")
device_sn = os.getenv("DEVICE_SN", "W703BB44444")
play_cloud_voice(app_id, app_secret, device_sn)
INFO("请检查讯飞系统是否正确单点登录,并查看讯飞语音转录是否成功!!!") # 判断客户端是否在线
SELENIUM_LOG_SCREEN(wd, "75%", "Exhibit_Inspect", "XF_meeting", "讯飞纪要界面截屏") notify_text = elment_get_text((By.CSS_SELECTOR, "div[class='client'] span span:nth-child(1) span:nth-child(1)"), wd)
CHECK_POINT('查看讯飞客户端是否正常启动', notify_text == "正常启动")
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "XF_Meeting", "查看讯飞客户端是否正常启动")
# 结束这场会议 # 点击【LOGO】按钮,返回首页界面
wd.switch_to.window(wd.window_handles[0]) INFO("点击【LOGO】按钮,返回首页界面")
sleep(2) safe_click((By.XPATH, "//img[@class='logo']"), wd)
safe_click((By.XPATH, "//span[contains(text(),'已预订会议')]"),wd)
sleep(1) sleep(1)
safe_send_keys((By.XPATH, "//input[@placeholder='输入关键字搜索']"), "展厅巡检测试", wd) # 搜索“展厅巡检”会议数据
send_keyboard((By.XPATH, "//input[@placeholder='输入关键字搜索']"), wd) INFO("搜索“展厅巡检”会议数据")
sleep(2) safe_send_keys((By.XPATH, "//input[@placeholder='输入文件名称']"), "Test02", wd)
send_keyboard((By.XPATH, "//input[@placeholder='输入文件名称']"), wd)
sleep(3)
safe_click((By.XPATH, "//span[contains(text(),'更多操作')]"), wd) # 获取搜索结果,点击【会议纪要】按钮进入转录界面
sleep(2) INFO("获取搜索结果,点击【会议纪要】按钮进入转录界面")
safe_click((By.XPATH, "//li[contains(text(),'会议状态')]"),wd) safe_click((By.XPATH, "//tbody/tr[1]/td[6]/div[1]/div[1]/img[2]"),wd)
sleep(2) sleep(1)
safe_click((By.XPATH, "//span[contains(text(),'提前结束')]"), wd) SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "XF_Meeting", "查看讯飞转录界面")
sleep(2) # 获取转录文字
safe_click((By.XPATH, "//div[@slot='footer']//span[contains(text(),'确定')]"), wd) transfer_text = ""
sleep(2) transfer_text = elment_get_text((By.CSS_SELECTOR, ".result.sentences0"), wd)
# 点击二次确认按钮 INFO("讯飞语音转录文字:" + transfer_text)
safe_click((By.XPATH, "//button[@class='el-button el-button--default el-button--small el-button--primary ']//span[contains(text(),'确定')]"), wd) # 判断转录文字是否为空
sleep(2) if transfer_text != "":
\ No newline at end of file CHECK_POINT("讯飞语音转录成功", True)
else:
CHECK_POINT("讯飞语音转录失败", False)
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论