1、提交Settings中的WAN NET关键字 和用例

This commit is contained in:
lyf
2020-12-10 18:11:49 +08:00
parent a59f81b1db
commit 46edbe525e
2 changed files with 156 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
*** Settings ***
Force Tags tsg-ui settings SNAT IP Pools
Resource ../../../03-Variable/bifangapivariable.txt
Resource ../../../02-Keyword/tsg_ui/setting/Settings.robot
Library OperatingSystem
*** Test Cases ***
SNAT_IP_Pools_Create-001
${iplist} create list 192.168.50.35 192.168.50.34
Create-SNAT-IP-Pools SNAT_IP_Pools_Create-001 1 ${iplist} j=2
SNAT-IP-Delete SNAT_IP_Pools_Create-001 Name

View File

@@ -47,6 +47,152 @@ Settings-Search
click xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[1]/span/div/i #点击搜索按钮
sleep 1
Create-SNAT-IP-Pools
[Arguments] ${name} ${type} ${ip} ${j}=1
Sleep 1
click id=children6 #点击一级目录Settings
Sleep 1
click id=sidebarSetting_Wannat #点击wan net
sleep 1
click id=ip #点击SNAT-IP-Pools
sleep 1
click id=app_create #点击新建按钮
sleep 1
input xpath=//*[@id="wannat_vpn_color"]/form/div[1]/div/div/div[1]/input ${name} #输入name
#判断是手动输入还是搜索添加,type=1为手动输入type=2为搜索添加
run keyword if "${type}"=="1" run keywords sleep 1
... AND click id=temporary_form #点击添加ip的加号
... AND sleep 2
... AND input id=statusInputedit ${ip}[0] #输入ip内容这里${value}是一个列表
... AND sleep 1
... AND SANT-IP-IF ${j} ${ip} #判断是添加一个ip还是多个ip
... AND click id=wan_reach_test #点击可达性测试按钮
... AND Wait Until Element Is Visible id=edit_0 20 #等待时间,等待元素出现后在进行后续操作
run keyword if "${type}"=="2" run keywords sleep 1
... AND click id=active-ip #点击 History Active IP按钮
... AND sleep 1
... AND input xpath=//*[@id="remoteInput"]/div/div/input ${ip}[0] #搜索输入框输入
... AND sleep 1
... AND click xpath=//*[@id="wannat_vpn_color"]/div[1]/div/div/div/div[2]/div[3]/div/div/div[3]/table/tbody/tr/td[1]/div/span/div #点击搜索到的ip添加
... AND sleep 1
... AND SANT-IP-IF1 ${j} ${ip} #判断是搜索添加一个ip还是多个ip
sleep 1
click id=wanAdd_ok #点击ok
sleep 2
${status} Run Keyword And Return Status Page Should Contain Go to #判断页面是否包含该文本
Should Be Equal As Strings ${status} True #断言
Edit-SNAT-IP-Pools
[Arguments] ${value} ${search} ${name} ${type} ${ip}=null ${j}=1
Sleep 1
SNAT-IP-Search ${value} ${search}
sleep 1
click id=appEdit #点击修改按钮
sleep 1
Clear Element Text xpath=//*[@id="wannat_vpn_color"]/form/div[1]/div/div/div[1]/input #清空输入框
sleep 1
input xpath=//*[@id="wannat_vpn_color"]/form/div[1]/div/div/div[1]/input ${name} #输入name
sleep 1
#判断对ip是修改或是新建或删除后新建或不进行修改
run keyword if "${type}"=="edit" Run Keywords click id=editForm0
... AND sleep 1
... AND clear element text id=statusInputedit
... AND sleep 1
... AND input id=statusInputedit ${ip}[0]
... AND sleep 1
... AND click id=wan_reach_test
run keyword if "${type}"=="create" Run Keywords SNAT-IP_Range_Create ${j} ${ip}
... AND sleep 1
... AND click id=wan_reach_test
run keyword if "${type}"=="delete" and "${type1}"=="create" Run Keywords click id=delForm0
... AND sleep 1
... AND SNAT-IP_Range_Create ${j} ${ip}
... AND sleep 1
... AND click id=wan_reach_test
run keyword if "${type}"=="null" log 不做更改
sleep 1
click id=wanAdd_ok #点击ok
Wait Until Element Is Visible id=app_create 20
${status} Run Keyword And Return Status Page Should Contain Go to #判断页面是否包含该文本
Should Be Equal As Strings ${status} True #断言
SANT-IP-IF
[Arguments] ${j} ${ip}
#多个ip添加
run keyword if "${j}"!="1" SNAT-IP_Range_Create ${j} ${ip}
SANT-IP-IF1
[Arguments] ${j} ${ip}
#多个ip搜索
run keyword if "${j}"!="1" SNAT-IP_Range_Search ${j} ${ip}
SNAT-IP_Range_Search
[Arguments] ${j} ${ip}
#for循环添加ip
sleep 1
: FOR ${i} IN RANGE 1 ${j}
\ sleep 1
\ Clear Element Text id=insert_profileName #清空输入框
\ sleep 1
\ input xpath=xpath=//*[@id="remoteInput"]/div/div/input ${ip}[${i}] #搜索输入框输入
\ sleep 1
\ click xpath=//*[@id="wannat_vpn_color"]/div[1]/div/div/div/div[2]/div[3]/div/div/div[3]/table/tbody/tr/td[1]/div/span/div #点击搜索到的ip添加
\ sleep 1
SNAT-IP_Range_Create
[Arguments] ${j} ${ip}
#for循环添加ip
sleep 1
: FOR ${i} IN RANGE 1 ${j}
\ sleep 1
\ click id=temporary_form
\ sleep 2
\ input id=statusInputedit ${ip}[${i}]
\ sleep 1
SNAT-IP-Search
[Arguments] ${value} ${search}
Wait Until Element Is Visible xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div/div[2]/div[2]/div/div/div[2]/div/div/div/input 20
click xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div/div[2]/div[2]/div/div/div[2]/div/div/div/input #点击搜索框
sleep 1
#判断是使用name搜索还是id搜索
run keyword if "${search}"=="Name" run keywords sleep 1
... AND click xpath=/html/body/div/div[1]/div[1]/ul/li[3]
... AND input xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div/div[2]/div[2]/div/div/div[2]/div/div[1]/div[3]/div/input ${value}
... ELSE IF "${search}"=="ID" run keywords sleep 1
... AND click xpath=/html/body/div/div[1]/div[1]/ul/li[2]
... AND input xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div/div[2]/div[2]/div/div/div[2]/div/div[1]/div[3]/div/input ${value}
... ELSE IF "${search}"=="IP" run keywords sleep 1
... AND click xpath=/html/body/div[7]/div[1]/div[1]/ul/li[4]
... AND input xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div/div[2]/div[2]/div/div/div[2]/div/div[1]/div[3]/div/input ${value}
sleep 1
click xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[1]/div/div[2]/div[2]/div/i #点击搜索按钮
sleep 1
click xpath=//*[@id="wannat-table"]/div[3]/table/tbody/tr[1]
sleep 1
SNAT-IP-Delete
[Arguments] ${value} ${search}
SNAT-IP-Search ${value} ${search} #搜索需要删除的数据
click id=appDel #点击删除按钮
sleep 2
click xpath=/html/body/div/div/div[3]/button[2]
sleep 2
Create-VPN-Accounts
[Arguments] ${name} ${passwd}
Sleep 1
click id=children6 #点击一级目录Settings
Sleep 1
click id=account #点击VPN Accounts按钮
sleep 1
click id=app_create #点击新建按钮
input xpath=//*[@id="wannat_vpn_username"]/div/div/div[1]/input ${name} #输入vpnname
sleep 1
input xpath=//*[@id="wannat_vpn_password"]/div/div/input ${passwd} #输入密码
sleep 1
click id=wanAdd_ok #点击ok按钮
Create-Hijack Files
[Arguments] ${name} ${file} ${type} ${search} ${shift}=1 ${input1}=1
Sleep 1