1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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 *
class areafuntionDel001:
name = '删除区域功能-001-搜索删除单个功能'
def teststeps(self):
wd = GSTORE['wd']
STEP(1, '搜索对应的区域功能')
areafuntion_search= WebDriverWait(wd, 10).until(
EC.element_to_be_clickable(
(By.XPATH, "//input[@placeholder='请输入功能名称']"))
)
areafuntion_search.clear()
areafuntion_search.send_keys("修改-测试功能1")
STEP(2, '勾选区域功能')
areafuntion_select = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable(
(By.XPATH, "(//span[@class='el-checkbox__inner'])[2]"))
)
areafuntion_select.click()
STEP(3, '点击删除按钮')
areafuntion_mod = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable(
(By.XPATH, "//span[contains(text(),'删除')]"))
)
areafuntion_mod.click()
sleep(1)
STEP(4, '点击确认')
commit = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable(
(By.XPATH, "(//span[contains(text(),'确 定')])[3]"))
)
commit.click()
STEP(5, '验证是否修改成功')
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 == "操作成功!")
# 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1)
wd.refresh()
# class areafuntionDel002:
# name = '删除区域功能-001-全选删除全部功能'
# def teststeps(self):
# wd = GSTORE['wd']
#
# STEP(1, '勾选全部区域功能')
# areafuntion_select = WebDriverWait(wd, 10).until(
# EC.element_to_be_clickable(
# (By.XPATH, "//th[contains(@class,'is-leaf el-table__cell')]//span[contains(@class,'el-checkbox__inner')]"))
# )
# areafuntion_select.click()
#
# STEP(2, '点击删除按钮')
# areafuntion_mod = WebDriverWait(wd, 10).until(
# EC.element_to_be_clickable(
# (By.XPATH, "//span[contains(text(),'删除')]"))
# )
# areafuntion_mod.click()
# sleep(1)
#
# STEP(3, '点击确认')
# commit = WebDriverWait(wd, 10).until(
# EC.element_to_be_clickable(
# (By.XPATH, "(//span[contains(text(),'确 定')])[3]"))
# )
# commit.click()
#
# STEP(4, '验证是否修改成功')
# 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 == "操作成功!")
#
# # 截图并保存
# SELENIUM_LOG_SCREEN(wd, "50%")
# sleep(1)
# wd.refresh()