Merge pull request #12785 from danfengliu/add-distribution-ui-test

Add distribution UI test in nightly
This commit is contained in:
stonezdj(Daojun Zhang) 2020-08-21 14:19:05 +08:00 committed by GitHub
commit b2ed195df5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 77 additions and 10 deletions

View File

@ -94,6 +94,7 @@ Cannot Push image
Wait Unitl Command Success docker login -u ${user} -p ${pwd} ${ip}
Wait Unitl Command Success docker tag ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image} ${ip}/${project}/${image}
${output}= Command Should be Failed docker push ${ip}/${project}/${image}
Log To Console ${output}
Run Keyword If '${err_msg}' != '${null}' Should Contain ${output} ${err_msg}
Run Keyword If '${err_msg_2}' != '${null}' Should Contain ${output} ${err_msg_2}
Wait Unitl Command Success docker logout ${ip}

View File

@ -159,6 +159,11 @@ Switch To Project Quotas
Retry Element Click xpath=//clr-main-container//clr-vertical-nav//a[contains(.,'Project Quotas')]
Sleep 1
Switch To Distribution
Sleep 1
Retry Element Click xpath=//clr-main-container//clr-vertical-nav-group//span[contains(.,'Distributions')]
Sleep 1
Modify Token Expiration
[Arguments] ${minutes}
Input Text xpath=//*[@id='tokenExpiration'] ${minutes}
@ -353,4 +358,23 @@ Set User Name Claim And Save
[Arguments] ${type}
Retry Text Input ${cfg_auth_user_name_claim_input} ${type}
Retry Element Click xpath=${config_auth_save_button_xpath}
Capture Page Screenshot
Capture Page Screenshot
Select Provider
[Arguments] ${provider}
Retry Element Click ${distribution_provider_select_id}
Retry Element Click ${distribution_provider_select_id}//option[contains(.,'${provider}')]
Distribution Exist
[Arguments] ${provider} ${name} ${endpoint}
Retry Wait Until Page Contains Element //div[@class='datagrid-scrolling-cells' and contains(.,'${name}') and contains(.,'${endpoint}')]
Create An New Distribution
[Arguments] ${provider} ${name} ${endpoint}
Switch To Distribution
Retry Element Click ${distribution_add_btn_id}
Select Provider ${provider}
Retry Text Input ${distribution_name_input_id} ${name}
Retry Text Input ${distribution_endpoint_id} ${endpoint}
Retry Double Keywords When Error Retry Element Click ${distribution_add_save_btn_id} Retry Wait Until Page Not Contains Element xpath=${distribution_add_save_btn_id}
Distribution Exist ${provider} ${name} ${endpoint}

View File

@ -42,5 +42,17 @@ ${checkbox_delete_untagged_artifacts} //gc-config//clr-toggle-wrapper/label[con
${cfg_auth_automatic_onboarding_checkbox} //clr-checkbox-wrapper//label[contains(@for,'oidcAutoOnboard')]
${cfg_auth_user_name_claim_input} //*[@id='oidcUserClaim']
${distribution_add_btn_id} //*[@id='new-instance']
${distribution_provider_select_id} //*[@id='provider']
${distribution_name_input_id} //*[@id='name']
${distribution_endpoint_id} //*[@id='endpoint']
${distribution_description_id} //*[@id='description']
${distribution_auth_none_mode_ratio_id} //*[@id='none_mode']
${distribution_auth_basic_mode_ratio_id} //*[@id='basic_mode']
${distribution_auth_oauth_mode_ratio_id} //*[@id='token_mode']
${distribution_enable_checkbox_id} //*[@id='enabled']
${distribution_insecure_checkbox_id} //*[@id='insecure']
${distribution_add_save_btn_id} //*[@id='instance-ok']

View File

@ -20,7 +20,7 @@ Resource ../../resources/Util.robot
*** Keywords ***
Create An New Project And Go Into Project
[Arguments] ${projectname} ${public}=false ${count_quota}=${null} ${storage_quota}=${null} ${storage_quota_unit}=${null}
[Arguments] ${projectname} ${public}=false ${count_quota}=${null} ${storage_quota}=${null} ${storage_quota_unit}=${null} ${proxy_cache}=${false} ${registry}=${null}
Navigate To Projects
Retry Button Click xpath=${create_project_button_xpath}
Log To Console Project Name: ${projectname}
@ -30,6 +30,7 @@ Create An New Project And Go Into Project
Run Keyword If '${public}' == 'true' Run Keywords Wait Until Element Is Visible And Enabled ${element_project_public} AND Retry Element Click ${element_project_public}
Run Keyword If '${count_quota}'!='${null}' Input Count Quota ${count_quota}
Run Keyword If '${storage_quota}'!='${null}' Input Storage Quota ${storage_quota} ${storage_quota_unit}
Run Keyword If '${proxy_cache}' == '${true}' Run Keywords Mouse Down ${project_proxy_cache_switcher_id} AND Mouse Up ${project_proxy_cache_switcher_id} AND Retry Element Click ${project_registry_select_id} AND Retry Element Click xpath=//select[@id='registry']//option[contains(.,'${registry}')]
Capture Page Screenshot
Retry Double Keywords When Error Retry Element Click ${create_project_OK_button_xpath} Retry Wait Until Page Not Contains Element ${create_project_OK_button_xpath}
Capture Page Screenshot

View File

@ -75,3 +75,7 @@ ${project_config_save_btn} xpath=//hbr-project-policy-config//button[contains
${project_add_count_quota_input_text_id} xpath=//*[@id='create_project_count_limit']
${project_add_storage_quota_input_text_id} xpath=//*[@id='create_project_storage_limit']
${project_add_storage_quota_unit_id} xpath=//*[@id='create_project_storage_limit_unit']
${project_proxy_cache_switcher_id} xpath=//*[@id='proxy-cache']
${project_registry_select_id} xpath=//*[@id='registry']
#//create-project//clr-toggle-wrapper/label[contains(@for,'proxy-cache')]

View File

@ -443,20 +443,20 @@ Test Case - Create An New Project With Quotas Set
Test Case - Project Storage Quotas Dispaly And Control
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${storage_quota}= Set Variable 330
${storage_quota}= Set Variable 350
${storage_quota_unit}= Set Variable MB
${image_a}= Set Variable redis
${image_b}= Set Variable logstash
${image_a_size}= Set Variable 34.15MB
${image_b_size}= Set Variable 321.03MB
${image_a_ver}= Set Variable donotremove5.0
${image_b_ver}= Set Variable do_not_remove_6.8.3
${image_a}= Set Variable one_layer
${image_b}= Set Variable redis
${image_a_size}= Set Variable 330.83MB
${image_b_size}= Set Variable 34.15MB
${image_a_ver}= Set Variable 1.0
${image_b_ver}= Set Variable donotremove5.0
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project${d} storage_quota=${storage_quota} storage_quota_unit=${storage_quota_unit}
Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image_b} tag=${image_b_ver} tag1=${image_b_ver}
${storage_quota_ret}= Get Project Storage Quota Text From Project Quotas List project${d}
Should Be Equal As Strings ${storage_quota_ret} ${image_b_size} of ${storage_quota}${storage_quota_unit}
Cannot Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image_a}:${image_a_ver} err_msg=adding 25.8 MiB of storage resource, which when updated to current usage of err_msg_2=MiB will exceed the configured upper limit of 330.0 MiB
Cannot Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image_a}:${image_a_ver} err_msg=adding 330.1 MiB of storage resource, which when updated to current usage of err_msg_2=MiB will exceed the configured upper limit of ${storage_quota}.0 MiB
Go Into Project project${d}
Delete Repo project${d}/${image_b}
Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${image_a} tag=${image_a_ver} tag1=${image_a_ver}
@ -693,3 +693,28 @@ Test Case - Read Only Mode
Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} busybox:latest
Close Browser
Test Case - Proxy Cache
${d}= Get Current Date result_format=%m%s
${registry}= Set Variable https://hub.docker.com/
${user_namespace}= Set Variable danfengliu
${image}= Set Variable for_proxy
${tag}= Set Variable 1.0
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries
Create A New Endpoint docker-hub e1${d} ${registry} ${user_namespace} Aa123456
Create An New Project And Go Into Project project${d} proxy_cache=${true} registry=e1${d}
Cannot Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} busybox:latest err_msg=can not push artifact to a proxy project
Pull Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${user_namespace}/${image} tag=${tag}
Sleep 180
Go Into Project project${d}
Go Into Repo project${d}/${user_namespace}/${image}
Close Browser
Test Case - Distribution CRUD
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
${d}= Get Current Date result_format=%m%s
Create An New Distribution Dragonfly distribution${d} https://1.1.1.2
Close Browser