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

处理会议测试用例所有模块的JSON数据格式以及代码处理,规范化类名。

上级 93803d12
......@@ -268,4 +268,5 @@
- 实现通过JSON数据中对应的name值来区分测试用例数量。
- 补充write_xlsx_data函数用以将测试结果与日志截图写入到xlsx测试用例文件中。调试write_xlsx_data函数与统一平台的窗口切换关闭。
72. 2025-03-24
- 优化write_xlsx_data函数实现表格自动填充测试结果和日志截图功能。
\ No newline at end of file
- 优化write_xlsx_data函数实现表格自动填充测试结果和日志截图功能。
- 处理会议测试用例所有模块的JSON数据格式以及代码处理,规范化类名。
\ No newline at end of file
......@@ -23,33 +23,36 @@ class AIMeeting:
1.cd 预定系统
2.hytest --report_title AI创会测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-AI创会测试
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='AI创会')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='AI创会', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self):
wd = GSTORE['wd']
ddt_cases = read_xlsx_data(xlsx_file_path, "AI创会")
# 遍历 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')
# 将会议名称赋值,后面调用函数结束会议
message_name = element_value
# 判断页面功能类型
if step.get("page") == "AIMeeting":
if 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 == "click":
safe_click((locator_type, locator_value), wd)
sleep(2)
\ No newline at end of file
name = self.name
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
# 判断页面功能类型
if page_type == "AIMeeting":
if 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 == "click":
safe_click((locator_type, locator_value), wd)
sleep(2)
\ No newline at end of file
......@@ -16,63 +16,69 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class SMCMeeting_00x:
class SMCMeeting:
tags = ['新-会控SMC测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
2.hytest --report_title 会控SMC测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会控SMC测试
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会控-SMC')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会控-SMC', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self):
wd = GSTORE['wd']
ddt_cases = read_xlsx_data(xlsx_file_path, "会控-SMC")
name = self.name
# 调用会议创建函数
meeting_message("SMC会议室", "SMC3.0", "SMC3.0", "标准版", wd)
sleep(1)
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
# 调用会议创建函数
meeting_message("SMC会议室", "SMC3.0", "SMC3.0", "标准版", wd)
sleep(1)
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')
# 将会议名称赋值,后面调用函数结束会议
message_name = element_value
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
# 将会议名称赋值,后面调用函数结束会议
message_name = element_value
# 判断页面功能类型
if step.get("page") == "MeetingControl_SMC":
if element_type == "input":
# 查询会议
safe_send_keys((locator_type, locator_value), element_value, wd)
send_keyboard((locator_type, locator_value), wd)
sleep(2)
# 提前开始会议
safe_click((By.XPATH, "//span[contains(text(),'更多操作')]"), wd)
sleep(1)
safe_click((By.XPATH, "//li[contains(text(),'会议状态')]"), wd)
sleep(1)
safe_click((By.XPATH, "//div[@slot='footer']//span[contains(text(),'确定')]"), wd)
sleep(2)
# 判断页面功能类型
if page_type == "MeetingControl_SMC":
if element_type == "input":
# 查询会议
safe_send_keys((locator_type, locator_value), element_value, wd)
send_keyboard((locator_type, locator_value), wd)
sleep(2)
# 提前开始会议
safe_click((By.XPATH, "//span[contains(text(),'更多操作')]"), wd)
sleep(1)
safe_click((By.XPATH, "//li[contains(text(),'会议状态')]"), wd)
sleep(1)
safe_click((By.XPATH, "//div[@slot='footer']//span[contains(text(),'确定')]"), wd)
sleep(2)
elif element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(2)
elif element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(2)
elif element_type == "getText":
# 切换到新窗口
wd.switch_to.window(wd.window_handles[1])
notify_text = elment_get_text((locator_type, locator_value), wd)
INFO(f"当前页面标题为:{notify_text}")
CHECK_POINT(f"当前页面标题为:{notify_text}", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50")
# 切换窗口
wd.switch_to.window(wd.window_handles[0])
wd.refresh()
# 调用会议结束函数,传入会议名称
INFO(f"调用message_satus_control函数结束{message_name}名称的会议")
message_satus_control(message_name, "会控", "提前结束", wd)
\ No newline at end of file
elif element_type == "getText":
# 切换到新窗口
wd.switch_to.window(wd.window_handles[1])
notify_text = elment_get_text((locator_type, locator_value), wd)
INFO(f"当前页面标题为:{notify_text}")
CHECK_POINT(f"当前页面标题为:{notify_text}", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50")
# 切换窗口
wd.switch_to.window(wd.window_handles[0])
wd.refresh()
# 调用会议结束函数,传入会议名称
INFO(f"调用message_satus_control函数结束{message_name}名称的会议")
message_satus_control(message_name, "会控", "提前结束", wd)
\ No newline at end of file
......@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class TxcentMeeting_00x:
class TxcentMeeting:
tags = ['新-会控腾讯测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
2.hytest --report_title 腾讯会控测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会控腾讯测试
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会控-腾讯会议')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会控-腾讯会议', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self):
"""
......@@ -30,53 +33,57 @@ class TxcentMeeting_00x:
"""
# 从全局存储中获取webdriver对象
wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据
ddt_cases = read_xlsx_data(xlsx_file_path, "会控-腾讯会议")
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
# 调用会议创建函数
meeting_message("腾讯会议室", "腾讯会议", "腾讯会议","标准版", wd)
sleep(1)
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')
# 将会议名称赋值,后面调用函数结束会议
message_name = element_value
name = self.name
# 判断页面功能类型
if step.get("page") == "MeetingControl_Txcent":
if element_type == "input":
# 查询会议
safe_send_keys((locator_type, locator_value), element_value, wd)
send_keyboard((locator_type, locator_value), wd)
sleep(2)
# 提前开始会议
safe_click((By.XPATH, "//span[contains(text(),'更多操作')]"), wd)
sleep(1)
safe_click((By.XPATH, "//li[contains(text(),'会议状态')]"), wd)
sleep(1)
safe_click((By.XPATH, "//div[@slot='footer']//span[contains(text(),'确定')]"), wd)
sleep(2)
# 调用会议创建函数
meeting_message("腾讯会议室", "腾讯会议", "腾讯会议", "标准版", wd)
sleep(1)
elif element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(2)
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
# 将会议名称赋值,后面调用函数结束会议
message_name = element_value
elif element_type == "getText":
# 切换到新窗口
wd.switch_to.window(wd.window_handles[1])
notify_text = elment_get_text((locator_type,locator_value), wd)
INFO(f"当前页面标题为:{notify_text}")
CHECK_POINT(f"当前页面标题为:{notify_text}", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50")
# 切换窗口
wd.switch_to.window(wd.window_handles[0])
wd.refresh()
# 调用会议结束函数,传入会议名称
INFO(f"调用message_satus_control函数结束{message_name}名称的会议")
message_satus_control(message_name, "会控", "提前结束", wd)
\ No newline at end of file
# 判断页面功能类型
if page_type == "MeetingControl_Txcent":
if element_type == "input":
# 查询会议
safe_send_keys((locator_type, locator_value), element_value, wd)
send_keyboard((locator_type, locator_value), wd)
sleep(2)
# 提前开始会议
safe_click((By.XPATH, "//span[contains(text(),'更多操作')]"), wd)
sleep(1)
safe_click((By.XPATH, "//li[contains(text(),'会议状态')]"), wd)
sleep(1)
safe_click((By.XPATH, "//div[@slot='footer']//span[contains(text(),'确定')]"), wd)
sleep(2)
elif element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(2)
elif element_type == "getText":
# 切换到新窗口
wd.switch_to.window(wd.window_handles[1])
notify_text = elment_get_text((locator_type, locator_value), wd)
INFO(f"当前页面标题为:{notify_text}")
CHECK_POINT(f"当前页面标题为:{notify_text}", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50")
# 切换窗口
wd.switch_to.window(wd.window_handles[0])
wd.refresh()
# 调用会议结束函数,传入会议名称
INFO(f"调用message_satus_control函数结束{message_name}名称的会议")
message_satus_control(message_name, "会控", "提前结束", wd)
\ No newline at end of file
......@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class EditMessage_00x:
class EditMessage:
tags = ['新-会议修改测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
2.hytest --report_title 会议修改测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议修改测试
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会议修改')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会议修改', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self):
"""
......@@ -30,54 +33,58 @@ class EditMessage_00x:
"""
# 从全局存储中获取webdriver对象
wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据
ddt_cases = read_xlsx_data(xlsx_file_path, "会议修改")
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
# 调用会议创建函数
meeting_message("预约会议室", "普通会议", "普通会议","标准版", wd)
# 搜索会议
safe_send_keys((By.XPATH, "//input[@placeholder='输入关键字搜索']"), "普通会议", wd)
send_keyboard((By.XPATH, "//input[@placeholder='输入关键字搜索']"), wd)
sleep(1)
# 点击会议修改按钮
safe_click((By.XPATH, "//button[@type='button']//span[contains(text(),'修改会议')]"), wd)
name = self.name
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')
# 将会议名称赋值,后面调用函数结束会议
message_name = element_value
# 调用会议创建函数
meeting_message("预约会议室", "普通会议", "普通会议", "标准版", wd)
# 搜索会议
safe_send_keys((By.XPATH, "//input[@placeholder='输入关键字搜索']"), "普通会议", wd)
send_keyboard((By.XPATH, "//input[@placeholder='输入关键字搜索']"), wd)
sleep(1)
# 点击会议修改按钮
safe_click((By.XPATH, "//button[@type='button']//span[contains(text(),'修改会议')]"), wd)
# 判断页面功能类型
if step.get("page") == "MessageNameTest":
# 这是会议名称字符测试用例
if element_type == "input":
# 输入会议名称
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(1)
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
# 将会议名称赋值,后面调用函数结束会议
message_name = element_value
elif element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(2)
# 判断页面功能类型
if page_type == "MessageNameTest":
# 这是会议名称字符测试用例
if element_type == "input":
# 输入会议名称
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(1)
elif element_type == "getText":
# 搜索会议数据,获取会议列表的会议名称
safe_send_keys((locator_type, locator_value), element_value, wd)
send_keyboard((locator_type, locator_value), wd)
sleep(2)
# 获取提示文本
notify_text = elment_get_text(
(By.CSS_SELECTOR, "tbody tr[class='el-table__row'] td:nth-child(2) div:nth-child(1)"),
wd)
INFO(f"查询已预定列表的会议名称为:{notify_text}")
CHECK_POINT("判断会议是否创建成功", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50")
# 调用会议删除函数
INFO("调用会议删除函数")
del_message(message_name, wd)
\ No newline at end of file
elif element_type == "click":
safe_click((locator_type, locator_value), wd)
safe_click((locator_type, locator_value), wd)
sleep(2)
elif element_type == "getText":
# 搜索会议数据,获取会议列表的会议名称
safe_send_keys((locator_type, locator_value), element_value, wd)
send_keyboard((locator_type, locator_value), wd)
sleep(2)
# 获取提示文本
notify_text = elment_get_text(
(By.CSS_SELECTOR, "tbody tr[class='el-table__row'] td:nth-child(2) div:nth-child(1)"),
wd)
INFO(f"查询已预定列表的会议名称为:{notify_text}")
CHECK_POINT("判断会议是否创建成功", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50")
# 调用会议删除函数
INFO("调用会议删除函数")
del_message(message_name, wd)
\ No newline at end of file
......@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class MeetingMessage_00x:
class MeetingMessage:
tags = ['新-会议创建测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
2.hytest --report_title 会议创建测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议创建测试
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会议创建')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会议创建', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self):
"""
......@@ -30,52 +33,56 @@ class MeetingMessage_00x:
"""
# 从全局存储中获取webdriver对象
wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据
ddt_cases = read_xlsx_data(xlsx_file_path, "会议创建")
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
# 调用进入会议预定界面函数
enter_meeting_booking_page("预约会议室", wd)
sleep(1)
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')
# 将会议名称赋值,后面调用函数结束会议
message_name = element_value
name = self.name
# 调用进入会议预定界面函数
enter_meeting_booking_page("预约会议室", wd)
sleep(1)
# 判断页面功能类型
if step.get("page") == "MessageNameTest":
# 这是会议名称字符测试用例
if element_type == "input":
# 输入会议名称
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(1)
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
elif element_type == "click":
# 点击快速预定按钮
safe_click((locator_type, locator_value), wd)
safe_click((locator_type, locator_value), wd)
sleep(2)
safe_click((By.XPATH, "//button[@type='button']//span[contains(text(),'预定')]"), wd)
sleep(2)
# 将会议名称赋值,后面调用函数结束会议
message_name = element_value
elif element_type == "getText":
# 搜索会议数据,获取会议列表的会议名称
safe_send_keys((locator_type, locator_value), element_value, wd)
send_keyboard((locator_type, locator_value), wd)
sleep(2)
# 获取提示文本
notify_text = elment_get_text(
(By.CSS_SELECTOR, "tbody tr[class='el-table__row'] td:nth-child(2) div:nth-child(1)"),
wd)
INFO(f"查询已预定列表的会议名称为:{notify_text}")
CHECK_POINT("判断会议是否创建成功", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50")
# 调用会议删除函数
INFO("调用会议删除函数")
del_message(message_name, wd)
\ No newline at end of file
# 判断页面功能类型
if page_type == "MessageNameTest":
# 这是会议名称字符测试用例
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)
safe_click((locator_type, locator_value), wd)
sleep(2)
safe_click((By.XPATH, "//button[@type='button']//span[contains(text(),'预定')]"), wd)
sleep(2)
elif element_type == "getText":
# 搜索会议数据,获取会议列表的会议名称
safe_send_keys((locator_type, locator_value), element_value, wd)
send_keyboard((locator_type, locator_value), wd)
sleep(2)
# 获取提示文本
notify_text = elment_get_text(
(By.CSS_SELECTOR, "tbody tr[class='el-table__row'] td:nth-child(2) div:nth-child(1)"),
wd)
INFO(f"查询已预定列表的会议名称为:{notify_text}")
CHECK_POINT("判断会议是否创建成功", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50")
# 调用会议删除函数
INFO("调用会议删除函数")
del_message(message_name, wd)
\ No newline at end of file
......@@ -16,46 +16,54 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class HistoryMessage_00x:
class HistoryMessage:
tags = ['新-会议历史记录测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
2.hytest --report_title 会议历史记录测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议历史记录测试
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会议历史记录')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会议历史记录', columns_to_clear=['测试结果', '测试频次', '日志截图'])
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") == "MessageQuery":
# 这是会议名称字符测试用例
if element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(2)
elif element_type == "click":
# 点击按钮
safe_click((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)
SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
name = self.name
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
# 判断页面功能类型
if page_type == "MessageQuery":
# 这是会议名称字符测试用例
if element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(2)
elif element_type == "click":
# 点击按钮
safe_click((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)
SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
......@@ -23,6 +23,9 @@ class MessageApproval:
1.cd 预定系统
2.hytest --report_title 会议审批测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议审批测试
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会议审批')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会议审批', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self):
"""
......@@ -30,45 +33,52 @@ class MessageApproval:
"""
# 从全局存储中获取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')
name = self.name
# 创建审批会议
meeting_message("审批会议室", "普通会议", "审批测试会议", "标准版", wd)
# 判断页面功能类型
if step.get("page") == "ApprovalInitiate":
# 这是编辑模板测试
if element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(1)
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
elif element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(2)
# 判断页面功能类型
if page_type == "ApprovalInitiate":
# 这是编辑模板测试
if element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(1)
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)
SELENIUM_LOG_SCREEN(wd, "50")
elif element_type == "click":
safe_click((locator_type, locator_value), wd)
safe_click((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("获取文本判断是否正确", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50")
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)
SELENIUM_LOG_SCREEN(wd, "50")
# 取消审批会议数据
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
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)
SELENIUM_LOG_SCREEN(wd, "50")
# 取消审批会议数据
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
......@@ -17,53 +17,59 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class MeetingList_000x:
class MeetingRoomList:
tags = ['新-会议室列表', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
2.hytest --report_title 账号密码登录测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议室列表
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会议室列表')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会议室列表', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self):
wd = GSTORE['wd']
ddt_cases = read_xlsx_data(xlsx_file_path,"会议室列表")
name = self.name
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
for step in case:
print(f"当前步骤: {step}")
if "MeetingRoomToken" in step.get("page"):
# 先赋值
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')
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
if element_type == "input":
# 点击展开筛选界面
STEP(1, "搜索会议室")
safe_send_keys((locator_type, locator_value), element_value, wd)
send_keyboard((locator_type, locator_value), wd)
sleep(2)
# 点击【查询】按钮
safe_click((By.XPATH, "//span[contains(text(),'查询')]"), wd)
sleep(1)
if page_type == "MeetingList_MeetingRoomToken":
if element_type == "input":
# 点击展开筛选界面
STEP(1, "搜索会议室")
safe_send_keys((locator_type, locator_value), element_value, wd)
send_keyboard((locator_type, locator_value), wd)
sleep(2)
# 点击【查询】按钮
safe_click((By.XPATH, "//span[contains(text(),'查询')]"), wd)
sleep(1)
elif element_type == "click":
# 点击会议室,查看提示信息
STEP(2, "点击【会议预约】")
safe_click((locator_type, locator_value), wd)
sleep(2)
# 判断是否为已授权的会议室,如果是,则点击会议预定判断是否进入会议预定界面,否则,点击会议预定,查看提示信息
if "会议" in expented_result:
notify_text = elment_get_text((By.XPATH, "//div[@class='reserve_Title']"), wd)
else:
notify_text = get_notify_text(wd, (By.XPATH, "//p[@class='el-message__content']"),
"MeetingList", "RoomToken", f"未授权会议室点击【会议预定】")
INFO(f"提示信息为:{notify_text}")
# 判断提示信息是否正确
sleep(1)
CHECK_POINT("提示信息是否正确", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
elif element_type == "click":
# 点击会议室,查看提示信息
STEP(2, "点击【会议预约】")
safe_click((locator_type, locator_value), wd)
sleep(2)
# 判断是否为已授权的会议室,如果是,则点击会议预定判断是否进入会议预定界面,否则,点击会议预定,查看提示信息
if "会议" in expented_result:
notify_text = elment_get_text((By.XPATH, "//div[@class='reserve_Title']"), wd)
else:
notify_text = get_notify_text(wd, (By.XPATH, "//p[@class='el-message__content']"),
"MeetingList", "RoomToken", f"未授权会议室点击【会议预定】")
INFO(f"提示信息为:{notify_text}")
# 判断提示信息是否正确
sleep(1)
CHECK_POINT("提示信息是否正确", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
......@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class ConferenceStatistics:
class ConferenceRoomManagement:
tags = ['新-会议室管理测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
2.hytest --report_title 会议室管理测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议室管理测试
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会议室管理')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会议室管理', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self):
"""
......@@ -30,31 +33,34 @@ class ConferenceStatistics:
"""
# 从全局存储中获取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')
name = self.name
# 判断页面功能类型
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)
SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
# 判断页面功能类型
if page_type == "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)
SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
......@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class MessageTemplate_00x:
class MessageTemplate:
tags = ['新-会议模板测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
2.hytest --report_title 会议模板测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议模板测试
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会议模板')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会议模板', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self):
"""
......@@ -30,33 +33,37 @@ class MessageTemplate_00x:
"""
# 从全局存储中获取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')
name = self.name
# 判断页面功能类型
if step.get("page") == "EditTemplate":
# 这是编辑模板测试
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)
SELENIUM_LOG_SCREEN(wd, "50")
# 切换至会议模板模块
safe_click(
(By.XPATH, "//ul[contains(@class,'meeting_list')]//span[contains(text(),'会议模板')]"), wd)
\ No newline at end of file
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
# 判断页面功能类型
if page_type== "EditTemplate":
# 这是编辑模板测试
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)
SELENIUM_LOG_SCREEN(wd, "50")
# 切换至会议模板模块
safe_click(
(By.XPATH, "//ul[contains(@class,'meeting_list')]//span[contains(text(),'会议模板')]"), wd)
\ No newline at end of file
......@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class AndroidInformation:
class InformationDelivery:
tags = ['新-信息发布测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
2.hytest --report_title 信息发布测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-信息发布测试
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='信息发布')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='信息发布', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self):
"""
......@@ -30,30 +33,33 @@ class AndroidInformation:
"""
# 从全局存储中获取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')
name = self.name
# 判断页面功能类型
if step.get("page") == "AndroidInformation":
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("判断当前界面是否正确", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
# 判断页面功能类型
if page_type == "MaterialManagement":
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("判断当前界面是否正确", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
......@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class ConferenceStatistics:
class InformationStatistics:
tags = ['新-信息统计测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
2.hytest --report_title 信息统计测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-信息统计测试
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='信息统计')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='信息统计', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self):
"""
......@@ -30,24 +33,27 @@ class ConferenceStatistics:
"""
# 从全局存储中获取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')
name = self.name
# 判断页面功能类型
if step.get("page") == "ConferenceStatistics":
if element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(1)
SELENIUM_LOG_SCREEN(wd, "50")
elif element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
\ No newline at end of file
for step in self.para:
# 赋值页面page类型
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
# 判断页面功能类型
if page_type == "ConferenceStatistics":
if element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(1)
SELENIUM_LOG_SCREEN(wd, "50")
elif element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
\ No newline at end of file
......@@ -23,6 +23,9 @@ class GlobalConfiguration:
1.cd 预定系统
2.hytest --report_title 全局配置测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-全局配置测试
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='全局配置')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='全局配置', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self):
"""
......@@ -30,25 +33,28 @@ class GlobalConfiguration:
"""
# 从全局存储中获取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')
name = self.name
# 判断页面功能类型
if step.get("page") == "GlobalConfiguration":
if element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(2)
SELENIUM_LOG_SCREEN(wd, "50")
elif element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(2)
\ No newline at end of file
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
# 判断页面功能类型
if page_type == "GlobalConfiguration":
if element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(2)
SELENIUM_LOG_SCREEN(wd, "50")
elif element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(2)
\ No newline at end of file
......@@ -23,6 +23,9 @@ class AndroidInformation:
1.cd 预定系统
2.hytest --report_title 安卓信息测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-安卓信息测试
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='安卓信息')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='安卓信息', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self):
"""
......@@ -30,29 +33,32 @@ class AndroidInformation:
"""
# 从全局存储中获取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')
name = self.name
# 判断页面功能类型
if step.get("page") == "AndroidInformation":
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)
sleep(2)
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)
SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
# 判断页面功能类型
if page_type == "AndroidInformation":
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)
sleep(2)
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)
SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
......@@ -24,11 +24,11 @@ csv_file_path = os.path.join(current_dir, '../../../测试数据/展厅巡检/
# 定义时间格式
time_format = "%H:%M"
class Exhibition_hall_inspection_000x:
class Exhibition_hall_inspection:
"""
执行指令:
1.cd 预定系统
2.hytest --report_title 会议预约测试报告 --report_url_prefix http://192.168.1.225 --test 展厅巡检_0**
2.hytest --report_title 展厅会议预约测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 展厅巡检会议系统
"""
tags = ['展厅巡检','展厅巡检会议系统']
ddt_cases = read_csv_data(csv_file_path)
......@@ -87,8 +87,8 @@ class Exhibition_hall_inspection_000x:
sleep(1)
# 调用函数添加议题
# INFO("添加议题文件")
# issue_send_and_upload(wd, 5, issue_name)
INFO("添加议题文件")
issue_send_and_upload(wd, 5, issue_name)
sleep(2)
# 选择签到时间
......
......@@ -118,9 +118,11 @@ class Exhibition_Meeting_Control_0001:
sleep(1)
safe_send_keys((By.XPATH, "//input[@id='input_checkin']"), "30", wd)
# 根据开始时间选择8点30
safe_click((By.XPATH, f"(//div[normalize-space()='08:30'])[1]"), wd)
safe_click((By.XPATH, f"(//div[normalize-space()='08:45'])[1]"), wd)
# 调用函数根据当前时间进行选择
current_time = get_current_time_formatted()
INFO(f"获取当前的时间{current_time}")
safe_click((By.XPATH, f"//div[normalize-space()='{current_time}']"), wd)
sleep(1)
# 在会议预定第二步界面进行数据填入
STEP(4, "会议第二步数据填写")
......
......@@ -23,6 +23,9 @@ class TokenManage:
1.cd 预定系统
2.hytest --report_title 授权码管理测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-授权码管理测试
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='授权码管理')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='授权码管理', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self):
"""
......@@ -30,32 +33,35 @@ class TokenManage:
"""
# 从全局存储中获取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") == "TokenManage":
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"获取到的文本为:{notify_text}", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
name = self.name
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
# 判断页面功能类型
if page_type == "TokenManage":
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"获取到的文本为:{notify_text}", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
......@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class Login_00x:
class Login:
tags = ['新-登录测试']
"""
执行指令是:
1.cd 预定系统
2.hytest --report_title 账号密码登录测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-登录测试
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='登录页面')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='登录页面', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self):
"""
......@@ -30,51 +33,51 @@ class Login_00x:
本函数根据参数输入账号、密码和验证码,并检查登录后的提示信息是否与预期相符。
"""
wd = GSTORE['wd']
ddt_cases = read_xlsx_data(xlsx_file_path, "登录页面")
name = self.name
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
for step in case:
print(f"当前步骤: {step}")
# 你可以在这里对 step 进行进一步处理
# 例如:访问特定字段
# page = step.get('page')
# 调用get_by_enum将定位类型转为枚举
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')
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
if element_type == 'input':
INFO(f"输入值: {element_value}")
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(1)
if element_type == 'input':
INFO(f"输入值: {element_value}")
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(1)
elif element_type == 'click':
INFO("点击【登录】按钮")
safe_click((locator_type, locator_value), wd)
sleep(2)
if "成功" in expented_result:
notify_text = elment_get_text((By.CSS_SELECTOR, "div[class='meeting_t'] span:nth-child(1)"), wd)
SELENIUM_LOG_SCREEN(wd, '50%', 'Login', 'Login_Pwd', "检查登录成功提示信息")
INFO(f"Alert text: {notify_text}")
CHECK_POINT('检查是否出现提示弹窗', "欢迎" in notify_text)
elif element_type == 'click':
INFO("点击【登录】按钮")
safe_click((locator_type, locator_value), wd)
sleep(2)
if "成功" in expented_result:
notify_text = elment_get_text((By.CSS_SELECTOR, "div[class='meeting_t'] span:nth-child(1)"), wd)
SELENIUM_LOG_SCREEN(wd, '50%', 'Login', 'Login_Pwd', "检查登录成功提示信息")
INFO(f"Alert text: {notify_text}")
CHECK_POINT('检查是否出现提示弹窗', "欢迎" in notify_text)
safe_click((By.XPATH, "//img[@title='退出登录']"), wd)
sleep(2)
safe_click((By.XPATH, "//img[@title='退出登录']"), wd)
sleep(2)
elif "错误" in expented_result:
notify_text = get_notify_text(wd, (By.XPATH, "//p[@class='el-message__content']"), 'Login',
'Login_Pwd', f"检查{expented_result}登录的提示信息")
elif "错误" in expented_result:
notify_text = get_notify_text(wd, (By.XPATH, "//p[@class='el-message__content']"), 'Login',
'Login_Pwd', f"检查{expented_result}登录的提示信息")
INFO(f"获取到的结果:{notify_text}")
CHECK_POINT('检查是否出现提示弹窗', expented_result in notify_text)
sleep(2)
INFO(f"获取到的结果:{notify_text}")
CHECK_POINT('检查是否出现提示弹窗', expented_result in notify_text)
sleep(2)
elif "请输入" in expented_result:
notify_text = get_notify_text(wd, (By.XPATH, "//p[@class='el-message__content']"), 'Login',
'Login_Pwd', f"检查{expented_result}登录的提示信息")
INFO(f"获取到的结果:{notify_text}")
CHECK_POINT('检查是否出现提示弹窗', expented_result in notify_text)
sleep(2)
\ No newline at end of file
elif "请输入" in expented_result:
notify_text = get_notify_text(wd, (By.XPATH, "//p[@class='el-message__content']"), 'Login',
'Login_Pwd', f"检查{expented_result}登录的提示信息")
INFO(f"获取到的结果:{notify_text}")
CHECK_POINT('检查是否出现提示弹窗', expented_result in notify_text)
sleep(2)
\ No newline at end of file
......@@ -23,6 +23,9 @@ class SystemManage:
1.cd 预定系统
2.hytest --report_title 系统管理测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-系统管理测试
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='系统管理')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='系统管理', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self):
"""
......@@ -30,33 +33,36 @@ class SystemManage:
"""
# 从全局存储中获取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") == "SystemLog":
# 判断page为系统日志界面,点击【系统日志】,进入系统日志模块
safe_click((By.XPATH, "//li[contains(text(),'系统日志')]"), wd)
sleep(1)
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)
sleep(2)
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)
SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
name = self.name
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
# 判断页面功能类型
if page_type == "SystemLog":
# 判断page为系统日志界面,点击【系统日志】,进入系统日志模块
safe_click((By.XPATH, "//li[contains(text(),'系统日志')]"), wd)
sleep(1)
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)
sleep(2)
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)
SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
......@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class ConferenceStatistics:
class AccountManagement:
tags = ['新-账号管理测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
2.hytest --report_title 账号管理测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-账号管理测试
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='账号管理')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='账号管理', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self):
"""
......@@ -30,29 +33,32 @@ class ConferenceStatistics:
"""
# 从全局存储中获取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')
name = self.name
# 判断页面功能类型
if step.get("page") == "CompanyManagement":
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)
sleep(2)
elif element_type == "getTips":
notify_text = get_notify_text(wd, (locator_type, locator_value))
INFO(f"获取到的提示信息为:{notify_text}")
CHECK_POINT(f"获取到的提示信息为:{notify_text}", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
# 判断页面功能类型
if page_type == "CompanyManagement":
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)
sleep(2)
elif element_type == "getTips":
notify_text = get_notify_text(wd, (locator_type, locator_value))
INFO(f"获取到的提示信息为:{notify_text}")
CHECK_POINT(f"获取到的提示信息为:{notify_text}", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
......@@ -20,7 +20,6 @@ class ChangAnMessageApproval:
1.cd 预定系统
2.hytest --report_title 长安大学取消审批测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 长安大学取消审批测试
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会议审批')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会议审批',columns_to_clear=['测试结果', '测试频次', '日志截图'])
......@@ -36,6 +35,8 @@ class ChangAnMessageApproval:
meeting_message("审批会议室", "普通会议", "审批测试会议", "长安大学", wd)
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
......@@ -48,7 +49,7 @@ class ChangAnMessageApproval:
expented_result = step.get('expented_result')
# 判断页面功能类型
if step.get("page") == "ApprovalInitiate":
if page_type == "ApprovalInitiate":
if element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
......
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,展厅会议室,展厅巡检测试,普通会议,议题1,08:00,08:15,开会前一天提醒,预定成功
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论