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

补充读取测试用例JSON数据会议审批和会议室管理的部分功能测试。优化message_meeting函数传参。

上级 a5ec2474
No preview for this file type
......@@ -1469,7 +1469,7 @@ def get_current_time_formatted():
return closest_time_point
# 会议创建函数
def meeting_message(meeting_room_name, message_type, wd):
def meeting_message(meeting_room_name, message_type, message_name, wd):
"""
会议室会议预定功能的实现。
......@@ -1497,7 +1497,7 @@ def meeting_message(meeting_room_name, message_type, wd):
safe_click((By.XPATH, "//span[@class='MeetingCityList_t_btn']"), wd)
sleep(2)
# 输入会议名称并勾选MessageType类型
safe_send_keys((By.XPATH, "//input[@placeholder='请输入会议名称']"), message_type, wd)
safe_send_keys((By.XPATH, "//input[@placeholder='请输入会议名称']"), message_name, wd)
safe_click(
(By.XPATH, f"//div[@class='reserve_input']//span[@class='el-checkbox__label'][contains(text(),'{message_type}')]"), wd)
sleep(1)
......
......@@ -252,4 +252,5 @@
- 实现测试用例中的会议修改和会议历史记录的部分功能测试。
- 实现测试用例中的会议模板的部分功能测试。
67. 2025-03-12
- 实现读取测试用例JSON数据全局配置、账号管理以及信息统计的部分功能测试。优化get_notify_text传参。
\ No newline at end of file
- 实现读取测试用例JSON数据全局配置、账号管理以及信息统计的部分功能测试。优化get_notify_text传参。
- 补充读取测试用例JSON数据会议审批和会议室管理的部分功能测试。优化message_meeting函数传参。
\ No newline at end of file
......@@ -31,7 +31,7 @@ class SMCMeeting_00x:
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
# 调用会议创建函数
meeting_message("SMC会议室", "SMC3.0", wd)
meeting_message("SMC会议室", "SMC3.0", "SMC3.0", wd)
sleep(1)
for step in case:
print(f"当前步骤: {step}")
......
No preview for this file type
No preview for this file type
......@@ -35,7 +35,7 @@ class TxcentMeeting_00x:
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
# 调用会议创建函数
meeting_message("腾讯会议室", "腾讯会议", wd)
meeting_message("腾讯会议室", "腾讯会议", "腾讯会议",wd)
sleep(1)
for step in case:
print(f"当前步骤: {step}")
......
No preview for this file type
......@@ -35,7 +35,7 @@ class EditMessage_00x:
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
# 调用会议创建函数
meeting_message("预约会议室", "普通会议", wd)
meeting_message("预约会议室", "普通会议", "普通会议",wd)
# 搜索会议
safe_send_keys((By.XPATH, "//input[@placeholder='输入关键字搜索']"), "普通会议", wd)
send_keyboard((By.XPATH, "//input[@placeholder='输入关键字搜索']"), wd)
......
No preview for this file type
File added
import sys
import os
from time import sleep
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径
......@@ -14,10 +14,11 @@ def suite_setup():
STEP(1, "初始化浏览器")
# 初始化浏览器与系统地址
browser_init("标准版预定系统")
wd = GSTORE['wd']
admin_login("admin@user", "Ubains@4321")
admin_login("admin@PT", "Ubains@4321")
sleep(2)
wd = GSTORE['wd']
def suite_teardown():
browser_quit()
\ No newline at end of file
wd = GSTORE['wd']
wd.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 *
# 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class MessageApproval:
tags = ['新-会议审批测试']
"""
执行指令是:
1.cd 预定系统
2.hytest --report_title 会议审批测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议审批测试
"""
def teststeps(self):
"""
执行测试步骤函数,主要用于执行读取的测试用例并进行会议模板模块功能测试操作
"""
# 从全局存储中获取webdriver对象
wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据
ddt_cases = read_xlsx_data(xlsx_file_path, "会议审批")
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
# 创建审批会议
meeting_message("审批会议室", "普通会议", "审批测试会议",wd)
for step in case:
print(f"当前步骤: {step}")
# 先赋值
locator_type = get_by_enum(step.get('locator_type'))
locator_value = step.get('locator_value')
element_type = step.get('element_type')
element_value = step.get('element_value')
expented_result = step.get('expented_result')
# 判断页面功能类型
if step.get("page") == "ApprovalInitiate":
# 这是编辑模板测试
if element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(1)
elif element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(2)
elif element_type == "getTips":
notify_text = get_notify_text(wd, (locator_type, locator_value), "Message_Template", "Template_Edit", "编辑模板")
INFO(f"提示信息为:{notify_text}")
CHECK_POINT("编辑测试判断是否正确", expented_result in notify_text)
elif element_type == "getText":
notify_text = elment_get_text((locator_type, locator_value), wd)
INFO(f"获取文本信息为:{notify_text}")
CHECK_POINT("获取文本判断是否正确", expented_result in notify_text)
# 取消审批会议数据
safe_click((By.XPATH, "//span[contains(text(),'取消审批')]"), wd)
sleep(1)
safe_click((By.XPATH, "//button[contains(@class,'el-button el-button--default el-button--small el-button--primary')]//span[contains(text(),'确定')]"), wd)
\ No newline at end of file
File added
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, "初始化浏览器")
# 初始化浏览器与系统地址
browser_init("标准版预定系统")
wd = GSTORE['wd']
admin_login("admin@user", "Ubains@4321")
sleep(2)
def suite_teardown():
browser_quit()
\ No newline at end of file
File added
File added
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 *
def suite_setup():
STEP(1, "初始化浏览器")
# 初始化浏览器与系统地址
browser_init("标准版预定系统")
admin_login("admin@Test", "Ubains@4321")
sleep(2)
wd = GSTORE['wd']
# 进入后台模块
safe_click((By.XPATH, "//img[@title='后台系统']"),wd)
# 切换至信息统计模块
safe_click((By.XPATH, "//span[contains(text(),'会议室管理')]"), wd)
def suite_teardown():
wd = GSTORE['wd']
wd.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 *
# 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class ConferenceStatistics:
tags = ['新-会议室管理测试']
"""
执行指令是:
1.cd 预定系统
2.hytest --report_title 会议室管理测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议室管理测试
"""
def teststeps(self):
"""
执行测试步骤函数,主要用于执行读取的测试用例并进行信息统计模块功能测试操作
"""
# 从全局存储中获取webdriver对象
wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据
ddt_cases = read_xlsx_data(xlsx_file_path, "会议室管理")
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
for step in case:
print(f"当前步骤: {step}")
# 先赋值
locator_type = get_by_enum(step.get('locator_type'))
locator_value = step.get('locator_value')
element_type = step.get('element_type')
element_value = step.get('element_value')
expented_result = step.get('expented_result')
# 判断页面功能类型
if step.get("page") == "ConferenceManageQuery":
safe_click((By.XPATH, "//li[contains(text(),'会议室管理')]"), wd)
if element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(2)
elif element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
send_keyboard((locator_type, locator_value), wd)
sleep(2)
elif element_type == "getText":
notify_text = elment_get_text((locator_type, locator_value), wd)
INFO(f"获取到的文本为:{notify_text}")
CHECK_POINT(f"判断查询结果是否正确", expented_result in notify_text)
\ No newline at end of file
from datetime import datetime, timedelta
from time import sleep
import sys
import os
......
No preview for this file type
No preview for this file type
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论