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

根据展厅巡检报告处理展厅中控屏步骤缺失问题,是由元素定位值发生变化导致无法定位成功。补充图片对比函数,还需调整一下判断的图像点阈值。讯飞系统的定位元素改为C...

根据展厅巡检报告处理展厅中控屏步骤缺失问题,是由元素定位值发生变化导致无法定位成功。补充图片对比函数,还需调整一下判断的图像点阈值。讯飞系统的定位元素改为CSS,因国际化导致原先的XPATH可能会由变化。
上级 4935f268
......@@ -45,7 +45,7 @@ def swipe_up(app_driver):
# 执行滑动操作
app_driver.swipe(start_x, start_y, end_x, end_y, duration=500)
# 请使用“pip install opencv-python”安装PIL库
# 请使用“pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple”安装PIL库
from PIL import Image
import numpy as np
import os
......@@ -110,13 +110,6 @@ def compare_brightness(light_down_path, light_on_path, threshold=1):
# 请使用“pip install opencv-python”安装cv2库
import cv2
import numpy as np
import logging
from PIL import Image
import numpy as np
import logging
from PIL import Image
import numpy as np
......@@ -235,8 +228,8 @@ if __name__ == '__main__':
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logging.info("开始对比图片")
image1_path = r'D:\GithubData\自动化\ubains-module-test\预定系统\reports\imgs\Exhibit_Inspect\No_PaperLess\DeviceA-ShareScreen.png'
image2_path = r'D:\GithubData\自动化\ubains-module-test\预定系统\reports\imgs\Exhibit_Inspect\No_PaperLess\DeviceB-ShareScreen.png'
image1_path = r'D:\GithubData\自动化\ubains-module-test\预定系统\reports\imgs\Exhibit_Inspect\No_PaperLess\同屏后-无纸化设备A界面截屏.png'
image2_path = r'D:\GithubData\自动化\ubains-module-test\预定系统\reports\imgs\Exhibit_Inspect\No_PaperLess\同屏后-无纸化设备B界面截屏.png'
if not os.path.exists(image1_path):
logging.error(f"图片 {image1_path} 不存在")
......@@ -489,7 +482,7 @@ def air_condition_control(app_drive,wd):
def information_control(app_drive,wd):
# 选择生日快乐内容播放
brithday_information_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]")
"/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[1]")
brithday_information_button.click()
logging.info("选择生日快乐内容播放")
sleep(5)
......@@ -506,7 +499,7 @@ def information_control(app_drive,wd):
# 选择欢迎领导发布内容播放
meeting_information_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]")
"/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]")
meeting_information_button.click()
logging.info("选择会议发布内容播放")
sleep(5)
......@@ -522,7 +515,7 @@ def information_control(app_drive,wd):
# 选择展厅空间结构内容播放
information_space_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]")
"/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]")
information_space_button.click()
logging.info("选择展厅空间结构内容播放")
sleep(5)
......
from hytest.utils.my_globals import my_global_var
print(my_global_var)
\ No newline at end of file
import cv2
import os
def image_matching(floder_name,picture_name):
# 使用绝对路径
path1 = os.path.abspath(r"C:\information_meeting_on.png")
path2 = os.path.abspath(r"C:\information_brithday_on.png")
if not os.path.exists(path1):
print(f"文件不存在: {path1}")
if not os.path.exists(path2):
print(f"文件不存在: {path2}")
# 加载图片
image1 = cv2.imread(path1, cv2.IMREAD_GRAYSCALE)
image2 = cv2.imread(path2, cv2.IMREAD_GRAYSCALE)
# 检查图片是否加载成功
if image1 is None:
print("图片1加载失败,请检查路径或文件是否存在")
if image2 is None:
print("图片2加载失败,请检查路径或文件是否存在")
# 如果图片加载成功,继续执行特征匹配
if image1 is not None and image2 is not None:
# 初始化ORB检测器
orb = cv2.ORB_create()
# 检测关键点和描述符
keypoints1, descriptors1 = orb.detectAndCompute(image1, None)
keypoints2, descriptors2 = orb.detectAndCompute(image2, None)
# 使用BFMatcher进行匹配
bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)
matches = bf.match(descriptors1, descriptors2)
# 根据匹配点数量判断相似性
matches_count = len(matches)
print(f"匹配点数量: {matches_count}")
if matches_count > 400: # 阈值可以根据需求调整
print("图片相似")
else:
print("图片不相似")
if __name__ == "__main__":
image_matching()
\ No newline at end of file
......@@ -217,4 +217,8 @@
56. 2025-02-18
- 讯飞语音转录补充云喇叭调用,更新ngrok映射前ip地址,将无纸化同屏打上展厅巡检标签。
- 补充了自动获取本机IP地址以及自动运行ngrok开启映射,避免后续IP改变后无法打开报告问题。
- 补充开启ngrok进程之前先关闭已运行的进程,然后再启动ngrok映射.规避因多个ngrok共存出现的问题.
\ No newline at end of file
- 补充开启ngrok进程之前先关闭已运行的进程,然后再启动ngrok映射.规避因多个ngrok共存出现的问题.
57. 2025-02-19
- 根据展厅巡检报告处理展厅中控屏步骤缺失问题,是由元素定位值发生变化导致无法定位成功。
- 补充图片对比函数,还需调整一下判断的图像点阈值。
- 讯飞系统的定位元素改为CSS,因国际化导致原先的XPATH可能会由变化。
\ No newline at end of file
import cv2
import os
def image_matching(floder_name,picture_name):
# 使用绝对路径
path1 = os.path.abspath(r"C:\information_meeting_on.png")
path2 = os.path.abspath(r"C:\information_brithday_on.png")
if not os.path.exists(path1):
print(f"文件不存在: {path1}")
if not os.path.exists(path2):
print(f"文件不存在: {path2}")
# 加载图片
image1 = cv2.imread(path1, cv2.IMREAD_GRAYSCALE)
image2 = cv2.imread(path2, cv2.IMREAD_GRAYSCALE)
# 检查图片是否加载成功
if image1 is None:
print("图片1加载失败,请检查路径或文件是否存在")
if image2 is None:
print("图片2加载失败,请检查路径或文件是否存在")
# 如果图片加载成功,继续执行特征匹配
if image1 is not None and image2 is not None:
# 初始化ORB检测器
orb = cv2.ORB_create()
# 检测关键点和描述符
keypoints1, descriptors1 = orb.detectAndCompute(image1, None)
keypoints2, descriptors2 = orb.detectAndCompute(image2, None)
# 使用BFMatcher进行匹配
bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)
matches = bf.match(descriptors1, descriptors2)
# 根据匹配点数量判断相似性
matches_count = len(matches)
print(f"匹配点数量: {matches_count}")
if matches_count > 400: # 阈值可以根据需求调整
print("图片相似")
else:
print("图片不相似")
if __name__ == "__main__":
panduan()
\ No newline at end of file
......@@ -10,7 +10,7 @@ class Exhibition_hall_Control_000x:
"""
执行指令:
1.cd 预定系统
2.hytest --report_title 会议预约测试报告 --report_url_prefix http://192.168.1.225 --tag 展厅中控屏
2.hytest --report_title 会议预约测试报告 --report_url_prefix http://nat.ubaindyun.com:31133 --tag 展厅中控屏
"""
tags = ['展厅中控屏','展厅巡检']
......@@ -142,7 +142,7 @@ class Exhibition_hall_Control_000x:
# 打开信息发布播放
information_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.RelativeLayout/android.widget.RelativeLayout[2]/android.widget.Button[7]")
"/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]")
information_on_button.click()
logging.info("信息发布播放开启成功")
# 调用信息发布控制函数
......
......@@ -19,10 +19,10 @@ class XF_Meeting_0001:
sleep(1)
safe_send_keys((By.XPATH, "//input[@placeholder='输入关键字搜索']"), "展厅巡检测试", wd)
send_keyboard((By.XPATH, "//input[@placeholder='输入关键字搜索']"), wd)
sleep(2)
sleep(5)
safe_click((By.XPATH, "//span[contains(text(),'更多操作')]"),wd)
sleep(1)
safe_click((By.XPATH, "//li[contains(text(),'讯飞纪要')]"), wd)
sleep(5)
safe_click((By.CSS_SELECTOR, "ul[id='dropdown-menu-280'] li:nth-child(2)"), wd)
sleep(3)
wd.switch_to.window(wd.window_handles[1])
sleep(5)
......
......@@ -72,19 +72,22 @@ start_workers(3)
# schedule.every().day.at("15:33").do(run_task, run_automation_test, report_title="预定系统测试报告", report_url_prefix="http://nat.ubainsyun.com:31133", test_case="预定系统功能", ding_type="标准版巡检")
# 获取本机IP地址
local_ip = get_local_ip()
logging.info(f"本机IP地址: {local_ip}")
# local_ip = get_local_ip()
# logging.info(f"本机IP地址: {local_ip}")
# 更新ngrok.cfg文件
ngrok_config_path = r'D:\GithubData\自动化\ubains-module-test\预定系统\ngrok\ngrok-调试主机\ngrok.cfg'
update_ngrok_config(ngrok_config_path, local_ip)
# 启动ngrok
ngrok_path = r'D:\GithubData\自动化\ubains-module-test\预定系统\ngrok\ngrok-调试主机\ngrok.exe'
start_ngrok(ngrok_path, ngrok_config_path)
# # 更新ngrok.cfg文件
# ngrok_config_path = r'D:\GithubData\自动化\ubains-module-test\预定系统\ngrok\ngrok-调试主机\ngrok.cfg'
# update_ngrok_config(ngrok_config_path, local_ip)
#
# # 启动ngrok
# ngrok_path = r'D:\GithubData\自动化\ubains-module-test\预定系统\ngrok\ngrok-调试主机\ngrok.exe'
# start_ngrok(ngrok_path, ngrok_config_path)
# 定时执行展厅巡检任务
schedule.every().day.at("07:45").do(run_task, run_automation_test, report_title="展厅巡检测试报告", report_url_prefix="http://nat.ubainsyun.com:31133", test_case="展厅巡检", ding_type="展厅巡检")
schedule.every().day.at("16:47").do(run_task, run_automation_test, report_title="展厅巡检测试调试报告", report_url_prefix="http://nat.ubainsyun.com:31133", test_case="展厅巡检", ding_type="展厅巡检")
# 调试使用
# schedule.every().day.at("08:44").do(run_task, run_automation_test, report_title="展厅调试", report_url_prefix="http://nat.ubainsyun.com:31133", test_case="腾讯会议", ding_type="展厅巡检")
try:
# 无限循环,持续检查并执行计划任务
......
name,conference_name,message_name,book_start_time,book_end_time,book_check_text
会议状态设置_001,预约会议室,哈哈哈哈会议,09:30,09:45,预定成功
\ No newline at end of file
会议状态设置_001,预约会议室,哈哈哈哈会议,16:00,16:15,预定成功
\ No newline at end of file
name,conference_name,message_name,book_type,issue_name,book_start_time,book_end_time,message_notification,check_text
展厅巡检_001,MeetingRoom,展厅巡检测试,普通会议,议题1,08:00,08:15,开会前一天提醒,预定成功
\ No newline at end of file
展厅巡检_001,MeetingRoom,展厅巡检测试,普通会议,议题1,17:00,17:15,开会前一天提醒,预定成功
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论