Update UI testcases (#18491)

1. Update copy test case to add retries
2. Updata P2P Preheat test case to waiting
3. Update the Replication new rule button xpath

Signed-off-by: Yang Jiao <jiaoya@vmware.com>
This commit is contained in:
Yang Jiao 2023-04-07 17:22:58 +08:00 committed by GitHub
parent 5791f0c979
commit cbf0a86ba2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 27 deletions

View File

@ -2,16 +2,16 @@ Documentation This resource provides any keywords related to the Harbor private
Resource ../../resources/Util.robot
*** Keywords ***
Copy Image
[Arguments] ${tag} ${projectname} ${reponame}
[Arguments] ${tag} ${projectname} ${reponame} ${is_success}=${true}
Retry Element Click xpath=//clr-dg-row[contains(.,'${tag}')]//label
Sleep 1
Retry Action Keyword Copy Image Action ${projectname} ${reponame} ${is_success}
Copy Image Action
[Arguments] ${projectname} ${reponame} ${is_success}=${true}
Retry Element Click ${artifact_action_xpath}
Sleep 1
Retry Element Click ${artifact_action_copy_xpath}
Sleep 1
#input necessary info
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}
Retry Text Input ${copy_project_name_xpath} ${projectname}
Retry Text Input ${copy_repo_name_xpath} ${reponame}
Retry Double Keywords When Error Retry Element Click ${confirm_btn} Wait Until Element Is Not Visible ${confirm_btn}
Run Keyword If '${is_success}' == '${true}' Retry Wait Until Page Contains Copy artifact successfully

View File

@ -106,19 +106,21 @@ Execute P2P Preheat
Verify Latest Execution Result
[Arguments] ${project_name} ${policy_name} ${contain} ${not_contain}=${null} ${expected_status}=Success
Retry Double Keywords When Error Select P2P Preheat Policy ${policy_name} Wait Until Element Is Visible ${p2p_preheat_executions_refresh_xpath}
${latest_execution_id}= Get Text ${p2p_preheat_latest_execute_id_xpath}
Retry P2P Preheat Be Successful ${project_name} ${policy_name} ${latest_execution_id} ${contain} ${not_contain}
Retry Keyword N Times When Error 5 Retry P2P Preheat Be Successful ${project_name} ${policy_name} ${contain} ${not_contain}
Retry P2P Preheat Be Successful
[Arguments] ${project_name} ${policy_name} ${execution_id} ${contain} ${not_contain}=${null} ${expected_status}=Success
Retry Keyword N Times When Error 15 P2P Preheat Be Successful ${project_name} ${policy_name} ${execution_id} ${contain} ${not_contain} ${expected_status}
[Arguments] ${project_name} ${policy_name} ${contain} ${not_contain}=${null} ${expected_status}=Success
Retry Element Click ${p2p_preheat_executions_refresh_xpath}
${latest_execution_id}= Get Text ${p2p_preheat_latest_execute_id_xpath}
P2P Preheat Be Successful ${project_name} ${policy_name} ${latest_execution_id} ${contain} ${not_contain} ${expected_status}
P2P Preheat Be Successful
[Arguments] ${project_name} ${policy_name} ${execution_id} ${contain} ${not_contain}=${null} ${expected_status}=Success
${rc} ${output}= Run And Return Rc And Output curl -u ${HARBOR_ADMIN}:${HARBOR_PASSWORD} -i --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/v2.0/projects/${project_name}/preheat/policies/${policy_name}/executions/${execution_id}/tasks"
Log All ${output}
Should Be Equal As Integers ${rc} 0
Should Contain Any ${output} ${expected_status} @{contain}
Should Contain ${output} ${expected_status}
Should Contain ${output} @{contain}
${out} Run Keyword And Ignore Error Get Length ${not_contain}
Run Keyword If '${out[0]}'=='PASS' Should Not Contain Any ${output} @{not_contain}
@ -158,4 +160,4 @@ Get P2P Preheat Logs
Log All cmd:${cmd}
${rc} ${output}= Run And Return Rc And Output ${cmd}
Log All ${output}
[Return] ${output}
[Return] ${output}

View File

@ -115,12 +115,11 @@ Create A Rule With Existing Endpoint
... ${mode}=Manual ${cron}="* */59 * * * *" ${del_remote}=${false} ${filter_tag}=${false} ${filter_tag_model}=matching ${filter_label}=${false} ${filter_label_model}=matching
... ${flattening}=Flatten 1 Level ${bandwidth}=-1 ${bandwidth_unit}=Kbps
#click new
Retry Element Click ${new_name_xpath}
Retry Double Keywords When Error Retry Element Click ${new_name_xpath} Wait Until Element Is Enabled ${rule_name}
#input name
Retry Text Input ${rule_name} ${name}
Run Keyword If '${replication_mode}' == 'push' Run Keywords Retry Element Click ${replication_mode_radio_push} AND Select Dest Registry ${endpoint}
Retry Text Input ${rule_name} ${name}
Run Keyword If '${replication_mode}' == 'push' Run Keywords Retry Element Click ${replication_mode_radio_push} AND Select Dest Registry ${endpoint}
... ELSE Run Keywords Retry Element Click ${replication_mode_radio_pull} AND Select Source Registry ${endpoint}
#set filter
Retry Password Input ${filter_name_id} ${filter_project_name}
Run Keyword If '${filter_tag_model}' != 'matching' Select Filter Tag Model ${filter_tag_model}
@ -137,7 +136,6 @@ Create A Rule With Existing Endpoint
#set bandwidth
Run Keyword If '${bandwidth}' != '-1' Retry Text Input ${bandwidth_input} ${bandwidth}
Run Keyword If '${bandwidth_unit}' != 'Kbps' Select Bandwidth Unit ${bandwidth_unit}
#click save
Retry Double Keywords When Error Retry Element Click ${rule_save_button} Retry Wait Until Page Not Contains Element ${rule_save_button}
Sleep 2

View File

@ -16,7 +16,7 @@
Documentation This resource provides any keywords related to the Harbor private registry appliance
*** Variables ***
${new_name_xpath} //hbr-list-replication-rule//button[contains(.,'New')]
${new_name_xpath} //*[@id='new_replication_rule_id']
${policy_name_xpath} //*[@id='policy_name']
${policy_description_xpath} //*[@id='policy_description']
${policy_enable_checkbox} //input[@id='policy_enable']/../label

View File

@ -498,7 +498,6 @@ Test Case - Copy A Image
Sleep 1
Go Into Repo project${random_num1}/redis
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}
Sleep 1
@ -531,7 +530,6 @@ Test Case - Copy A Image And Accessory
Retry Double Keywords When Error Go Into Repo ${source_project}/${image} Should Be Signed By Cosign ${tag}
Copy Image ${tag} ${target_project} ${image}
Retry Wait Until Page Contains Copy artifact successfully
Retry Double Keywords When Error Go Into Project ${target_project} Retry Wait Until Page Contains ${image}
Retry Double Keywords When Error Go Into Repo ${target_project}/${image} Retry Wait Until Page Contains Element //clr-dg-row[contains(.,${tag})]
@ -595,11 +593,9 @@ Test Case - Project Quotas Control Under Copy
Go Into Project project_a_${d}
Go Into Repo project_a_${d}/${image_a}
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}
Copy Image ${image_b_ver} project_b_${d} ${image_b}
Retry Wait Element Not Visible ${repo_retag_confirm_dlg}
Copy Image ${image_b_ver} project_b_${d} ${image_b} is_success=${false}
Sleep 2
Go Into Project project_b_${d}
Sleep 2
@ -726,7 +722,7 @@ Test Case - Can Not Copy Image In ReadOnly Mode
Sleep 1
Enable Read Only
Go Into Repo project${random_num1}/redis
Copy Image ${image_tag} project${random_num1}${random_num2} ${target_image_name}
Copy Image ${image_tag} project${random_num1}${random_num2} ${target_image_name} is_success=${false}
Retry Wait Element Not Visible ${repo_retag_confirm_dlg}
Navigate To Projects
Go Into Project project${random_num1}${random_num2} has_image=${false}