Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
U
ubains-module-test
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
郑晓兵
ubains-module-test
Commits
faf0358e
提交
faf0358e
authored
12月 27, 2024
作者:
陈泽健
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
补充展厅中控屏的灯光控制以及窗帘控制。
上级
9bd284ae
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
160 行增加
和
2 行删除
+160
-2
base.cpython-310.pyc
预定系统/Base/__pycache__/base.cpython-310.pyc
+0
-0
README.md
预定系统/README.md
+4
-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
+33
-0
展厅中控屏.py
预定系统/cases/展厅巡检/00展厅中控屏/展厅中控屏.py
+123
-0
没有找到文件。
预定系统/Base/__pycache__/base.cpython-310.pyc
浏览文件 @
faf0358e
No preview for this file type
预定系统/README.md
浏览文件 @
faf0358e
...
...
@@ -139,4 +139,6 @@
28.
2024-12-26
-
调整服务状态监测读取文本文件函数fetch_and_parse_check_txt的重复赋值问题。
-
补充展厅巡检关于桌牌系统是否可用的简单检测。
-
调整富创数据,调整标准版定时任务的启动标签为预定系统功能,执行预定系统全部功能自动化验证。
\ No newline at end of file
-
调整富创数据,调整标准版定时任务的启动标签为预定系统功能,执行预定系统全部功能自动化验证。
29.
2024-12-27
-
补充展厅中控屏的灯光控制以及窗帘控制。
\ No newline at end of file
预定系统/cases/展厅巡检/00展厅中控屏/__pycache__/__st__.cpython-310.pyc
0 → 100644
浏览文件 @
faf0358e
File added
预定系统/cases/展厅巡检/00展厅中控屏/__pycache__/展厅中控屏.cpython-310.pyc
0 → 100644
浏览文件 @
faf0358e
File added
预定系统/cases/展厅巡检/00展厅中控屏/__st__.py
0 → 100644
浏览文件 @
faf0358e
import
sys
import
os
from
time
import
sleep
# 获取当前脚本的绝对路径
current_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
# 构建预定系统的绝对路径
预定系统
_path
=
os
.
path
.
abspath
(
os
.
path
.
join
(
current_dir
,
'..'
,
'..'
,
'..'
))
# 添加路径
sys
.
path
.
append
(
预定系统
_path
)
# 导入模块
try
:
from
预定系统
.
Base
.
base
import
*
except
ModuleNotFoundError
as
e
:
print
(
f
"ModuleNotFoundError: {e}"
)
print
(
"尝试使用绝对路径导入"
)
from
预定系统
.
Base
.
base
import
*
def
suite_setup
():
STEP
(
1
,
"初始化浏览器"
)
login_exhibit_url
=
'http://192.168.5.200:8080/#/login/logindf'
login_exhibit_ngrok_url
=
'http://nat.ubainsyun.com:11060/#/login/logindf'
browser_init
(
login_exhibit_url
)
wd
=
GSTORE
[
'wd'
]
admin_login
(
"Test02"
,
"ubains@123"
)
sleep
(
5
)
SELENIUM_LOG_SCREEN
(
wd
,
"50
%
"
,
"Exhibit_Inspect"
,
"Tx_meeting"
,
"会场画面截屏"
)
def
suite_teardown
():
browser_quit
()
\ No newline at end of file
预定系统/cases/展厅巡检/00展厅中控屏/展厅中控屏.py
0 → 100644
浏览文件 @
faf0358e
from
appium.webdriver.common.appiumby
import
AppiumBy
from
预定系统
.
Base
.
app_base
import
*
import
logging
from
time
import
sleep
# 配置日志记录
logging
.
basicConfig
(
level
=
logging
.
DEBUG
,
format
=
'
%(asctime)
s -
%(levelname)
s -
%(message)
s'
)
class
Exhibition_hall_Control_000x
:
"""
执行指令:
1.cd 预定系统
2.hytest --report_title 会议预约测试报告 --report_url_prefix http://192.168.1.225 --tag 展厅中控屏
"""
tags
=
[
'展厅中控屏'
]
def
teststeps
(
self
):
"""
执行测试步骤以自动化测试腾讯会议应用的登录和会议加入流程。
该方法初始化应用驱动,等待应用加载,定位并点击会议按钮,加入会议,并截取会议画面。
"""
app_drive
=
None
try
:
# 初始化应用驱动,连接到指定的设备和应用
app_drive
=
app_setup_driver
(
"Android"
,
"5.1.1"
,
"UT-13"
,
"com.ubains.gviewer"
,
".SplashActivity"
,
"192.168.5.112:5555"
)
app_drive
.
implicitly_wait
(
60
)
# 设置缺省等待时间
# 使用显式等待来等待元素出现
logging
.
info
(
"等待首页加载..."
)
# 先切换界面,再切回灯光控制
air_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[1]/android.widget.Button[6]"
)
logging
.
info
(
"尝试定位【空气净化】按钮元素,并点击按钮"
)
air_button
.
click
()
sleep
(
20
)
# 定位灯光控制按钮元素,并点击按钮
logging
.
info
(
"尝试定位【灯光控制】按钮元素,并点击按钮"
)
light_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/android.widget.Button[3]"
)
logging
.
info
(
"定位成功"
)
# 点击【灯光控制】按钮
light_button
.
click
()
logging
.
info
(
"点击【灯光控制】按钮成功"
)
sleep
(
20
)
# 开启所有区域灯光
# 定位【接待区】灯光
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
)
# 切换至窗帘控制界面
logging
.
info
(
"尝试定位【窗帘控制】按钮元素,并点击按钮"
)
curtain_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[1]/android.widget.Button[4]"
)
curtain_button
.
click
()
sleep
(
2
)
# 所有窗帘全部上升
logging
.
info
(
"尝试定位【窗帘上升】按钮元素,并点击按钮"
)
for
i
in
range
(
1
,
6
):
logging
.
info
(
f
"尝试定位第{i}个【窗帘上升】按钮元素,并点击按钮"
)
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
)
except
Exception
as
e
:
# 捕获并记录任何发生的错误
logging
.
error
(
f
"发生错误: {e}"
,
exc_info
=
True
)
finally
:
# 确保驱动程序在测试结束后正确关闭
if
app_drive
:
app_drive
.
quit
()
logging
.
info
(
"驱动程序已退出。"
)
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论