mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-22 16:48:30 +01:00
Modify elements locator in nightly tests
1. Modify get signature API in sign image test; 2. Modify locator for tag in artifact list; Signed-off-by: danfengliu <danfengl@vmware.com>
This commit is contained in:
parent
e1a1e4d121
commit
deb225b0f2
@ -231,12 +231,12 @@ Click Scan Now
|
||||
|
||||
|
||||
Enable Read Only
|
||||
${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X PUT -d '{"read_only":true}' "https://${ip}/api/configurations"
|
||||
${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X PUT -d '{"read_only":true}' "https://${ip}/api/v2.0/configurations"
|
||||
Log To Console ${output}
|
||||
Should Be Equal As Integers ${rc} 0
|
||||
|
||||
Disable Read Only
|
||||
${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X PUT -d '{"read_only":false}' "https://${ip}/api/configurations"
|
||||
${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X PUT -d '{"read_only":false}' "https://${ip}/api/v2.0/configurations"
|
||||
Log To Console ${output}
|
||||
Should Be Equal As Integers ${rc} 0
|
||||
|
||||
|
22
tests/resources/Harbor-Pages/Project-Artifact-Elements.robot
Normal file
22
tests/resources/Harbor-Pages/Project-Artifact-Elements.robot
Normal file
@ -0,0 +1,22 @@
|
||||
# Copyright Project Harbor Authors
|
||||
#
|
||||
# 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
|
||||
|
||||
*** Variables ***
|
||||
${artifact_action_xpath} //clr-dg-action-bar/clr-dropdown/span[contains(@class,'dropdown-toggle')]
|
||||
${artifact_action_delete_xpath} //clr-dropdown-menu//div[contains(.,'Delete')]
|
||||
${artifact_action_copy_xpath} //clr-dropdown-menu//div[contains(.,'Copy') and @aria-label='retag']
|
||||
|
19
tests/resources/Harbor-Pages/Project-Artifact.robot
Normal file
19
tests/resources/Harbor-Pages/Project-Artifact.robot
Normal file
@ -0,0 +1,19 @@
|
||||
# Copyright Project Harbor Authors
|
||||
#
|
||||
# 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
|
||||
|
||||
*** Keywords ***
|
@ -4,12 +4,11 @@ Documentation This resource provides any keywords related to the Harbor private
|
||||
*** Variables ***
|
||||
|
||||
${retag_btn} //clr-dg-action-bar//button[contains(.,'Retag')]
|
||||
${project-name_xpath} //*[@id='project-name']
|
||||
${repo-name_xpath} //*[@id='repo-name']
|
||||
${tag-name_xpath} //*[@id='tag-name']
|
||||
${copy_project_name_xpath} //*[@id='project-name']
|
||||
${copy_repo_name_xpath} //*[@id='repo-name']
|
||||
${tag_name_xpath} //*[@id='tag-name']
|
||||
${confirm_btn} //button[contains(.,'CONFIRM')]
|
||||
${target_image_name} target-alpine
|
||||
${target_tag_value} 3.2.10-target
|
||||
${tag_value_xpath} //clr-dg-row[contains(.,'${target_tag_value}')]
|
||||
${image_tag} 3.2.10-alpine
|
||||
${tag_value_xpath} //clr-dg-row[contains(.,'${image_tag}')]
|
||||
${modal-dialog} div.modal-dialog
|
@ -3,12 +3,15 @@ Resource ../../resources/Util.robot
|
||||
|
||||
*** Keywords ***
|
||||
|
||||
Retag Image
|
||||
[Arguments] ${tag} ${projectname} ${reponame} ${tagname}
|
||||
Copy Image
|
||||
[Arguments] ${tag} ${projectname} ${reponame}
|
||||
Retry Element Click xpath=//clr-dg-row[contains(.,'${tag}')]//label
|
||||
Retry Element Click xpath=${retag_btn}
|
||||
Sleep 1
|
||||
Retry Element Click ${artifact_action_xpath}
|
||||
Sleep 1
|
||||
Retry Element Click ${artifact_action_copy_xpath}
|
||||
Sleep 1
|
||||
#input necessary info
|
||||
Retry Text Input xpath=${project-name_xpath} ${projectname}
|
||||
Retry Text Input xpath=${repo-name_xpath} ${reponame}
|
||||
Retry Text Input xpath=${tag-name_xpath} ${tagname}
|
||||
Retry Text Input xpath=${copy_project_name_xpath} ${projectname}
|
||||
Retry Text Input xpath=${copy_repo_name_xpath} ${reponame}
|
||||
Retry Double Keywords When Error Retry Element Click ${confirm_btn} Retry Wait Until Page Not Contains Element ${confirm_btn}
|
@ -63,7 +63,9 @@ Multi-delete Object
|
||||
\ Retry Element Click ${element}
|
||||
Sleep 1
|
||||
Capture Page Screenshot
|
||||
Retry Element Click ${delete_btn}
|
||||
Retry Element Click ${artifact_action_xpath}
|
||||
Sleep 1
|
||||
Retry Element Click ${artifact_action_delete_xpath}
|
||||
Sleep 1
|
||||
Capture Page Screenshot
|
||||
Retry Element Click ${repo_delete_on_card_view_btn}
|
||||
|
@ -56,7 +56,7 @@ Scan Repo
|
||||
|
||||
Summary Chart Should Display
|
||||
[Arguments] ${tagname}
|
||||
Retry Wait Until Page Contains Element //clr-dg-row[contains(.,'${tagname}')]//hbr-vulnerability-bar//hbr-result-tip-histogram
|
||||
Retry Wait Until Page Contains Element //artifact-list-tab//clr-dg-row[contains(.,'${tagname}')]//clr-dg-cell//clr-tooltip
|
||||
|
||||
Enable Scan On Push
|
||||
Checkbox Should Not Be Selected //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//input
|
||||
|
@ -93,7 +93,7 @@ Switch To LDAP
|
||||
Enable Notary Client
|
||||
${rc} ${output}= Run And Return Rc And Output rm -rf ~/.docker/
|
||||
Log ${rc}
|
||||
${rc} ${output}= Run And Return Rc and Output curl -o /notary_ca.crt -s -k -X GET --header 'Accept: application/json' -u 'admin:Harbor12345' 'https://${ip}/api/systeminfo/getcert'
|
||||
${rc} ${output}= Run And Return Rc and Output curl -o /notary_ca.crt -s -k -X GET --header 'Accept: application/json' -u 'admin:Harbor12345' 'https://${ip}/api/v2.0/systeminfo/getcert'
|
||||
Log ${output}
|
||||
Should Be Equal As Integers ${rc} 0
|
||||
|
||||
|
@ -106,10 +106,11 @@ Body Of Admin Push Signed Image
|
||||
Log ${output}
|
||||
Should Be Equal As Integers ${rc} 0
|
||||
|
||||
${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/repositories/library/${image}/signatures"
|
||||
${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/v2.0/projects/library/repositories/${image}/artifacts/latest?with_signature=true"
|
||||
|
||||
Log To Console ${output}
|
||||
Should Be Equal As Integers ${rc} 0
|
||||
Should Contain ${output} sha256
|
||||
Should Contain ${output} "signed":true
|
||||
|
||||
Run Keyword If ${with_remove} == ${true} Remove Notary Signature ${ip} ${image}
|
||||
|
||||
|
@ -39,12 +39,14 @@ Resource Harbor-Pages/Project-Webhooks.robot
|
||||
Resource Harbor-Pages/Project-Webhooks_Elements.robot
|
||||
Resource Harbor-Pages/Project-Repository.robot
|
||||
Resource Harbor-Pages/Project-Repository_Elements.robot
|
||||
Resource Harbor-Pages/Project-Artifact.robot
|
||||
Resource Harbor-Pages/Project-Artifact-Elements.robot
|
||||
Resource Harbor-Pages/Project-Config.robot
|
||||
Resource Harbor-Pages/Project-Config-Elements.robot
|
||||
Resource Harbor-Pages/Project-Helmcharts.robot
|
||||
Resource Harbor-Pages/Project-Helmcharts_Elements.robot
|
||||
Resource Harbor-Pages/Project-Retag.robot
|
||||
Resource Harbor-Pages/Project-Retag_Elements.robot
|
||||
Resource Harbor-Pages/Project-Copy.robot
|
||||
Resource Harbor-Pages/Project-Copy-Elements.robot
|
||||
Resource Harbor-Pages/Project-Tag-Retention.robot
|
||||
Resource Harbor-Pages/Project-Tag-Retention_Elements.robot
|
||||
Resource Harbor-Pages/Project_Robot_Account.robot
|
||||
|
@ -312,7 +312,7 @@ Test Case - Delete Multi Repo
|
||||
Delete Success hello-world busybox
|
||||
Close Browser
|
||||
|
||||
Test Case - Delete Multi Tag
|
||||
Test Case - Delete Multi Artifacts
|
||||
Init Chrome Driver
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
Sign In Harbor ${HARBOR_URL} user014 Test1@34
|
||||
@ -324,7 +324,7 @@ Test Case - Delete Multi Tag
|
||||
@{tag_list} Create List 3.2.10-alpine 4.0.7-alpine
|
||||
Multi-delete object ${tag_delete_btn} @{tag_list}
|
||||
# Verify
|
||||
Delete Success 3.2.10-alpine 4.0.7-alpine
|
||||
Delete Success sha256:dd179737 sha256:28a85227
|
||||
Close Browser
|
||||
|
||||
Test Case - Delete Repo on CardView
|
||||
@ -408,7 +408,7 @@ Test Case - Developer Operate Labels
|
||||
Retry Wait Until Page Not Contains Element xpath=//a[contains(.,'Labels')]
|
||||
Close Browser
|
||||
|
||||
Test Case - Retag A Image Tag
|
||||
Test Case - Copy A Image
|
||||
Init Chrome Driver
|
||||
${random_num1}= Get Current Date result_format=%m%s
|
||||
${random_num2}= Evaluate str(random.randint(1000,9999)) modules=random
|
||||
@ -422,7 +422,7 @@ Test Case - Retag A Image Tag
|
||||
Push Image With Tag ${ip} user028 Test1@34 project${random_num1} redis ${image_tag}
|
||||
Sleep 1
|
||||
Go Into Repo project${random_num1}/redis
|
||||
Retag Image ${image_tag} project${random_num1}${random_num2} ${target_image_name} ${target_tag_value}
|
||||
Copy Image ${image_tag} project${random_num1}${random_num2} ${target_image_name}
|
||||
Retry Wait Element Not Visible ${repo_retag_confirm_dlg}
|
||||
Navigate To Projects
|
||||
Go Into Project project${random_num1}${random_num2}
|
||||
@ -481,6 +481,26 @@ Test Case - Project Image And Chart Artifact Count Quotas Dispaly And Control
|
||||
Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} busybox
|
||||
Close Browser
|
||||
|
||||
# Make sure image logstash was pushed to harbor for the 1st time, so GC will delete it.
|
||||
Test Case - Project Quotas Control Under GC
|
||||
Init Chrome Driver
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
${storage_quota}= Set Variable 200
|
||||
${storage_quota_unit}= Set Variable MB
|
||||
${image_a}= Set Variable logstash
|
||||
${image_a_size}= Set Variable 321.03MB
|
||||
${image_a_ver}= Set Variable 6.8.3
|
||||
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
||||
Capture Page Screenshot
|
||||
Create An New Project project${d} storage_quota=${storage_quota} storage_quota_unit=${storage_quota_unit}
|
||||
Capture Page Screenshot
|
||||
Cannot Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image_a}:${image_a_ver} err_msg=will exceed the configured upper limit of 200.0 MiB
|
||||
Capture Page Screenshot
|
||||
GC Now ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
||||
@{param} Create List project${d}
|
||||
Retry Keyword When Return Value Mismatch Get Project Storage Quota Text From Project Quotas List 0Byte of ${storage_quota}${storage_quota_unit} 60 @{param}
|
||||
Close Browser
|
||||
|
||||
Test Case - Project Storage Quotas Dispaly And Control
|
||||
Init Chrome Driver
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
@ -510,7 +530,7 @@ Test Case - Project Storage Quotas Dispaly And Control
|
||||
Should Be Equal As Strings ${storage_quota_ret} ${image_a_size} of ${storage_quota}${storage_quota_unit}
|
||||
Close Browser
|
||||
|
||||
Test Case - Project Quotas Control Under Retag
|
||||
Test Case - Project Quotas Control Under Copy
|
||||
Init Chrome Driver
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
${count_quota}= Set Variable 1
|
||||
@ -525,11 +545,11 @@ Test Case - Project Quotas Control Under Retag
|
||||
Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project_a_${d} ${image_b} tag=${image_b_ver} tag1=${image_b_ver}
|
||||
Go Into Project project_a_${d}
|
||||
Go Into Repo project_a_${d}/${image_a}
|
||||
Retag Image ${image_a_ver} project_b_${d} ${image_a} ${image_a_ver}
|
||||
Copy Image ${image_a_ver} project_b_${d} ${image_a}
|
||||
Retry Wait Element Not Visible ${repo_retag_confirm_dlg}
|
||||
Go Into Project project_a_${d}
|
||||
Go Into Repo project_a_${d}/${image_b}
|
||||
Retag Image ${image_b_ver} project_b_${d} ${image_b} ${image_b_ver}
|
||||
Copy Image ${image_b_ver} project_b_${d} ${image_b}
|
||||
Retry Wait Element Not Visible ${repo_retag_confirm_dlg}
|
||||
Sleep 2
|
||||
Go Into Project project_b_${d}
|
||||
@ -540,25 +560,6 @@ Test Case - Project Quotas Control Under Retag
|
||||
Capture Page Screenshot
|
||||
Close Browser
|
||||
|
||||
Test Case - Project Quotas Control Under GC
|
||||
Init Chrome Driver
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
${storage_quota}= Set Variable 200
|
||||
${storage_quota_unit}= Set Variable MB
|
||||
${image_a}= Set Variable logstash
|
||||
${image_a_size}= Set Variable 321.03MB
|
||||
${image_a_ver}= Set Variable 6.8.3
|
||||
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
||||
Capture Page Screenshot
|
||||
Create An New Project project${d} storage_quota=${storage_quota} storage_quota_unit=${storage_quota_unit}
|
||||
Capture Page Screenshot
|
||||
Cannot Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image_a}:${image_a_ver} err_msg=will exceed the configured upper limit of 200.0 MiB
|
||||
Capture Page Screenshot
|
||||
GC Now ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
||||
@{param} Create List project${d}
|
||||
Retry Keyword When Return Value Mismatch Get Project Storage Quota Text From Project Quotas List 0Byte of ${storage_quota}${storage_quota_unit} 60 @{param}
|
||||
Close Browser
|
||||
|
||||
Test Case - Create New Webhook
|
||||
Init Chrome Driver
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
@ -658,7 +659,7 @@ Test Case - Read Only Mode
|
||||
Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} busybox:latest
|
||||
Close Browser
|
||||
|
||||
Test Case - Can Not Retag Image In ReadOnly Mode
|
||||
Test Case - Can Not Copy Image In ReadOnly Mode
|
||||
Init Chrome Driver
|
||||
${random_num1}= Get Current Date result_format=%m%s
|
||||
${random_num2}= Evaluate str(random.randint(1000,9999)) modules=random
|
||||
@ -673,7 +674,7 @@ Test Case - Can Not Retag Image In ReadOnly Mode
|
||||
Sleep 1
|
||||
Enable Read Only
|
||||
Go Into Repo project${random_num1}/redis
|
||||
Retag Image ${image_tag} project${random_num1}${random_num2} ${target_image_name} ${target_tag_value}
|
||||
Copy Image ${image_tag} project${random_num1}${random_num2} ${target_image_name}
|
||||
Retry Wait Element Not Visible ${repo_retag_confirm_dlg}
|
||||
Navigate To Projects
|
||||
Go Into Project project${random_num1}${random_num2} has_image=${false}
|
||||
|
Loading…
Reference in New Issue
Block a user