Add batch delete testcase (#3981)

This commit is contained in:
sigsbee 2018-01-12 10:42:17 +08:00 committed by Yan
parent 7831a01f26
commit bf14cf4436
7 changed files with 150 additions and 8 deletions

View File

@ -55,8 +55,8 @@ Push Image With Tag
${rc} ${output}= Run And Return Rc And Output docker login -u ${user} -p ${pwd} ${ip}
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc docker tag ${image} ${tag}
${rc} ${output}= Run And Return Rc And Output docker push ${tag}
${rc}= Run And Return Rc docker tag ${image} ${ip}/${project}/${image}:${tag}
${rc} ${output}= Run And Return Rc And Output docker push ${ip}/${project}/${image}:${tag}
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc}= Run And Return Rc docker logout ${ip}

View File

@ -71,3 +71,5 @@ Create An New User
sleep 5
Wait Until Page Contains ${username}
Sleep 3

View File

@ -171,7 +171,7 @@ User Should Be Developer
User Can Not Add Member
Page Should Contain Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Developer')]
Logout Harbor
Push Image With Tag ${ip} ${user} ${pwd} ${project} hello-world ${ip}/${project}/hello-world:v1
Push Image With Tag ${ip} ${user} ${pwd} ${project} hello-world v1
User Should Be Admin
[Arguments] ${user} ${pwd} ${project} ${guest}
@ -183,7 +183,7 @@ User Should Be Admin
User Can Change Role ${guest}
Page Should Contain Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Admin')]
Logout Harbor
Push Image With Tag ${ip} ${user} ${pwd} ${project} hello-world ${ip}/${project}/hello-world:v2
Push Image With Tag ${ip} ${user} ${pwd} ${project} hello-world v2
Project Should Have Member
[Arguments] ${project} ${user}

View File

@ -189,12 +189,12 @@ Do Log Advanced Search
Go Into Repo
[Arguments] ${repoName}
Sleep 2
Click Element xpath=//*[@id="search_input"]
Click Element xpath=//hbr-filter//clr-icon
Sleep 2
Input Text xpath=//*[@id="search_input"] ${repoName}
Sleep 8
Input Text xpath=//hbr-filter//input ${repoName}
Sleep 3
Wait Until Page Contains ${repoName}
Click Element xpath=//*[@id="results"]/list-repository-ro//clr-dg-cell[contains(.,${repoName})]/a
Click Element xpath=//clr-dg-cell[contains(.,${repoName})]/a
Sleep 2
Capture Page Screenshot gointo_${repoName}.png

View File

@ -0,0 +1,56 @@
# Copyright 2016-2017 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot
*** Variables ***
${HARBOR_VERSION} v1.1.1
*** Keywords ***
Delete Success
Page Should Contain Deleted successfully
Page Should Not Contain Deleted failed
Click Element //clr-modal//button[contains(.,'CLOSE')]
Sleep 1
Partly Success
Page Should Contain Deleted successfully
Page Should Contain Deleted failed
Click Element //clr-modal//button[contains(.,'CLOSE')]
Sleep 1
Filter Object
[Arguments] ${kw}
Click Element xpath=//hbr-filter//clr-icon
Input Text xpath=//hbr-filter//input ${kw}
Sleep 1
Select Object
[Arguments] ${obj}
Click Element //clr-dg-cell[contains(.,'${obj}')]//label
Multi-delete Object
[Arguments] @{obj}
:For ${obj} in @{obj}
\ Click Element //clr-dg-row[contains(.,'${obj}')]//label
Sleep 1
Click Element //button[contains(.,'Delete')]
Sleep 2
Click Element //clr-modal//button[contains(.,'DELETE')]
Sleep 3
Select All On Current Page Object
Click Element //div[@class='datagrid-head']//label

View File

@ -40,6 +40,7 @@ Resource Harbor-Pages/Administration-Users.robot
Resource Harbor-Pages/Administration-Users_Elements.robot
Resource Harbor-Pages/Configuration.robot
Resource Harbor-Pages/Configuration_Elements.robot
Resource Harbor-Pages/ToolKit.robot
Resource Docker-Util.robot
Resource Admiral-Util.robot
Resource OVA-Util.robot

View File

@ -296,6 +296,89 @@ Test Case - Delete A Project
Project Should Be Deleted project${d}
Close Browser
Test Case - Delete Multi Project
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Create An New User ${HARBOR_URL} test${d} test${d}@vmware.com test${d} Test1@34 harbor
Create An New Project projecta${d}
Create An New Project projectb${d}
Push Image ${ip} test${d} Test1@34 projecta${d} hello-world
Filter Object project
Multi-delete Object projecta projectb
#verify delete project with image should not be deleted directly
Partly Success
Page Should Contain projecta${d}
Page Should Not Contain projectb${d}
Close Browser
Test Case - Delete Multi User
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Create An New User ${HARBOR_URL} deletea${d} testa${d}@vmware.com test${d} Test1@34 harbor
Logout Harbor
Create An New User ${HARBOR_URL} deleteb${d} testb${d}@vmware.com test${d} Test1@34 harbor
Logout Harbor
Create An New User ${HARBOR_URL} deletec${d} testc${d}@vmware.com test${d} Test1@34 harbor
Logout Harbor
Sign In Harbor ${HARBOR_URL} admin Harbor12345
Switch To User Tag
Filter Object delete
Multi-delete Object deletea deleteb deletec
#assert delete
#Delete Success comment temp wait for fixing
Click Element //clr-modal//button[contains(.,'CLOSE')]
Sleep 1
#filter object delete
Page Should Not Contain deletea
Close Browser
Test Case - Delete Multi Repo
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Create An New User ${HARBOR_URL} test${d} test${d}@vmware.com test${d} Test1@34 harbor
Create An New Project project${d}
Push Image ${ip} test${d} Test1@34 project${d} hello-world
Push Image ${ip} test${d} Test1@34 project${d} busybox
Sleep 2
Go Into Project project${d}
Multi-delete Object hello-world busybox
#verify
Delete Success
Close Browser
Test Case - Delete Multi Tag
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Create An New User ${HARBOR_URL} test${d} test${d}@vmware.com test${d} Test1@34 harbor
Create An New Project project${d}
Push Image With Tag ${ip} test${d} Test1@34 project${d} hello-world latest
Push Image With Tag ${ip} test${d} Test1@34 project${d} hello-world v1
Sleep 2
Go Into Project project${d}
Go Into Repo hello-world
Multi-delete object latest v1
#verify
Delete Success
Close Browser
Test Case - Delete Multi Member
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Create An New User ${HARBOR_URL} testa${d} testa${d}@vmware.com test${d} Test1@34 harbor
Logout Harbor
Create An New User ${HARBOR_URL} testb${d} testb${d}@vmware.com test${d} Test1@34 harbor
Logout Harbor
Create An New User ${HARBOR_URL} test${d} test${d}@vmware.com test${d} Test1@34 harbor
Create An New Project project${d}
Go Into Project project${d}
Switch To Member
Add Guest Member to project testa${d}
Add Guest Member to project testb${d}
Multi-delete Object testa${d} testb${d}
Delete Success
Page Should Not Contain testa${d}
Close Browser
Test Case - Assign Sys Admin
Init Chrome Driver
${d}= Get Current Date result_format=%m%s