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

输出功能管理模块中的功能查询、功能删除相关代码。输出区域管理模块中的区域新增、区域删除相关代码。调整base类中封装的get_notify_text函数,调...

输出功能管理模块中的功能查询、功能删除相关代码。输出区域管理模块中的区域新增、区域删除相关代码。调整base类中封装的get_notify_text函数,调整传参类型,优化代码的可维护性,减少代码冗余。
上级 1de04c68
No preview for this file type
......@@ -236,7 +236,7 @@ def send_keyboard(element_locator, wd):
# 如果元素不可交互,打印不可交互错误消息。
print(f"ElementNotInteractableException: Element {element_locator} is not interactable.")
def get_notify_text(wd,locator,module_name,function_name,name):
def get_notify_text(wd,element_locator,module_name,function_name,name):
"""
获取通知文本信息。
......@@ -252,7 +252,7 @@ def get_notify_text(wd,locator,module_name,function_name,name):
try:
# 获取提示信息
notify_text = WebDriverWait(wd, 20).until(
EC.presence_of_element_located((By.XPATH, locator))
EC.presence_of_element_located(element_locator)
).text
# 屏幕截图
SELENIUM_LOG_SCREEN(wd,"50%",module_name,function_name,name)
......
......@@ -46,4 +46,8 @@
13. 2024-11-13
- 已将部门管理、用户管理模块完全输出完成,部门编辑存在定位失败问题,暂时没排查出来。
- 输出会议室管理相关模块的脚本,当前已输出功能管理模块的新增与编辑功能代码。
- 封装正则表达式函数用来判断密码的字符格式。优化代码的可维护性。
\ No newline at end of file
- 封装正则表达式函数用来判断密码的字符格式。优化代码的可维护性。
14. 2024-11-14
- 输出功能管理模块中的功能查询、功能删除相关代码。
- 输出区域管理模块中的区域新增、区域删除相关代码。
- 调整base类中封装的get_notify_text函数,调整传参类型,优化代码的可维护性,减少代码冗余。
\ No newline at end of file
from sys import dllhandle
from time import sleep
from hytest import *
# 获取当前脚本的绝对路径
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 *
# 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建CSV文件的绝对路径
csv_file_path = os.path.join(current_dir, '../../../测试数据/会议室管理/功能管理模块/功能删除.csv')
class Function_Delete_000x:
# 执行指令是:hytest --test _0**
ddt_cases = read_csv_data(csv_file_path)
def teststeps(self):
"""
执行测试步骤以用户新增功能。
本函数根据参数输入账号、用户名、密码、确认密码、部门、性别、手机号和邮箱,并检查新增后的提示信息是否与预期相符。
"""
# 初始化通知文本为空字符串
notify_text = ""
# 从全局存储中获取webdriver实例
wd = GSTORE['wd']
# 从self.para中解构出用户名、密码、验证码和检查文本
name = self.name
function_name, del_type, check_text = self.para
# 步骤1:查询功能名称
STEP(1, f"查询功能名称:{function_name}")
safe_send_keys((By.XPATH, "//input[@placeholder='输入关键字']"), function_name, wd)
send_keyboard((By.XPATH, "//input[@placeholder='输入关键字']"), wd)
sleep(1)
# 根据del_type执行不同的删除操作
if del_type == "单个删除":
# 步骤2:选择单个删除
STEP(2, "选择单个删除")
safe_click((By.XPATH, "(//i[contains(text(),'删除')])[1]"), wd)
sleep(1)
# 步骤3:检查弹窗内容
STEP(3, "检查弹窗内容")
notify_text = elment_get_text((By.XPATH, "//p[contains(text(),'是否要删除此功能?')]"), wd)
INFO(f"弹窗内容:{notify_text}")
CHECK_POINT("弹窗内容正确", notify_text == "是否要删除此功能?")
# 步骤4:点击【确定】按钮
STEP(4, "点击【确定】按钮")
safe_click((By.XPATH,
"//button[contains(@class,'el-button el-button--default el-button--small el-button--primary')]//span[contains(text(),'确定')]"),
wd)
sleep(2)
# 步骤5:检查删除结果
STEP(5, "检查删除结果")
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"), "Function_Manage", "Function_Del",
f"{name}_检查提示信息")
INFO(f"删除结果:{notify_text}")
CHECK_POINT("删除结果正确", notify_text == check_text)
elif del_type == "批量删除":
# 步骤2:勾选全部功能
STEP(2, "勾选全部功能")
safe_click((By.XPATH,
"//th[contains(@class,'is-leaf el-table__cell')]//span[contains(@class,'el-checkbox__inner')]"),
wd)
sleep(1)
# 步骤3:点击【批量删除】按钮
STEP(3, "点击【批量删除】按钮")
safe_click((By.XPATH, "//span[contains(text(),'批量删除')]"), wd)
sleep(1)
# 步骤4:检查弹窗内容
STEP(4, "检查弹窗内容")
notify_text = elment_get_text((By.XPATH, "//p[contains(text(),'是否要删除此功能?')]"), wd)
INFO(f"弹窗内容:{notify_text}")
CHECK_POINT("弹窗内容正确", notify_text == "是否要删除此功能?")
# 步骤5:点击【确定】按钮
STEP(5, "点击【确定】按钮")
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[@class='el-message__content']"), "Function_Manage", "Function_Del",
f"{name}_检查提示信息")
INFO(f"删除结果:{notify_text}")
CHECK_POINT("删除结果正确", notify_text == check_text)
elif del_type == "单个取消删除":
# 步骤2:选择单个删除
STEP(2, "选择单个删除")
safe_click((By.XPATH, "//i[@class='el-icon-delete']"), wd)
sleep(1)
# 步骤3:检查弹窗内容
STEP(3, "检查弹窗内容")
notify_text = elment_get_text((By.XPATH, "//p[contains(text(),'是否要删除此功能?')]"), wd)
INFO(f"弹窗内容:{notify_text}")
CHECK_POINT("弹窗内容正确", notify_text == "是否要删除此功能?")
# 步骤4:点击【取消】按钮
STEP(4, "点击【取消】按钮")
safe_click((By.XPATH, "//span[contains(text(),'取消')]"), wd)
sleep(2)
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"), "Function_Manage", "Function_Del",
f"{name}_检查提示信息")
INFO(f"取消结果:{notify_text}")
CHECK_POINT("取消结果正确", notify_text == check_text)
elif del_type == "批量取消删除":
# 步骤2:勾选全部功能
STEP(2, "勾选全部功能")
safe_click((By.XPATH,
"//th[contains(@class,'is-leaf el-table__cell')]//span[contains(@class,'el-checkbox__inner')]"),
wd)
sleep(1)
# 步骤3:点击【批量删除】按钮
STEP(3, "点击【批量删除】按钮")
safe_click((By.XPATH, "//span[contains(text(),'批量删除')]"), wd)
sleep(1)
# 步骤4:检查弹窗内容
STEP(4, "检查弹窗内容")
notify_text = elment_get_text((By.XPATH, "//p[contains(text(),'是否要删除此功能?')]"), wd)
INFO(f"弹窗内容:{notify_text}")
CHECK_POINT("弹窗内容正确", notify_text == "是否要删除此功能?")
# 步骤5:点击【取消】按钮
STEP(5, "点击【取消】按钮")
safe_click((By.XPATH, "//span[contains(text(),'取消')]"), wd)
sleep(2)
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"), "Function_Manage", "Function_Del",
f"{name}_检查提示信息")
INFO(f"取消结果:{notify_text}")
CHECK_POINT("取消结果正确", notify_text == check_text)
elif del_type == "不勾选数据":
# 步骤2:点击【批量删除】按钮,但未勾选任何数据
safe_click((By.XPATH, "//span[contains(text(),'批量删除')]"), wd)
sleep(1)
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"), "Function_Manage", "Function_Del",
f"{name}_检查提示信息")
INFO(f"取消结果:{notify_text}")
CHECK_POINT("取消结果正确", notify_text == check_text)
\ No newline at end of file
......@@ -26,8 +26,8 @@ class Function_Add_000x:
def teststeps(self):
"""
执行测试步骤以用户新增功能。
本函数根据参数输入账号、用户名、密码、确认密码、部门、性别、手机号和邮箱,并检查新增后的提示信息是否与预期相符。
执行测试步骤以功能新增功能。
本函数根据参数输入功能名称、功能描述和功能类型,并检查新增后的提示信息是否与预期相符。
"""
# 初始化通知文本为空字符串
notify_text = ""
......@@ -64,7 +64,7 @@ class Function_Add_000x:
sleep(2)
STEP(5, "检查新增结果")
notify_text = get_notify_text(wd,"//p[@class='el-message__content']","Function_Manage","Function_Add",f"{name}检查提示信息")
notify_text = get_notify_text(wd,(By.XPATH,"//p[@class='el-message__content']"),"Function_Manage","Function_Add",f"{name}检查提示信息")
INFO(f"新增结果为:{notify_text}")
CHECK_POINT("新增结果检查", notify_text == check_text)
......
from time import sleep
from hytest import *
# 获取当前脚本的绝对路径
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 *
# 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建CSV文件的绝对路径
csv_file_path = os.path.join(current_dir, '../../../测试数据/会议室管理/功能管理模块/功能查询.csv')
class Function_Query_000x:
# 执行指令是:hytest --test _0**
ddt_cases = read_csv_data(csv_file_path)
def teststeps(self):
"""
执行测试步骤以用户新增功能。
本函数根据参数输入账号、用户名、密码、确认密码、部门、性别、手机号和邮箱,并检查新增后的提示信息是否与预期相符。
"""
# 初始化通知文本为空字符串
notify_text = ""
# 从全局存储中获取webdriver实例
wd = GSTORE['wd']
# 从self.para中解构出用户名、密码、验证码和检查文本
name = self.name
function_name, query_type = self.para
# 根据查询类型执行不同的测试步骤
if query_type == "精确查询":
# 步骤1: 输入功能名称
STEP(1, f"输入功能名称:{function_name}")
safe_send_keys((By.XPATH, "//input[@placeholder='输入关键字']"), function_name, wd)
send_keyboard((By.XPATH, "//input[@placeholder='输入关键字']"), wd)
sleep(1)
# 步骤2: 检查查询结果
STEP(2, "检查查询结果")
notify_text = elment_get_text((By.XPATH, "//tbody/tr[1]/td[2]/div[1]"), wd)
INFO(f"查询结果为:{notify_text}")
CHECK_POINT("查询结果正确", notify_text == function_name)
elif query_type == "模糊查询":
# 步骤1: 输入功能名称
STEP(1, f"输入功能名称:{function_name}")
safe_send_keys((By.XPATH, "//input[@placeholder='输入关键字']"), function_name, wd)
send_keyboard((By.XPATH, "//input[@placeholder='输入关键字']"), wd)
sleep(1)
# 步骤2: 检查查询结果
STEP(2, "检查查询结果")
notify_text = elment_get_text((By.XPATH, "//tbody/tr[1]/td[2]/div[1]"), wd)
INFO(f"查询结果为:{notify_text}")
CHECK_POINT("查询结果正确", function_name in notify_text)
elif query_type == "错误查询":
# 步骤1: 输入功能名称
STEP(1, f"输入功能名称:{function_name}")
safe_send_keys((By.XPATH, "//input[@placeholder='输入关键字']"), function_name, wd)
send_keyboard((By.XPATH, "//input[@placeholder='输入关键字']"), wd)
sleep(1)
# 步骤2: 检查查询结果
STEP(2, "检查查询结果")
notify_text = elment_get_text((By.XPATH, "//span[contains(@class,'el-table__empty-text')]"), wd)
INFO(f"查询结果为:{notify_text}")
CHECK_POINT("查询结果正确", notify_text == "暂无数据")
elif query_type == "分页查询":
# 步骤1: 切换分页
STEP(1, f"切换分页")
safe_click((By.XPATH, "//li[@class='number']"), wd)
sleep(1)
# 步骤2: 输入功能名称
STEP(2, f"输入功能名称:{function_name}")
safe_send_keys((By.XPATH, "//input[@placeholder='输入关键字']"), function_name, wd)
send_keyboard((By.XPATH, "//input[@placeholder='输入关键字']"), wd)
sleep(1)
# 步骤3: 检查查询结果
STEP(2, "检查查询结果")
notify_text = elment_get_text((By.XPATH, "//tbody/tr[1]/td[2]/div[1]"), wd)
INFO(f"查询结果为:{notify_text}")
CHECK_POINT("查询结果正确", notify_text in function_name)
\ No newline at end of file
......@@ -72,7 +72,7 @@ class Function_Edit_000x:
sleep(2)
STEP(5, "检查修改结果")
notify_text = get_notify_text(wd, "//p[@class='el-message__content']", "Function_Manage", "Function_Edit",
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"), "Function_Manage", "Function_Edit",
f"{name}检查提示信息")
INFO(f"修改结果为:{notify_text}")
CHECK_POINT("修改结果检查", notify_text == check_text)
......
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():
wd = GSTORE['wd']
admin_login()
enter_the_backend()
INFO("打开会议室管理下拉菜单")
safe_click((By.XPATH, "//div[@class='el-submenu__title']//span[contains(text(),'会议室管理')]"), wd)
sleep(1)
INFO("进入区域管理模块")
safe_click((By.XPATH, "//li[contains(text(),'区域管理')]"), wd)
sleep(1)
\ No newline at end of file
from time import sleep
from hytest import *
# 获取当前脚本的绝对路径
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 *
# 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建CSV文件的绝对路径
csv_file_path = os.path.join(current_dir, '../../../测试数据/会议室管理/区域管理模块/区域删除.csv')
class Area_Delete_000x:
"""
执行指令:
1.cd 预定系统
2.hytest --test 区域删除_00*
"""
ddt_cases = read_csv_data(csv_file_path)
def teststeps(self):
"""
执行测试步骤以区域新增功能。
本函数根据点击【新增】按钮,增加区域,并检查新增后的提示信息是否与预期相符。
"""
# 初始化通知文本为空字符串
notify_text = ""
# 从全局存储中获取webdriver实例
wd = GSTORE['wd']
# 从self.para中解构出区域名称和检查文本
name = self.name
del_type, check_text = self.para
# 根据del_type的值,执行不同的测试步骤
if del_type == "删除子区域":
# 步骤1:点击子区域的【删除】按钮
STEP(1, f"点击子区域的【删除】按钮")
safe_click((By.XPATH, "(//span[contains(text(),'删除')])[3]"), wd)
sleep(1)
# 步骤2:检查弹窗内容
STEP(2, f"检查弹窗内容")
notify_text = elment_get_text((By.XPATH, "//p[contains(text(),'是否要删除此区域?')]"), wd)
INFO(f"弹窗内容:{notify_text}")
CHECK_POINT("弹窗内容是否正确", notify_text == "是否要删除此区域?")
# 步骤3:点击【确定】按钮
STEP(3, f"点击【确定】按钮")
safe_click((By.XPATH, "(//span[contains(text(),'确定')])[5]"), wd)
sleep(1)
# 步骤4:检查删除后的提示信息
STEP(4, f"检查删除后的提示信息")
notify_text = get_notify_text(wd, (By.XPATH, "//p[@class='el-message__content']"), "Area_Manage",
"Area_Del", f"{name}_检查子区域删除提示信息")
INFO(f"删除后的提示信息:{notify_text}")
CHECK_POINT("删除后的提示信息是否正确", notify_text == check_text)
elif del_type == "删除父区域":
# 步骤1:点击父区域的【删除】按钮
STEP(1, f"点击父区域的【删除】按钮")
safe_click((By.XPATH, "(//span[contains(text(),'删除')])[1]"), wd)
sleep(1)
# 步骤2:检查弹窗内容
STEP(2, f"检查弹窗内容")
notify_text = elment_get_text((By.XPATH, "//p[contains(text(),'是否要删除此区域?')]"), wd)
INFO(f"弹窗内容:{notify_text}")
CHECK_POINT("弹窗内容是否正确", notify_text == "是否要删除此区域?")
# 步骤3:点击【确定】按钮
STEP(3, f"点击【确定】按钮")
safe_click((By.XPATH, "(//span[contains(text(),'确定')])[5]"), wd)
sleep(1)
# 步骤4:检查父区域删除后的提示信息
STEP(4, f"检查父区域删除后的提示信息")
notify_text = get_notify_text(wd, (By.XPATH, "//p[@class='el-message__content']"), "Area_Manage",
"Area_Del", f"{name}_检查父区域删除提示信息")
INFO(f"删除后的提示信息:{notify_text}")
CHECK_POINT("删除后的提示信息是否正确", notify_text == check_text)
\ No newline at end of file
from time import sleep
from hytest import *
# 获取当前脚本的绝对路径
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 *
# 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建CSV文件的绝对路径
csv_file_path = os.path.join(current_dir, '../../../测试数据/会议室管理/区域管理模块/区域新增.csv')
class Area_Add_000x:
"""
执行指令:
1.cd 预定系统
2.hytest --test 区域新增_00*
"""
ddt_cases = read_csv_data(csv_file_path)
def teststeps(self):
"""
执行测试步骤以区域新增功能。
本函数根据点击【新增】按钮,增加区域,并检查新增后的提示信息是否与预期相符。
"""
# 初始化通知文本为空字符串
notify_text = ""
# 从全局存储中获取webdriver实例
wd = GSTORE['wd']
# 从self.para中解构出区域名称和检查文本
name = self.name
area_name, check_text = self.para
# 步骤1:点击父级【添加】按钮
STEP(1, f"点击父级【添加】按钮")
safe_click((By.XPATH, "//span[contains(text(),'添 加')]"), wd)
sleep(2)
# 获取并检查父级区域新增提示信息
notify_text = get_notify_text(wd, (By.XPATH, "//p[@class='el-message__content']"), "Area_Manage", "Area_Add",
f"{name}_检查父级区域新增提示信息")
INFO(f"获取到父级区域新增提示文本:{notify_text}")
CHECK_POINT("新增提示文本是否与预期相符", notify_text == check_text)
# 步骤2:检查区域新增的默认名称
STEP(2, f"检查区域新增的默认名称")
sleep(1)
notify_text = elment_get_text((By.XPATH, "//span[contains(text(),'默认区域名称')]"), wd)
INFO(f"获取到新增区域的名称:{notify_text}")
CHECK_POINT("新增区域的默认名称是否与预期相符", area_name in notify_text)
# 步骤3和4:对子级区域重复上述步骤
for i in range(3, 5):
STEP(i, f"点击子级【添加】按钮")
safe_click((By.XPATH,
"//button[@class='el-button el-button--primary el-button--mini']//span[contains(text(),'添 加')]"),
wd)
sleep(2)
# 获取并检查子级区域新增提示信息
notify_text = get_notify_text(wd, (By.XPATH, "//p[@class='el-message__content']"), "Area_Manage",
"Area_Add",
f"{name}_检查子级区域新增提示信息")
INFO(f"获取到子级区域新增提示文本:{notify_text}")
CHECK_POINT("新增提示文本是否与预期相符", notify_text == check_text)
STEP(i + 1, f"检查子级区域新增的默认名称")
notify_text = elment_get_text((By.XPATH,
"//div[@role='group']//span[contains(text(),'默认区域名称')]"),
wd)
INFO(f"获取到新增区域的名称:{notify_text}")
CHECK_POINT("新增区域的默认名称是否与预期相符", area_name in notify_text)
\ No newline at end of file
No preview for this file type
......@@ -71,7 +71,7 @@ class Login_00x:
INFO(f"Alert text: {notify_text}")
else:
try:
notify_text = get_notify_text(wd, "//p[@class='el-message__content']",'Login','Login_Pwd', f"{name}_检查登录失败提示信息")
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"),'Login','Login_Pwd', f"{name}_检查登录失败提示信息")
INFO(f"Alert text: {notify_text}")
except Exception as e:
INFO(f"Exception occurred: {e}")
......
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -58,7 +58,7 @@ class Main_User_Manage_0001:
safe_click((By.XPATH, "//div[@aria-label='添加用户']//span[contains(text(),'确定')]"), wd)
sleep(2)
notify_text = get_notify_text(wd, "//p[@class='el-message__content']",'User_Manage', 'User_Main', '用户管理主流程-用户新增')
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"),'User_Manage', 'User_Main', '用户管理主流程-用户新增')
# 检查点:验证提示信息是否与预期相符
CHECK_POINT('弹出提示', notify_text == "添加成功")
......@@ -75,7 +75,7 @@ class Main_User_Manage_0001:
safe_click((By.XPATH, "//input[@value='登 录']"),wd)
sleep(2)
notify_text = get_notify_text(wd, "//p[@class='el-message__content']",'User_Manage', 'User_Main', '用户管理主流程-用户首次登录')
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"),'User_Manage', 'User_Main', '用户管理主流程-用户首次登录')
# 检查点:验证提示信息是否与预期相符
INFO(f"首次登录提示:{notify_text}")
CHECK_POINT('弹出提示', notify_text == "首次登录,请修改密码")
......@@ -89,7 +89,7 @@ class Main_User_Manage_0001:
safe_click((By.XPATH, "//span[contains(text(),'确定')]"),wd)
sleep(2)
notify_text = get_notify_text(wd, "//p[@class='el-message__content']",'User_Manage', 'User_Main', '用户管理主流程-用户密码修改')
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"),'User_Manage', 'User_Main', '用户管理主流程-用户密码修改')
# 检查点:验证提示信息是否与预期相符
INFO(f"首次登录修改密码提示:{notify_text}")
CHECK_POINT('弹出提示', notify_text == "修改成功,请重新登录")
......
......@@ -73,11 +73,11 @@ class User_Chanage_Pwd_000x:
sleep(2)
STEP(5, '检查提示信息')
if new_password == check_password:
notify_text = get_notify_text(wd, "//p[@class='el-message__content']", 'User_Manage',
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"), 'User_Manage',
'User_Chanage_Pwd',
f'{name}检查提示信息')
else:
notify_text = get_notify_text(wd, "//div[@class='el-message el-message--error']", 'User_Manage',
notify_text = get_notify_text(wd, (By.XPATH,"//div[@class='el-message el-message--error']"), 'User_Manage',
'User_Chanage_Pwd',
f'{name}检查提示信息')
......@@ -92,7 +92,7 @@ class User_Chanage_Pwd_000x:
safe_send_keys((By.XPATH, "//input[@placeholder='确认密码']"), check_password, wd)
sleep(2)
STEP(4, '检查提示信息')
notify_text = get_notify_text(wd, "//div[@class='el-message el-message--error']", 'User_Manage',
notify_text = get_notify_text(wd, (By.XPATH,"//div[@class='el-message el-message--error']"), 'User_Manage',
'User_Chanage_Pwd',
f'{name}检查提示信息')
INFO(f'校验修改密码提示信息:{notify_text}')
......
......@@ -79,7 +79,7 @@ class Add_User_00x:
safe_click((By.XPATH, "//div[@aria-label='添加用户']//span[contains(text(),'确定')]"), wd)
sleep(2)
notify_text = get_notify_text(wd,"//p[@class='el-message__content']","User_Manage","User_Add",f"{name}_检查提示信息")
notify_text = get_notify_text(wd,(By.XPATH,"//p[@class='el-message__content']"),"User_Manage","User_Add",f"{name}_检查提示信息")
#输出提示信息
INFO(f"Alert text: {notify_text}")
......
......@@ -66,7 +66,7 @@ class User_Status_000x:
sleep(2)
STEP(4, '检查提示信息')
notify_text = get_notify_text(wd, "//p[@class='el-message__content']", 'User_Manage', 'User_Status',
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"), 'User_Manage', 'User_Status',
f'{name}检查提示信息')
INFO(f'校验停用用户提示信息:{notify_text}')
CHECK_POINT(f'校验{status_type}用户提示信息', notify_text == check_text)
......@@ -86,7 +86,7 @@ class User_Status_000x:
safe_send_keys((By.XPATH, "//input[@placeholder='请输入图形验证码']"), 'csba', wd)
safe_click((By.XPATH, "//input[@value='登 录']"), wd)
sleep(2)
notify_text = get_notify_text(wd, "//div[@role='alert']", 'User_Manage', 'User_Status',
notify_text = get_notify_text(wd, (By.XPATH,"//div[@role='alert']"), 'User_Manage', 'User_Status',
f'{name}检查登录提示信息')
INFO(f'校验登录提示信息:{notify_text}')
CHECK_POINT('校验登录提示信息', notify_text == '用户被停用')
......
......@@ -82,6 +82,6 @@ class User_Edit_000x:
# 检查操作后的提示信息
STEP(4, '检查提示信息')
notify_text = get_notify_text(wd, "//p[@class='el-message__content']", 'User_Manage', 'User_Chanage_Pwd',
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"), 'User_Manage', 'User_Chanage_Pwd',
f'{name}检查提示信息')
CHECK_POINT('校验编辑用户提示信息', notify_text == check_text)
\ No newline at end of file
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -37,7 +37,7 @@ class Main_Department_Manage_000x:
safe_click((By.XPATH, "//button[@class='el-button el-button--primary el-button--medium']"), wd)
sleep(1)
# 获取新增后的通知文本
notify_text = get_notify_text(wd, "//p[@class='el-message__content']","Department_Manage", "Department_Main", f"{name}部门新增")
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"),"Department_Manage", "Department_Main", f"{name}部门新增")
# 检查新增提示文本是否与预期相符
INFO(f"部门新增提示文本:{notify_text}")
CHECK_POINT("部门新增提示文本", notify_text == check_add_text)
......@@ -64,7 +64,7 @@ class Main_Department_Manage_000x:
safe_click((By.XPATH, "//div[@aria-label='编 辑']//span[contains(text(),'确定')]"), wd)
sleep(1)
# 获取编辑后的通知文本
notify_text = get_notify_text(wd, "//p[@class='el-message__content']","Department_Manage", "Department_Main", f"{name}部门编辑")
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"),"Department_Manage", "Department_Main", f"{name}部门编辑")
INFO(f"部门编辑提示文本:{notify_text}")
# 检查编辑提示文本是否与预期相符
CHECK_POINT("部门编辑提示文本", notify_text == check_edit_text)
......@@ -95,7 +95,7 @@ class Main_Department_Manage_000x:
wd)
sleep(1)
# 获取删除后的通知文本
notify_text = get_notify_text(wd, "//p[@class='el-message__content']","Department_Manage", "Department_Main", f"{name}部门删除")
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"),"Department_Manage", "Department_Main", f"{name}部门删除")
INFO(f"部门删除提示文本:{notify_text}")
# 检查删除提示文本是否与预期相符
CHECK_POINT("部门删除提示文本", notify_text == check_del_text)
\ No newline at end of file
......@@ -40,7 +40,7 @@ class Department_Add_000x:
sleep(1)
STEP(2, "检查父级部门新增提示文本信息")
# 获取新增后的通知文本
notify_text = get_notify_text(wd, "//p[@class='el-message__content']","Department_Manage", "Department_Delete", f"{name}部门新增")
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"),"Department_Manage", "Department_Delete", f"{name}部门新增")
# 检查新增提示文本是否与预期相符
INFO(f"父级部门新增提示文本:{notify_text}")
CHECK_POINT("父级部门新增提示文本", notify_text == check_add_text)
......@@ -50,7 +50,7 @@ class Department_Add_000x:
safe_click((By.XPATH, "(//span[contains(text(),'删除')])[4]"),wd)
safe_click((By.XPATH, "(//span[contains(text(),'确定')])[4]"),wd)
sleep(2)
notify_text = get_notify_text(wd, "//p[@class='el-message__content']","Department_Manage", "Department_Delete", f"{name}部门单个删除")
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"),"Department_Manage", "Department_Delete", f"{name}部门单个删除")
INFO(f"单个部门删除提示文本:{notify_text}")
CHECK_POINT("单个部门删除提示文本", notify_text == check_del_text)
sleep(2)
......@@ -66,7 +66,7 @@ class Department_Add_000x:
(By.XPATH, "(//span[contains(text(),'添 加')])[1]"),
wd)
sleep(2)
notify_text = get_notify_text(wd, "//p[@class='el-message__content']","Department_Manage", "Department_Delete", f"{name}第{i+1}个部门新增")
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"),"Department_Manage", "Department_Delete", f"{name}第{i+1}个部门新增")
CHECK_POINT(f"新增第{i+1}个部门提示文本", notify_text == check_add_text)
STEP(2, "检查勾选多个部门")
......@@ -78,7 +78,7 @@ class Department_Add_000x:
safe_click((By.XPATH, "(//span[contains(text(),'批量删除')])[1]"),wd)
safe_click((By.XPATH, "(//span[contains(text(),'确定')])[4]"),wd)
sleep(2)
notify_text = get_notify_text(wd, "//p[@class='el-message__content']","Department_Manage", "Department_Delete", f"{name}部门批量删除")
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"),"Department_Manage", "Department_Delete", f"{name}部门批量删除")
INFO(f"批量部门删除提示文本:{notify_text}")
CHECK_POINT("批量部门删除提示文本", notify_text == check_del_text)
......@@ -88,5 +88,5 @@ class Department_Add_000x:
safe_click((By.XPATH, "//button[@type='button']//span[contains(text(),'批量删除')]"), wd)
sleep(2)
STEP(2, "检查提示信息")
notify_text = get_notify_text(wd, "//p[@class='el-message__content']","Department_Manage", "Department_Delete", f"{name}部门不勾选批量删除")
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"),"Department_Manage", "Department_Delete", f"{name}部门不勾选批量删除")
CHECK_POINT("不勾选部门进行批量删除提示文本", notify_text == check_del_text)
\ No newline at end of file
......@@ -41,7 +41,7 @@ class Department_Add_000x:
sleep(1)
STEP(2, "检查父级部门新增提示文本信息")
# 获取新增后的通知文本
notify_text = get_notify_text(wd, "//p[@class='el-message__content']","Department_Manage", "Department_Add", f"{name}部门新增")
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"),"Department_Manage", "Department_Add", f"{name}部门新增")
# 检查新增提示文本是否与预期相符
INFO(f"父级部门新增提示文本:{notify_text}")
CHECK_POINT("父级部门新增提示文本", notify_text == check_add_text)
......@@ -52,7 +52,7 @@ class Department_Add_000x:
sleep(1)
STEP(2, "检查二级子部门新增提示文本信息")
# 获取新增后的通知文本
notify_text = get_notify_text(wd, "//p[@class='el-message__content']","Department_Manage", "Department_Add", f"{name}部门新增")
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"),"Department_Manage", "Department_Add", f"{name}部门新增")
# 检查新增提示文本是否与预期相符
INFO(f"二级子部门新增提示文本:{notify_text}")
CHECK_POINT("二级子部门新增提示文本", notify_text == check_add_text)
\ No newline at end of file
......@@ -40,7 +40,7 @@ class Department_Query_000x:
safe_click((By.XPATH, "(//span[contains(text(),'添 加')])[1]"), wd)
sleep(2)
# 获取新增后的通知文本并与预期比较
notify_text = get_notify_text(wd, "//p[@class='el-message__content']","Department_Manage", "Department_Query", f"{name}部门新增")
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"),"Department_Manage", "Department_Query", f"{name}部门新增")
INFO(f"部门新增提示:{notify_text}")
CHECK_POINT(f"新增部门提示文本", notify_text == "添加成功")
......@@ -60,7 +60,7 @@ class Department_Query_000x:
STEP(4, "检查部门编辑提示信息")
sleep(2)
# 获取编辑后的通知文本并与预期比较
notify_text = get_notify_text(wd, "//p[@class='el-message__content']","Department_Manage", "Department_Query", f"{name}部门编辑")
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"),"Department_Manage", "Department_Query", f"{name}部门编辑")
INFO(f"部门编辑提示:{notify_text}")
CHECK_POINT("检查部门编辑提示", notify_text == "修改成功")
......@@ -100,6 +100,6 @@ class Department_Query_000x:
safe_click((By.XPATH, "(//span[contains(text(),'确定')])[4]"), wd)
sleep(2)
# 获取删除后的通知文本并与预期比较
notify_text = get_notify_text(wd, "//p[@class='el-message__content']","Department_Manage", "Department_Query", f"{name}删除部门数据")
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"),"Department_Manage", "Department_Query", f"{name}删除部门数据")
CHECK_POINT("部门删除提示", notify_text == "删除成功")
INFO(f"检查CPU使用率:{get_cpu_usage()}")
\ No newline at end of file
......@@ -94,7 +94,7 @@ class Department_Edit_000x:
safe_click((By.XPATH, "//div[@aria-label='编 辑']//span[contains(text(),'确定')]"), wd)
sleep(1)
# 获取并检查编辑部门后的提示信息
notify_text = get_notify_text(wd, "//p[@class='el-message__content']","Department_Manage", "Department_Edit", name)
notify_text = get_notify_text(wd, (By.XPATH,"//p[@class='el-message__content']"),"Department_Manage", "Department_Edit", name)
INFO(f"部门编辑提示:{notify_text}")
CHECK_POINT("检查部门编辑提示", notify_text == check_text)
......
此差异已折叠。
......@@ -9,16 +9,43 @@
== cases\会议室管理\功能管理\__st__.py
== cases\会议室管理\功能管理\功能删除.py
CSV文件已读取
** no cases in this file , skip it.
== cases\会议室管理\功能管理\功能新增.py
CSV文件已读取
** no cases in this file , skip it.
== cases\会议室管理\功能管理\功能查询.py
CSV文件已读取
** no cases in this file , skip it.
== cases\会议室管理\功能管理\功能编辑.py
CSV文件已读取
** no cases in this file , skip it.
== cases\会议室管理\区域管理\__st__.py
== cases\会议室管理\区域管理\区域删除.py
CSV文件已读取
== cases\会议室管理\区域管理\区域新增.py
CSV文件已读取
** no cases in this file , skip it.
== cases\测试\test.py
......@@ -128,11 +155,11 @@ CSV文件已读取
=== [ 执行测试用例 ] ===
预备执行用例数量 : 22
预备执行用例数量 : 2
========= 测试开始 : 20241113_174820 =========
========= 测试开始 : 20241114_114724 =========
......@@ -150,214 +177,23 @@ CSV文件已读取
'----------' SSL证书警告处理完成 '----------'
>>> cases\会议室管理\功能管理\
>>> cases\会议室管理\区域管理\
[ suite setup ] cases\会议室管理\功能管理\
[ suite setup ] cases\会议室管理\区域管理\
输入用户名:admin@ZDH
输入密码:Ubains@4321
输入验证码:csba
点击登录按钮
进入后台
打开会议室管理下拉菜单
进入功能管理模块
>>> cases\会议室管理\功能管理\功能编辑.py
* 功能编辑_001 - 2024-11-13 17:48:25
[ case execution steps ]
-- 第 1 步 -- 输入功能名称:功能编辑专用,进行搜索
搜索结果为:功能编辑专用
** 检查点 ** 搜索结果与预期相符 ----> 通过
-- 第 2 步 -- 点击【编辑】按钮
当前弹窗标题为:修改功能
** 检查点 ** 弹窗标题与预期相符 ----> 通过
-- 第 3 步 -- 输入新的功能名称、功能描述
输入功能名称:,输入功能描述:功能编辑专用
-- 第 4 步 -- 选择功能类型
选择功能类型:普通
-- 第 4 步 -- 点击【确定】按钮
-- 第 5 步 -- 检查修改结果
picture imgs/Function_Manage/Function_Add/功能编辑_001检查提示信息20241113174830562391.png
修改结果为:请输入功能名称
** 检查点 ** 修改结果检查 ----> 通过
check_text不等于修改成功
PASS
* 功能编辑_002 - 2024-11-13 17:48:30
[ case execution steps ]
-- 第 1 步 -- 输入功能名称:功能编辑专用,进行搜索
搜索结果为:功能编辑专用
** 检查点 ** 搜索结果与预期相符 ----> 通过
-- 第 2 步 -- 点击【编辑】按钮
当前弹窗标题为:修改功能
** 检查点 ** 弹窗标题与预期相符 ----> 通过
-- 第 3 步 -- 输入新的功能名称、功能描述
输入功能名称:功能编辑专用功能编辑专用功能编辑专用,输入功能描述:功能编辑专用
-- 第 4 步 -- 选择功能类型
选择功能类型:普通
-- 第 4 步 -- 点击【确定】按钮
-- 第 5 步 -- 检查修改结果
picture imgs/Function_Manage/Function_Add/功能编辑_002检查提示信息20241113174835845676.png
修改结果为:修改成功
** 检查点 ** 修改结果检查 ----> 通过
PASS
* 功能编辑_003 - 2024-11-13 17:48:35
[ case execution steps ]
-- 第 1 步 -- 输入功能名称:功能编辑专用功能编辑专用功能编辑专用,进行搜索
搜索结果为:功能编辑专用功能编辑专用功能编辑专用
** 检查点 ** 搜索结果与预期相符 ----> 通过
-- 第 2 步 -- 点击【编辑】按钮
当前弹窗标题为:修改功能
** 检查点 ** 弹窗标题与预期相符 ----> 通过
-- 第 3 步 -- 输入新的功能名称、功能描述
输入功能名称:功能编辑专用AB,输入功能描述:功能编辑专用
-- 第 4 步 -- 选择功能类型
选择功能类型:普通
-- 第 4 步 -- 点击【确定】按钮
-- 第 5 步 -- 检查修改结果
picture imgs/Function_Manage/Function_Add/功能编辑_003检查提示信息20241113174841093348.png
修改结果为:修改成功
** 检查点 ** 修改结果检查 ----> 通过
PASS
* 功能编辑_004 - 2024-11-13 17:48:41
[ case execution steps ]
-- 第 1 步 -- 输入功能名称:功能编辑专用AB,进行搜索
搜索结果为:功能编辑专用AB
** 检查点 ** 搜索结果与预期相符 ----> 通过
-- 第 2 步 -- 点击【编辑】按钮
当前弹窗标题为:修改功能
** 检查点 ** 弹窗标题与预期相符 ----> 通过
-- 第 3 步 -- 输入新的功能名称、功能描述
输入功能名称:功能编辑专用12,输入功能描述:功能编辑专用
-- 第 4 步 -- 选择功能类型
选择功能类型:普通
-- 第 4 步 -- 点击【确定】按钮
-- 第 5 步 -- 检查修改结果
picture imgs/Function_Manage/Function_Add/功能编辑_004检查提示信息20241113174846325058.png
修改结果为:修改成功
** 检查点 ** 修改结果检查 ----> 通过
PASS
* 功能编辑_005 - 2024-11-13 17:48:46
[ case execution steps ]
-- 第 1 步 -- 输入功能名称:功能编辑专用12,进行搜索
搜索结果为:功能编辑专用12
** 检查点 ** 搜索结果与预期相符 ----> 通过
-- 第 2 步 -- 点击【编辑】按钮
当前弹窗标题为:修改功能
** 检查点 ** 弹窗标题与预期相符 ----> 通过
-- 第 3 步 -- 输入新的功能名称、功能描述
输入功能名称:功能编辑专用@@,输入功能描述:功能编辑专用
-- 第 4 步 -- 选择功能类型
选择功能类型:普通
-- 第 4 步 -- 点击【确定】按钮
-- 第 5 步 -- 检查修改结果
picture imgs/Function_Manage/Function_Add/功能编辑_005检查提示信息20241113174851513346.png
修改结果为:修改成功
进入区域管理模块
** 检查点 ** 修改结果检查 ----> 通过
PASS
>>> cases\会议室管理\区域管理\区域删除.py
* 功能编辑_006 - 2024-11-13 17:48:51
* 区域删除_001 - 2024-11-14 11:47:30
[ case execution steps ]
-- 第 1 步 -- 输入功能名称:测试功能@@,进行搜索
-- 第 1 步 -- 点击子区域的【删除】按钮
此差异已折叠。
name,function_name,del_type,check_text
功能删除_001,功能测试1,单个删除,删除成功
功能删除_002,测试功能,单个删除,删除成功
功能删除_003,功能测试,单个取消删除,已取消
功能删除_004,功能测试,批量取消删除,已取消
功能删除_005,功能测试,不勾选数据,请先选择功能
功能删除_006,测试功能测试功能测试功能测试功能测试功能,单个删除,删除成功
功能删除_007,测试功能AB,单个删除,删除成功
功能删除_008,测试功能12,单个删除,删除成功
功能删除_009,测试功能@@,单个删除,删除成功
功能删除_010,功能测试12,单个删除,删除成功
功能删除_011,###,单个删除,删除成功
功能删除_012,功能测试,批量删除,删除成功
\ No newline at end of file
name,function_name,query_type
功能查询_001,功能查询专用,精确查询
功能查询_002,功能查询,模糊查询
功能查询_003,12,错误查询
功能查询_004,功能查询专用,分页查询
\ No newline at end of file
name,del_type,check_text
区域删除_001,删除子区域,删除成功
区域删除_002,删除父区域,删除成功
\ No newline at end of file
name,area_name,check_text
区域新增_001,默认区域名称,添加成功
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论