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

补充会议审批预约以及取消审批功能的自动化处理。

上级 e4aa8533
......@@ -5,13 +5,12 @@
</component>
<component name="ChangeListManager">
<list default="true" id="923e4366-b26b-44a4-9a8e-7655702750f8" name="更改" comment="">
<change afterPath="$PROJECT_DIR$/预定系统/cases/会议审批/01审批会议创建.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/预定系统/cases/会议审批/__st__.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/预定系统/测试数据/会议审批/会议审批预约.csv" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/预定系统/Base/base.py" beforeDir="false" afterPath="$PROJECT_DIR$/预定系统/Base/base.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/预定系统/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/预定系统/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/预定系统/cases/展厅巡检/04讯飞系统巡检/讯飞系统巡检.py" beforeDir="false" afterPath="$PROJECT_DIR$/预定系统/cases/展厅巡检/04讯飞系统巡检/讯飞系统巡检.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/预定系统/cases/设备管理/安卓信息-消息监听.py" beforeDir="false" afterPath="$PROJECT_DIR$/预定系统/cases/设备管理/安卓信息-消息监听.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/预定系统/定时执行功能测试.py" beforeDir="false" afterPath="$PROJECT_DIR$/预定系统/定时执行功能测试.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/预定系统/测试数据/展厅巡检/会议预约.csv" beforeDir="false" afterPath="$PROJECT_DIR$/预定系统/测试数据/展厅巡检/会议预约.csv" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
......@@ -37,7 +36,7 @@
"keyToString": {
"Python.安卓信息-消息监听.executor": "Run",
"git-widget-placeholder": "develop",
"last_opened_file_path": "D:/GithubData/自动化/ubains-module-test/预定系统/测试数据/会议模板",
"last_opened_file_path": "D:/GithubData/自动化/ubains-module-test/预定系统/cases/会议审批",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
......@@ -46,6 +45,7 @@
}]]></component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="D:\GithubData\自动化\ubains-module-test\预定系统\cases\会议审批" />
<recent name="D:\GithubData\自动化\ubains-module-test\预定系统\测试数据\会议模板" />
<recent name="D:\GithubData\自动化\ubains-module-test\预定系统\测试数据\会议历史记录" />
</key>
......
......@@ -131,4 +131,5 @@
- 拆分出MQTT通用工具目录,用于后续开发测试人员进行模拟设备调试以及MQTT相关的程序验证。
- 补充历史会议再次预定、会议模板查询以及再次预定功能的代码处理。
27. 2024-12-25
- 根据展厅巡检使用时遇到的问题进行调整,在议题文件上传前做文件是否存在的校验,若不存在则跳出函数。补充讯飞流程的切换窗口句柄代码。
\ No newline at end of file
- 根据展厅巡检使用时遇到的问题进行调整,在议题文件上传前做文件是否存在的校验,若不存在则跳出函数。补充讯飞流程的切换窗口句柄代码。
- 补充会议审批预约以及取消审批功能的自动化处理。
\ No newline at end of file
from datetime import datetime, timedelta
from time import sleep
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 *
# 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建CSV文件的绝对路径
csv_file_path = os.path.join(current_dir, '../../测试数据/会议审批/会议审批预约.csv')
# 定义时间格式
time_format = "%H:%M"
class MeetingApproval_Book_000x:
"""
执行指令:
1.cd 预定系统
2.hytest --report_title 审批会议预约测试报告 --test 审批会议预约_0**
"""
ddt_cases = read_csv_data(csv_file_path)
def teststeps(self):
"""
执行测试步骤以会议室删除功能。
本函数根据参数输入会议室名称进行搜索并删除会议室,并检查删除后的提示信息是否与预期相符。
字段含义:
name:用例名称
conference_name:会议室名称
message_name:会议名称
book_start_time:会议开始时间
book_end_time:会议结束时间
check_text:检查提示文本
"""
# 初始化通知文本为空字符串
notify_text = ""
# 从全局存储中获取webdriver实例
wd = GSTORE['wd']
name = self.name
conference_name, message_name, book_start_time, book_end_time, check_text = self.para
# 在会议室列表搜索会议室
STEP(1, f"在会议室列表搜索:{conference_name}")
# 展开筛选下拉框
safe_click((By.XPATH, "//i[@class='el-collapse-item__arrow el-icon-arrow-right']"), wd)
sleep(1)
# 输入会议室名称,并点击【查询】按钮
safe_send_keys((By.XPATH, "//input[@placeholder='请输入会议室名称']"), conference_name, wd)
safe_click((By.XPATH, "//button[@type='button']//span[contains(text(),'查询')]"), wd)
sleep(1)
INFO("检查搜索结果")
# 获取搜索出的会议室名称
notify_text = elment_get_text((By.XPATH, "//span[@class='MeetingCityList_name']"), wd)
INFO(f"搜索结果为:{notify_text}")
CHECK_POINT("搜索结果是否正确", conference_name in notify_text)
# 点击【会议预定】按钮,进入会议预定界面
STEP(2, "点击【会议预定】按钮")
safe_click((By.XPATH, "//span[@class='MeetingCityList_t_btn']"), wd)
sleep(1)
INFO("检查页面标题是否正确")
# 获取页面标题
notify_text = elment_get_text((By.XPATH, "//div[@class='reserve_Title']"), wd)
INFO(f"页面标题为:{notify_text}")
CHECK_POINT("页面标题是否正确", "会议预定" in notify_text)
sleep(1)
# 在会议预定第一步界面进行数据填入
STEP(3, "会议第一步数据填写")
INFO(
f"输入会议名称:{message_name},选择会议开始时间:{book_start_time},选择会议结束时间:{book_end_time}")
# 输入会议名称
safe_send_keys((By.XPATH, "//input[@placeholder='请输入会议名称']"), message_name, wd)
# 将字符串转换为时间对象
start_time = datetime.strptime(book_start_time, time_format)
end_time = datetime.strptime(book_end_time, time_format)
# 如果需要将时间差转换为分钟数
time_diff_minutes = (end_time - start_time).total_seconds() / 60
INFO(f"时间差为:time_diff_minutes")
# 判断如果开始时间与结束时间相等,则不重复点击
if book_start_time == book_end_time:
INFO(f"开始时间与结束时间相等,选择时间块:{book_start_time}")
# 根据开始时间选择对应时间块,时间格式为:**:**
safe_click((By.XPATH, f"(//div[normalize-space()='{book_start_time}'])[1]"), wd)
elif book_start_time != book_end_time:
INFO(f"开始时间与结束时间不相等,选择时间块:{book_start_time},{book_end_time}")
# 根据开始时间选择对应时间块,时间格式为:**:**
safe_click((By.XPATH, f"(//div[normalize-space()='{book_start_time}'])[1]"), wd)
# 根据结束时间选择对应时间块,时间格式为:**:**
safe_click((By.XPATH, f"(//div[normalize-space()='{book_end_time}'])[1]"), wd)
sleep(2)
# 判断时间差是否大于最大预约时长1小时,即60分钟
if time_diff_minutes > 60:
INFO(f"时间差大于最大预约时长1小时,选择【超出预约时长】")
notify_text = get_notify_text(wd, (By.XPATH, "//p[contains(@class,'el-message__content')]"),
"Meeting_Approval", "Message_Book", f"{name}_超出预约时长")
INFO(f"提示信息为:{notify_text}")
CHECK_POINT("超出预约时长提示是否正确", "最大预定时间 1 小时" in notify_text)
sleep(2)
# 不选时间点击【下一步】查看提示信息
INFO("不选时间点击【下一步】查看提示信息")
safe_click((By.XPATH, "//div[contains(text(),'下一步')]"), wd)
sleep(1)
notify_text = get_notify_text(wd, (By.XPATH, "//p[contains(@class,'el-message__content')]"),
"Meeting_Approval", "Message_Book", f"{name}请选择会议时间提示信息")
INFO(f"提示信息为:{notify_text}")
CHECK_POINT("未选时间提示是否正确", "请选择会议时间" in notify_text)
sleep(1)
# 重新选择时间,将字符串转换为时间对象
time_obj = datetime.strptime(book_end_time, time_format)
time_obj_minus_5_minutes = time_obj - timedelta(minutes=30)
# 将时间对象转换回字符串
book_end_time = time_obj_minus_5_minutes.strftime(time_format)
INFO(f"重新选择结束时间为:{book_end_time}")
# 根据开始时间选择对应时间块,时间格式为:**:**
safe_click((By.XPATH, f"(//div[normalize-space()='{book_start_time}'])[1]"), wd)
# 根据结束时间选择对应时间块,时间格式为:**:**
safe_click((By.XPATH, f"(//div[normalize-space()='{book_end_time}'])[1]"), wd)
sleep(2)
STEP(4, "点击【快速预约】按钮")
safe_click((By.XPATH, "//div[@class='header_Quick']"), wd)
sleep(4)
safe_click((By.XPATH, "//button[@type='button']//span[contains(text(),'预定')]"), wd)
sleep(2)
notify_text = get_notify_text(wd, (By.XPATH, "//p[contains(@class,'el-message__content')]"),
"Meeting_Approval", "Message_Book", f"{name}预定成功提示信息")
INFO(f"预定成功提示信息为:{notify_text}")
CHECK_POINT("预定成功提示是否正确", notify_text == check_text)
STEP(5,"检查审批会议是否创建成功")
# 进入会议审批模块
safe_click((By.XPATH, "//span[contains(text(),'会议审批')]"), wd)
sleep(2)
# 查询会议
safe_send_keys((By.XPATH, "//input[@placeholder='请输入会议名称搜索']"), message_name, wd)
send_keyboard((By.XPATH, "//input[@placeholder='请输入会议名称搜索']"), wd)
sleep(2)
# 获取审批会议名称
notify_text = elment_get_text((By.CSS_SELECTOR, "body > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div:nth-child(3) > div:nth-child(1) > div:nth-child(3) > div:nth-child(2) > 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)"), wd)
INFO(f"审批会议名称为:{notify_text}")
SELENIUM_LOG_SCREEN(wd, "50%", "Meeting_Approval", "Message_Book", f"{name}_审批会议名称")
CHECK_POINT("审批会议名称是否正确", notify_text == message_name)
STEP(6, "点击【取消审批】按钮")
# 查询会议
safe_send_keys((By.XPATH, "//input[@placeholder='请输入会议名称搜索']"), message_name, wd)
send_keyboard((By.XPATH, "//input[@placeholder='请输入会议名称搜索']"), wd)
sleep(2)
safe_click((By.XPATH, "//span[contains(text(),'取消审批')]"), wd)
sleep(2)
# 点击【取消】按钮
safe_click((By.XPATH, "//button[@class='el-button el-button--default el-button--small btn-custom-cancel']//span[contains(text(),'取消')]"), wd)
# 再次点击【取消审批】按钮,并点击【确定】按钮
sleep(1)
safe_click((By.XPATH, "//span[contains(text(),'取消审批')]"), wd)
sleep(2)
safe_click((By.XPATH, "//button[contains(@class,'el-button el-button--default el-button--small el-button--primary')]//span[contains(text(),'确定')]"), wd)
sleep(2)
notify_text = get_notify_text(wd, (By.XPATH, "//p[contains(@class,'el-message__content')]"),
"Meeting_Approval", "Message_Book", f"{name}取消审批成功提示信息")
INFO(f"取消审批成功提示信息为:{notify_text}")
CHECK_POINT("取消审批成功提示是否正确", notify_text == "取消成功")
\ 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_url = 'https://192.168.5.218/#/login/logindf'
# login_ngrok_url = "https://nat.ubainsyun.com:11046"
login_url = 'http://192.168.5.200:8080/#/login/logindf'
browser_init(login_url)
wd = GSTORE['wd']
admin_login("admin@user", "Ubains@4321")
sleep(2)
\ No newline at end of file
......@@ -72,7 +72,7 @@ schedule.every().saturday.at("12:00").do(run_task, run_automation_test, report_t
schedule.every().monday.at("08:05").do(run_task, run_automation_test, report_title="展厅巡检测试报告", report_url_prefix="http://nat.ubainsyun.com:31133", test_case="展厅巡检", ding_type="展厅巡检")
schedule.every().tuesday.at("08:05").do(run_task, run_automation_test, report_title="展厅巡检测试报告", report_url_prefix="http://nat.ubainsyun.com:31133", test_case="展厅巡检", ding_type="展厅巡检")
schedule.every().wednesday.at("08:43").do(run_task, run_automation_test, report_title="展厅巡检测试报告", report_url_prefix="http://nat.ubainsyun.com:31133", test_case="展厅巡检", ding_type="展厅巡检")
schedule.every().wednesday.at("08:05").do(run_task, run_automation_test, report_title="展厅巡检测试报告", report_url_prefix="http://nat.ubainsyun.com:31133", test_case="展厅巡检", ding_type="展厅巡检")
schedule.every().thursday.at("08:05").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:05").do(run_task, run_automation_test, report_title="展厅巡检测试报告", report_url_prefix="http://nat.ubainsyun.com:31133", test_case="展厅巡检", ding_type="展厅巡检")
......
name,conference_name,message_name,book_start_time,book_end_time,check_text
审批会议预约_001,产研中心会议室,这是审批会议,15:00,15:15,会议正在审批中
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论