提交 17bea318 authored 作者: 彭甘宇's avatar 彭甘宇

1、增加钉钉短信对接;

2、增加用户编辑和删除模块;
3、调整初始化方法;
4、增加测试数据;
上级 cc50c6a5
......@@ -2,11 +2,11 @@ from lib.login import *
def suite_setup():
wd = GSTORE['wd']
open_browser()
user_login("admin@pgy", "ub@123456", "csba")
enter_system()
enter_manage()
enter_user_manage()
# def suite_teardown():
# INFO('进行清除操作')
# wd = GSTORE['wd']
......
from lib.login import *
class UserAdd001:
name = 'user_add_001'
def teststeps(self):
wd = GSTORE['wd']
STEP(1, '点击新增按钮')
user_add = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@class='company-edmit-right']//span[contains(text(),'新增')]"))
)
user_add.click()
sleep(2)
STEP(2, '填写登录名')
account_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//input[@placeholder='登录名以字母开头,长度在5-18之间,只能包含字母、数字和下划线、@']"))
)
account_input.clear()
account_input.send_keys("admin@test")
STEP(3, '填写用户名称')
account_name_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//div[@class='el-input el-input--suffix']//input[@placeholder='请输入用户名称']"))
)
account_name_input.clear()
account_name_input.send_keys("测试用户")
STEP(4, '填写新密码')
passwd_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(By.XPATH, "//input[@placeholder='必须包含字母(不区分大小写)、数字和特殊字符,至少8个字符']"))
)
passwd_input.clear()
passwd_input.send_keys("ub@123456")
STEP(5, '填写确认密码')
sepasswd_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(By.XPATH, "//input[@placeholder='请确认密码']"))
)
sepasswd_input.clear()
sepasswd_input.send_keys("ub@123456")
STEP(6, '点击确认')
commit = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@aria-label='新增']//span[contains(text(),'确 定')]"))
)
commit.click()
STEP(7, '验证是否新增成功')
get_menu = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content'))
)
get_menu1 = get_menu.text
CHECK_POINT('检查是否出现成功提示弹窗', get_menu1 == "操作成功!")
sleep(2)
class UserAdd002:
name = 'user_add_002'
def teststeps(self):
wd = GSTORE['wd']
STEP(1, '点击新增按钮')
user_add = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@class='company-edmit-right']//span[contains(text(),'新增')]"))
)
user_add.click()
sleep(2)
STEP(2, '填写登录名')
account_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//input[@placeholder='登录名以字母开头,长度在5-18之间,只能包含字母、数字和下划线、@']"))
)
account_input.clear()
account_input.send_keys("admin@test")
STEP(3, '填写用户名称')
account_name_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.XPATH, "//div[@class='el-input el-input--suffix']//input[@placeholder='请输入用户名称']"))
)
account_name_input.clear()
account_name_input.send_keys("测试用户")
STEP(4, '填写新密码')
passwd_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(By.XPATH, "//input[@placeholder='必须包含字母(不区分大小写)、数字和特殊字符,至少8个字符']"))
)
passwd_input.clear()
passwd_input.send_keys("ub@123456")
STEP(5, '填写确认密码')
sepasswd_input = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(By.XPATH, "//input[@placeholder='请确认密码']"))
)
sepasswd_input.clear()
sepasswd_input.send_keys("ub@123456")
STEP(6, '点击确认')
commit = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable((By.XPATH, "//div[@aria-label='新增']//span[contains(text(),'确 定')]"))
)
commit.click()
STEP(7, '验证是否正常提示')
get_menu = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content'))
)
get_menu1 = get_menu.text
CHECK_POINT('检查是否出现错误提示弹窗', get_menu1 == "登录名已存在,请重新输入")
sleep(2)
from lib.login import *
def suite_setup():
wd = GSTORE['wd']
open_browser()
# def suite_teardown():
# INFO('进行清除操作')
# def suite_setup():
# wd = GSTORE['wd']
# wd.quit()
#
\ No newline at end of file
def suite_teardown():
INFO('进行清除操作')
wd = GSTORE['wd']
wd.quit()
from lib.login import *
# def suite_setup():
# INFO('初始化浏览器')
# open_browser()
# # run_login_tests()
#
#
# def suite_teardown():
# INFO('进行清除操作')
# wd = GSTORE['wd']
# wd.quit()
class user_login_001:
name = 'login_test_01'
def teststeps(self):
STEP(1, '打开网页')
open_browser()
wd = GSTORE['wd']
STEP(2, '用户登录')
user_login("admin@pgy1", "ub@123456", "csba")
STEP(1, '用户登录')
user_login("admin@pgy", "ub@123456", "csba")
# run_login_tests()
STEP(3, '验证是否登录成功')
STEP(2, '验证是否登录成功')
get_menu = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content'))
)
......@@ -35,27 +20,27 @@ class user_login_001:
wd.quit()
class user_login_002:
name = 'login_test_02'
def teststeps(self):
STEP(1, '打开网页')
wd = GSTORE['wd']
STEP(2, '用户登录')
user_login("admin@pgy", "ub@123456", "csba")
# run_login_tests()
STEP(3, '验证是否登录成功')
get_menu = WebDriverWait(wd, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content'))
)
get_menu1 = get_menu.text
CHECK_POINT('检查是否出现弹窗', get_menu1 == "操作成功!")
STEP(4, '清除数据')
def suite_teardown():
INFO('进行清除操作')
wd.quit()
# class user_login_002:
# name = 'login_test_02'
#
# def teststeps(self):
# STEP(1, '打开网页')
#
# wd = GSTORE['wd']
#
# STEP(2, '用户登录')
# user_login("admin@pgy", "ub@123456", "csba")
# # run_login_tests()
#
# STEP(3, '验证是否登录成功')
# get_menu = WebDriverWait(wd, 10).until(
# EC.presence_of_element_located((By.CSS_SELECTOR, '.el-message__content'))
# )
# get_menu1 = get_menu.text
# CHECK_POINT('检查是否出现弹窗', get_menu1 == "操作成功!")
#
# STEP(4, '清除数据')
#
# def suite_teardown():
# INFO('进行清除操作')
# wd.quit()
username,password,captcha
ywys@pgy,ub@1234567,csba
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论