From 97b285168a88f37e5de8ac04800ab8775eb4977c Mon Sep 17 00:00:00 2001 From: Yang Jiao <72076317+YangJiao0817@users.noreply.github.com> Date: Wed, 13 Sep 2023 16:14:34 +0800 Subject: [PATCH] Refactor unstable test cases (#19350) Fix #19282 Signed-off-by: Yang Jiao --- .../Harbor-Pages/Administration-Users.robot | 2 +- .../Harbor-Pages/Configuration.robot | 10 +++++----- .../Harbor-Pages/Configuration_Elements.robot | 10 +++++----- .../resources/Harbor-Pages/GC_Elements.robot | 2 +- .../resources/Harbor-Pages/Log_Rotation.robot | 2 +- .../Harbor-Pages/Project-Config.robot | 2 +- .../resources/Harbor-Pages/Project-Copy.robot | 2 +- .../Harbor-Pages/Project-Members.robot | 6 +++--- .../Project-Members_Elements.robot | 2 +- .../Harbor-Pages/Project-P2P-Preheat.robot | 2 +- .../Harbor-Pages/Project-Repository.robot | 2 +- .../Harbor-Pages/Project-Webhooks.robot | 4 ++-- tests/resources/Harbor-Pages/Project.robot | 9 +++++---- .../Harbor-Pages/Project_Elements.robot | 12 +++++------ .../Harbor-Pages/Public_Elements.robot | 4 ++-- .../resources/Harbor-Pages/Replication.robot | 4 ++-- .../Harbor-Pages/Replication_Elements.robot | 20 +++++++++---------- .../Harbor-Pages/Robot_Account.robot | 2 +- .../Harbor-Pages/Robot_Account_Elements.robot | 2 +- tests/resources/Harbor-Pages/ToolKit.robot | 14 ++++++------- tests/resources/Harbor-Pages/Verify.robot | 4 ++-- .../Harbor-Pages/Vulnerability.robot | 10 +++++----- tests/robot-cases/Group1-Nightly/Common.robot | 10 +++++----- tests/robot-cases/Group1-Nightly/OIDC.robot | 2 +- 24 files changed, 70 insertions(+), 69 deletions(-) diff --git a/tests/resources/Harbor-Pages/Administration-Users.robot b/tests/resources/Harbor-Pages/Administration-Users.robot index 86ba32f5123..6500ab4e4d9 100644 --- a/tests/resources/Harbor-Pages/Administration-Users.robot +++ b/tests/resources/Harbor-Pages/Administration-Users.robot @@ -25,7 +25,7 @@ Assign User Admin Input Text xpath=//harbor-user//hbr-filter//input ${user} Sleep 2 #select checkbox - Retry Element Click //clr-dg-row[contains(.,'${user}')]//label + Retry Element Click //clr-dg-row[contains(.,'${user}')]//label[contains(@class,'clr-control-label')] #click assign admin Retry Element Click //*[@id='set-admin'] Sleep 1 diff --git a/tests/resources/Harbor-Pages/Configuration.robot b/tests/resources/Harbor-Pages/Configuration.robot index a7c9b32f083..68b3a565a45 100644 --- a/tests/resources/Harbor-Pages/Configuration.robot +++ b/tests/resources/Harbor-Pages/Configuration.robot @@ -245,7 +245,7 @@ Create New Labels Update A Label [Arguments] ${labelname} - Retry Element Click xpath=//clr-dg-row[contains(.,'${labelname}')]//div[contains(@class,'clr-checkbox-wrapper')]//label + Retry Element Click xpath=//clr-dg-row[contains(.,'${labelname}')]//div[contains(@class,'clr-checkbox-wrapper')]//label[contains(@class,'clr-control-label')] Sleep 1 Retry Element Click xpath=//button[contains(.,'Edit')] Sleep 1 @@ -256,7 +256,7 @@ Update A Label Delete A Label [Arguments] ${labelname} - Retry Element Click xpath=//clr-dg-row[contains(.,'${labelname}')]//div[contains(@class,'clr-checkbox-wrapper')]//label + Retry Element Click xpath=//clr-dg-row[contains(.,'${labelname}')]//div[contains(@class,'clr-checkbox-wrapper')]//label[contains(@class,'clr-control-label')] Sleep 1 Retry Element Click xpath=//button[contains(.,'Delete')] Sleep 3 @@ -312,7 +312,7 @@ Set User Name Claim And Save Select Distribution [Arguments] ${name} - Retry Element Click //clr-dg-row[contains(.,'${name}')]//div[contains(@class,'clr-checkbox-wrapper')]/label + Retry Element Click //clr-dg-row[contains(.,'${name}')]//div[contains(@class,'clr-checkbox-wrapper')]/label[contains(@class,'clr-control-label')] Distribution Exist [Arguments] ${name} ${endpoint} @@ -349,7 +349,7 @@ Delete A Distribution ${is_exsit} evaluate not ${deletable} Switch To Distribution Filter Distribution List ${name} ${endpoint} - Retry Double Keywords When Error Select Distribution ${name} Wait Until Element Is Visible //clr-datagrid//clr-dg-footer//clr-checkbox-wrapper/label + Retry Double Keywords When Error Select Distribution ${name} Wait Until Element Is Visible //clr-datagrid//clr-dg-footer//clr-checkbox-wrapper/label[contains(@class,'clr-control-label')] Retry Double Keywords When Error Retry Element Click ${distribution_action_btn_id} Wait Until Element Is Visible And Enabled ${distribution_del_btn_id} Retry Double Keywords When Error Retry Element Click ${distribution_del_btn_id} Wait Until Element Is Visible And Enabled ${delete_confirm_btn} Retry Double Keywords When Error Retry Element Click ${delete_confirm_btn} Retry Wait Until Page Not Contains Element ${delete_confirm_btn} @@ -359,7 +359,7 @@ Edit A Distribution [Arguments] ${name} ${endpoint} ${new_endpoint}=${null} Switch To Distribution Filter Distribution List ${name} ${endpoint} - Retry Double Keywords When Error Select Distribution ${name} Wait Until Element Is Visible //clr-datagrid//clr-dg-footer//clr-checkbox-wrapper/label times=9 + Retry Double Keywords When Error Select Distribution ${name} Wait Until Element Is Visible //clr-datagrid//clr-dg-footer//clr-checkbox-wrapper/label[contains(@class,'clr-control-label')] times=9 Retry Double Keywords When Error Retry Element Click ${distribution_action_btn_id} Wait Until Element Is Visible And Enabled ${distribution_edit_btn_id} Retry Double Keywords When Error Retry Element Click ${distribution_edit_btn_id} Wait Until Element Is Visible And Enabled ${distribution_name_input_id} Retry Text Input ${distribution_endpoint_id} ${new_endpoint} diff --git a/tests/resources/Harbor-Pages/Configuration_Elements.robot b/tests/resources/Harbor-Pages/Configuration_Elements.robot index 05a9bbb03a9..b4e1ee3707a 100644 --- a/tests/resources/Harbor-Pages/Configuration_Elements.robot +++ b/tests/resources/Harbor-Pages/Configuration_Elements.robot @@ -35,9 +35,9 @@ ${configuration_system_wl_add_confirm_btn} //*[@id='add-to-system'] ${configuration_system_wl_delete_a_cve_id_icon} //app-security//form/section//ul/li[1]/a[2]/clr-icon ${configuration_sys_repo_readonly_chb_id} //*[@id='repo_read_only_lbl'] ${cve_allowlist_expires_btn} //clr-date-container[.//div[@class='clr-input-group' and not(@hidden)]]//button -${cve_allowlist_expires_yesterday} //td[.//button[@class='day-btn is-today']]/preceding-sibling::td[1] -${cve_allowlist_expires_tomorrow} //td[.//button[@class='day-btn is-today']]/following-sibling::td[1] -${cfg_auth_automatic_onboarding_checkbox} //clr-checkbox-wrapper//label[contains(@for,'oidcAutoOnboard')] +${cve_allowlist_expires_yesterday} //td[.//button[@class='day-btn is-today']]/preceding::td[1] +${cve_allowlist_expires_tomorrow} //td[.//button[@class='day-btn is-today']]/following::td[1] +${cfg_auth_automatic_onboarding_checkbox} //clr-checkbox-wrapper//label[contains(@class,'clr-control-label') and contains(@for,'oidcAutoOnboard')] ${cfg_auth_user_name_claim_input} //*[@id='oidcUserClaim'] ${cfg_auth_ldap_group_admin_dn} //*[@id='ldapGroupAdminDN'] @@ -62,6 +62,6 @@ ${filter_dist_input} //hbr-filter//input ${audit_log_forward_syslog_endpoint_input_id} //*[@id='auditLogForwardEndpoint'] ${skip_audit_log_database_checkbox} //*[@id='skipAuditLogDatabase'] -${skip_audit_log_database_label} //clr-checkbox-wrapper//label[contains(@for,'skipAuditLogDatabase')] -${retain_image_last_pull_time_label} //clr-checkbox-wrapper//label[contains(@for,'scannerSkipUpdatePullTime')] +${skip_audit_log_database_label} //clr-checkbox-wrapper//label[contains(@class,'clr-control-label') and contains(@for,'skipAuditLogDatabase')] +${retain_image_last_pull_time_label} //clr-checkbox-wrapper//label[contains(@class,'clr-control-label') and contains(@for,'scannerSkipUpdatePullTime')] ${retain_image_last_pull_time_checkbox} //*[@id='scannerSkipUpdatePullTime'] diff --git a/tests/resources/Harbor-Pages/GC_Elements.robot b/tests/resources/Harbor-Pages/GC_Elements.robot index b3b454d6f5f..a87cc02be64 100644 --- a/tests/resources/Harbor-Pages/GC_Elements.robot +++ b/tests/resources/Harbor-Pages/GC_Elements.robot @@ -19,7 +19,7 @@ Documentation This resource provides any keywords related to the Harbor private ${gc_page_xpath} //clr-main-container//clr-vertical-nav-group//span[contains(.,'Clean Up')] ${gc_now_button} //*[@id='gc-now'] ${dry_run_button} //*[@id='gc-dry-run'] -${checkbox_delete_untagged_artifacts} //gc-config//clr-toggle-wrapper/label[contains(@for,'delete_untagged')] +${checkbox_delete_untagged_artifacts} //gc-config//clr-toggle-wrapper/label[contains(@class,'clr-control-label') and contains(@for,'delete_untagged')] ${latest_job_id_xpath} //clr-datagrid//div//clr-dg-row[1]//clr-dg-cell[1] ${gc_schedule_edit_btn} //*[@id='editSchedule'] ${gc_schedule_select} //*[@id='selectPolicy'] diff --git a/tests/resources/Harbor-Pages/Log_Rotation.robot b/tests/resources/Harbor-Pages/Log_Rotation.robot index b6270a6b3a2..35e219e13de 100644 --- a/tests/resources/Harbor-Pages/Log_Rotation.robot +++ b/tests/resources/Harbor-Pages/Log_Rotation.robot @@ -32,7 +32,7 @@ Purge Now Click Exclude Operation [Arguments] @{exclude_operations} FOR ${element} IN @{exclude_operations} - Retry Element Click //form//div//label[contains(.,'${element}')] + Retry Element Click //form//div//label[contains(@class,'clr-control-label') and contains(.,'${element}')] END Verify Last completed Time diff --git a/tests/resources/Harbor-Pages/Project-Config.robot b/tests/resources/Harbor-Pages/Project-Config.robot index 03d6c6eda41..aaec6cc20ae 100644 --- a/tests/resources/Harbor-Pages/Project-Config.robot +++ b/tests/resources/Harbor-Pages/Project-Config.robot @@ -8,7 +8,7 @@ Resource ../../resources/Util.robot Goto Project Config Retry Element Click //project-detail//ul/li[contains(.,'Summary')] - Retry Double Keywords When Error Retry Element Click //project-detail//ul/li[contains(.,'Configuration')] Retry Wait Element //clr-checkbox-wrapper/label[contains(.,'Prevent vulnerable images from running.')] + Retry Double Keywords When Error Retry Element Click //project-detail//ul/li[contains(.,'Configuration')] Retry Wait Element //clr-checkbox-wrapper/label[contains(@class,'clr-control-label') and contains(.,'Prevent vulnerable images from running.')] Click Project Public Mouse Down //hbr-project-policy-config//input[@name='public'] diff --git a/tests/resources/Harbor-Pages/Project-Copy.robot b/tests/resources/Harbor-Pages/Project-Copy.robot index c7b8d4004fc..05aa3fb5aa3 100644 --- a/tests/resources/Harbor-Pages/Project-Copy.robot +++ b/tests/resources/Harbor-Pages/Project-Copy.robot @@ -4,7 +4,7 @@ Resource ../../resources/Util.robot *** Keywords *** Copy Image [Arguments] ${tag} ${projectname} ${reponame} ${is_success}=${true} - Retry Element Click xpath=//clr-dg-row[contains(.,'${tag}')]//label + Retry Element Click xpath=//clr-dg-row[contains(.,'${tag}')]//label[contains(@class,'clr-control-label')] Retry Action Keyword Copy Image Action ${projectname} ${reponame} ${is_success} Copy Image Action diff --git a/tests/resources/Harbor-Pages/Project-Members.robot b/tests/resources/Harbor-Pages/Project-Members.robot index bd877846129..e4de3f590df 100644 --- a/tests/resources/Harbor-Pages/Project-Members.robot +++ b/tests/resources/Harbor-Pages/Project-Members.robot @@ -56,13 +56,13 @@ Change Member Role User Can Change Role [arguments] ${username} - Retry Element Click xpath=//clr-dg-row[contains(.,'${username}')]//input/../label + Retry Element Click xpath=//clr-dg-row[contains(.,'${username}')]//input/../label[contains(@class,'clr-control-label')] Retry Element Click xpath=//*[@id='member-action'] Retry Wait Until Page Not Contains Element xpath=//button[@disabled='' and contains(.,'Admin')] User Can Not Change Role [arguments] ${username} - Retry Element Click xpath=//clr-dg-row[contains(.,'${username}')]//input/../label + Retry Element Click xpath=//clr-dg-row[contains(.,'${username}')]//input/../label[contains(@class,'clr-control-label')] Retry Element Click xpath=//*[@id='member-action'] Retry Wait Until Page Contains Element xpath=//button[@disabled='' and contains(.,'Admin')] @@ -85,7 +85,7 @@ Add Guest Member To Project Delete Project Member [arguments] ${member} - Retry Element Click xpath=//clr-dg-row[contains(.,'${member}')]//input/../label + Retry Element Click xpath=//clr-dg-row[contains(.,'${member}')]//input/../label[contains(@class,'clr-control-label')] Retry Double Keywords When Error Retry Element Click ${member_action_xpath} Retry Wait Until Page Contains Element ${delete_action_xpath} Retry Double Keywords When Error Retry Element Click ${delete_action_xpath} Retry Wait Until Page Contains Element ${repo_delete_on_card_view_btn} Retry Double Keywords When Error Retry Element Click ${repo_delete_on_card_view_btn} Retry Wait Element xpath=${project_member_xpath} diff --git a/tests/resources/Harbor-Pages/Project-Members_Elements.robot b/tests/resources/Harbor-Pages/Project-Members_Elements.robot index e1b73850f87..a9873a33de1 100644 --- a/tests/resources/Harbor-Pages/Project-Members_Elements.robot +++ b/tests/resources/Harbor-Pages/Project-Members_Elements.robot @@ -19,7 +19,7 @@ Documentation This resource provides any keywords related to the Harbor private ${project_member_tag_xpath} //clr-main-container//project-detail/clr-tabs//a[contains(.,'Members')] ${project_member_add_button_xpath} //project-detail//button[contains(.,'User')] ${project_member_add_username_xpath} //*[@id='member_name'] -${project_member_add_admin_xpath} /html/body/harbor-app/harbor-shell/clr-main-container/div/div/project-detail/ng-component/div/div[1]/div/div[1]/add-member/clr-modal/div/div[1]/div/div[1]/div/div[2]/form/section/div[2]/div[1]/label +${project_member_add_admin_xpath} /html/body/harbor-app/harbor-shell/clr-main-container/div/div/project-detail/ng-component/div/div[1]/div/div[1]/add-member/clr-modal/div/div[1]/div/div[1]/div/div[2]/form/section/div[2]/div[1]/label[contains(@class,'clr-control-label')] ${project_member_add_save_button_xpath} /html/body/harbor-app/harbor-shell/clr-main-container/div/div/project-detail/ng-component/div/div[1]/div/div[1]/add-member/clr-modal/div/div[1]/div/div[1]/div/div[3]/button[2] ${project_member_search_button_xpath} //project-detail//hbr-filter/span/clr-icon ${project_member_search_text_xpath} //project-detail//hbr-filter/span/input diff --git a/tests/resources/Harbor-Pages/Project-P2P-Preheat.robot b/tests/resources/Harbor-Pages/Project-P2P-Preheat.robot index 22963a15d78..8b29eccee1e 100644 --- a/tests/resources/Harbor-Pages/Project-P2P-Preheat.robot +++ b/tests/resources/Harbor-Pages/Project-P2P-Preheat.robot @@ -29,7 +29,7 @@ Select Distribution For P2P Preheat Select P2P Preheat Policy [Arguments] ${name} - Retry Element Click //clr-dg-row[contains(.,'${name}')]//clr-radio-wrapper/label + Retry Element Click //clr-dg-row[contains(.,'${name}')]//clr-radio-wrapper/label[contains(@class,'clr-control-label')] P2P Preheat Policy Exist [Arguments] ${name} ${repo}=${null} diff --git a/tests/resources/Harbor-Pages/Project-Repository.robot b/tests/resources/Harbor-Pages/Project-Repository.robot index 9d89350e822..ab000f87a31 100644 --- a/tests/resources/Harbor-Pages/Project-Repository.robot +++ b/tests/resources/Harbor-Pages/Project-Repository.robot @@ -31,7 +31,7 @@ View Scan Error Log Retry Element Click xpath=${view_log_xpath} Scan Artifact - [Arguments] ${project} ${repo} ${label_xpath}=//clr-dg-row//label[1] + [Arguments] ${project} ${repo} ${label_xpath}=//clr-dg-row//label[contains(@class,'clr-control-label')][1] Go Into Repo ${project} ${repo} Retry Element Click ${label_xpath} Retry Element Click ${scan_artifact_btn} diff --git a/tests/resources/Harbor-Pages/Project-Webhooks.robot b/tests/resources/Harbor-Pages/Project-Webhooks.robot index 234fdfeb339..eb7e2230220 100644 --- a/tests/resources/Harbor-Pages/Project-Webhooks.robot +++ b/tests/resources/Harbor-Pages/Project-Webhooks.robot @@ -25,12 +25,12 @@ Select Payload Format Select Event Type [Arguments] @{event_type} - ${elements}= Get WebElements //form//div[contains(@class,'clr-control-inline')]//label + ${elements}= Get WebElements //form//div[contains(@class,'clr-control-inline')]//label[contains(@class,'clr-control-label')] FOR ${element} IN @{elements} Retry Element Click ${element} END FOR ${element} IN @{event_type} - Retry Element Click //form//div[contains(@class,'clr-control-inline')]//label[contains(.,'${element}')] + Retry Element Click //form//div[contains(@class,'clr-control-inline')]//label[contains(@class,'clr-control-label') and contains(.,'${element}')] END Update A Webhook diff --git a/tests/resources/Harbor-Pages/Project.robot b/tests/resources/Harbor-Pages/Project.robot index 5922cc0d347..e994506d17c 100644 --- a/tests/resources/Harbor-Pages/Project.robot +++ b/tests/resources/Harbor-Pages/Project.robot @@ -128,7 +128,7 @@ Filter Repo Delete Repo [Arguments] ${pro_name} ${repo_name} - ${element_repo_checkbox}= Set Variable xpath=//clr-dg-row[contains(.,'${pro_name}/${repo_name}')]//div[contains(@class,'clr-checkbox-wrapper')]//label + ${element_repo_checkbox}= Set Variable xpath=//clr-dg-row[contains(.,'${pro_name}/${repo_name}')]//div[contains(@class,'clr-checkbox-wrapper')]//label[contains(@class,'clr-control-label')] Filter Repo ${pro_name} ${repo_name} Retry Double Keywords When Error Retry Element Click ${element_repo_checkbox} Wait Until Element Is Visible And Enabled ${repo_delete_btn} Retry Double Keywords When Error Retry Element Click ${repo_delete_btn} Wait Until Element Is Visible And Enabled ${delete_confirm_btn} @@ -145,7 +145,7 @@ Delete Repo on CardView Delete Project [Arguments] ${projectname} Navigate To Projects - Retry Element Click xpath=//clr-dg-row[contains(.,'${projectname}')]//div[contains(@class,'clr-checkbox-wrapper')]//label + Retry Element Click xpath=//clr-dg-row[contains(.,'${projectname}')]//div[contains(@class,'clr-checkbox-wrapper')]//label[contains(@class,'clr-control-label')] Retry Element Click ${project_action_xpath} Retry Element Click xpath=//*[@id='delete-project'] Retry Element Click //clr-modal//button[contains(.,'DELETE')] @@ -292,7 +292,7 @@ Switch To Project Repo Add Labels To Tag [Arguments] ${tagName} ${labelName} - Retry Element Click xpath=//clr-dg-row[contains(.,'${tagName}')]//label + Retry Element Click xpath=//clr-dg-row[contains(.,'${tagName}')]//label[contains(@class,'clr-control-label')] Retry Element Click xpath=//clr-dg-action-bar//clr-dropdown//span Retry Element Click xpath=//clr-dropdown-menu//clr-dropdown//button[contains(.,'Add Labels')] Retry Element Click xpath=//clr-dropdown//div//label[contains(.,'${labelName}')] @@ -317,6 +317,7 @@ Filter Labels In Tags Get Statics [Arguments] ${locator} Reload Page + Wait Until Element Is Visible And Enabled ${locator} ${privaterepo}= Get Text ${locator} [Return] ${privaterepo} @@ -393,7 +394,7 @@ Should be Accessory deleted Export CVEs [Arguments] ${project} ${repositories} ${tags} ${labels} ${cve_ids} Filter Project ${project} - Retry Element Click //clr-dg-row[contains(.,'${project}')]//div[contains(@class,'clr-checkbox-wrapper')]//label + Retry Element Click //clr-dg-row[contains(.,'${project}')]//div[contains(@class,'clr-checkbox-wrapper')]//label[contains(@class,'clr-control-label')] Retry Element Click ${project_action_xpath} Retry Button Click ${export_cve_btn} Retry Text Input ${export_cve_filter_repo_input} ${repositories} diff --git a/tests/resources/Harbor-Pages/Project_Elements.robot b/tests/resources/Harbor-Pages/Project_Elements.robot index cb55e0f1e96..f1306e4fa19 100644 --- a/tests/resources/Harbor-Pages/Project_Elements.robot +++ b/tests/resources/Harbor-Pages/Project_Elements.robot @@ -18,7 +18,7 @@ Documentation This resource provides any keywords related to the Harbor private *** Variables *** ${create_project_button_xpath} //clr-main-container//button[contains(., 'New Project')] ${project_name_xpath} //*[@id='create_project_name'] -${project_public_xpath} //input[@name='public']/..//label +${project_public_xpath} //input[@name='public']/..//label[contains(@class,'clr-control-label')] ${project_save_css} html body.no-scrolling harbor-app harbor-shell clr-main-container.main-container div.content-container div.content-area.content-area-override project div.row div.col-lg-12.col-md-12.col-sm-12.col-xs-12 div.row.flex-items-xs-between div.option-left create-project clr-modal div.modal div.modal-dialog div.modal-content div.modal-footer button.btn.btn-primary ${projects_xpath} //clr-main-container//clr-vertical-nav//a[contains(.,'Projects')] ${project_replication_xpath} //project-detail//a[contains(.,'Replication')] @@ -57,16 +57,16 @@ ${tag_table_column_size} xpath=//clr-dg-column//span[contains(.,'Size')] ${tag_table_column_vulnerability} xpath=//clr-dg-column//span[contains(.,'Vulnerability')] ${tag_images_btn} xpath=//hbr-repository//button[contains(.,'Images')] ${project_member_action_xpath} xpath=//*[@id='member-action'] -${project_member_set_role_xpath} xpath=//clr-dropdown-menu//label[contains(.,'Set Role')] +${project_member_set_role_xpath} xpath=//clr-dropdown-menu//label[contains(@class,'clr-control-label') and contains(.,'Set Role')] ${project_config_public_checkbox} xpath=//input[@name='public'] ${project_config_content_trust_checkbox} xpath=//input[@name='content-trust'] ${project_config_scan_images_on_push_checkbox} xpath=//input[@name='scan-image-on-push'] ${project_config_prevent_vulnerable_images_from_running_checkbox} xpath=//input[@name='prevent-vulenrability-image-input'] ${project_config_severity_select} xpath=//select[@id='severity'] -${project_config_public_checkbox_label} xpath=//*[@id="clr-wrapper-public"]/div/clr-checkbox-wrapper/label -${project_config_prevent_vulenrability_checkbox_label} xpath=//*[@id='prevent-vulenrability-image']//clr-checkbox-wrapper//label -${project_config_system_wl_radio_input} xpath=//clr-radio-wrapper//label[contains(.,'System allowlist')] -${project_config_project_wl_radio_input} xpath=//clr-radio-wrapper//label[contains(.,'Project allowlist')] +${project_config_public_checkbox_label} xpath=//*[@id="clr-wrapper-public"]/div/clr-checkbox-wrapper/label[contains(@class,'clr-control-label')] +${project_config_prevent_vulenrability_checkbox_label} xpath=//*[@id='prevent-vulenrability-image']//clr-checkbox-wrapper//label[contains(@class,'clr-control-label')] +${project_config_system_wl_radio_input} xpath=//clr-radio-wrapper//label[contains(@class,'clr-control-label') and contains(.,'System allowlist')] +${project_config_project_wl_radio_input} xpath=//clr-radio-wrapper//label[contains(@class,'clr-control-label') and contains(.,'Project allowlist')] ${project_config_system_wl_radio_input_id} systemAllowlistOrProjectAllowlist ${project_config_project_wl_radio_input_id} systemAllowlistOrProjectAllowlist ${project_config_project_wl_add_btn} xpath=//*[@id='show-add-modal'] diff --git a/tests/resources/Harbor-Pages/Public_Elements.robot b/tests/resources/Harbor-Pages/Public_Elements.robot index 04e48d0ec2a..7acaee3d2b0 100644 --- a/tests/resources/Harbor-Pages/Public_Elements.robot +++ b/tests/resources/Harbor-Pages/Public_Elements.robot @@ -20,9 +20,9 @@ ${delete_btn} //clr-modal//button[contains(.,'DELETE')] ${delete_btn_2} //button[contains(.,'Delete')] ${default_scanner_info_close_icon} /html/body/harbor-app/harbor-shell/clr-main-container/div[1]/div[3]/clr-icon ${back_to_home_link} /html/body/harbor-app/harbor-shell/clr-main-container/div[2]/div/search-result/div/div[2]/a -${select_all_project_box} //label[contains(@for, 'clr-dg-select-all-clr-id-75')] +${select_all_project_box} //label[contains(@class,'clr-control-label') and contains(@for, 'clr-dg-select-all-clr-id-75')] ${export_cve_btn} //button[contains(.,'Export CVEs')] ${export_cve_filter_repo_input} //*[@id='repo'] ${export_cve_filter_tag_input} //*[@id='tag'] ${export_cve_filter_cveid_input} //*[@id='ids'] -${export_btn} //clr-modal//button[contains(.,'EXPORT')] \ No newline at end of file +${export_btn} //clr-modal//button[contains(.,'EXPORT')] diff --git a/tests/resources/Harbor-Pages/Replication.robot b/tests/resources/Harbor-Pages/Replication.robot index 2f09e35d494..19509611bf6 100644 --- a/tests/resources/Harbor-Pages/Replication.robot +++ b/tests/resources/Harbor-Pages/Replication.robot @@ -165,7 +165,7 @@ Trigger Replication Manual [Arguments] ${rule} Retry Element Click ${rule_filter_search} Retry Text Input ${rule_filter_input} ${rule} - Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label + Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label[contains(@class,'clr-control-label')] Retry Element Click ${action_bar_replicate} Retry Wait Until Page Contains Element ${dialog_replicate} #change from click to mouse down and up @@ -177,7 +177,7 @@ Rename Rule [Arguments] ${rule} ${newname} Retry Element Click ${rule_filter_search} Retry Text Input ${rule_filter_input} ${rule} - Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label + Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label[contains(@class,'clr-control-label')] Retry Element Click ${replication_rule_action} Retry Element Click ${replication_rule_action_bar_edit} Retry Text Input ${rule_name} ${newname} diff --git a/tests/resources/Harbor-Pages/Replication_Elements.robot b/tests/resources/Harbor-Pages/Replication_Elements.robot index 3ad520220f8..88013c42491 100644 --- a/tests/resources/Harbor-Pages/Replication_Elements.robot +++ b/tests/resources/Harbor-Pages/Replication_Elements.robot @@ -19,15 +19,15 @@ Documentation This resource provides any keywords related to the Harbor private ${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 -${policy_endpoint_checkbox} //input[@id='check_new']/../label +${policy_enable_checkbox} //input[@id='policy_enable']/../label[contains(@class,'clr-control-label')] +${policy_endpoint_checkbox} //input[@id='check_new']/../label[contains(@class,'clr-control-label')] ${destination_name_xpath} //*[@id='destination_name'] ${destination_url_xpath} //*[@id='destination_url'] ${destination_username_xpath} //*[@id='destination_access_key'] ${destination_password_xpath} //*[@id='destination_password'] ${replication_save_xpath} //button[contains(.,'OK')] ${replication_xpath} //clr-vertical-nav-group-children/a[contains(.,'Replication')] -${destination_insecure_xpath} //label[@id='destination_insecure_checkbox'] +${destination_insecure_xpath} //label[contains(@class,'clr-control-label') and @id='destination_insecure_checkbox'] ${new_replication-rule_button} //button[contains(.,'New Replication Rule')] ${link_to_registries} //clr-modal//span[contains(.,'Endpoint')] ${new_endpoint_button} //hbr-endpoint//button[contains(.,'New Endpoint')] @@ -59,8 +59,8 @@ ${dialog_replicate} //clr-modal//button[contains(.,'REPLICATE')] ${action_bar_replicate} //button[contains(.,'Replicate')] ${rule_save_button} //button[contains(.,'SAVE')] ${provider_selector} //*[@id='adapter'] -${replication_mode_radio_push} //clr-main-container//hbr-create-edit-rule//label[contains(.,'Push-based')] -${replication_mode_radio_pull} //clr-main-container//hbr-create-edit-rule//label[contains(.,'Pull-based')] +${replication_mode_radio_push} //clr-main-container//hbr-create-edit-rule//label[contains(@class,'clr-control-label') and contains(.,'Push-based')] +${replication_mode_radio_pull} //clr-main-container//hbr-create-edit-rule//label[contains(@class,'clr-control-label') and contains(.,'Pull-based')] ${filter_name_id} //input[@id='filter_name'] ${filter_tag_model_select} //div[@class='filterSelect ng-star-inserted'][2]//select ${filter_tag_id} //input[@id='filter_tag'] @@ -80,9 +80,9 @@ ${replication_rule_action} //*[@id='rule-action'] ${replication_rule_action_bar_edit} //*[@id='edit_replication_rule_id'] ${replication_rule_action_bar_delete} //*[@id='delete_replication_rule_id'] ${replication_rule_exec_id} //*[@id='replication_exe_id'] -${replication_task_line_1} //clr-datagrid//clr-dg-row/div/div[2]//div[contains(@class,'clr-checkbox-wrapper')]/label[1] -${is_overide_xpath} //label[contains(.,'Replace the destination resources if name exists')] -${enable_rule_xpath} //label[contains(.,'Enable rule')] +${replication_task_line_1} //clr-datagrid//clr-dg-row/div/div[2]//div[contains(@class,'clr-checkbox-wrapper')]/label[contains(@class,'clr-control-label')][1] +${is_overide_xpath} //label[contains(@class,'clr-control-label') and contains(.,'Replace the destination resources if name exists')] +${enable_rule_xpath} //label[contains(@class,'clr-control-label') and contains(.,'Enable rule')] ${targetCron_id} //*[@id='targetCron'] ${rule_name_input} //*[@id='ruleName'] ${src_registry_dropdown_list} //select[@id='src_registry_id'] @@ -91,8 +91,8 @@ ${rule_confirm_btn} //*[@id='ruleBtnOk'] ${rule_cancel_btn} //*[@id='ruleBtnCancel'] ${filter_rules_btn} //*[@id='filter-rules'] ${filter_rules_input} //*[@id='filter-rules']//input -${del_remote_checkbox} //label[@for='ruleDeletion'] +${del_remote_checkbox} //label[contains(@class,'clr-control-label') and @for='ruleDeletion'] ${filter_registry_btn} //hbr-filter ${filter_registry_input} //input[contains(@class,'filter-input')] ${flattening_select} //select[@id='dest_namespace_replace_count'] -${copy_by_chunk_checkbox} //label[@for='by-chunk'] +${copy_by_chunk_checkbox} //label[contains(@class,'clr-control-label') and @for='by-chunk'] diff --git a/tests/resources/Harbor-Pages/Robot_Account.robot b/tests/resources/Harbor-Pages/Robot_Account.robot index 0a92d1f0b9b..ac43951f13f 100644 --- a/tests/resources/Harbor-Pages/Robot_Account.robot +++ b/tests/resources/Harbor-Pages/Robot_Account.robot @@ -110,7 +110,7 @@ Create A New System Robot Account ${permission_item_list}= Get From Dictionary ${tmp} permission_item_list Log To Console permission_item_list: ${permission_item_list} Filter Project In Project Permisstion List ${project_name} - Retry Element Click //clr-dg-row[contains(.,'${project_name}')]//div[contains(@class,'clr-checkbox-wrapper')]/label + Retry Element Click //clr-dg-row[contains(.,'${project_name}')]//div[contains(@class,'clr-checkbox-wrapper')]/label[contains(@class,'clr-control-label')] Retry Element Click //clr-dg-row[contains(., '${project_name}')]//clr-dropdown/button Select Project Permission ${project_name} ${permission_item_list} END diff --git a/tests/resources/Harbor-Pages/Robot_Account_Elements.robot b/tests/resources/Harbor-Pages/Robot_Account_Elements.robot index 5278b7578bf..3be6ad65575 100644 --- a/tests/resources/Harbor-Pages/Robot_Account_Elements.robot +++ b/tests/resources/Harbor-Pages/Robot_Account_Elements.robot @@ -22,7 +22,7 @@ ${sys_robot_account_expiration_type_select} //*[@id='expiration-type'] ${sys_robot_account_expiration_input} //*[@id='robotTokenExpiration'] ${sys_robot_account_description_textarea} //*[@id='description'] ${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_coverall_chb} //clr-checkbox-wrapper[contains(@class, 'clr-checkbox-wrapper')]/label[contains(@class,'clr-control-label') and 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 diff --git a/tests/resources/Harbor-Pages/ToolKit.robot b/tests/resources/Harbor-Pages/ToolKit.robot index 3b29e9343d9..541f419dacf 100644 --- a/tests/resources/Harbor-Pages/ToolKit.robot +++ b/tests/resources/Harbor-Pages/ToolKit.robot @@ -51,12 +51,12 @@ Filter Project Select Object #select single element such as user project repo tag [Arguments] ${obj} - Retry Element Click xpath=//clr-dg-row[contains(.,'${obj}')]//label + Retry Element Click xpath=//clr-dg-row[contains(.,'${obj}')]//label[contains(@class,'clr-control-label')] Multi-delete Object [Arguments] ${delete_btn} @{obj} FOR ${obj} IN @{obj} - ${element}= Set Variable xpath=//clr-dg-row[contains(.,'${obj}')]//label + ${element}= Set Variable xpath=//clr-dg-row[contains(.,'${obj}')]//label[contains(@class,'clr-control-label')] Retry Element Click ${element} END Sleep 1 @@ -70,7 +70,7 @@ Multi-delete Object Multi-delete Artifact [Arguments] @{obj} FOR ${obj} IN @{obj} - ${element}= Set Variable xpath=//clr-dg-row[contains(.,'${obj}')]//label + ${element}= Set Variable xpath=//clr-dg-row[contains(.,'${obj}')]//label[contains(@class,'clr-control-label')] Retry Element Click ${element} END Sleep 1 @@ -85,7 +85,7 @@ Multi-delete Artifact Multi-delete User [Arguments] @{obj} FOR ${obj} IN @{obj} - Retry Element Click //clr-dg-row[contains(.,'${obj}')]//label + Retry Element Click //clr-dg-row[contains(.,'${obj}')]//label[contains(@class,'clr-control-label')] END Retry Element Click ${member_action_xpath} Retry Element Click //*[@id='deleteUser'] @@ -95,7 +95,7 @@ Multi-delete User Multi-delete Member [Arguments] @{obj} FOR ${obj} IN @{obj} - Retry Element Click //clr-dg-row[contains(.,'${obj}')]//div[contains(@class,'clr-checkbox-wrapper')]/label + Retry Element Click //clr-dg-row[contains(.,'${obj}')]//div[contains(@class,'clr-checkbox-wrapper')]/label[contains(@class,'clr-control-label')] END Retry Double Keywords When Error Retry Element Click ${member_action_xpath} Retry Wait Until Page Contains Element ${delete_action_xpath} Retry Double Keywords When Error Retry Element Click ${delete_action_xpath} Retry Wait Until Page Contains Element ${delete_btn} @@ -105,10 +105,10 @@ Multi-delete Member Multi-delete Object Without Confirmation [Arguments] @{obj} FOR ${obj} IN @{obj} - Retry Element Click //clr-dg-row[contains(.,'${obj}')]//label + Retry Element Click //clr-dg-row[contains(.,'${obj}')]//label[contains(@class,'clr-control-label')] END Retry Double Keywords When Error Retry Element Click ${delete_btn_2} Retry Wait Until Page Not Contains Element ${delete_btn_2} Select All On Current Page Object - Retry Element Click //div[@class='datagrid-head']//label + Retry Element Click //div[@class='datagrid-head']//label[contains(@class,'clr-control-label')] diff --git a/tests/resources/Harbor-Pages/Verify.robot b/tests/resources/Harbor-Pages/Verify.robot index 190e75383bc..e0748ed25df 100644 --- a/tests/resources/Harbor-Pages/Verify.robot +++ b/tests/resources/Harbor-Pages/Verify.robot @@ -397,8 +397,8 @@ Verify System Setting Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Switch To Configure Page Should Contain ${authtype}[0] - Run Keyword If ${selfreg}[0] == 'True' Checkbox Should Be Checked //clr-checkbox-wrapper[@id='selfReg']//label - Run Keyword If ${selfreg}[0] == 'False' Checkbox Should Not Be Checked //clr-checkbox-wrapper[@id='selfReg']//label + Run Keyword If ${selfreg}[0] == 'True' Checkbox Should Be Checked //clr-checkbox-wrapper[@id='selfReg']//label[contains(@class,'clr-control-label')] + Run Keyword If ${selfreg}[0] == 'False' Checkbox Should Not Be Checked //clr-checkbox-wrapper[@id='selfReg']//label[contains(@class,'clr-control-label')] Switch To System Settings ${ret} Get Selected List Value xpath=//select[@id='proCreation'] Should Be Equal As Strings ${ret} ${creation}[0] diff --git a/tests/resources/Harbor-Pages/Vulnerability.robot b/tests/resources/Harbor-Pages/Vulnerability.robot index 4fc3741abfa..ae5d4ee8624 100644 --- a/tests/resources/Harbor-Pages/Vulnerability.robot +++ b/tests/resources/Harbor-Pages/Vulnerability.robot @@ -20,7 +20,7 @@ Set Scan Schedule Trigger Scan Now And Wait Until The Result Appears Retry Element Click xpath=${scan_now_button} - Retry Action Keyword Wait Until Element Is Visible And Enabled ${scan_now_button} + Retry Keyword N Times When Error 11 Wait Until Element Is Visible And Enabled ${scan_now_button} Switch To Vulnerability Page Retry Element Click xpath=//clr-main-container//clr-vertical-nav//a[contains(.,'Interrogation')] @@ -43,7 +43,7 @@ Scan Is Disabled Scan Repo [Arguments] ${tagname} ${status} - Retry Element Click //clr-dg-row[contains(.,'${tagname}')]//label + Retry Element Click //clr-dg-row[contains(.,'${tagname}')]//label[contains(@class,'clr-control-label')] Retry Element Click //button[@id='scan-btn'] Run Keyword If '${status}' == 'Succeed' Wait Until Element Is Visible //hbr-vulnerability-bar//hbr-result-tip-histogram 300 Run Keyword If '${status}' == 'Fail' Wait Until Element Is Visible //hbr-vulnerability-bar//a 300 @@ -55,7 +55,7 @@ Scan Result Should Display In List Row Enable Scan On Push Checkbox Should Not Be Selected //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//input - Retry Element Click //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//label + Retry Element Click //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//label[contains(@class,'clr-control-label')] Checkbox Should Be Selected //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//input Retry Element Click ${project_config_save_btn} @@ -72,14 +72,14 @@ Should Display The Default Trivy Scanner Retry Wait Until Page Contains Element //clr-datagrid//clr-dg-row//clr-dg-cell[contains(.,'Trivy')]//span[contains(.,'Default')] Trivy Is Immutable Scanner - Retry Element Click //clr-dg-row[contains(.,'Trivy')]//clr-radio-wrapper/label + Retry Element Click //clr-dg-row[contains(.,'Trivy')]//clr-radio-wrapper/label[contains(@class,'clr-control-label')] Retry Double Keywords When Error Retry Element Click ${scanner_action_xpath} Retry Wait Until Page Contains Element ${delete_scanner_action_xpath} Retry Double Keywords When Error Retry Element Click ${delete_scanner_action_xpath} Retry Wait Until Page Contains Element ${delete_scanner_confirm_btn} Retry Double Keywords When Error Retry Element Click ${delete_scanner_confirm_btn} Retry Wait Until Page Contains Element ${immutable_trivy_msg_xpath} Set Default Scanner [Arguments] ${scanner_name} - Retry Element Click //clr-dg-row[contains(.,'${scanner_name}')]//clr-radio-wrapper/label + Retry Element Click //clr-dg-row[contains(.,'${scanner_name}')]//clr-radio-wrapper/label[contains(@class,'clr-control-label')] Retry Double Keywords When Error Retry Element Click ${scanner_set_default} Retry Wait Until Page Contains Element ${scanner_set_default_success_xpath} Check Listed In CVE Allowlist diff --git a/tests/robot-cases/Group1-Nightly/Common.robot b/tests/robot-cases/Group1-Nightly/Common.robot index e892b211e0b..dd01b519949 100644 --- a/tests/robot-cases/Group1-Nightly/Common.robot +++ b/tests/robot-cases/Group1-Nightly/Common.robot @@ -328,7 +328,7 @@ Test Case - Delete Multi Project Retry Wait Element Not Visible //clr-datagrid/div/div[2] @{project_list} Create List projecta projectb FOR ${project} IN @{project_list} - Retry Element Click //clr-dg-row[contains(.,'${project}')]//label + Retry Element Click //clr-dg-row[contains(.,'${project}')]//label[contains(@class,'clr-control-label')] END Retry Element Click ${project_action_xpath} Retry Element Click ${project_delete_btn} @@ -928,8 +928,8 @@ Test Case - Export CVE Add Labels To Tag ${images['redis']} ${labels}[1] Navigate To Projects Should Not Be Export CVEs - Retry Element Click //clr-dg-row[1]//label - Retry Element Click //clr-dg-row[2]//label + Retry Element Click //clr-dg-row[1]//label[contains(@class,'clr-control-label')] + Retry Element Click //clr-dg-row[2]//label[contains(@class,'clr-control-label')] Should Not Be Export CVEs Export CVEs project${d} photon,postgres,nginx,redis ${images['photon']},${images['nginx']},${images['redis']} ${labels} ${cve_ids}[0],${cve_ids}[1],${cve_ids}[2] ${csv_file_path}= Download Latest CVE CSV File @@ -968,7 +968,7 @@ Test Case - Job Service Dashboard Job Queues ${retention_execution2}= Execute Run photon 0/0 # Triggers three IMAGE_SCAN jobs Go Into Repo project${d} photon - Retry Element Click //clr-datagrid//label[contains(.,'Select All')] + Retry Element Click //clr-datagrid//label[contains(@class,'clr-control-label') and contains(.,'Select All')] Retry Button Click ${scan_artifact_btn} # Triggers a GARBAGE_COLLECTION job ${gc_execution1}= GC Now dry_run=${true} @@ -1004,7 +1004,7 @@ Test Case - Job Service Dashboard Job Queues Purge Now 1 Days Running # Triggers three IMAGE_SCAN jobs Go Into Repo project${d} photon - Retry Element Click //clr-datagrid//label[contains(.,'Select All')] + Retry Element Click //clr-datagrid//label[contains(@class,'clr-control-label') and contains(.,'Select All')] Retry Button Click ${scan_artifact_btn} # Check job queues Switch To Job Queues diff --git a/tests/robot-cases/Group1-Nightly/OIDC.robot b/tests/robot-cases/Group1-Nightly/OIDC.robot index b1c9ad30f68..f4b11079b32 100644 --- a/tests/robot-cases/Group1-Nightly/OIDC.robot +++ b/tests/robot-cases/Group1-Nightly/OIDC.robot @@ -142,7 +142,7 @@ Test Case - OIDC Group Filter Retry Wait Until Page Contains Element //clr-dg-pagination//div[contains(@class, 'pagination-description')] ${total}= Get Text //clr-dg-pagination//div[contains(@class, 'pagination-description')] # Delete all groups - Run Keyword If '${total}' != '0 items' Run Keywords Retry Element Click //div[@class='clr-checkbox-wrapper']//label AND Retry Button Click //button[contains(.,'Delete')] AND Retry Button Click //button[contains(.,'DELETE')] + Run Keyword If '${total}' != '0 items' Run Keywords Retry Element Click //div[@class='clr-checkbox-wrapper']//label[contains(@class,'clr-control-label')] AND Retry Button Click //button[contains(.,'Delete')] AND Retry Button Click //button[contains(.,'DELETE')] # Set OIDCGroupFilter to .*users Switch To Configuration Authentication Retry Text Input //*[@id='OIDCGroupFilter'] .*users