Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
U
ubains-module-test
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
郑晓兵
ubains-module-test
Commits
60c2e68c
提交
60c2e68c
authored
12月 31, 2024
作者:
陈泽健
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
封装中控屏对应控制模块函数,减少主函数的代码冗杂,增加可维护性。
上级
47566a9a
展开全部
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
154 行增加
和
6 行删除
+154
-6
app_base.cpython-310.pyc
预定系统/Base/__pycache__/app_base.cpython-310.pyc
+0
-0
app_base.py
预定系统/Base/app_base.py
+130
-0
README.md
预定系统/README.md
+3
-2
__st__.cpython-310.pyc
预定系统/cases/展厅巡检/00展厅中控屏/__pycache__/__st__.cpython-310.pyc
+0
-0
展厅中控屏.cpython-310.pyc
预定系统/cases/展厅巡检/00展厅中控屏/__pycache__/展厅中控屏.cpython-310.pyc
+0
-0
__st__.py
预定系统/cases/展厅巡检/00展厅中控屏/__st__.py
+21
-4
展厅中控屏.py
预定系统/cases/展厅巡检/00展厅中控屏/展厅中控屏.py
+0
-0
无纸化1.0.cpython-310.pyc
预定系统/cases/展厅巡检/02无纸化/__pycache__/无纸化1.0.cpython-310.pyc
+0
-0
没有找到文件。
预定系统/Base/__pycache__/app_base.cpython-310.pyc
浏览文件 @
60c2e68c
No preview for this file type
预定系统/Base/app_base.py
浏览文件 @
60c2e68c
from
time
import
sleep
from
appium.webdriver.common.appiumby
import
AppiumBy
from
dominate.tags
import
button
from
pygments.console
import
light_colors
import
logging
from
time
import
sleep
from
appium.options.android
import
UiAutomator2Options
import
logging
from
selenium
import
webdriver
...
...
@@ -274,3 +280,127 @@ def capture_frame_from_rtsp(rtsp_url, file_name, output_path=None):
# else:
# logging.error("帧捕获失败")
def
light_control
(
app_drive
):
# 开启所有区域灯光
# 定位【接待区】灯光
light_reception_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.RelativeLayout/android.widget.RelativeLayout[2]/android.widget.ImageView[1]"
)
sleep
(
2
)
logging
.
info
(
"尝试定位【接待区】按钮元素,并点击按钮"
)
light_reception_button
.
click
()
sleep
(
2
)
# 定位【指挥中心】灯光
light_command_center_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.RelativeLayout/android.widget.RelativeLayout[2]/android.widget.Button[3]"
)
sleep
(
2
)
logging
.
info
(
"尝试定位【指挥中心】按钮元素,并点击按钮"
)
light_command_center_button
.
click
()
sleep
(
2
)
# 定位【影音室】灯光
light_audio_room_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.RelativeLayout/android.widget.RelativeLayout[2]/android.widget.Button[2]"
)
sleep
(
2
)
logging
.
info
(
"尝试定位【影音室】按钮元素,并点击按钮"
)
light_audio_room_button
.
click
()
sleep
(
2
)
# 定位【会议室】灯光
light_meeting_room_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.RelativeLayout/android.widget.RelativeLayout[2]/android.widget.Button[5]"
)
sleep
(
2
)
logging
.
info
(
"尝试定位【会议室】按钮元素,并点击按钮"
)
light_meeting_room_button
.
click
()
sleep
(
2
)
# 定位【会商区】灯光
light_meeting_area_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.RelativeLayout/android.widget.RelativeLayout[2]/android.widget.Button[4]"
)
sleep
(
2
)
logging
.
info
(
"尝试定位【会商区】按钮元素,并点击按钮"
)
light_meeting_area_button
.
click
()
sleep
(
2
)
# 定位【培训室】灯光
light_training_room_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.RelativeLayout/android.widget.RelativeLayout[2]/android.widget.Button[6]"
)
sleep
(
2
)
logging
.
info
(
"尝试定位【培训室】按钮元素,并点击按钮"
)
light_training_room_button
.
click
()
sleep
(
2
)
def
curtain_control
(
app_drive
):
# 所有窗帘全部上升
logging
.
info
(
"尝试定位所有【窗帘上升】按钮元素,并点击按钮"
)
# 上升按钮的定位
curtain_up_locator
=
[
'3'
,
'4'
,
'5'
,
'1'
,
'13'
]
for
i
in
curtain_up_locator
:
curtain_up_button
=
app_drive
.
find_element
(
AppiumBy
.
XPATH
,
f
"/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.RelativeLayout[2]/android.widget.Button[{i}]"
)
curtain_up_button
.
click
()
sleep
(
2
)
# 截图获取当前中控屏软件窗帘上升的界面
app_drive
.
get_screenshot_as_file
(
r"D:\GithubData\自动化\ubains-module-test\预定系统\reports\imgs\Exhibit_Inspect\Control_Manage\curtain_up.png"
)
sleep
(
10
)
# 所有窗帘全部下降
logging
.
info
(
"尝试定位所有【窗帘下降】按钮元素,并点击按钮"
)
# 下降按钮的定位
curtain_down_locator
=
[
'10'
,
'11'
,
'12'
,
'6'
,
'15'
]
for
i
in
curtain_down_locator
:
curtain_down_button
=
app_drive
.
find_element
(
AppiumBy
.
XPATH
,
f
"/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.RelativeLayout[2]/android.widget.Button[{i}]"
)
curtain_down_button
.
click
()
sleep
(
2
)
# 截图获取当前中控屏软件窗帘上升的界面
app_drive
.
get_screenshot_as_file
(
r"D:\GithubData\自动化\ubains-module-test\预定系统\reports\imgs\Exhibit_Inspect\Control_Manage\curtain_down.png"
)
def
air_condition_control
(
app_drive
):
# 点击【打开空调】按钮
logging
.
info
(
"尝试定位【打开空调】按钮元素,并点击按钮"
)
open_air_conditioner_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.RelativeLayout/android.widget.RelativeLayout[2]/android.widget.Button[14]"
)
open_air_conditioner_button
.
click
()
sleep
(
20
)
app_drive
.
get_screenshot_as_file
(
r"D:\GithubData\自动化\ubains-module-test\预定系统\reports\imgs\Exhibit_Inspect\Control_Manage\air_condition_on.png"
)
sleep
(
2
)
# 点击【关闭空调】按钮
logging
.
info
(
"尝试定位【关闭空调】按钮元素,并点击按钮"
)
close_air_conditioner_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.RelativeLayout/android.widget.RelativeLayout[2]/android.widget.Button[14]"
)
close_air_conditioner_button
.
click
()
sleep
(
20
)
app_drive
.
get_screenshot_as_file
(
r"D:\GithubData\自动化\ubains-module-test\预定系统\reports\imgs\Exhibit_Inspect\Control_Manage\air_condition_off.png"
)
sleep
(
2
)
def
command_centre_control
(
rtsp_url
,
app_drive
):
open_center_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.RelativeLayout/android.widget.RelativeLayout[2]/android.widget.Button"
)
open_center_button
.
click
()
sleep
(
10
)
# 从rtsp流中截取一帧保存为图片
logging
.
info
(
"开始捕获RTSP流中的帧"
)
if
capture_frame_from_rtsp
(
rtsp_url
,
"command_screen_on.png"
):
logging
.
info
(
"帧捕获成功"
)
else
:
logging
.
error
(
"帧捕获失败"
)
# 关闭指挥中心大屏幕
logging
.
info
(
"尝试定位【关闭指挥中心控制】按钮元素,并点击按钮"
)
close_center_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.RelativeLayout/android.widget.RelativeLayout[2]/android.widget.Button"
)
close_center_button
.
click
()
sleep
(
10
)
# 从rtsp流中截取一帧保存为图片
logging
.
info
(
"开始捕获RTSP流中的帧"
)
if
capture_frame_from_rtsp
(
rtsp_url
,
"command_screen_down.png"
):
logging
.
info
(
"帧捕获成功"
)
else
:
logging
.
error
(
"帧捕获失败"
)
预定系统/README.md
浏览文件 @
60c2e68c
...
...
@@ -147,4 +147,5 @@
31.
2024-12-31
-
补充对于rtsp流抓取一帧保存为图片,然后再进行对应的亮度判断。处理优化调用。
-
补充展厅中开屏的关于灯光控制、窗帘控制、指挥大屏控制以及配合监控视频来判断灯光与指挥大屏是否正确打开。
-
优化capture_frame_from_rtsp函数的异常判断。
\ No newline at end of file
-
优化capture_frame_from_rtsp函数的异常判断。
-
封装中控屏对应控制模块函数,减少主函数的代码冗杂,增加可维护性。
\ No newline at end of file
预定系统/cases/展厅巡检/00展厅中控屏/__pycache__/__st__.cpython-310.pyc
浏览文件 @
60c2e68c
No preview for this file type
预定系统/cases/展厅巡检/00展厅中控屏/__pycache__/展厅中控屏.cpython-310.pyc
浏览文件 @
60c2e68c
No preview for this file type
预定系统/cases/展厅巡检/00展厅中控屏/__st__.py
浏览文件 @
60c2e68c
...
...
@@ -25,13 +25,13 @@ def suite_setup():
wd
=
GSTORE
[
'wd'
]
admin_login
(
"Test02"
,
"ubains@123"
)
sleep
(
5
)
INFO
(
"请检查灯光开启的状态是否正常"
)
INFO
(
"请检查
中控屏软件
灯光开启的状态是否正常"
)
STEP
(
2
,
"检查灯光开启状态"
)
# 这是全部灯光关闭后在软件界面上的状态显示
INFO
(
"请检查
灯光关闭的状态
是否正常"
)
INFO
(
"请检查
中控屏软件的灯光关闭状态显示
是否正常"
)
SELENIUM_LOG_SCREEN
(
wd
,
"50
%
"
,
"Exhibit_Inspect"
,
"Control_Manage"
,
"light_all_off"
)
# 这是全部灯光开启后在软件界面上的状态显示
INFO
(
"请检查
灯光开启的状态
是否正常"
)
INFO
(
"请检查
中控屏软件的灯光开启状态显示
是否正常"
)
SELENIUM_LOG_SCREEN
(
wd
,
"50
%
"
,
"Exhibit_Inspect"
,
"Control_Manage"
,
"light_all_on"
)
# 这是灯光开启前的截图
INFO
(
"请检查灯光开启前的监控视频状态是否正常"
)
...
...
@@ -40,13 +40,19 @@ def suite_setup():
INFO
(
"请检查灯光开启后的监控视频状态是否正常"
)
SELENIUM_LOG_SCREEN
(
wd
,
"50
%
"
,
"Exhibit_Inspect"
,
"Control_Manage"
,
"light_on"
)
STEP
(
3
,
"检查窗帘的上升下降状态"
)
INFO
(
"请检查窗帘上升状态是否正常"
)
SELENIUM_LOG_SCREEN
(
wd
,
"50
%
"
,
"Exhibit_Inspect"
,
"Control_Manage"
,
"curtain_up"
)
INFO
(
"请检查窗帘下降状态是否正常"
)
SELENIUM_LOG_SCREEN
(
wd
,
"50
%
"
,
"Exhibit_Inspect"
,
"Control_Manage"
,
"curtain_down"
)
STEP
(
3
,
"检查空调开启状态"
)
# 这是空调关闭的状态显示
INFO
(
"请检查空调关闭的状态是否正常"
)
SELENIUM_LOG_SCREEN
(
wd
,
"50
%
"
,
"Exhibit_Inspect"
,
"Control_Manage"
,
"air_condition_off"
)
# 这是空调开启的状态显示
INFO
(
"请检查空调开启的状态是否正常"
)
SELENIUM_LOG_SCREEN
(
wd
,
"50
%
"
,
"Exhibit_Inspect"
,
"Control_Manage"
,
"air_condition_o
ff
"
)
SELENIUM_LOG_SCREEN
(
wd
,
"50
%
"
,
"Exhibit_Inspect"
,
"Control_Manage"
,
"air_condition_o
n
"
)
STEP
(
4
,
"检查指挥大屏开启状态"
)
# 这是指挥大屏关闭的监控视频显示
...
...
@@ -56,5 +62,15 @@ def suite_setup():
INFO
(
"请检查指挥大屏开启的监控视频状态是否正常"
)
SELENIUM_LOG_SCREEN
(
wd
,
"50
%
"
,
"Exhibit_Inspect"
,
"Control_Manage"
,
"command_screen_on"
)
STEP
(
5
,
"检查音乐播放状态"
)
# 这是音乐开启播放后的界面显示
INFO
(
"请检查中控屏软件打开音乐播放后的界面状态显示"
)
SELENIUM_LOG_SCREEN
(
wd
,
"50
%
"
,
"Exhibit_Inspect"
,
"Control_Manage"
,
"music_on"
)
# 这是音乐关闭播放后的界面显示
INFO
(
"请检查中控屏软件关闭音乐播放后的界面状态显示"
)
SELENIUM_LOG_SCREEN
(
wd
,
"50
%
"
,
"Exhibit_Inspect"
,
"Control_Manage"
,
"music_off"
)
def
suite_teardown
():
browser_quit
()
\ No newline at end of file
预定系统/cases/展厅巡检/00展厅中控屏/展厅中控屏.py
浏览文件 @
60c2e68c
此差异已折叠。
点击以展开。
预定系统/cases/展厅巡检/02无纸化/__pycache__/无纸化1.0.cpython-310.pyc
浏览文件 @
60c2e68c
No preview for this file type
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论