Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
U
ubains-module-test
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
郑晓兵
ubains-module-test
Commits
8b4b7483
提交
8b4b7483
authored
3月 06, 2025
作者:
陈泽健
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
补充展厅无纸化中控2.0的同屏巡检代码。
上级
a53882ab
显示空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
136 行增加
和
9 行删除
+136
-9
app_base.cpython-310.pyc
预定系统/Base/__pycache__/app_base.cpython-310.pyc
+0
-0
base.cpython-310.pyc
预定系统/Base/__pycache__/base.cpython-310.pyc
+0
-0
app_base.py
预定系统/Base/app_base.py
+3
-3
README.md
预定系统/README.md
+3
-0
01无纸化1.0同屏测试.py
预定系统/cases/展厅巡检/03无纸化/01无纸化1.0同屏测试.py
+2
-2
01无纸化2.0同屏巡检.py
预定系统/cases/展厅巡检/03无纸化/01无纸化2.0同屏巡检.py
+124
-0
02无纸化1.0.py
预定系统/cases/展厅巡检/03无纸化/02无纸化1.0.py
+2
-2
01无纸化1.0同屏测试.cpython-310.pyc
...cases/展厅巡检/03无纸化/__pycache__/01无纸化1.0同屏测试.cpython-310.pyc
+0
-0
01无纸化2.0同屏巡检.cpython-310.pyc
...cases/展厅巡检/03无纸化/__pycache__/01无纸化2.0同屏巡检.cpython-310.pyc
+0
-0
02无纸化1.0.cpython-310.pyc
预定系统/cases/展厅巡检/03无纸化/__pycache__/02无纸化1.0.cpython-310.pyc
+0
-0
讯飞系统巡检.cpython-310.pyc
预定系统/cases/展厅巡检/06讯飞系统巡检/__pycache__/讯飞系统巡检.cpython-310.pyc
+0
-0
讯飞系统巡检.py
预定系统/cases/展厅巡检/06讯飞系统巡检/讯飞系统巡检.py
+1
-1
ngrok.cfg
预定系统/ngrok/ngrok-调试主机/ngrok.cfg
+1
-1
没有找到文件。
预定系统/Base/__pycache__/app_base.cpython-310.pyc
浏览文件 @
8b4b7483
No preview for this file type
预定系统/Base/__pycache__/base.cpython-310.pyc
浏览文件 @
8b4b7483
No preview for this file type
预定系统/Base/app_base.py
浏览文件 @
8b4b7483
...
...
@@ -744,7 +744,7 @@ def get_screenshot_with_retry(wd,app_drive, module_name, function_name, max_retr
file_path
=
os
.
path
.
join
(
target_dir
,
f
"{function_name}.png"
)
#截屏
SELENIUM_LOG_SCREEN
(
wd
,
"75
%
"
,
"Exhibit_Inspect"
,
"Control_Manage"
,
f
"{function_name}"
)
SELENIUM_LOG_SCREEN
(
wd
,
"75
%
"
,
"Exhibit_Inspect"
,
module_name
,
f
"{function_name}"
)
# 使用循环实现重试机制
for
_
in
range
(
max_retries
):
...
...
@@ -761,7 +761,7 @@ def get_screenshot_with_retry(wd,app_drive, module_name, function_name, max_retr
# 如果多次尝试均失败,则抛出异常
raise
Exception
(
f
"多次尝试截图失败: {file_path}"
)
def
find_element_with_retry
(
driver
,
by
,
value
,
max_retries
=
3
,
retry_delay
=
5
):
def
find_element_with_retry
(
app_
driver
,
by
,
value
,
max_retries
=
3
,
retry_delay
=
5
):
"""
使用重试机制查找元素。
...
...
@@ -785,7 +785,7 @@ def find_element_with_retry(driver, by, value, max_retries=3, retry_delay=5):
for
_
in
range
(
max_retries
):
try
:
# 尝试查找元素,如果成功则立即返回元素
return
driver
.
find_element
(
by
,
value
)
return
app_
driver
.
find_element
(
by
,
value
)
except
Exception
as
e
:
# 如果查找元素失败,记录日志并等待一段时间后重试
logging
.
warning
(
f
"查找元素失败,重试中... ({e})"
)
...
...
预定系统/README.md
浏览文件 @
8b4b7483
...
...
@@ -236,3 +236,5 @@
-
排查展厅巡检报告中的异常,处理会场名称变动,导致会场搜索失败问题,改为模糊查询与CSS定位,处理腾讯软终端元素变动问题。
-
排查展厅巡检报告中讯飞语音转录为空的问题。
-
调整讯飞语音转录的流程,登录讯飞语音转录系统后先判断客户端盒子是否在线,如果在线就进行后续的转录文字提取判断。config.json配置文件增加展厅讯飞系统配置项。
63.
2025-03-06
-
补充展厅无纸化中控2.0的同屏巡检代码。
\ No newline at end of file
预定系统/cases/展厅巡检/03无纸化/01无纸化同屏测试.py
→
预定系统/cases/展厅巡检/03无纸化/01无纸化
1.0
同屏测试.py
浏览文件 @
8b4b7483
...
...
@@ -6,9 +6,9 @@ class same_screen_share_000x:
"""
执行指令:
1.cd 预定系统
2.hytest --report_title 无纸化同屏测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 无纸化同屏
2.hytest --report_title 无纸化同屏测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 无纸化
1.0
同屏
"""
tags
=
[
'无纸化
同屏'
,
'展厅巡检'
,
'无纸化
测试'
]
tags
=
[
'无纸化
1.0同屏'
,
'无纸化1.0
测试'
]
def
teststeps
(
self
):
wd
=
GSTORE
[
'wd'
]
...
...
预定系统/cases/展厅巡检/03无纸化/01无纸化2.0同屏巡检.py
0 → 100644
浏览文件 @
8b4b7483
from
预定系统
.
Base
.
app_base
import
*
import
logging
import
time
class
same_screen_share_000x
:
"""
执行指令:
1.cd 预定系统
2.hytest --report_title 无纸化同屏测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 无纸化同屏
"""
tags
=
[
'无纸化2.0同屏'
,
'展厅巡检'
,
'无纸化2.0测试'
]
def
teststeps
(
self
):
wd
=
GSTORE
[
'wd'
]
app_drive1
=
None
app_drive2
=
None
try
:
# 初始化第一个设备
app_drive1
=
app_setup_driver
(
"Android"
,
"7.1.2"
,
"展厅无纸化设备2.0"
,
"com.ubains.local.gviewer"
,
"com.ubains.ub.gview.SplashActivity"
,
"192.168.5.156:5555"
)
app_drive1
.
implicitly_wait
(
10
)
# 设置缺省等待时间
# 初始化第二个设备
app_drive2
=
app_setup_driver
(
"Android"
,
"7.1.2"
,
"展厅无纸化设备2.0"
,
"com.ubains.local.gviewer"
,
"com.ubains.ub.gview.SplashActivity"
,
"192.168.5.157:5555"
)
app_drive2
.
implicitly_wait
(
10
)
# 设置缺省等待时间
# 使用显式等待来等待元素出现
logging
.
info
(
f
"等待登录页加载."
)
sleep
(
10
)
# 进入后台设置界面
logging
.
info
(
f
"尝试进入后台设置"
)
back_setting_button
=
find_element_with_retry
(
app_drive1
,
AppiumBy
.
XPATH
,
"/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[1]/android.widget.Button[3]"
)
click_with_retry
(
back_setting_button
)
# 输入管理员密码点击【确定】按钮
logging
.
info
(
f
"尝试输入管理员密码点击【确定】"
)
admin_pwd_input
=
find_element_with_retry
(
app_drive1
,
AppiumBy
.
XPATH
,
"/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.EditText"
)
admin_pwd_input
.
send_keys
(
"Ubains@123"
)
sleep
(
3
)
# 点击确定按钮
confirm_button
=
find_element_with_retry
(
app_drive1
,
AppiumBy
.
XPATH
,
"/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.TextView[3]"
)
click_with_retry
(
confirm_button
)
sleep
(
5
)
# 先截取另一台设备的界面做参照物
INFO
(
f
"这是设备B的界面"
)
# 调用截屏函数
get_screenshot_with_retry
(
wd
,
app_drive2
,
"No_PaperLess"
,
"BeforeShareDeviceB"
)
# 进入【同屏和视频服务】界面
logging
.
info
(
f
"进入【同屏和视频服务】"
)
same_screen_module
=
find_element_with_retry
(
app_drive1
,
AppiumBy
.
XPATH
,
'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[3]/android.widget.FrameLayout[1]/androidx.recyclerview.widget.RecyclerView/android.widget.FrameLayout[4]/android.widget.FrameLayout/android.widget.TextView'
)
click_with_retry
(
same_screen_module
)
sleep
(
2
)
# 点击右上角【同屏配置】按钮
share_setting_button
=
find_element_with_retry
(
app_drive1
,
AppiumBy
.
XPATH
,
'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[3]/android.widget.FrameLayout[2]/androidx.viewpager.widget.ViewPager/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.Button[1]'
)
click_with_retry
(
share_setting_button
)
sleep
(
3
)
# 进入同屏配置模块界面,点击【同屏共享】进入同屏共享界面
same_screen_button
=
find_element_with_retry
(
app_drive1
,
AppiumBy
.
XPATH
,
"/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.ScrollView/android.widget.LinearLayout/android.widget.FrameLayout[2]/android.widget.TextView"
)
click_with_retry
(
same_screen_button
)
sleep
(
2
)
# 点击【开始】同屏按钮
same_screen_start_button
=
find_element_with_retry
(
app_drive1
,
AppiumBy
.
XPATH
,
'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/androidx.viewpager.widget.ViewPager/androidx.recyclerview.widget.RecyclerView/android.widget.FrameLayout/android.view.ViewGroup/androidx.appcompat.widget.LinearLayoutCompat/android.widget.Button[1]'
)
click_with_retry
(
same_screen_start_button
)
sleep
(
2
)
# 截取设备A和设备B的同屏画面截屏
INFO
(
f
"这是设备A同屏共享的界面"
)
get_screenshot_with_retry
(
wd
,
app_drive1
,
"No_PaperLess"
,
"AfterShareDeviceA"
)
INFO
(
f
"这是设备B同屏共享的界面"
)
get_screenshot_with_retry
(
wd
,
app_drive2
,
"No_PaperLess"
,
"AfterShareDeviceB"
)
# 调用图片对比函数判断相似度
# image1_path = r"/预定系统/reports/imgs/Exhibit_Inspect/No_PaperLess/同屏后-无纸化设备A界面截屏.png"
# image2_path = r"/预定系统/reports/imgs/Exhibit_Inspect/No_PaperLess/同屏后-无纸化设备B界面截屏.png"
#
# if not os.path.exists(image1_path):
# logging.error(f"图片 {image1_path} 不存在")
# exit(1)
# if not os.path.exists(image2_path):
# logging.error(f"图片 {image2_path} 不存在")
# exit(1)
#
# # 对比两张截图的相似度
# result1 = classify_hist_with_split(image1_path, image2_path)
#
# # 确保 result1 是一个标量值
# if isinstance(result1, numpy.ndarray):
# result1 = result1.item()
# # 输出相似度
# INFO("相似度为:" + "%.2f%%" % (result1 * 100))
sleep
(
1
)
# 点击【停止】同屏按钮,退出同屏操作
share_quit_button
=
find_element_with_retry
(
app_drive1
,
AppiumBy
.
XPATH
,
'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.widget.FrameLayout/android.view.ViewGroup/androidx.viewpager.widget.ViewPager/androidx.recyclerview.widget.RecyclerView/android.widget.FrameLayout/android.view.ViewGroup/androidx.appcompat.widget.LinearLayoutCompat/android.widget.Button[2]'
)
INFO
(
"执行退出同屏操作"
)
click_with_retry
(
share_quit_button
)
# 退出同屏后截屏操作
INFO
(
f
"这是设备A关闭同屏共享的界面"
)
get_screenshot_with_retry
(
wd
,
app_drive1
,
"No_PaperLess"
,
"QuitShareDeviceA"
)
INFO
(
f
"这是设备B关闭同屏共享的界面"
)
get_screenshot_with_retry
(
wd
,
app_drive2
,
"No_PaperLess"
,
"QuitShareDeviceB"
)
sleep
(
5
)
except
Exception
as
e
:
logging
.
error
(
f
"发生错误: {e}"
,
exc_info
=
True
)
\ No newline at end of file
预定系统/cases/展厅巡检/03无纸化/02无纸化1.0.py
浏览文件 @
8b4b7483
...
...
@@ -11,9 +11,9 @@ class Exhibition_hall_NoPaperinspection_000x:
"""
执行指令:
1.cd 预定系统
2.hytest --report_title 无纸化会议操作测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 无纸化
2.hytest --report_title 无纸化会议操作测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 无纸化
1.0测试
"""
tags
=
[
'
展厅巡检'
,
'无纸化
测试'
]
tags
=
[
'
无纸化1.0
测试'
]
def
teststeps
(
self
):
app_drive
=
None
...
...
预定系统/cases/展厅巡检/03无纸化/__pycache__/01无纸化同屏测试.cpython-310.pyc
→
预定系统/cases/展厅巡检/03无纸化/__pycache__/01无纸化
1.0
同屏测试.cpython-310.pyc
浏览文件 @
8b4b7483
No preview for this file type
预定系统/cases/展厅巡检/03无纸化/__pycache__/01无纸化2.0同屏巡检.cpython-310.pyc
0 → 100644
浏览文件 @
8b4b7483
File added
预定系统/cases/展厅巡检/03无纸化/__pycache__/02无纸化1.0.cpython-310.pyc
浏览文件 @
8b4b7483
No preview for this file type
预定系统/cases/展厅巡检/06讯飞系统巡检/__pycache__/讯飞系统巡检.cpython-310.pyc
浏览文件 @
8b4b7483
No preview for this file type
预定系统/cases/展厅巡检/06讯飞系统巡检/讯飞系统巡检.py
浏览文件 @
8b4b7483
...
...
@@ -34,7 +34,7 @@ class XF_Meeting_0001:
sleep
(
1
)
# 搜索“展厅巡检”会议数据
INFO
(
"搜索“展厅巡检”会议数据"
)
safe_send_keys
((
By
.
XPATH
,
"//input[@placeholder='输入文件名称']"
),
"
Test02
"
,
wd
)
safe_send_keys
((
By
.
XPATH
,
"//input[@placeholder='输入文件名称']"
),
"
展厅巡检测试
"
,
wd
)
send_keyboard
((
By
.
XPATH
,
"//input[@placeholder='输入文件名称']"
),
wd
)
sleep
(
3
)
...
...
预定系统/ngrok/ngrok-调试主机/ngrok.cfg
浏览文件 @
8b4b7483
...
...
@@ -3,5 +3,5 @@ trust_host_root_certs: false
tunnels:
nat1:
proto:
tcp: 192.168.
2.254
:80
tcp: 192.168.
1.228
:80
remote_port: 31133
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论