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/devices/Devices.robot

111 lines
4.6 KiB
Plaintext
Raw Normal View History

*** Settings ***
Library Selenium2Library
Library ../../../04-CustomLibrary/Custometest/StringManipulation.py
*** Keywords ***
Devices_OpenPage
[Arguments] ${Three-levelMenu}
[Documentation]
... ${Three-levelMenu}:三级菜单
sleep 1
click element id=children5
sleep 2
click element id=${Three-levelMenu}
sleep 2
CreateHSM
[Arguments] ${name} ${ServerIP} ${password} ${DataCenter}
[Documentation]
Devices_OpenPage sidebarDevice_hsm
click element id=insertAdd
sleep 2
input text id=insert_profileName ${name}
sleep 1
input text xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[3]/div/div/input ${ServerIP}
sleep 1
input text xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[4]/div/div/input ${password}
# sleep 1
# click element xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[5]/div/div/button
sleep 2
click element xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[6]/div/div/i
sleep 1
click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[2]/div/div[2]/ul/li[contains(text(), "${DataCenter}")]
sleep 1
click element id=fqdn_allcancelobject5
sleep 1
click element id=insertAddOk1
sleep 2
EditHSM
[Arguments] ${name} ${ServerIP} ${password} ${DataCenter}
[Documentation]
sleep 2
click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]
sleep 1
click element id=insertEdit
sleep 2
input text id=insert_profileName ${name}
sleep 1
input text xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[3]/div/div/input ${ServerIP}
sleep 1
input text xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[4]/div/div/input ${password}
# sleep 1
# click element xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[5]/div/div/button
sleep 2
click element xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[6]/div/div/i
sleep 1
click element xpath=//*[@id="policy_Manipulation_create8"]/div[2]/form/div[6]/div/div/i
sleep 1
click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[2]/div/div[2]/ul/li[contains(text(), "${DataCenter}")]
sleep 1
click element id=fqdn_allcancelobject5
sleep 1
click element id=insertAddOk1
Wait Until Element Is Enabled id=insertAdd
DdeleteHSM
sleep 2
click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]
sleep 1
click element id=insertDel
sleep 1
click element xpath=/html/body/div[2]/div/div/button[2]
Wait Until Element Is Enabled xpath=/html/body/div[last()]/p
Assertion
[Arguments] ${assertxpath} ${asserttext}
sleep 1
${text} Get text xpath=${assertxpath}
Should Be Equal As Strings ${text} ${asserttext}
PagingDisplay
[Arguments] ${Number}
[Documentation]
... ${Number}: 设置页面显示数据条数 20、5、30、50、100
Mouse Over xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[4]/span/div/i
sleep 1
run keyword if "${Number}"=="30" run keywords sleep 1
... AND Click element xpath=//*[@id="page-size"]/div/label[2]
... ELSE IF "${Number}"=="50" run keywords sleep 1
... AND Click element xpath=//*[@id="page-size"]/div/label[3]
... ELSE IF "${Number}"=="100" run keywords sleep 1
... AND Click element xpath=//*[@id="page-size"]/div/label[4]
... ELSE Clear Element Text xpath=/html/body/div[last()]/div[1]/div[2]/input
... AND Input Text xpath=/html/body/div[last()]/div[1]/div[2]/input ${Number}
sleep 1
Click element xpath=/html/body/div[last()]/div[1]/div[2]/button
sleep 2
${text} Get text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[4]/div/span[1]
sleep 1
${Quantity} StringSegmentation ${text}
sleep 1
${quyu} Evaluate ${Quantity}%${Number}
${qumo} Evaluate ${Quantity}/${Number}
${quzheng} Evaluate int(${qumo})
${b} Set Variable ${1}
${Page1} Evaluate ${quzheng}+${b}
${Page} Set Variable if "${qumo}" != "0" ${Page1} ${qumo}
sleep 1
${text} Get text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[4]/div/ul/li[last()]
Should Be Equal As Strings ${text} ${Page}