From da2e33850b0371d99f0e94a89bfbeb774b3800b1 Mon Sep 17 00:00:00 2001 From: lyf Date: Tue, 15 Dec 2020 18:33:01 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=8F=90=E4=BA=A4=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=99=90=E5=88=B6=E5=85=B3=E9=94=AE=E5=AD=97=E5=92=8C=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=EF=BC=8C2=E3=80=81=E4=BF=AE=E6=94=B9=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E5=85=AC=E5=85=B1=E5=85=B3=E9=94=AE=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Login_Restrictions.robot | 26 ++++++ .../LoginRestrictions/LoginRestrictions.robot | 83 +++++++++++++++++++ 02-Keyword/tsg_ui/Menu.robot | 4 +- 02-Keyword/tsg_ui/login/Login.robot | 2 +- 02-Keyword/tsg_ui/objects/ObjectPages.robot | 2 +- 02-Keyword/tsg_ui/setting/Settings.robot | 10 ++- 6 files changed, 121 insertions(+), 6 deletions(-) create mode 100644 01-TestCase/tsg_ui/ui_Login_Restrictions/Login_Restrictions.robot create mode 100644 02-Keyword/tsg_ui/LoginRestrictions/LoginRestrictions.robot diff --git a/01-TestCase/tsg_ui/ui_Login_Restrictions/Login_Restrictions.robot b/01-TestCase/tsg_ui/ui_Login_Restrictions/Login_Restrictions.robot new file mode 100644 index 0000000..b490182 --- /dev/null +++ b/01-TestCase/tsg_ui/ui_Login_Restrictions/Login_Restrictions.robot @@ -0,0 +1,26 @@ +*** Settings *** +Force Tags tsg-ui accounts +Resource ../../../02-Keyword/tsg_ui/LoginRestrictions/LoginRestrictions.robot +Library OperatingSystem + +*** Test Cases *** +User-Edit-001 + #用户修改Login Restrictions 不动原本内容 + Login_Restrictions +User-Edit-002 + #用户修改Login Restrictions Login Restrictions开启 + Login_Restrictions Login-Restrictions=open +User-Edit-003 + #用户修改Login Restrictions Login Restrictions关闭 + Login_Restrictions Login-Restrictions=close + +User-Edit-004 + #用户修改Login Restrictions 其他保持不动,新建ip白名单 ipv4最小值和Cidr最小值,ipv4最大值和Cidr最大值,中间值 + ${list-ip} Create list 0.0.0.0/0 255.255.255.255/32 199.199.199.199/22 + Login_Restrictions Login-Restrictions=open ip-type=create ip-value=${list-ip} + +User-Edit-005 + #用户修改Login Restrictions 其他保持不动,修改ip白名单 ipv4最小值和Cidr最小值,ipv4最大值和Cidr最大值,中间值 + ${list-ip} Create list 192.168.99.1/24 + ${list-ip1} Create list 0.0.0.0/15 + Login_Restrictions ip-type=edit ip-value=${list-ip} ip-value1=${list-ip1} \ No newline at end of file diff --git a/02-Keyword/tsg_ui/LoginRestrictions/LoginRestrictions.robot b/02-Keyword/tsg_ui/LoginRestrictions/LoginRestrictions.robot new file mode 100644 index 0000000..a609a5c --- /dev/null +++ b/02-Keyword/tsg_ui/LoginRestrictions/LoginRestrictions.robot @@ -0,0 +1,83 @@ +*** Settings *** +Library Selenium2Library +Resource ../../../03-Variable/BifangApiVariable.txt +Library Selenium2Library +Resource ../objects/Objects.robot +Resource ../objects/ObjectPages.robot + +*** Keywords *** +Login_Restrictions + [Arguments] ${Login-Restrictions}=1 ${ip-type}=1 ${ip-value}=[192.2.2.2/24] ${ip-value1}=[192.2.2.2/24] ${Maximum-Login-Attemepts}=1 ${Maximum-Login-Attemepts-valuie}=5 ${Lock-Time}=1 ${Lock-Time-valuie}=60 + sleep 1 + Menu administration Login Restrictions #点击菜单Login Restrictions + sleep 1 + ${class}= Get Element Attribute xpath=//*[@id="policy_Manipulation2"]/div/div[2]/div/div/form/div[1]/div/div class #获取Login-Restrictions按钮的class元素的值 + #通过元素的值判断按钮是开启状态还是关闭状态 + run keyword if "${Login-Restrictions}"=="open" and "${class}"=="el-switch is-checked" log 按钮为开启状态,不进行操作 + run keyword if "${Login-Restrictions}"=="open" and "${class}"=="el-switch" Run Keywords log 按钮为关闭状态,需要点击开启 + ... AND sleep 1 + ... AND click element link=//*[@id="policy_Manipulation2"]/div/div[2]/div/div/form/div[1]/div/div + run keyword if "${Login-Restrictions}"=="close" and "${class}"=="el-switch is-checked" Run Keywords log 按钮为开启状态,需要点击关闭 + ... AND sleep 1 + ... AND click element xpath=//*[@id="policy_Manipulation2"]/div/div[2]/div/div/form/div[1]/div/div + run keyword if "${Login-Restrictions}"=="close" and "${class}"=="el-switch" log 按钮为关闭状态,不进行操作 + sleep 1 + #判断操作类型 + run keyword if "${ip-type}"=="create" Ip-Create ${ip-value} + run keyword if "${ip-type}"=="edit" IP-Edit ${ip-value} ${ip-value1} + run keyword if "${ip-type}"=="delete" IP-Delete ${ip-value} + run keyword if "${Maximum-Login-Attemepts}"=="input" input text xpath=//*[@id="policy_Manipulation2"]/div/div[2]/div/div/form/div[3]/div/div/input ${Maximum-Login-Attemepts-valuie} + run keyword if "${Lock-Time}"=="input" input text xpath=//*[@id="policy_Manipulation2"]/div/div[2]/div/div/form/div[3]/div/div/input ${Lock-Time-valuie} + sleep 1 + click element id=wanAdd_ok + sleep 1 + ${Text} get text xpath=/div/p + sleep 2 + Should Be Equal As Strings ${Text} Success #断言 + +Ip-Create + [Arguments] ${ip} + ${j} get length ${ip} + sleep 1 + : FOR ${i} IN RANGE ${j} + \ sleep 1 + \ click element id=temporary_form + \ sleep 1 + \ input text id=statusInputedit ${ip}[${i}] + \ sleep 1 + sleep 1 + +IP-search + [Arguments] ${ip} + sleep 1 + input text id=object_ip_search ${ip} + sleep 1 + press keys id=object_ip_search ENTER + +IP-Edit + [Arguments] ${ip} ${new_ip} + ${j} get length ${ip} + sleep 1 + : FOR ${i} IN RANGE ${j} + \ sleep 1 + \ IP-search ${ip}[${i}] + \ sleep 1 + \ Double Click Element xpath =//*[@id="policy_Manipulation2"]/div/div[2]/div/div/form/div[2]/div/div[1]/div[2]/div[1][@placeholder='${ip}[${i}]'] #点击修改按钮 + \ sleep 1 + \ input text id=statusInputedit ${new_ip} #输入修改后的ip + sleep 1 + + +IP-Delete + [Arguments] ${ip} + ${j} get length ${ip} + sleep 1 + : FOR ${i} IN RANGE ${j} + \ sleep 1 + \ IP-search ${ip}[${i}] + \ sleep 1 + \ click element xpath=/html/body/div[1]/div/div[3]/div[2]/div/div[1]/div/div[2]/div/div/form/div[2]/div/div[1]/div[2]/div[1]/div/div/div/div/div[2]/i[2] #点击删除按钮 + \ sleep 1 + sleep 1 + + diff --git a/02-Keyword/tsg_ui/Menu.robot b/02-Keyword/tsg_ui/Menu.robot index ce1b779..d7cd8a1 100644 --- a/02-Keyword/tsg_ui/Menu.robot +++ b/02-Keyword/tsg_ui/Menu.robot @@ -6,12 +6,12 @@ Menu [Arguments] ${menuOne} ${menuTwo} Wait Until Element Is Enabled id=children0 10 # 一级菜单 - ${dict} create dictionary dashboard=children0 policys=children1 objects=children2 log=children3 report=children4 device=children5 settings=children6 administartion=children7 + ${dict} create dictionary dashboard=children0 policys=children1 objects=children2 log=children3 report=children4 device=children5 settings=children6 administration=children7 # 二级菜单 ${policys} create dictionary Security Policy=sidebarObjects_ProxyInterception Proxy Policy=sidebarObjects_ProxyManipulation WAN NAT=sidebarWan_nat Schedules=sidebarObjects_Schedule Tags=sidebarObjects_Tags ${objects} create dictionary IP=sidebarObjects_ip FQDN=sidebarObjects_fqdn SubscriberID=sidebarObjects_subscriberid HTTPSignature=sidebarObjects_http_signature Key=sidebarObjects_keywords URL=sidebarObjects_url Category=sidebarObjects_fqdn_category Account=sidebarObjects_account Applications=sidebarApplication ${log} create dictionary Security Event Logs=sidebarLog_SecurityEventLogs Proxy Event Logs=sidebarLog_ProxyEventLogs Session Records=sidebarLog_SesssionRecords Radius Logs=sidebarLog_RadiusLogs - ${administartion} create dictionary Accounts=sidebarsystem_UserManagement Audit Log=sidebarsystem_PolicyConfigurationLog Login Log =sidebarsystem_LoginLog Mail Server=sidebarsystem_MailServer LDAP Server=sidebarsystem_LadpServer + ${administration} create dictionary Accounts=sidebarsystem_UserManagement Audit Log=sidebarsystem_PolicyConfigurationLog Login Log =sidebarsystem_LoginLog Mail Server=sidebarsystem_MailServer LDAP Server=sidebarsystem_LadpServer Login Restrictions=sidebarLogin_Restrictions # 遍历一级菜单 FOR ${list} ${num} IN ENUMERATE @{dict} diff --git a/02-Keyword/tsg_ui/login/Login.robot b/02-Keyword/tsg_ui/login/Login.robot index f1afb75..7d40ff8 100644 --- a/02-Keyword/tsg_ui/login/Login.robot +++ b/02-Keyword/tsg_ui/login/Login.robot @@ -42,7 +42,7 @@ Password-prompt-true ... AND click element xpath=/html/body/div[2]/div/div[3]/button[1] ... AND sleep 1 AddLocalIp - ${obj1} create dictionary type=Ip name=LocahIPName ipads=${ipType} ipclient=masks ipclienttext1=${testClentIP} ipclienttext2=${ipMask} + ${obj1} create dictionary type=IP name=LocahIPName ipads=${ipType} ipclient=masks ipclienttext1=${testClentIP} ipclienttext2=${ipMask} CreatePage ${obj1}[type] ${obj1}[name] ipads=${obj1}[ipads] ipclient=${obj1}[ipclient] ipclienttext1=${obj1}[ipclienttext1] ipclienttext2=${obj1}[ipclienttext2] set global variable ${LocahIPName} ${obj1}[name] diff --git a/02-Keyword/tsg_ui/objects/ObjectPages.robot b/02-Keyword/tsg_ui/objects/ObjectPages.robot index 1a9d5e4..52e2077 100644 --- a/02-Keyword/tsg_ui/objects/ObjectPages.robot +++ b/02-Keyword/tsg_ui/objects/ObjectPages.robot @@ -8,7 +8,7 @@ Library Collections CreatePage [Arguments] ${objtype} ${name} ${ip_type}=null ${ipads}=null ${ipclient}=null ${ipclienttext1}=null ${ipclienttext2}=null ... ${keywordtext}=null ${hex}=close ${reqrestype}=null ${reqresheader}=null ${post}=null ${Country}=null ${City}=null ${group}=null ${object_name}=null - Menu policy&objects Objects + Menu objects ${objtype} sleep 3 Objects.CreateButton ${objtype} Objects.Create-name ${name} diff --git a/02-Keyword/tsg_ui/setting/Settings.robot b/02-Keyword/tsg_ui/setting/Settings.robot index 8e5ec80..24ccc0b 100644 --- a/02-Keyword/tsg_ui/setting/Settings.robot +++ b/02-Keyword/tsg_ui/setting/Settings.robot @@ -231,7 +231,10 @@ VPN-Accounts-Delete sleep 2 Create-Proxy-TCP-Options - [Arguments] ${name} ${passwd} ${search} + [Arguments] ${name} ${ip-type} ${ip-value} ${ip-type1} ${ip-value1} ${Client-ttl-value} ${Client-User-Timeout} ${Server-ttl-value} ${Server-User-Timeout} ${search} + ... ${Filter}=1 ${sni-type}=FQDN ${sni-value}=test-.com ${Enable-TCP-Passthrough}=1 ${Bypass-Duplicated-Packet}=1 ${Client-Override-MSS}=1 + ... ${Client-MSS-value}=1000 ${Client-No-Delay}=1 ${Client-Keepalive}=1 ${Client-Probe-Number}=1 ${Client-Idle-Time}=30 ${Client-Interval}=15 + ... ${Server-Override-MSS}=1 ${Server-MSS-value}=100 ${Server-No-Delay}=1 ${Server-Keepalive}=1 ${Server-Probe-Number}=1 ${Server-Idle-Time}=30 ${Server-Interval}=15 Sleep 1 click id=children6 #点击一级目录Settings Sleep 1 @@ -360,6 +363,8 @@ Create-Proxy-TCP-Options click id=proxyManipulationSuccess #点击OK sleep 1 Proxy-TCP-Options-Search ${name} ${search} #搜索刚新建的name + ${text1} Get Text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]/td[2]/div/div/p #获取点击后页面文本信息 + Should Be Equal As Strings ${text1} ${name} #断言 Source-or-Destination-Search [Arguments] ${value} @@ -401,7 +406,8 @@ Proxy-TCP-Options-Search click xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div[1]/div/div[1]/span/div/i #点击搜索按钮 sleep 1 click xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1] #点击搜索到的列表 - sleep te-Hijack Files + sleep 1 +Create-Hijack Files [Arguments] ${name} ${file} ${type} ${search} ${shift}=1 ${input1}=1 Sleep 1 click id=children6 #点击一级目录Settings