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
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 areafuntionMod:
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("语音翻译")
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, '修改区域功能内容')
funtion_name = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(By.XPATH, "//div[contains(@class,'dialog-input')]//input[contains(@placeholder,'请输入功能名称')]"))
)
funtion_name.clear()
funtion_name.send_keys("修改-测试功能1")
STEP(5, '修改排序')
funtion_sort = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(By.XPATH, "//input[contains(@placeholder,'排序')]"))
)
funtion_sort.clear()
funtion_sort.send_keys("999")
STEP(6, '修改备注信息')
funtion_remark = WebDriverWait(wd, 10).until(
EC.presence_of_element_located(
(By.XPATH, "//input[@placeholder='备注']"))
)
funtion_remark.clear()
funtion_remark.send_keys("修改-功能备注")
STEP(7, '点击确认')
commit = WebDriverWait(wd, 10).until(
EC.element_to_be_clickable(
(By.XPATH, "(//span[contains(text(),'确 定')])[2]"))
)
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 == "操作成功!")
# 截图并保存
SELENIUM_LOG_SCREEN(wd, "50%")
sleep(1)
wd.refresh()