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

补充讯飞、运维以及统一平台的巡检流程,并整合展厅巡检目录的执行初始化文件。

上级 45726b6e
...@@ -217,8 +217,8 @@ def issue_send_and_upload(wd , issue_num, issue_name): ...@@ -217,8 +217,8 @@ def issue_send_and_upload(wd , issue_num, issue_name):
INFO("定位【选择文件】按钮") INFO("定位【选择文件】按钮")
upload_button = wd.find_element(By.XPATH, '//*[@id="global-uploader-btn"]/input') upload_button = wd.find_element(By.XPATH, '//*[@id="global-uploader-btn"]/input')
INFO(f"元素定位:{upload_button}") # INFO(f"元素定位:{upload_button}")
INFO("选择议题文件上传") # INFO("选择议题文件上传")
upload_button.send_keys(issue_file_path[i]) upload_button.send_keys(issue_file_path[i])
INFO(f"第{i+1}个议题文件上传完成") INFO(f"第{i+1}个议题文件上传完成")
sleep(15) sleep(15)
...@@ -699,4 +699,21 @@ def single_click_and_drag(source_element_locator, target_element_locator, wd): ...@@ -699,4 +699,21 @@ def single_click_and_drag(source_element_locator, target_element_locator, wd):
except NoSuchElementException as e: except NoSuchElementException as e:
logging.error(f"元素未找到: {e}") logging.error(f"元素未找到: {e}")
except Exception as e: except Exception as e:
logging.error(f"发生未知错误: {e}") logging.error(f"发生未知错误: {e}")
\ No newline at end of file
def get_current_window_index(wd):
current_handle = wd.current_window_handle
handles = wd.window_handles
return handles.index(current_handle)
def switch_to_next_window(wd):
current_index = get_current_window_index(wd)
handles = wd.window_handles
next_index = (current_index + 1) % len(handles)
wd.switch_to.window(handles[next_index])
def switch_to_previous_window(wd):
current_index = get_current_window_index(wd)
handles = wd.window_handles
previous_index = (current_index - 1) % len(handles)
wd.switch_to.window(handles[previous_index])
\ No newline at end of file
...@@ -118,4 +118,5 @@ ...@@ -118,4 +118,5 @@
- 调整钉钉发送消息的密钥和接口获取方式,通过最外层传参来进行控制需要发送的钉钉群。 - 调整钉钉发送消息的密钥和接口获取方式,通过最外层传参来进行控制需要发送的钉钉群。
- 优化appium相关代码的注释。 - 优化appium相关代码的注释。
34. 2024-12-20 34. 2024-12-20
- 调整dingding调用函数的传参问题,调整定时任务执行时间为工作日。 - 调整dingding调用函数的传参问题,调整定时任务执行时间为工作日。
\ No newline at end of file - 补充讯飞、运维以及统一平台的巡检流程,并整合展厅巡检目录的执行初始化文件。
\ No newline at end of file
import sys import sys
import os import os
from time import sleep from time import sleep
# 获取当前脚本的绝对路径 # 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 # 构建预定系统的绝对路径
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..')) 预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..'))
# 添加路径 # 添加路径
sys.path.append(预定系统_path) sys.path.append(预定系统_path)
# 导入模块 # 导入模块
from 预定系统.Base.base import * try:
from 预定系统.Base.base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化浏览器") STEP(1, "初始化浏览器")
...@@ -17,4 +23,7 @@ def suite_setup(): ...@@ -17,4 +23,7 @@ def suite_setup():
browser_init(login_exhibit_url) browser_init(login_exhibit_url)
wd = GSTORE['wd'] wd = GSTORE['wd']
admin_login("Test02", "ubains@123") admin_login("Test02", "ubains@123")
\ No newline at end of file
def suite_teardown():
browser_quit()
\ No newline at end of file
from datetime import timedelta from datetime import timedelta
import sys import sys
import os import os
from venv import logger
from pygments.lexers.diff import WDiffLexer
# 获取当前脚本的绝对路径 # 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
...@@ -12,13 +9,18 @@ current_dir = os.path.dirname(os.path.abspath(__file__)) ...@@ -12,13 +9,18 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 添加路径 # 添加路径
sys.path.append(预定系统_path) sys.path.append(预定系统_path)
# 导入模块 # 导入模块
from 预定系统.Base.base import * try:
from 预定系统.Base.base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
# 获取当前脚本所在的目录 # 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建CSV文件的绝对路径 # 构建CSV文件的绝对路径
csv_file_path = os.path.join(current_dir, '../../测试数据/展厅巡检/会议预约.csv') csv_file_path = os.path.join(current_dir, '../../../测试数据/展厅巡检/会议预约.csv')
# 定义时间格式 # 定义时间格式
time_format = "%H:%M" time_format = "%H:%M"
...@@ -62,20 +64,11 @@ class Exhibition_hall_inspection_000x: ...@@ -62,20 +64,11 @@ class Exhibition_hall_inspection_000x:
safe_send_keys((By.XPATH, "//input[@placeholder='请输入会议室名称']"),conference_name,wd) safe_send_keys((By.XPATH, "//input[@placeholder='请输入会议室名称']"),conference_name,wd)
safe_click((By.XPATH, "//button[@type='button']//span[contains(text(),'查询')]"),wd) safe_click((By.XPATH, "//button[@type='button']//span[contains(text(),'查询')]"),wd)
sleep(1) sleep(1)
INFO("检查搜索结果")
# 获取搜索出的会议室名称
notify_text = elment_get_text((By.XPATH, "//span[@class='MeetingCityList_name']"),wd)
INFO(f"搜索结果为:{notify_text}")
# 点击【会议预定】按钮,进入会议预定界面 # 点击【会议预定】按钮,进入会议预定界面
STEP(2, "点击【会议预定】按钮") STEP(2, "点击【会议预定】按钮")
safe_click((By.XPATH, "//span[@class='MeetingCityList_t_btn']"),wd) safe_click((By.XPATH, "//span[@class='MeetingCityList_t_btn']"),wd)
sleep(1) sleep(1)
INFO("检查页面标题是否正确")
# 获取页面标题
notify_text = elment_get_text((By.XPATH, "//div[@class='reserve_Title']"),wd)
INFO(f"页面标题为:{notify_text}")
sleep(1)
# 在会议预定第一步界面进行数据填入 # 在会议预定第一步界面进行数据填入
STEP(3,"会议第一步数据填写") STEP(3,"会议第一步数据填写")
...@@ -89,8 +82,6 @@ class Exhibition_hall_inspection_000x: ...@@ -89,8 +82,6 @@ class Exhibition_hall_inspection_000x:
safe_click((By.XPATH, f"//div[@class='reserve_input']//span[@class='el-checkbox__label'][normalize-space()='腾讯会议']"),wd) safe_click((By.XPATH, f"//div[@class='reserve_input']//span[@class='el-checkbox__label'][normalize-space()='腾讯会议']"),wd)
sleep(2) sleep(2)
# 预约类型
INFO("预约类型为:普通会议")
# 选择普通会议 # 选择普通会议
safe_click((By.XPATH, f"//span[contains(text(),'{book_type}')]"), wd) safe_click((By.XPATH, f"//span[contains(text(),'{book_type}')]"), wd)
sleep(1) sleep(1)
...@@ -113,7 +104,7 @@ class Exhibition_hall_inspection_000x: ...@@ -113,7 +104,7 @@ class Exhibition_hall_inspection_000x:
# 如果需要将时间差转换为分钟数 # 如果需要将时间差转换为分钟数
time_diff_minutes = (end_time - start_time).total_seconds() / 60 time_diff_minutes = (end_time - start_time).total_seconds() / 60
INFO(f"时间差为:time_diff_minutes") # INFO(f"时间差为:time_diff_minutes")
# 判断如果开始时间与结束时间相等,则不重复点击 # 判断如果开始时间与结束时间相等,则不重复点击
if book_start_time == book_end_time: if book_start_time == book_end_time:
...@@ -162,19 +153,17 @@ class Exhibition_hall_inspection_000x: ...@@ -162,19 +153,17 @@ class Exhibition_hall_inspection_000x:
safe_click((By.XPATH, "//div[contains(text(),'下一步')]"),wd) safe_click((By.XPATH, "//div[contains(text(),'下一步')]"),wd)
sleep(1) sleep(1)
# 根据参会人名称搜搜对应参会人 # 根据参会人名称搜搜对应参会人
ipn = ['赵嘉诚','CZJ','向彩娇','马晓丽','王兵','陈林','李立键','丁海洪','刘建胜','潘松林','卢培锽','黄史恭','罗一龙','彭甘宇'] # ipn = ['赵嘉诚','CZJ','向彩娇','马晓丽','王兵','陈林','李立键','丁海洪','刘建胜','潘松林','卢培锽','黄史恭','罗一龙','彭甘宇']
for i in range(0, 14): # for i in range(0, 14):
safe_send_keys((By.XPATH, "//input[@placeholder='账号/用户名']"), ipn[i], wd) # safe_send_keys((By.XPATH, "//input[@placeholder='账号/用户名']"), ipn[i], wd)
send_keyboard((By.XPATH, "//input[@placeholder='账号/用户名']"), wd) # send_keyboard((By.XPATH, "//input[@placeholder='账号/用户名']"), wd)
sleep(1) # sleep(1)
# 选择内部参会人 # # 选择内部参会人
# INFO(f"选择内部参会人:{ipn[i]}") # safe_click((By.XPATH, "//th[contains(@class,'is-leaf el-table__cell')]//span[contains(@class,'el-checkbox__inner')]"), wd)
safe_click((By.XPATH, "//th[contains(@class,'is-leaf el-table__cell')]//span[contains(@class,'el-checkbox__inner')]"), wd) # # 获取已选的参会人名称
# 获取已选的参会人名称 # notify_text = elment_get_text((By.XPATH, f"//span[normalize-space()='{ipn[i]}']"), wd)
notify_text = elment_get_text((By.XPATH, f"//span[normalize-space()='{ipn[i]}']"), wd) # INFO(f"已选择参会人:{ipn}")
INFO(f"已选择参会人:{notify_text}") # SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Meeting_Message", "选择内部参会人")
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Meeting_Message", "选择内部参会人")
# 点击【下一步】按钮 # 点击【下一步】按钮
safe_click((By.XPATH,"//div[contains(text(),'下一步')]"),wd) safe_click((By.XPATH,"//div[contains(text(),'下一步')]"),wd)
...@@ -183,11 +172,6 @@ class Exhibition_hall_inspection_000x: ...@@ -183,11 +172,6 @@ class Exhibition_hall_inspection_000x:
# 进入会议预约第三步进行填写 # 进入会议预约第三步进行填写
STEP(5, "会议第三步数据填写") STEP(5, "会议第三步数据填写")
INFO("检查页面标题是否正确")
sleep(1)
# 获取页面标题
notify_text = elment_get_text((By.XPATH,"//h2[contains(text(),'消息提醒')]"),wd)
INFO(f"页面标题为:{notify_text}")
# 选择消息提醒时间 # 选择消息提醒时间
INFO(f"选择消息提醒时间:{message_notification}") INFO(f"选择消息提醒时间:{message_notification}")
...@@ -228,12 +212,12 @@ class Exhibition_hall_inspection_000x: ...@@ -228,12 +212,12 @@ class Exhibition_hall_inspection_000x:
sleep(1) sleep(1)
safe_click((By.XPATH,"(//span[contains(text(),'设备管理')])[1]"),wd) safe_click((By.XPATH,"(//span[contains(text(),'设备管理')])[1]"),wd)
safe_click((By.XPATH,"(//li[contains(text(),'安卓信息')])[1]"),wd) safe_click((By.XPATH,"(//li[contains(text(),'安卓信息')])[1]"),wd)
INFO("进入安卓信息界面,查看门口屏设备列表") INFO("进入安卓信息界面,查看门口屏设备列表,请查看设备列表状态显示是否正常")
sleep(5) sleep(5)
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Android", "门口屏设备列表") SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Android", "门口屏设备列表")
safe_click((By.XPATH,"(//span[contains(text(),'应用截屏')])[1]"),wd) safe_click((By.XPATH,"(//span[contains(text(),'应用截屏')])[1]"),wd)
sleep(30) sleep(30)
INFO("查看门口屏截屏显示") INFO("查看门口屏截屏显示,请查看门口屏截屏功能是否正常")
# 截屏查看门口屏的显示 # 截屏查看门口屏的显示
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Android", "门口屏截屏") SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Android", "门口屏截屏")
# 返回上一级界面 # 返回上一级界面
...@@ -258,7 +242,7 @@ class Exhibition_hall_inspection_000x: ...@@ -258,7 +242,7 @@ class Exhibition_hall_inspection_000x:
# 会控操作 # 会控操作
STEP(10, "检查会控界面功能") STEP(10, "检查会控界面功能")
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "MeetingControl", "检查会控界面功能") SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "MeetingControl", "检查会控界面功能")
INFO("检查会控界面功能") INFO("请检查会控界面功能是否正常")
# 添加SMC会场 # 添加SMC会场
INFO("添加SMC会场:展厅指挥中心、展厅会议室") INFO("添加SMC会场:展厅指挥中心、展厅会议室")
...@@ -300,7 +284,7 @@ class Exhibition_hall_inspection_000x: ...@@ -300,7 +284,7 @@ class Exhibition_hall_inspection_000x:
single_click_and_drag((By.CSS_SELECTOR,"body > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(3) > table:nth-child(1) > tbody:nth-child(2) > tr:nth-child(1) > td:nth-child(2) > div:nth-child(1) > span:nth-child(1)"),(By.XPATH,"(//div)[120]"), wd) single_click_and_drag((By.CSS_SELECTOR,"body > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(3) > table:nth-child(1) > tbody:nth-child(2) > tr:nth-child(1) > td:nth-child(2) > div:nth-child(1) > span:nth-child(1)"),(By.XPATH,"(//div)[120]"), wd)
sleep(4) sleep(4)
# SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "MeetingControl", "会场画面控制") SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "MeetingControl", "会场画面控制")
INFO("使用基础会控功能:禁用摄像头、麦克风") INFO("使用基础会控功能:禁用摄像头、麦克风")
safe_click((By.XPATH,"//span[contains(text(),'禁用摄像头')]"),wd) safe_click((By.XPATH,"//span[contains(text(),'禁用摄像头')]"),wd)
......
import sys import sys
import os import os
from time import sleep from time import sleep
# 获取当前脚本的绝对路径 # 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 # 构建预定系统的绝对路径
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) 预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..'))
# 添加路径 # 添加路径
sys.path.append(预定系统_path) sys.path.append(预定系统_path)
# 导入模块 # 导入模块
from 预定系统.Base.base import * try:
from 预定系统.Base.base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
def suite_setup(): 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'] wd = GSTORE['wd']
admin_login("Test02", "ubains@123")
sleep(5)
SELENIUM_LOG_SCREEN(wd,"50%","Exhibit_Inspect","No_PaperLess","无纸化会议信息截图") SELENIUM_LOG_SCREEN(wd,"50%","Exhibit_Inspect","No_PaperLess","无纸化会议信息截图")
SELENIUM_LOG_SCREEN(wd,"50%","Exhibit_Inspect","No_PaperLess","无纸化首页截图") SELENIUM_LOG_SCREEN(wd,"50%","Exhibit_Inspect","No_PaperLess","无纸化首页截图")
SELENIUM_LOG_SCREEN(wd,"50%","Exhibit_Inspect","No_PaperLess","议题文件截图") SELENIUM_LOG_SCREEN(wd,"50%","Exhibit_Inspect","No_PaperLess","议题文件截图")
SELENIUM_LOG_SCREEN(wd,"50%","Exhibit_Inspect","No_PaperLess","议题文件1截图") SELENIUM_LOG_SCREEN(wd,"50%","Exhibit_Inspect","No_PaperLess","议题文件1截图")
SELENIUM_LOG_SCREEN(wd,"50%","Exhibit_Inspect","No_PaperLess","议题文件2截图") SELENIUM_LOG_SCREEN(wd,"50%","Exhibit_Inspect","No_PaperLess","议题文件2截图")
SELENIUM_LOG_SCREEN(wd,"50%","Exhibit_Inspect","No_PaperLess","议题文件3截图") SELENIUM_LOG_SCREEN(wd,"50%","Exhibit_Inspect","No_PaperLess","议题文件3截图")
\ No newline at end of file
def suite_teardown():
browser_quit()
\ No newline at end of file
import sys import sys
import os import os
from time import sleep from time import sleep
# 获取当前脚本的绝对路径 # 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径 # 构建预定系统的绝对路径
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..')) 预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..'))
# 添加路径 # 添加路径
sys.path.append(预定系统_path) sys.path.append(预定系统_path)
# 导入模块 # 导入模块
from 预定系统.Base.base import * try:
from 预定系统.Base.base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
def suite_setup(): 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'] wd = GSTORE['wd']
SELENIUM_LOG_SCREEN(wd,"50%","Exhibit_Inspect","Tx_meeting","会场画面截屏") admin_login("Test02", "ubains@123")
\ No newline at end of file sleep(5)
SELENIUM_LOG_SCREEN(wd,"50%","Exhibit_Inspect","Tx_meeting","会场画面截屏")
def suite_teardown():
browser_quit()
\ No newline at end of file
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)
def suite_teardown():
browser_quit()
\ No newline at end of file
import sys
import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..'))
# 添加路径
sys.path.append(预定系统_path)
# 导入模块
from 预定系统.Base.base import *
class XF_Meeting_0001:
tags = ['展厅巡检']
def teststeps(self):
wd = GSTORE['wd']
safe_click((By.XPATH, "//span[contains(text(),'已预订会议')]"), wd)
sleep(1)
safe_click((By.XPATH, "//span[contains(text(),'更多操作')]"),wd)
sleep(1)
safe_click((By.XPATH, "//li[contains(text(),'会议纪要')]"), wd)
sleep(1)
safe_click((By.XPATH, "//i[@title='跳转至语音转录']"), wd)
sleep(3)
INFO("请检查讯飞系统是否正确单点登录")
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "XF_meeting", "讯飞系统截屏")
# 结束这场会议
wd.switch_to.window(wd.window_handles[0])
sleep(2)
safe_click((By.XPATH, "//span[contains(text(),'已预订会议')]"),wd)
sleep(1)
safe_send_keys((By.XPATH, "//input[@placeholder='输入关键字搜索']"), "展厅巡检测试", wd)
send_keyboard((By.XPATH, "//input[@placeholder='输入关键字搜索']"), wd)
sleep(2)
safe_click((By.XPATH, "//span[contains(text(),'更多操作')]"), wd)
sleep(2)
safe_click((By.XPATH, "//li[contains(text(),'会议状态')]"),wd)
sleep(2)
safe_click((By.XPATH, "//span[contains(text(),'提前结束')]"), wd)
sleep(2)
safe_click((By.XPATH, "//div[@slot='footer']//span[contains(text(),'确定')]"), wd)
sleep(2)
\ No newline at end of file
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:8081/#/login'
browser_init(login_exhibit_url)
wd = GSTORE['wd']
STEP(2, "登录系统")
safe_send_keys((By.XPATH, "//input[@placeholder='请输入登录账号']"),"admin@pgy",wd)
safe_send_keys((By.XPATH, "//input[@placeholder='请输入登录密码']"),"ub123456",wd)
safe_send_keys((By.XPATH, "//input[@placeholder='请输入验证码(区分大小写)']"),"csba",wd)
sleep(2)
safe_click((By.XPATH, "//div[@class='loginButton']"),wd)
INFO("请查看运维系统首页")
def suite_teardown():
browser_quit()
\ No newline at end of file
import sys
import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..'))
# 添加路径
sys.path.append(预定系统_path)
# 导入模块
from 预定系统.Base.base import *
class Operation_maintenance_0001:
tags = ['展厅巡检','运维系统巡检']
def teststeps(self):
wd = GSTORE['wd']
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Operation_maintenance", "首页界面")
safe_click((By.XPATH, "(//span[contains(text(),'进入系统')])[4]"), wd)
sleep(4)
# 检查会议室数据展示界面并截图
INFO("请查看会议室的数据展示情况")
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Operation_maintenance", "进入系统界面")
INFO("请查看设备列表的连接状态")
# 检查五大系统的设备连接状态并截图
safe_click((By.XPATH, "//span[contains(text(),'设备列表')]"), wd)
sleep(4)
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Operation_maintenance", "设备连接状态")
INFO("请查看视频系统设备的连接状态")
safe_click((By.XPATH, "(//img)[11]"), wd)
sleep(4)
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Operation_maintenance", "视频系统")
INFO("请查看音频系统设备的连接状态")
safe_click((By.XPATH, "(//img)[12]"), wd)
sleep(4)
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Operation_maintenance", "音频系统")
INFO("请查看控制系统设备的连接状态")
safe_click((By.XPATH, "(//img)[13]"),wd)
sleep(4)
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Operation_maintenance", "控制系统")
INFO("请查看网络系统设备的连接状态")
safe_click((By.XPATH, "(//img)[14]"),wd)
sleep(4)
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Operation_maintenance", "网络系统")
INFO("请查看电源系统设备的连接状态")
safe_click((By.XPATH, "(//img)[15]"),wd)
sleep(4)
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Operation_maintenance", "电源系统")
INFO("请查看运维系统的告警数据展示")
safe_click((By.XPATH, "//li[contains(text(),'数据展示')]"), wd)
sleep(20)
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Operation_maintenance", "告警数据展示")
\ No newline at end of file
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:38083/#/login'
browser_init(login_exhibit_url)
wd = GSTORE['wd']
STEP(2, "登录系统")
safe_send_keys((By.XPATH, "//input[@placeholder='手机号/用户名/邮箱']"),"admin",wd)
safe_send_keys((By.XPATH, "//input[@placeholder='密码']"),"Ubains@98765",wd)
safe_send_keys((By.XPATH, "//input[@placeholder='图形验证']"),"csba",wd)
safe_click((By.XPATH, "//span[@class='el-checkbox__inner']"),wd)
sleep(2)
safe_click((By.XPATH, "//div[@id='pane-1']//div//span[contains(text(),'登录')]"),wd)
sleep(2)
def suite_teardown():
browser_quit()
\ No newline at end of file
import sys
import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..'))
# 添加路径
sys.path.append(预定系统_path)
# 导入模块
from 预定系统.Base.base import *
class Unified_Platform_0001:
tags = ['展厅巡检','统一平台系统巡检']
def teststeps(self):
wd = GSTORE['wd']
safe_click((By.XPATH, "//p[contains(text(),'新建会议')]"),wd)
sleep(2)
# 切换窗口2,转到创建会议界面
print(f"这是当前窗口句柄{wd.window_handles}")
wd.switch_to.window(wd.window_handles[1])
print(f"这是跳转后的窗口句柄{wd.window_handles}")
# 选择融合视讯会议
INFO("选择融合视讯会议")
safe_click((By.XPATH, "//span[contains(text(),'视讯会议')]"),wd)
sleep(1)
safe_click((By.XPATH, "//div[@aria-label='checkbox-group']//label[@class='el-checkbox']//span[@class='el-checkbox__inner']"),wd)
# 选择会议室与参会人
INFO("选择多会议室与参会人")
safe_send_keys((By.XPATH, "//input[@placeholder='请输入会议室名称']"), '展厅', wd)
send_keyboard((By.XPATH, "//input[@placeholder='请输入会议室名称']"), wd)
sleep(5)
safe_click((By.CSS_SELECTOR, "body > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(4) > div:nth-child(1) > table:nth-child(1) > thead:nth-child(2) > tr:nth-child(1) > th:nth-child(1) > div:nth-child(1) > label:nth-child(1) > span:nth-child(1) > span:nth-child(1)"),wd)
# 选择参会人分配对应会议室
safe_click((By.XPATH, "//div[contains(@class,'meeting_room')]//div[2]//div[2]//img[2]"),wd)
sleep(1)
safe_send_keys((By.XPATH, "//input[contains(@placeholder,'请输入关键字搜索')]"), '管理员', wd)
safe_click((By.XPATH, "//body[1]/div[1]/div[2]/div[1]/div[2]/div[2]/div[2]/div[1]/div[1]/div[4]/div[1]/table[1]/thead[1]/tr[1]/th[1]/div[1]/label[1]/span[1]/span[1]"),wd)
sleep(2)
safe_click((By.XPATH, "//span[contains(text(),'完成')]"),wd)
sleep(2)
# 创建会议,并查看详情
safe_click((By.XPATH, "//span[contains(text(),'确定创建')]"),wd)
sleep(8)
safe_click((By.XPATH, "//span[contains(text(),'查看详情')]"), wd)
# 切换窗口2,转到会控界面
print(f"这是当前窗口句柄{wd.window_handles}")
wd.switch_to.window(wd.window_handles[1])
print(f"这是跳转后的窗口句柄{wd.window_handles}")
sleep(10)
INFO("请查看会议详情是否正确包含:多会议室、会议号、会议名称、会议时间")
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Unified_Platform", "创建会议详情")
# 进入会控界面
safe_click((By.XPATH, "//span[contains(text(),'进入会控')]"),wd)
sleep(10)
# 切换窗口2,转到会控界面
wd.switch_to.window(wd.window_handles[1])
# 进行多画面设置
safe_click((By.XPATH, "//div[@class='frames framesActive el-popover__reference']//span[contains(text(),'一画面')]"),wd)
sleep(5)
safe_click((By.XPATH,"(//img[@class='img'])[705]"),wd)
sleep(4)
wd.refresh()
sleep(2)
# 将左侧会场拖拽到右侧画面进行播放
INFO("将左侧会场拖拽到右侧画面进行播放")
single_click_and_drag((By.CSS_SELECTOR, "body > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div:nth-child(2) > div:nth-child(4) > div:nth-child(1) > span:nth-child(2)"),
(By.CSS_SELECTOR, "body > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1)")
, wd)
sleep(4)
single_click_and_drag((By.CSS_SELECTOR, "body > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div:nth-child(2) > div:nth-child(5) > div:nth-child(1) > span:nth-child(2)"),
(By.CSS_SELECTOR, "body > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2)")
, wd)
sleep(4)
single_click_and_drag((By.CSS_SELECTOR, "body > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(2) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > span:nth-child(2)"),
(By.CSS_SELECTOR,"body > div:nth-child(1) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(2) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(3)")
, wd)
sleep(4)
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Unified_Platform", "多画面设置")
# 会控界面-设备控制
INFO("关闭展厅会议室终端的摄像头")
safe_click((By.XPATH, "(//img[@title='关闭摄像头'])[2]"),wd)
sleep(1)
safe_click((By.XPATH, "//span[contains(text(),'确定')]"),wd)
sleep(2)
INFO("开启展厅指挥中心终端的麦克风")
safe_click((By.XPATH, "(//img[@title='取消静音'])[1]"),wd)
sleep(2)
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Unified_Platform", "终端设备控制")
# 创建多SMC会议,提示MCU资源不足
print(f"这是当前窗口句柄{wd.window_handles}")
wd.switch_to.window(wd.window_handles[0])
print(f"这是跳转后的窗口句柄{wd.window_handles}")
safe_click((By.XPATH, "//p[contains(text(),'新建会议')]"),wd)
sleep(2)
# 切换窗口至新建会议的窗口
print(f"这是当前窗口句柄{wd.window_handles}")
wd.switch_to.window(wd.window_handles[1])
print(f"这是跳转后的窗口句柄{wd.window_handles}")
# 选择会议室
safe_click((By.XPATH, "//div[@class='meeting_area']//div[@class='el-table__fixed-header-wrapper']//div[1]//label[1]//span[1]//span[1]"),wd)
safe_click((By.XPATH, "//span[contains(text(),'视讯会议')]"),wd)
sleep(1)
safe_click((By.XPATH, "//span[@class='el-checkbox__label'][contains(text(),'腾讯会议')]"),wd)
sleep(2)
safe_click((By.XPATH, "//span[contains(text(),'确定创建')]"),wd)
sleep(10)
safe_click((By.XPATH, "//span[contains(text(),'查看详情')]"),wd)
sleep(5)
print(f"这是当前窗口句柄{wd.window_handles}")
wd.switch_to.window(wd.window_handles[2])
print(f"这是跳转后的窗口句柄{wd.window_handles}")
sleep(5)
# 获取会议详情截图信息
INFO("请查看会议详情是否提示:”MCU资源不足“")
SELENIUM_LOG_SCREEN(wd, "50%", "Exhibit_Inspect", "Unified_Platform", "创建多SMC会议提示MCU资源不足")
\ No newline at end of file
import os
import requests
import chardet
from urllib3.exceptions import InsecureRequestWarning
# 禁用 InsecureRequestWarning 警告
requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning)
def download_file(url, save_directory, filename):
# 确保保存目录存在
if not os.path.exists(save_directory):
os.makedirs(save_directory)
# 构建完整的本地文件路径
local_filepath = os.path.join(save_directory, filename)
try:
# 发送HTTP GET请求以获取文件数据
response = requests.get(url, verify=False) # 禁用SSL验证
# 检查响应状态码是否为200(OK)
if response.status_code == 200:
# 自动检测文件编码
detected_encoding = chardet.detect(response.content)['encoding']
print(f"检测到的编码: {detected_encoding}")
# 将响应内容解码为字符串
content = response.content.decode(detected_encoding)
# 打开本地文件以文本写入模式,并将响应内容写入文件
with open(local_filepath, 'w', encoding='utf-8') as f:
f.write(content)
print(f"文件已成功下载并保存为 {local_filepath}")
else:
print(f"无法下载文件,状态码: {response.status_code}")
except requests.exceptions.RequestException as e:
print(f"请求过程中出现错误: {e}")
if __name__ == "__main__":
# 使用示例
url = "https://192.168.5.218:8443/media/file/check.txt"
save_directory = r"D:\GithubData\自动化\ubains-module-test\预定系统\reports" # 指定保存目录
filename = "check.txt"
download_file(url, save_directory, filename)
\ No newline at end of file
# 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)
# # 导入模块
# 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")
\ No newline at end of file
...@@ -77,9 +77,8 @@ schedule.every().thursday.at("08:15").do(run_task, run_automation_test, report_t ...@@ -77,9 +77,8 @@ schedule.every().thursday.at("08:15").do(run_task, run_automation_test, report_t
schedule.every().friday.at("08:15").do(run_task, run_automation_test, report_title="展厅巡检_会议预约测试报告", report_url_prefix="http://nat.ubainsyun.com:31133", test_case="展厅巡检", ding_type="展厅巡检") schedule.every().friday.at("08:15").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:25").do(run_task, run_automation_test, report_title="展厅巡检_腾讯终端入会测试报告", report_url_prefix="http://nat.ubainsyun.com:31133", test_case="展厅巡检_腾讯会议") # schedule.every().day.at("08:25").do(run_task, run_automation_test, report_title="展厅巡检_腾讯终端入会测试报告", report_url_prefix="http://nat.ubainsyun.com:31133", test_case="展厅巡检_腾讯会议")
#
# schedule.every().day.at("08:30").do(run_task, run_automation_test, report_title="展厅巡检_无纸化查看议题测试报告", report_url_prefix="http://nat.ubainsyun.com:31133", test_case="展厅巡检_无纸化")
# schedule.every().day.at("08:30").do(run_task, run_automation_test, report_title="展厅巡检_无纸化查看议题测试报告", report_url_prefix="http://nat.ubainsyun.com:31133", test_case="展厅巡检_无纸化")
try: try:
# 无限循环,持续检查并执行计划任务 # 无限循环,持续检查并执行计划任务
......
name,conference_name,message_name,book_type,issue_name,book_start_time,book_end_time,message_notification,check_text name,conference_name,message_name,book_type,issue_name,book_start_time,book_end_time,message_notification,check_text
展厅巡检_001,展厅会议室,展厅巡检测试,普通会议,议题1,08:30,09:00,开会前一天提醒,预定成功 展厅巡检_001,展厅会议室,展厅巡检测试,普通会议,议题1,14:30,15:00,开会前一天提醒,预定成功
\ No newline at end of file \ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论