1、提交修改密码关键字和用例2、修改login登录时修改密码关键字

This commit is contained in:
lyf
2020-12-25 16:32:43 +08:00
parent 53a9ad1771
commit ecbcbeb5c8
3 changed files with 86 additions and 8 deletions

View File

@@ -0,0 +1,21 @@
*** Settings ***
Force Tags tsg-ui accounts
Resource ../../../02-Keyword/tsg_ui/ChangePassword/ChangePassword.robot
Library OperatingSystem
*** Test Cases ***
ChangePasswordNotModify
#用户修改密码 ,不动原本内容,直接提交
ChangePassword
ChangePasswordNewPassword
#用户修改密码修改新密码因为新密码和旧密码不能一直passwd每次需要修改并且要修改BifangApiVariable。txt中的登录密码
ChangePassword passwd=123
ChangePasswordNewPasswordAndOpenRequiredPasswordChange
#用户修改密码并开启Required-Password-Change按钮因为新密码和旧密码不能一直passwd每次需要修改并且要修改BifangApiVariable。txt中的登录密码
ChangePassword passwd=123456 Required-Password-Change=open
ChangePasswordNewPasswordAndOpenRequiredPasswordChangeAndEditDay
#用户修改密码并开启Required-Password-Change按钮并修改天数因为新密码和旧密码不能一直passwd每次需要修改并且要修改BifangApiVariable。txt中的登录密码
ChangePassword passwd=1 Required-Password-Change=open day=123

View File

@@ -0,0 +1,39 @@
*** Settings ***
Library Selenium2Library
*** Keywords ***
ChangePassword
[Arguments] ${passwd}=null ${Required-Password-Change}=close ${day}=100
Mouse Hover xpath=//*[@id="app"]/div/div[1]/div[2]/div/span/div/span #鼠标悬浮到用户名
sleep 0.5
click element id=editInfo #点击密码修改
sleep 1
#判断是否修改密码
run keyword if "${passwd}"!="null" Run Keywords sleep 1
... AND input text xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[3]/div/div/input ${passwd}
... AND sleep 1
... AND input text xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[4]/div/div/input ${passwd}
... AND sleep 1
${class}= Get Element Attribute xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[5]/div/div class #获取Required-Password-Change按钮的class元素的值
#通过元素的值判断按钮是开启状态还是关闭状态
run keyword if "${Required-Password-Change}"=="open" and "${class}"=="el-switch is-checked" Run Keywords log 按钮为开启状态,不进行操作
... AND sleep 1
... AND input text xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[6]/div/div/input ${day}
... AND sleep 1
run keyword if "${Required-Password-Change}"=="open" and "${class}"=="el-switch" Run Keywords log 按钮为关闭状态,需要点击开启
... AND sleep 1
... AND click element xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[5]/div/div
... AND sleep 1
... AND input text xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[6]/div/div/input ${day}
... AND sleep 1
run keyword if "${Required-Password-Change}"=="close" and "${class}"=="el-switch is-checked" Run Keywords log 按钮为开启状态,需要点击关闭
... AND sleep 1
... AND click element xpath=xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[5]/div/div
run keyword if "${Required-Password-Change}"=="close" and "${class}"=="el-switch" log 按钮为关闭状态,不进行操作
sleep 1
click element xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[2]/button[1] #点击OK提交
Wait Until Element Is Visible //p[.="Success"] 20
${Text} get text //p[.="Success"]
sleep 2
Should Be Equal As Strings ${Text} Success #断言

View File

@@ -21,7 +21,7 @@ Clear-cache
run keyword if "${status}"=="False" log 不用进行清除缓存
Password-prompt
[Arguments] ${passwd}=123 ${day}=30 ${editpasswd}=no
[Arguments] ${passwd}=null ${day}=100 ${editpasswd}=no
${status} Run Keyword And Return Status Page Should Contain Does the password need to be changed when the password expires? #判断页面是否包含该文本
run keyword if "${status}"=="True" run keywords Password-prompt-true ${passwd} ${day} ${editpasswd}
run keyword if "${status}"=="False" log 密码未过期
@@ -31,16 +31,34 @@ Password-prompt-true
run keyword if "${editpasswd}"=="yes" run keywords sleep 1
... AND click element xpath=/html/body/div[2]/div/div[3]/button[2]
... AND sleep 1
... AND input text xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[3]/div/div/input ${passwd}
... AND sleep 1
... AND input text xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[4]/div/div[1]/input ${passwd}
... AND sleep 1
... AND intup text xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[6]/div/div/input ${day}
... AND sleep 1
... AND click element xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[2]/button[1]
... AND ChangePassword ${passwd} ${day}
... ELSE IF "${editpasswd}"=="no" run keywords sleep 1
... AND click element xpath=/html/body/div[2]/div/div[3]/button[1]
... AND sleep 1
ChangePassword
[Arguments] ${passwd} ${day} ${Required-Password-Change}=close
#判断是否修改密码
run keyword if "${passwd}"!="null" Run Keywords sleep 1
... AND input text xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[3]/div/div/input ${passwd}
... AND sleep 1
... AND input text xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[4]/div/div/input ${passwd}
... AND sleep 1
${class}= Get Element Attribute xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[5]/div/div class #获取Required-Password-Change按钮的class元素的值
#通过元素的值判断按钮是开启状态还是关闭状态
run keyword if "${Required-Password-Change}"=="open" and "${class}"=="el-switch is-checked" Run Keywords log 按钮为开启状态,不进行操作
... AND sleep 1
... AND input text xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[6]/div/div/input ${day}
... AND sleep 1
run keyword if "${Required-Password-Change}"=="open" and "${class}"=="el-switch" Run Keywords log 按钮为关闭状态,需要点击开启
... AND sleep 1
... AND input text xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[6]/div/div/input ${day}
... AND sleep 1
run keyword if "${Required-Password-Change}"=="close" and "${class}"=="el-switch is-checked" Run Keywords log 按钮为开启状态,需要点击关闭
... AND sleep 1
... AND click element xpath=xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[5]/div/div
run keyword if "${Required-Password-Change}"=="close" and "${class}"=="el-switch" log 按钮为关闭状态,不进行操作
sleep 1
click element xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[2]/button[1] #点击OK提交
AddLocalIp
${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]