This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
dongxiaoyan-tsg-autotest/02-Keyword/tsg_ui/login/Login.robot

110 lines
5.1 KiB
Plaintext

*** Settings ***
Library Selenium2Library
Resource ../../../03-Variable/BifangApiVariable.txt
Library Selenium2Library
Resource ../objects/Objects.robot
Resource ../objects/ObjectPages.robot
*** Keywords ***
Login
Open Browser http://${host}/#/login ${browserType}
Maximize Browser Window
Clear-cache
input text xpath=//*[@id="app"]/div/div[2]/div/div[2]/div/input ${username}
input text xpath=//*[@id="app"]/div/div[2]/div/div[3]/div/input ${password}
Click button id=login
Password-prompt #判断是否有密码过期的提示
Clear-cache
${status} Run Keyword And Return Status Page Should Contain After update the version, you need to clear the cache and log in again, otherwise some functions will not be available. #判断页面是否包含该文本
run keyword if "${status}"=="True" click element xpath=/html/body/div[2]/div/div[3]/button[2]
run keyword if "${status}"=="False" log 不用进行清除缓存
Password-prompt
[Arguments] ${passwd}=123 ${day}=30
${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}
run keyword if "${status}"=="False" log 密码未过期
Password-prompt-true
[Arguments] ${passwd} ${day}
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]
... ELSE IF "${editpasswd}"=="no" run keywords sleep 1
... 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}
CreatePage ${obj1}[type] ${obj1}[name] ipads=${obj1}[ipads] ipclient=${obj1}[ipclient] ipclienttext1=${obj1}[ipclienttext1] ipclienttext2=${obj1}[ipclienttext2]
set global variable ${LocahIPName} ${obj1}[name]
UiLoginAndAddLocalIP
log UiLoginAndAddLocalIP
Login.Login
Run Keyword If ${addTestClentIPFlag}==1 AddLocalIp
log UiLoginAndAddLocalIP:${LocahIPName}
Ui-login
Menu administartion Login Log
sleep 3
click element id=sidebarsystem_LoginLog
sleep 2
Ui-User-login-Search-Name
[Arguments] ${value}
click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/span/div/div/div[2]/div/div/div/input
sleep 2
click element xpath=/html/body/div/div[1]/div[1]/ul/li[2]
sleep 1
input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/span/div/div/div[2]/div/div/div[3]/div/div/input ${value}
sleep 1
click element xpath=/html/body/div/div[1]/div[1]/ul/li[124]
sleep 2
click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/span/div/i
sleep 2
Ui-User-Search
click element id=one-input
sleep 2
click element id=input_list_li1
sleep 2
click element id=update_sreach0
sleep 2
click element id=OperatorInfo02
sleep 2
click element id=select_new_search_btn
sleep 2
User-Search-Name
[Arguments] ${name}
input text id=one-input ${name}
sleep 2
click element id=select_new_search_btn
sleep 2
Ui-Pages
[Arguments] ${accpages}
click element xpath=//*[@id="app"]/div/div[3]/div/div/div[4]/div/ul/li[1]
sleep 2
click element xpath=//*[@id="app"]/div/div[3]/div/div/div[4]/div/button[2]/i
sleep 2
Clear Element Text xpath=//*[@id="app"]/div/div[3]/div/div/div[4]/div/span[2]/div/input
sleep 2
input text xpath=//*[@id="app"]/div/div[3]/div/div/div[4]/div/span[2]/div/input ${accpages}
sleep 2
press keys xpath=//*[@id="app"]/div/div[3]/div/div/div[4]/div/span[2]/div/input ENTER
sleep 2
Pages
Menu administartion Login Log
sleep 3
click element id=sidebarsystem_LoginLog
sleep 2