From aeb8c8e5ca19d6e9a9ea4c7eb5608c431200aac3 Mon Sep 17 00:00:00 2001 From: byb11 Date: Mon, 1 Feb 2021 19:05:41 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=96=B0=E5=A2=9ECase=20=20=202.=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=85=B3=E9=94=AE=E5=AD=97=20=20=20=203.=E6=96=B0?= =?UTF-8?q?=E5=A2=9Epython=E6=96=87=E4=BB=B6=E5=AF=B9=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=E7=9A=84=E6=93=8D=E4=BD=9C=20=20=20=20=204.=E6=9B=B4?= =?UTF-8?q?=E6=94=B9UserCase=E7=9A=84=E6=96=87=E4=BB=B6=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 01-TestCase/tsg_ui/Administration/Users.robot | 180 ++++++++++++++ .../tsg_ui/ui_accounts/Accountscase.robot | 146 ----------- 02-Keyword/tsg_ui/Menu.robot | 4 +- 02-Keyword/tsg_ui/accounts/Accounts.robot | 126 ---------- .../tsg_ui/accounts/Accountspages.robot | 234 +++++++++++++++--- 02-Keyword/tsg_ui/setting/Settings.robot | 5 +- .../Custometest/StringManipulation.py | 6 + 7 files changed, 384 insertions(+), 317 deletions(-) create mode 100644 01-TestCase/tsg_ui/Administration/Users.robot delete mode 100644 01-TestCase/tsg_ui/ui_accounts/Accountscase.robot delete mode 100644 02-Keyword/tsg_ui/accounts/Accounts.robot create mode 100644 04-CustomLibrary/Custometest/StringManipulation.py diff --git a/01-TestCase/tsg_ui/Administration/Users.robot b/01-TestCase/tsg_ui/Administration/Users.robot new file mode 100644 index 0000000..b23c41d --- /dev/null +++ b/01-TestCase/tsg_ui/Administration/Users.robot @@ -0,0 +1,180 @@ +*** Settings *** +Force Tags tsg-ui Users +Resource ../../../02-Keyword/tsg_ui/accounts/Accountspages.robot +Library OperatingSystem + +*** Test Cases *** +UsersCreate + [Tags] Positive UI Administration Users + ${a} evaluate random.randint(1000,9999) random + CreatePage 0000 ${a} 111111 log 30 log superuser + #验证新建是否成功 + UserSearchName ${a} UserName + ${UserName} get text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]/td[3]/div/div + Should Be Equal As Strings ${UserName} ${a} + sleep 1 + login ${a} 111111 + ${text1} get text xpath=//*[@id="children0"]/div/span + Should Be Equal As Strings ${text1} Dashboard + +UsersCreateOpenRequiredPasswordChange + [Tags] Positive UI Administration Users + ${a} evaluate random.randint(1000,9999) random + CreatePage 0000 ${a} 111111 open 30 log superuser + UserSearchName ${a} UserName + ${UserName} get text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]/td[3]/div/div + Should Be Equal As Strings ${UserName} ${a} + +UsersCreateCloseEnableButton + [Tags] Positive UI Administration Users + ${a} evaluate random.randint(1000,9999) random + CreatePage 0000 ${a} 111111 open 30 close superuser + UserSearchName 0000 Name + sleep 1 + ${text} Get Element Attribute xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]/td[10]/div/div/span/div class + Should Be Equal As Strings ${text} el-switch + +UsersCreateRoleSuperReader + [Tags] Positive UI Administration Users + ${a} evaluate random.randint(1000,9999) random + CreatePage 0000 ${a} 111111 open 30 close superreader + UserSearchName 0000 Name + sleep 1 + ${text} get text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]/td[5]/div/div + Should Be Equal As Strings ${text} superreader + +UsersCloseEnableButton + [Tags] Positive UI Administration Users + ${a} evaluate random.randint(1000,9999) random + CreatePage 0000 ${a} 111111 log 30 log superuser + UserSearchName ${a} UserName + sleep 1 + Click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]/td[10]/div/div/span/div + sleep 1 + ${text} Get Element Attribute xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]/td[10]/div/div/span/div class + Should Be Equal As Strings ${text} el-switch + +UsersEdit + [Tags] Positive UI Administration Users + ${a} evaluate random.randint(10000,99990) random + CreatePage UsersEdit ${a} 111111 log 30 log superuser + UserSearchName UsersEdit Name + UserEdit 1111 close + UserSearchName ${a} UserName + ${text} Get Element Attribute xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]/td[10]/div/div/span/div class + Should Be Equal As Strings ${text} el-switch + +UserTurnPage + [Tags] Positive UI Administration Users + Menu administration Accounts + TurnPage //*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[4]/div/button[2] //*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[4]/div/button[1] + ... //*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[4]/div/span[2]/div/input 2 //*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]/td[1]/div/div + +UserSwitchDisplayNumber + [Tags] Positive UI Administration Users + Menu administration Accounts + PagingDisplay 50 + +UsersCreateNameMinSize + [Tags] Boundary UI Administration Users + ${a} evaluate random.randint(1000,9999) random + CreatePage 1 ${a} 111111 log 30 log superuser + UserSearchName 1 Name + ${name} get text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]/td[4]/div/div + Should Be Equal As Strings ${name} 1 + +UsersCreateNameMaxSize + [Tags] Boundary UI Administration Users + ${a} evaluate random.randint(1000,9999) random + CreatePage UsersCreateNameMaxSizeUsersCreat ${a} 111111 log 30 log superuser + UserSearchName UsersCreateNameMaxSizeUsersCreat Name + ${name} get text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]/td[4]/div/div + Should Be Equal As Strings ${name} UsersCreateNameMaxSizeUsersCreat + +UsersCreateNameSpecialChar + [Tags] Boundary UI Administration Users + ${a} evaluate random.randint(1000,9999) random + CreatePage 中文+absc+моряков+@#¥%……&* ${a} 111111 log 30 log superuser + UserSearchName 中文+absc+моряков+@#¥%……&* Name + ${name} get text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]/td[4]/div/div + Should Be Equal As Strings ${name} 中文+absc+моряков+@#¥%……&* + +UsersCreatePasswordExpirationMinimum + [Tags] Boundary UI Administration Users + ${a} evaluate random.randint(1000,9999) random + CreatePage 0000 ${a} 111111 open 1 log superuser + UserSearchName 0000 Name + ${name} get text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]/td[4]/div/div + Should Be Equal As Strings ${name} 0000 + +UsersCreatePasswordExpirationMax + [Tags] Boundary UI Administration Users + ${a} evaluate random.randint(1000,9999) random + CreatePage 0000 ${a} 111111 open 2147483647 log superuser + UserSearchName 0000 Name + ${name} get text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1]/td[4]/div/div + Should Be Equal As Strings ${name} 0000 + +UsersCreateUserNameRepeat + [Tags] Boundary UI Administration Users + Menu administration Accounts + CreatePage UsersCreateUserNameRepeat byb 111111 log 30 log superuser + sleep 1 + ${text} get text xpath=/html/body/div[last()]/p + Should Be Equal As Strings ${text} User already exists + +UsersCreatePasswordFormatError + [Tags] Boundary UI Administration Users + Menu administration Accounts + CreatePage UsersCreateUserNameRepeat byb @#¥%……&*(*-++ log 30 log superuser + sleep 1 + ${text1} get text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[3]/div/div[2] + ${text2} get text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[4]/div/div[2] + Should Be Equal As Strings ${text1} Only English letters, numbers, and special characters ~!@#$%^&*_.? + Should Be Equal As Strings ${text2} Only English letters, numbers, and special characters ~!@#$%^&*_.? + +UsersCreatePasswordDifferent + [Tags] Boundary UI Administration Users + Menu administration Accounts + sleep 1 + Click element id=userAdd + sleep 1 + Input Text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[3]/div/div/input 11 + sleep 1 + Input Text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[4]/div/div[1]/input 111 + sleep 1 + Accounts.Create-Ok + sleep 1 + ${text} get text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[4]/div/div[2] + Should Be Equal As Strings ${text} The two passwords are inconsistent + +UsersCreatePasswordExpirationFormatError + [Tags] Boundary UI Administration Users + ${a} evaluate random.randint(1000,9999) random + CreatePage 0000 ${a} 111111 open 2147483648 log superuser + ${text} get text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[6]/div/div[2] + Should Be Equal As Strings ${text} Cannot be 0, exceed maximum 2147483647, and be empty + +UsersCreatePasswordExpirationIs0 + [Tags] Boundary UI Administration Users + ${a} evaluate random.randint(1000,9999) random + CreatePage 0000 ${a} 111111 open 0 log superuser + ${text} get text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[6]/div/div[2] + Should Be Equal As Strings ${text} Cannot be 0, exceed maximum 2147483647, and be empty + +UsersCreateNull + [Tags] Boundary UI Administration Users + Menu administration Accounts + sleep 1 + Click element id=userAdd + Wait Until Element Is Enabled xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[2]/button[1] 20 + click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[2]/button[1] + sleep 1 + ${text1} Get text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[1]/div/div[3] + ${text2} Get text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[2]/div/div[3] + ${text3} Get text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[3]/div/div[2] + ${text4} Get text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[4]/div/div[2] + Should Be Equal As Strings ${text1} Name field is required. + Should Be Equal As Strings ${text2} Account field is required. + Should Be Equal As Strings ${text3} This item is required + Should Be Equal As Strings ${text4} This item is required \ No newline at end of file diff --git a/01-TestCase/tsg_ui/ui_accounts/Accountscase.robot b/01-TestCase/tsg_ui/ui_accounts/Accountscase.robot deleted file mode 100644 index 2a71351..0000000 --- a/01-TestCase/tsg_ui/ui_accounts/Accountscase.robot +++ /dev/null @@ -1,146 +0,0 @@ -*** Settings *** -Force Tags tsg-ui accounts -Resource ../../../02-Keyword/tsg_ui/accounts/Accountspages.robot -Library OperatingSystem -Resource ../../../02-Keyword/tsg_ui/accounts/Accounts.robot - -*** Test Cases *** -create-user-001 - #新建Accounts - CreatePage 0000 xxxx2 111111 log 30 log superuser - #验证新建是否成功 - Ui-User-Search-Name 0000 Name - ${name} get text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[4]/div/div/span/span - log ${name} - Should Be Equal As Strings ${name} 0000 - #删除对象 - - -create-user-002 - #新建Accounts - CreatePage-null ${EMPTY} ${EMPTY} ${EMPTY} - - -create-user-003 - #新建Accounts - CreatePage 111111111111111111111111111111111 ${EMPTY} ${EMPTY} log - - -create-user-004 - #新建Accounts - CreatePage xiaohong kkkkkk1 aaaa log superuser - #验证新建是否成功 - Ui-User-Search-Name xiaohong Name - ${name} get text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[4]/div/div/span/span - log ${name} - Should Be Equal As Strings ${name} xiaohong - #删除对象 - - -create-user-005 - #新建Accounts - CreatePage 小红 小红1 a1@й log superuser - #验证新建是否成功 - Ui-User-Search-Name 小红 Name - ${name} get text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[4]/div/div/span/span - log ${name} - Should Be Equal As Strings ${name} 小红 - #删除对象 - - -create-user-006 - #新建Accounts - CreatePage малый малый1 малый log superuser - #验证新建是否成功 - Ui-User-Search-Name малый Name - ${name} get text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[4]/div/div/span/span - log ${name} - Should Be Equal As Strings ${name} малый - #删除对象 - - -edit-user-007 - #新建Accounts - CreatePage 修改 edit3 111111 log superuser - #验证新建是否成功 - Ui-User-Search-Name 修改 Name - ${name} get text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[4]/div/div/span/span - log ${name} - Should Be Equal As Strings ${name} 修改 - #修改对象 - User-Edit edit-1 111111 log - #查询修改对象 - Ui-User-Search-Name edit-1 - #删除对象 - - -create-user-008 - #新建Accounts - CreatePage @#!&* *^%$1 *^%$ log superuser - #验证新建是否成功 - Ui-User-Search-Name @#!&* Name - ${name} get text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[4]/div/div/span/span - log ${name} - Should Be Equal As Strings ${name} @#!&* - #删除对象 - - -edit-user-009 - #新建Accounts - CreatePage 修改ss edit1 111111 log superuser - #验证新建是否成功 - Ui-User-Search-Name 修改ss Name - ${name} get text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[4]/div/div/span/span - log ${name} - Should Be Equal As Strings ${name} 修改 - #修改对象 - User-Edit 要修改了啊 !@#¥123lyfый1 close - #查询修改对象 - Ui-User-Search-Name 要修改了啊 - #删除对象 - - -create-user-010 - #新建Accounts - CreatePage @#!&* *^%$1 *^%$ log superuser - #验证新建是否成功 - Ui-User-Search-Name * User Name - ${name} get text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[4]/div/div/span/span - #log ${name} - #Should Be Equal As Strings ${name} * - #删除对象 - - -create-user-011 - #新建Accounts - CreatePage @#!&* *^%$1 *^%$ log superuser - #验证新建是否成功 - Ui-User-Search-Name @ - ${name} get text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[4]/div/div/span/span - #log ${name} - #Should Be Equal As Strings ${name} @ - #删除对象 - - -delete-user-012 - #新建Accounts - CreatePage @#!&* *^%$1 *^%$ log superuser - #验证新建是否成功 - Ui-User-Search-Name @#!&* - ${name} get text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[4]/div/div/span/span - log ${name} - Should Be Equal As Strings ${name} @#!&* - #删除对象 - - -user-013 - - Pages - Ui-Pages 5 - #${count} Get Matching Xpath Count xpath=//*[@id="app"]/div/div[3]/div/div/div[4]/div/span[2]/div/input #获取列表数据量 - #log ${count} - -create-user-014 - #新建Accounts - Ui-Button log - diff --git a/02-Keyword/tsg_ui/Menu.robot b/02-Keyword/tsg_ui/Menu.robot index 3f75e01..7039214 100644 --- a/02-Keyword/tsg_ui/Menu.robot +++ b/02-Keyword/tsg_ui/Menu.robot @@ -15,14 +15,14 @@ Menu # 遍历一级菜单 FOR ${list} ${num} IN ENUMERATE @{dict} - run keyword if "${num}"=="${menuOne}" run keywords sleep 5 + run keyword if "${num}"=="${menuOne}" run keywords sleep 2 ... AND click element id=${dict}[${num}] ... AND LeavePrompt ${OkorCancel} END # 遍历二级菜单 FOR ${list} ${num} IN ENUMERATE @{${menuOne}} run keyword if "${num}"=="dashboard" Exit For Loop - ... ELSE IF "${num}"=="${menuTwo}" run keywords sleep 3 + ... ELSE IF "${num}"=="${menuTwo}" run keywords sleep 2 ... AND click element id=${${menuOne}}[${num}] ... AND LeavePrompt ${OkorCancel} END diff --git a/02-Keyword/tsg_ui/accounts/Accounts.robot b/02-Keyword/tsg_ui/accounts/Accounts.robot deleted file mode 100644 index 7b3b3d6..0000000 --- a/02-Keyword/tsg_ui/accounts/Accounts.robot +++ /dev/null @@ -1,126 +0,0 @@ -*** Settings *** -Library Selenium2Library - -*** Keywords *** -openbrower - Open Browser http:192.168.40.120 chrome - -CreateButton - Wait Until Element Is Enabled id=userAdd - sleep 3 - Click element id=userAdd - -Create-Name - [Arguments] ${accName} - sleep 2 - input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[1]/div/div[1]/input ${accName} - -Create-Username - [Arguments] ${accName} - sleep 2 - input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[2]/div/div[1]/input ${accName} - -Create-Password - [Arguments] ${accPasswd} - sleep 2 - input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[3]/div/div/input ${accPasswd} - -Create-Enable - [Arguments] ${accEnable} - sleep 2 - run keyword if "${accEnable}"=="close" run keywords click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[6]/div/div - ... AND sleep 1 - ... ELSE log 不操作 - -Create-Ok - sleep 1 - click button xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[2]/button[1] - -Create-Cancel - click button id=userAdd_cancel - -SelectOne - sleep 3 - click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1] - -DeleteButton - click button id=userDel - -Delete-Delete - sleep 2 - click button xpath=/html/body/div/div/div[3]/button[2] - -Delete-Cancel - click button xpath=/html/body/div[2]/div/div[3]/button[1] - -User-Delete - sleep 1 - click element id=userDel #点击删除按钮 - sleep 1 - click element xpath=/html/body/div/div/div[3]/button[2] - - -User-Edit - [Arguments] ${name} ${password} ${enable} - Sleep 2 - click element id=userEdit - Sleep 2 - input text xpath=//*[@id="app"]/div/div[3]/div/div/div/div[2]/form/div[1]/div/div[1]/input ${name} - Sleep 1 - input text xpath=//*[@id="app"]/div/div[3]/div/div/div[1]/div[2]/form/div[3]/div/div/input ${password} - Sleep 1 - run keyword if "${enable}"=="close" run keywords click element xpath=//*[@id="app"]/div/div[3]/div/div/div[1]/div[2]/form/div[4]/div/div - ... AND sleep 1 - ... ELSE log 不操作 - click element xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/button[1]/span - sleep 2 - -Ui-User-Search-Name - [Arguments] ${name} ${type} - sleep 2 - Wait Until Page Contains Element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[1]/span/div/div/div[2]/div/div/div[1]/input 20 - click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[1]/span/div/div/div[2]/div/div/div[1]/input - sleep 2 - run keyword if "${type}"=="Name" run keywords click element xpath=/html/body/div/div[1]/div[1]/ul/li[3] - ... AND sleep 1 - run keyword if "${type}"=="User Name" run keywords click element xpath=/html/body/div/div[1]/div[1]/ul/li[2] - ... AND sleep 1 - sleep 2 - input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[1]/span/div/div/div[2]/div/div[1]/div[3]/div/input ${name} - sleep 2 - click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[1]/span/div/i - sleep 2 - click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1] - sleep 2 - - -login - Input Text xpath=//*[@id="app"]/div/div[2]/div/div[2]/div/input sjy - sleep 1 - Input Text xpath=//*[@id="app"]/div/div[2]/div/div[3]/div/input 111111 - sleep 1 - click element id=login - 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 - -Ui-Button - [Arguments] ${accEnable} - Menu administartion Accounts - sleep 2 - click element id=userAdd - sleep 2 - run keyword if "${accEnable}"=="close" run keywords click element xpath=//*[@id="app"]/div/div[3]/div/div/div[1]/div[2]/form/div[4]/div/div - ... AND sleep 1 - ... ELSE log success \ No newline at end of file diff --git a/02-Keyword/tsg_ui/accounts/Accountspages.robot b/02-Keyword/tsg_ui/accounts/Accountspages.robot index 2596dac..8f92d18 100644 --- a/02-Keyword/tsg_ui/accounts/Accountspages.robot +++ b/02-Keyword/tsg_ui/accounts/Accountspages.robot @@ -1,62 +1,216 @@ *** Settings *** Library Selenium2Library -Resource Accounts.robot Resource ../Menu.robot Library Collections +Library ../../../04-CustomLibrary/Custometest/StringManipulation.py *** Keywords *** + +openbrower + Open Browser http:192.168.40.120 chrome + +CreateButton + Wait Until Element Is Enabled id=userAdd + sleep 1 + Click element id=userAdd + +Create-Name + [Arguments] ${accName} + sleep 2 + input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[1]/div/div[1]/input ${accName} + +Create-Username + [Arguments] ${accName} + sleep 2 + input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[2]/div/div[1]/input ${accName} + +Create-Password + [Arguments] ${accPasswd} + sleep 2 + input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[3]/div/div/input ${accPasswd} + +Create-Enable + [Arguments] ${accEnable} + sleep 2 + run keyword if "${accEnable}"=="close" run keywords click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[6]/div/div + ... AND sleep 1 + ... ELSE log 不操作 + +Create-Ok + sleep 1 + click button xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[2]/button[1] + +Create-Cancel + click button id=userAdd_cancel + +SelectOne + sleep 3 + click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1] + +Delete-Delete + sleep 2 + click button xpath=/html/body/div/div/div[3]/button[2] + +Delete-Cancel + click button xpath=/html/body/div[2]/div/div[3]/button[1] + +User-Delete + sleep 1 + click element id=userDel #点击删除按钮 + sleep 1 + click element xpath=/html/body/div/div/div[3]/button[2] + CreatePage [Arguments] ${name} ${username} ${accPasswd} ${Required_Password_Change} ${day} ${accEnable} ${role} Menu administration Accounts - Accounts.CreateButton - Accounts.Create-Name ${name} - Accounts.Create-Username ${username} - Accounts.Create-Password ${accPasswd} + CreateButton + Create-Name ${name} + Create-Username ${username} + Create-Password ${accPasswd} input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[4]/div/div/input ${accPasswd} - run keyword if "${Required_Password_Change}"=="open" Run Keywords click xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[5]/div/div + sleep 1 + Create-Enable ${accEnable} + sleep 1 + run keyword if "${Required_Password_Change}"=="open" Run Keywords click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[5]/div/div ... AND sleep 1 ... AND input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[6]/div/div/input ${day} ... ELSE log 不开启密码过期验证 - Accounts.Create-Enable ${accEnable} - Click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[8]/div/div/div/span/span/i + Click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[last()]/div/div/div/span/span/i sleep 1 click element //span[.="${role}"] - Accounts.Create-Ok + Create-Ok + sleep 1 +UserEdit + [Arguments] ${password} ${enable} + Sleep 2 + click element id=userEdit + Sleep 1 + Create-Password ${password} + input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[4]/div/div/input ${password} + Sleep 1 + run keyword if "${enable}"=="close" run keywords click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div/div[1]/div[2]/form/div[6]/div/div + ... AND sleep 1 + ... ELSE log 不操作 + Create-Ok + sleep 2 + +UserSearchName + [Arguments] ${name} ${type} + sleep 2 + Wait Until Page Contains Element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[1]/span/div/div/div[2]/div/div/div[1]/input 20 + click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[1]/span/div/div/div[2]/div/div/div[1]/input + sleep 2 + run keyword if "${type}"=="Name" run keywords click element xpath=/html/body/div/div[1]/div[1]/ul/li[3] + ... AND sleep 1 + run keyword if "${type}"=="UserName" run keywords click element xpath=/html/body/div/div[1]/div[1]/ul/li[2] + ... AND sleep 1 + sleep 2 + input text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[1]/span/div/div/div[2]/div/div[1]/div[3]/div/input ${name} + sleep 2 + click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[1]/span/div/i + sleep 2 + click element xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr[1] + sleep 2 + +login + [Arguments] ${UserName} ${Password} + Mouse Hover xpath=//*[@id="app"]/div/div[1]/div[2]/div/span/div/span + sleep 1 + click element xpath=//div[@class='SignOut'] + sleep 2 + input text xpath=//*[@id="app"]/div/div[2]/div/div[2]/div/input ${UserName} + sleep 1 + input text xpath=//*[@id="app"]/div/div[2]/div/div[3]/div/input ${Password} + sleep 1 + click element xpath=/html/body/div/div/div[2]/div/div[4]/button + 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 + +Ui-Button + [Arguments] ${accEnable} + Menu administartion Accounts + sleep 2 + click element id=userAdd + sleep 2 + run keyword if "${accEnable}"=="close" run keywords click element xpath=//*[@id="app"]/div/div[3]/div/div/div[1]/div[2]/form/div[4]/div/div + ... AND sleep 1 + ... ELSE log success + +TurnPage + [Arguments] ${NextPage} ${PreviousPage} ${JumpInput} ${pages} ${AssertXpath} + [Documentation] + ... ${NextPage} 下一页按钮定位 + ... ${PreviousPage} 上一页按钮定位 + ... ${JumpInput} 跳转页面输入框 + ... ${pages} 跳转得页码 + ${text1} get text xpath=${AssertXpath} + Click element xpath=${NextPage} + sleep 2 + ${text2} get text xpath=${AssertXpath} + Click element xpath=${PreviousPage} + sleep 2 + ${text3} get text xpath=${AssertXpath} + Clear Element Text xpath=${JumpInput} + sleep 2 + input text xpath=${JumpInput} ${pages} + sleep 2 + press keys xpath=${JumpInput} ENTER + sleep 2 + ${text4} get text xpath=${AssertXpath} + Click element xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[last()]/div/ul/li[last()] + sleep 2 + ${text5} get text xpath=${AssertXpath} + Should Not Be Equal ${text1} ${text2} + Should Not Be Equal ${text3} ${text2} + Should Not Be Equal ${text3} ${text4} + Should Not Be Equal ${text1} ${text5} + +PagingDisplay + [Arguments] ${Number} + Mouse Over xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/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[3]/div/div/div[4]/div/span[1] + sleep 1 + ${Quantity} StringSegmentation ${text} + sleep 1 + ${quyu} Evaluate ${Quantity}%${Number} + ${qumo} Evaluate ${Quantity}/${Number} + ${qumo} Evaluate int(${qumo}) + ${b} Set Variable ${1} + ${Page1} Evaluate ${qumo}+${b} + ${Page} Set Variable if "${qumo}" != "0" ${Page1} ${qumo} + sleep 1 + ${text} Get text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[4]/div/ul/li[last()] + Should Be Equal As Strings ${text} ${Page} DeletePage [Arguments] ${name} sleep 1 - Accounts.DeleteButton 1 - Accounts.Delete-Delete - -CreatePage-null - [Arguments] ${name} ${username} ${accPasswd} - Menu administartion Accounts - sleep 3 - Accounts.CreateButton - Accounts.Create-Name ${name} - Accounts.Create-Username ${username} - Accounts.Create-Password ${accPasswd} - Accounts.Create-Ok - sleep 2 - ${text} get text xpath=//*[@id="app"]/div/div[3]/div/div/div/div[2]/form/div[1]/div/div[3] - run keyword if "${text}"=="Name field is required." click element xpath=//*[@id="app"]/div/div[3]/div/div/div[2]/button[2] - ... ELSE IF log "name值为空,不可以新建成功" - - -CreatePage-User-Name-null - [Arguments] ${name} ${username} ${accPasswd} - Menu administartion Accounts - sleep 3 - Accounts.CreateButton - Accounts.Create-Name ${name} - Accounts.Create-Username ${username} - Accounts.Create-Password ${accPasswd} - Accounts.Create-Ok - sleep 2 - ${text} get text xpath=//*[@id="app"]/div/div[3]/div/div/div/div[2]/form/div[2]/div/div[3] - run keyword if "${text}"=="Account field is required." click element xpath=//*[@id="app"]/div/div[3]/div/div/div/div[2]/form/div[6]/div/div/button[2] - ... ELSE IF log "name值为空,不可以新建成功" + DeleteButton 1 + Delete-Delete Pages [Arguments] diff --git a/02-Keyword/tsg_ui/setting/Settings.robot b/02-Keyword/tsg_ui/setting/Settings.robot index 7f887c2..b3f50c2 100644 --- a/02-Keyword/tsg_ui/setting/Settings.robot +++ b/02-Keyword/tsg_ui/setting/Settings.robot @@ -1986,7 +1986,7 @@ SystemUsageChart ... "${type}"=="URLs_Items" or "${type}"=="URLs_Objects" //*[@id="settings_storage"]/div[1]/div[2]/div[2]/div/div/div[2]/div[6] ... "${type}"=="IPAddresses_IPV4_Items" or "${type}"=="IPAddresses_IPV6_Items" or "${type}"=="IPAddresses_IP_Objects" or "${type}"=="IPAddresses_Geography_Items" or "${type}"=="IPAddresses_Geography_Objects" or "${type}"=="IPAddresses_IPLearning_Items(IPv4)" or "${type}"=="IPAddresses_IPLearning_Objects" //*[@id="settings_storage"]/div[1]/div[2]/div[2]/div/div/div[2]/div[7] ... "${type}"=="Applications_Items" or "${type}"=="Applications_Objects" or "${type}"=="Applications_Groups_Objects" or "${type}"=="Applications_Groups_Items" or "${type}"=="Applications_Selectors_Objects" or "${type}"=="Applications_Selectors_Items" //*[@id="settings_storage"]/div[1]/div[2]/div[2]/div/div/div[2]/div[8] - sleep 1 + Wait Until Element Is Enabled /html/body/div[last()]/div[1]/div/div/div[2]/table/tbody/tr[1]/td[2]/div/span 10 ${ChartValueXpath}= SystemUsageGetText ${type} Mouse Over xpath=${ChartSuspension} sleep 1 @@ -2007,7 +2007,7 @@ SystemUsageText ... "${type}"=="URLs_Items" or "${type}"=="URLs_Objects" //*[@id="settings_storage"]/div[1]/div[2]/div[2]/div/div/div[3]/div[6] ... "${type}"=="IPAddresses_IPV4_Items" or "${type}"=="IPAddresses_IPV6_Items" or "${type}"=="IPAddresses_IP_Objects" or "${type}"=="IPAddresses_Geography_Items" or "${type}"=="IPAddresses_Geography_Objects" or "${type}"=="IPAddresses_IPLearning_Items(IPv4)" or "${type}"=="IPAddresses_IPLearning_Objects" //*[@id="settings_storage"]/div[1]/div[2]/div[2]/div/div/div[3]/div[7] ... "${type}"=="Applications_Items" or "${type}"=="Applications_Objects" or "${type}"=="Applications_Groups_Objects" or "${type}"=="Applications_Groups_Items" or "${type}"=="Applications_Selectors_Objects" or "${type}"=="Applications_Selectors_Items" //*[@id="settings_storage"]/div[1]/div[2]/div[2]/div/div/div[3]/div[8] - sleep 1 + Wait Until Element Is Enabled /html/body/div[last()]/div[1]/div/div/div[2]/table/tbody/tr[1]/td[2]/div/spa 10 ${TextValueXpath}= SystemUsageGetText ${type} Mouse Over xpath=${TextSuspension} sleep 2 @@ -2068,7 +2068,6 @@ SystemUsageObjectsSQLVerification SystemUsageGetText [Arguments] ${type} - sleep 1 ${TextValueXpath} Set Variable if "${type}"=="Proxy_Disabled" /html/body/div[last()]/div[1]/div/div/div[2]/table/tbody/tr[1]/td[2]/div/span #在文本统计获取Value定位变量赋值 ... "${type}"=="Proxy_Enabled" /html/body/div[last()]/div[1]/div/div/div[2]/table/tbody/tr[2]/td[2]/div/span ... "${type}"=="Security_Disabled" /html/body/div[last()]/div[1]/div/div/div[2]/table/tbody/tr[1]/td[2]/div/span diff --git a/04-CustomLibrary/Custometest/StringManipulation.py b/04-CustomLibrary/Custometest/StringManipulation.py new file mode 100644 index 0000000..1d70d6c --- /dev/null +++ b/04-CustomLibrary/Custometest/StringManipulation.py @@ -0,0 +1,6 @@ +from builtins import len + +def StringSegmentation(a): + b=len(a) + c=a[6:b] + return c \ No newline at end of file