提交 8a3ef6d6 authored 作者: 彭甘宇's avatar 彭甘宇

更新运维自动化测试,调整代码,新增模块功能。

上级 403f3844
/预定系统/log
/预定系统/reports/
/预定系统/reports/imgs/
\ No newline at end of file
/预定系统/reports/imgs/
......@@ -42,3 +42,4 @@ class User_Login:
# 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%")
wd.refresh()
import sys
import os
from hytest.common import SELENIUM_LOG_SCREEN
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
#构建当前项目路径
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
# 构建 CSV 文件的绝对路径
csv_path = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..', 'testdata', '03类型标签', '新增标签.csv'))
class AreagroupAdd:
tag = ['新增类型标签']
ddt_cases = read_csv_data(csv_path)
def teststeps(self):
wd = GSTORE['wd']
# 从self.para中解构出数据
name = self.name
area_group, group_name, group_address, remark, info = self.para
STEP(1, '点击新增按钮')
areagroup_add = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@class='company-edmit-right']//span[contains(text(),'新增')]"))
)
areagroup_add.click()
STEP(2, f'查看并选择类型标签:{area_group}')
if area_group:
area_group_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "// input[ @ placeholder = '请选择分组']"))
)
area_group_input.clear()
area_group_input.send_keys(area_group)
sleep(1)
#默认选择第一个内容
area_group_select = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//div[@class='el-cascader__suggestion-panel el-scrollbar']//li[1]//span[1]"))
)
area_group_select.click()
else:
print("group_name 为空,不执行选择区域分组的操作")
STEP(3, f'填写标签名称:{group_name}')
group_name_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//input[@placeholder='长度1-20个字符']"))
)
group_name_input.clear()
group_name_input.send_keys(group_name)
STEP(4, f'填写标签排序:{group_address}')
group_address_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//input[@placeholder='输入地址不能大于50个字符']"))
)
group_address_input.clear()
group_address_input.send_keys(group_address)
STEP(5, f'填写分组备注:{remark}')
group_remark = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(By.XPATH, "//input[@placeholder='请输入备注']"))
)
group_remark.clear()
group_remark.send_keys(remark)
STEP(6, '点击确认')
commit = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@class='dialog-footer']//span[contains(text(),'确 定')]"))
)
commit.click()
STEP(7, '验证是否新增成功')
get_menu = WebDriverWait(wd, 10).until(
EC.visibility_of_element_located((By.XPATH, "//p[@class='el-message__content']"))
)
get_menu1 = get_menu.text
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == info )
# 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1)
wd.refresh()
import sys
import os
from hytest.common import SELENIUM_LOG_SCREEN
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', '..')))
from 运维集控.项目测试.运维标准版.lib.base import *
# 构建 CSV 文件的绝对路径
csv_path = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..', 'testdata', '08设备管理', '新增设备.csv'))
class AreafuntionAdd:
tag = ['新增设备']
ddt_cases = read_csv_data(csv_path)
def teststeps(self):
wd = GSTORE['wd']
#从self.para中解构出数据
name = self.name
area_group, area_type, area_name, area_ip, remark, info = self.para
STEP(1, '点击新增按钮')
areafuntion_add = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable(
(By.XPATH, "//div[@class='company-edmit-right']//span[contains(text(),'新增')]"))
)
areafuntion_add.click()
sleep(1)
STEP(2, f'查找并选择区域分组:{area_group}')
if area_group:
area_group_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(By.XPATH, "//div[@class='dialog_input']//input[@placeholder='请选择分组']"))
)
area_group_input.send_keys(area_group)
#默认选择第一个分组
areagroup_select = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(
By.XPATH, "//li[@class='el-cascader__suggestion-item']"))
)
sleep(1)
areagroup_select.click()
else:
print("group_name 为空,不执行选择区域分组的操作")
STEP(3, f'选择区域类型:{area_type}')
if area_type:
area_type_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(By.XPATH, "//div[@class='dialog_input']//input[@placeholder='请选择区域类型']"))
)
area_type_input.send_keys(area_type)
#默认选择第一个区域类型
areatype_select = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(By.XPATH, "//div[@x-placement='bottom-start']//ul[@class='el-scrollbar__view el-select-dropdown__list']"))
)
sleep(1)
areatype_select.click()
else:
print("area_type 为空,不执行选择区域类型的操作")
STEP(4, f'输入区域名称:{area_name}')
area_name_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(By.XPATH, "//div[contains(@class,'dialog_input')]//input[contains(@placeholder,'请输入区域名称')]"))
)
area_name_input.clear()
area_name_input.send_keys(area_name)
STEP(5, f'填写IP地址:{area_ip}')
area_ip_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(By.XPATH, "//input[@placeholder='IP地址']"))
)
area_ip_input.clear()
area_ip_input.send_keys(area_ip)
STEP(6, f'填写备注:{remark}')
funtion_remark = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(By.XPATH, "//input[@placeholder='备注']"))
)
funtion_remark.clear()
funtion_remark.send_keys(remark)
STEP(7, '点击确认')
commit = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable(
(By.XPATH, "//div[@aria-label='新增']//span[contains(text(),'确 定')]"))
)
commit.click()
STEP(8, '验证是否新增成功')
get_menu = WebDriverWait(wd, 10).until(
EC.visibility_of_element_located(
(By.CSS_SELECTOR, '.el-message__content'))
)
get_menu1 = get_menu.text
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == info)
# 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1)
wd.refresh()
\ No newline at end of file
name,typename,sort
新增标签-001-标签名称为空,,1
新增标签-002-排序为空,智慧大屏1,
新增标签-003-排序为小数,智慧大屏2,1.1
新增标签-004-排序为负数,智慧大屏3,-1
新增标签-005-正常新增标签1,智慧屏设备,1
新增标签-006-正常新增标签2,时序电源,2
新增标签-007-正常新增标签3,中控主机,3
新增标签-008-正常新增标签4,音频处理器,4
新增标签-009-正常新增标签5,视频处理器,5
新增标签-010-正常新增标签6,网络路由,6
name,area_name,device_name,type,brand,model,sn,ip,tag,supplier,contact,price,expiry_time,sort,useYear,description,relateMaster,outMaster
新增设备-001-正常新增设备,测试区域11,测试设备0,智慧屏设备,华为品牌,Ideahub,123456789,192.168.1.1,资产设备1,华为,13141234567,2000,2025-01-01 12:00:00,1,3,用途说明1,否,否
\ No newline at end of file
......@@ -69,7 +69,7 @@ start_workers(3)
# 定义每天定时执行的任务
# 每天早上07:50执行后台系统设置功能测试
for day in ['monday', 'tuesday', 'wednesday', 'thursday', 'friday']:
schedule.every().__getattribute__(day).at("07:50").do(run_task, run_automation_test, report_title="运维系统测试报告", report_url_prefix="http://nat.ubainsyun.com:31135", ding_type="标准版巡检")
schedule.every().__getattribute__(day).at("11:21").do(run_task, run_automation_test, report_title="运维系统测试报告", report_url_prefix="http://nat.ubainsyun.com:31135", ding_type="标准版巡检")
# 调试使用
#schedule.every().day.at("09:59").do(run_task, run_automation_test, report_title="运维系统脚本调试", report_url_prefix="http://nat.ubainsyun.com:31135", ding_type="标准版巡检")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论