Add robot account do replication test case (#16044)

Signed-off-by: Yang Jiao <jiaoya@vmware.com>
This commit is contained in:
Yang Jiao 2021-11-29 10:58:01 +08:00 committed by GitHub
parent 1d8719b7a0
commit 43912674b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 8 deletions

View File

@ -74,7 +74,7 @@ Filter Project In Project Permisstion List
Retry Text Input ${save_sys_robot_project_filter_input} ${name}
Retry Double Keywords When Error Retry Element Click ${save_sys_robot_project_filter_close_btn} Retry Wait Until Page Not Contains Element ${save_sys_robot_project_filter_input}
Clear Global Permissions By JaveScript
Clear Global Permissions By JavaScript
Retry Element Click //button[contains(., 'RESET PERMISSIONS')]
FOR ${i} IN RANGE 0 10
Execute JavaScript document.getElementsByClassName('dropdown-item')[${i}].click();
@ -100,7 +100,7 @@ Create A New System Robot Account
... Retry Element Click xpath=${sys_robot_account_expiration_type_select}//option[@value='${expiration_type}']
Run Keyword If '${description}' != '${null}' Retry Text Input ${sys_robot_account_description_textarea} ${description}
Run Keyword If '${is_cover_all}' == '${true}' Retry Double Keywords When Error Retry Element Click ${sys_robot_account_coverall_chb} Retry Checkbox Should Be Selected ${sys_robot_account_coverall_chb_input}
... ELSE Clear Global Permissions By JaveScript
... ELSE Clear Global Permissions By JavaScript
# Select project
FOR ${project} IN @{project_permission_list}
@ -119,9 +119,10 @@ Create A New System Robot Account
END
# Save it
Retry Double Keywords When Error Retry Element Click ${save_sys_robot_account_btn} Retry Wait Until Page Not Contains Element ${save_sys_robot_account_btn}
Retry Double Keywords When Error Retry Element Click ${save_sys_robot_project_paste_icon} Retry Wait Until Page Not Contains Element ${save_sys_robot_project_paste_icon}
[Return] ${name}
Retry Double Keywords When Error Retry Element Click ${save_sys_robot_export_to_file_btn} Retry Wait Until Page Not Contains Element ${save_sys_robot_export_to_file_btn}
# Get Robot Account Info
${id} ${name} ${secret} ${creation_time} ${expires_at}= Get Robot Account Info By File ${download_directory}/robot$${name}.json
[Return] ${name} ${secret}
System Robot Account Exist
[Arguments] ${name} ${project_count}
@ -130,3 +131,13 @@ System Robot Account Exist
${projects}= Set Variable If '${project_count}' == 'all' All projects with ${project_count} PROJECT
Retry Wait Until Page Contains Element //clr-dg-row[contains(.,'${name}') and contains(.,'${projects}')]
Get Robot Account Info By File
[Arguments] ${file_path}
Retry File Should Exist ${file_path}
${json}= Load Json From File ${file_path}
${id}= Set Variable ${json["id"]}
${name}= Set Variable ${json["name"]}
${secret}= Set Variable ${json["secret"]}
${creation_time}= Set Variable ${json["creation_time"]}
${expires_at}= Set Variable ${json["expires_at"]}
[Return] ${id} ${name} ${secret} ${creation_time} ${expires_at}

View File

@ -25,8 +25,8 @@ ${sys_robot_account_coverall_chb_input} xpath=//input[@id='coverAll']
${sys_robot_account_coverall_chb} //clr-checkbox-wrapper[contains(@class, 'clr-checkbox-wrapper')]/label[contains(@for, 'coverAll')]
${sys_robot_account_permission_list_btn} //form/section//clr-dropdown/button
${save_sys_robot_account_btn} //*[@id='system-robot-save']
${save_sys_robot_export_to_file_btn} //section//button
${save_sys_robot_project_filter_chb} //clr-dg-string-filter/clr-dg-filter//cds-icon
${save_sys_robot_project_filter_input} //input[contains(@name, 'search')]
${save_sys_robot_project_filter_close_btn} //button/cds-icon[contains(@title, 'Close')]
${save_sys_robot_project_paste_icon} //hbr-copy-input//clr-icon

View File

@ -807,7 +807,7 @@ Test Case - System Robot Account Cover All Projects
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project ${pro_name}
${name}= Create A New System Robot Account is_cover_all=${true}
${name} ${secret}= Create A New System Robot Account is_cover_all=${true}
Navigate To Projects
Switch To Robot Account
System Robot Account Exist ${name} all
@ -821,7 +821,7 @@ Test Case - System Robot Account
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
${project_permission_list}= Create A Random Project Permission List ${project_count}
${name}= Create A New System Robot Account project_permission_list=${project_permission_list}
${name} ${secret}= Create A New System Robot Account project_permission_list=${project_permission_list}
System Robot Account Exist ${name} ${project_count}
Close Browser

View File

@ -389,3 +389,40 @@ Test Case - Image Namespace Level Flattening
&{image3_with_tag}= Create Dictionary image=level_1/level_2/level_3/level_4/test_image_3 tag=tag.3 total_artifact_count=1 archive_count=0
@{src_images}= Create List '&{image1_with_tag}' '&{image2_with_tag}' '&{image3_with_tag}'
Replication With Flattening ${src_endpoint} 20 Flatten 3 Levels level_1/level_2/ @{src_images}
Test Case - Robot Account Do Replication
[tags] robot_account_do_replication
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project_dest${d}
# create system Robot Account
${robot_account_name} ${robot_account_secret}= Create A New System Robot Account is_cover_all=${true}
# logout and login source
Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
# push mode
Create An New Project And Go Into Project project${d}
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} hello-world:latest
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} busybox:latest
Switch To Registries
Create A New Endpoint harbor e${d} https://${ip1} ${robot_account_name} ${robot_account_secret}
Switch To Replication Manage
Create A Rule With Existing Endpoint rule_push_${d} push project${d}/* image e${d} project_dest${d}
Select Rule And Replicate rule_push_${d}
Retry Wait Until Page Contains Succeeded
Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Image Should Be Replicated To Project project_dest${d} hello-world period=0
Image Should Be Replicated To Project project_dest${d} busybox period=0
# pull mode
Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project And Go Into Project project_dest${d}
Switch To Replication Manage
Create A Rule With Existing Endpoint rule_pull_${d} pull project_dest${d}/* image e${d} project_dest${d}
Select Rule And Replicate rule_pull_${d}
Retry Wait Until Page Contains Succeeded
Image Should Be Replicated To Project project_dest${d} hello-world period=0
Image Should Be Replicated To Project project_dest${d} busybox period=0
Close Browser