diff --git a/tests/apitests/python/test_assign_role_to_ldap_group.py b/tests/apitests/python/test_assign_role_to_ldap_group.py index c3ea8af5f..bd360ae0d 100644 --- a/tests/apitests/python/test_assign_role_to_ldap_group.py +++ b/tests/apitests/python/test_assign_role_to_ldap_group.py @@ -29,7 +29,7 @@ class TestAssignRoleToLdapGroup(unittest.TestCase): def tearDown(self): print("Case completed") - def TestAssignRoleToLdapGroup(self): + def testAssignRoleToLdapGroup(self): """ Test case: Assign Role To Ldap Group diff --git a/tests/resources/Harbor-Pages/Configuration.robot b/tests/resources/Harbor-Pages/Configuration.robot index fb06b293b..87448fc8e 100644 --- a/tests/resources/Harbor-Pages/Configuration.robot +++ b/tests/resources/Harbor-Pages/Configuration.robot @@ -360,15 +360,30 @@ Set User Name Claim And Save Retry Element Click xpath=${config_auth_save_button_xpath} Capture Page Screenshot +Select Distribution + [Arguments] ${name} + Retry Element Click //div[@class='datagrid-scrolling-cells' and contains(.,'${name}')]//clr-checkbox-wrapper/label + +Distribution Exist + [Arguments] ${name} ${endpoint} + Retry Wait Until Page Contains Element //div[@class='datagrid-scrolling-cells' and contains(.,'${name}') and contains(.,'${endpoint}')] + +Distribution Not Exist + [Arguments] ${name} ${endpoint} + Retry Wait Until Page Not Contains Element //div[@class='datagrid-scrolling-cells' and contains(.,'${name}') and contains(.,'${endpoint}')] + +Filter Distribution List + [Arguments] ${name} ${endpoint} ${exsit}=${true} + Retry Double Keywords When Error Retry Element Click ${filter_dist_btn} Wait Until Element Is Visible And Enabled ${filter_dist_input} + Retry Text Input ${filter_dist_input} ${name} + Run Keyword If ${exsit}==${true} Distribution Exist ${name} ${endpoint} + ... ELSE Distribution Not Exist ${name} ${endpoint} + 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 @@ -377,4 +392,28 @@ Create An New Distribution 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} \ No newline at end of file + Distribution Exist ${name} ${endpoint} + +Delete A Distribution + [Arguments] ${name} ${endpoint} ${deletable}=${true} + ${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 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} + Sleep 10 + Filter Distribution List ${name} ${endpoint} exsit=${is_exsit} + +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 + 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} + 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} + Filter Distribution List ${name} ${new_endpoint} + Distribution Exist ${name} ${new_endpoint} \ No newline at end of file diff --git a/tests/resources/Harbor-Pages/Configuration_Elements.robot b/tests/resources/Harbor-Pages/Configuration_Elements.robot index aaaf96506..428f9ca0b 100644 --- a/tests/resources/Harbor-Pages/Configuration_Elements.robot +++ b/tests/resources/Harbor-Pages/Configuration_Elements.robot @@ -53,6 +53,10 @@ ${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'] - +${distribution_action_btn_id} //*[@id='member-action'] +${distribution_del_btn_id} //*[@id='distribution-delete'] +${distribution_edit_btn_id} //*[@id='distribution-edit'] +${filter_dist_btn} //hbr-filter//clr-icon[contains(@class,'search-btn')] +${filter_dist_input} //hbr-filter//input diff --git a/tests/resources/Harbor-Pages/Project-P2P-Preheat-Elements.robot b/tests/resources/Harbor-Pages/Project-P2P-Preheat-Elements.robot new file mode 100644 index 000000000..84dbc4323 --- /dev/null +++ b/tests/resources/Harbor-Pages/Project-P2P-Preheat-Elements.robot @@ -0,0 +1,33 @@ +# 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 *** +${project_p2p_preheat_tag_xpath} //clr-main-container//project-detail/clr-tabs//a[contains(.,'P2P Preheat')] +${p2p_preheat_new_policy_btn_id} //*[@id='new-policy'] +${p2p_preheat_provider_select_id} //*[@id='provider'] +${p2p_preheat_name_input_id} //*[@id='name'] +${p2p_preheat_repoinput_id} //*[@id='repo'] +${p2p_preheat_tag_input_id} //*[@id='tag'] +${p2p_preheat_trigger_type_select_id} //*[@id='trigger-type'] +${p2p_preheat_add_save_btn_id} //add-p2p-policy//*[@id='new-policy'] +${p2p_preheat_edit_save_btn_id} //*[@id='edit-policy-save'] +${p2p_preheat_action_btn_id} //*[@id='action-policy'] +${p2p_preheat_del_btn_id} //*[@id='delete-policy'] +${p2p_preheat_edit_btn_id} //*[@id='edit-policy'] + + + diff --git a/tests/resources/Harbor-Pages/Project-P2P-Preheat.robot b/tests/resources/Harbor-Pages/Project-P2P-Preheat.robot new file mode 100644 index 000000000..1c9386c7d --- /dev/null +++ b/tests/resources/Harbor-Pages/Project-P2P-Preheat.robot @@ -0,0 +1,71 @@ +# 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 + +*** Variables *** + +*** Keywords *** +Switch To P2P Preheat + Retry Element Click xpath=${project_p2p_preheat__tag_xpath} + +Select Distribution For P2P Preheat + [Arguments] ${provider} + Retry Element Click ${p2p_preheat_provider_select_id} + Retry Element Click ${p2p_preheat_provider_select_id}//option[contains(.,'${provider}')] + +Select P2P Preheat Policy + [Arguments] ${name} + Retry Element Click //div[@class='datagrid-scrolling-cells' and contains(.,'${name}')]//clr-radio-wrapper/label + +P2P Preheat Policy Exist + [Arguments] ${name} ${repo}=${null} + ${policy_row_xpath}= Set Variable If '${repo}'=='${null}' //div[@class='datagrid-scrolling-cells' and contains(.,'${name}')] //div[@class='datagrid-scrolling-cells' and contains(.,'${name}') and contains(.,'${repo}')] + Retry Wait Until Page Contains Element ${policy_row_xpath} + +P2P Preheat Policy Not Exist + [Arguments] ${name} + Retry Wait Until Page Not Contains Element //div[@class='datagrid-scrolling-cells' and contains(.,'${name}')] + +Create An New P2P Preheat Policy + [Arguments] ${policy_name} ${dist_name} ${repo} ${tag} ${trigger_type}=${null} + Switch To P2P Preheat + Retry Element Click ${p2p_preheat_new_policy_btn_id} + Select Distribution For P2P Preheat ${dist_name} + Retry Text Input ${p2p_preheat_name_input_id} ${policy_name} + Retry Text Input ${p2p_preheat_repoinput_id} ${repo} + Retry Text Input ${p2p_preheat_tag_input_id} ${tag} + Retry Double Keywords When Error Retry Element Click ${p2p_preheat_add_save_btn_id} Retry Wait Until Page Not Contains Element xpath=${p2p_preheat_add_save_btn_id} + P2P Preheat Policy Exist ${policy_name} + +Edit A P2P Preheat Policy + [Arguments] ${name} ${repo} ${trigger_type}=${null} + Switch To P2P Preheat + Retry Double Keywords When Error Select P2P Preheat Policy ${name} Wait Until Element Is Visible //clr-main-container//project-detail/p2p-provider/ng-component//h4[contains(.,'Executions')] + Retry Double Keywords When Error Retry Element Click ${p2p_preheat_action_btn_id} Wait Until Element Is Visible And Enabled ${p2p_preheat_edit_btn_id} + Retry Double Keywords When Error Retry Element Click ${p2p_preheat_edit_btn_id} Wait Until Element Is Visible And Enabled ${p2p_preheat_name_input_id} + Retry Text Input ${p2p_preheat_repoinput_id} ${repo} + Retry Double Keywords When Error Retry Element Click ${p2p_preheat_edit_save_btn_id} Retry Wait Until Page Not Contains Element xpath=${p2p_preheat_edit_save_btn_id} + P2P Preheat Policy Exist ${name} repo=${repo} + +Delete A P2P Preheat Policy + [Arguments] ${name} + Switch To P2P Preheat + Retry Double Keywords When Error Select P2P Preheat Policy ${name} Wait Until Element Is Visible //clr-main-container//project-detail/p2p-provider/ng-component//h4[contains(.,'Executions')] + Retry Double Keywords When Error Retry Element Click ${p2p_preheat_action_btn_id} Wait Until Element Is Visible And Enabled ${p2p_preheat_del_btn_id} + Retry Double Keywords When Error Retry Element Click ${p2p_preheat_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} + P2P Preheat Policy Not Exist ${name} diff --git a/tests/resources/Harbor-Pages/Project_Elements.robot b/tests/resources/Harbor-Pages/Project_Elements.robot index d3e3d7525..9c8e670a9 100644 --- a/tests/resources/Harbor-Pages/Project_Elements.robot +++ b/tests/resources/Harbor-Pages/Project_Elements.robot @@ -33,7 +33,7 @@ ${project_tag_immutability_switch} //project-detail/app-tag-feature-integration ${create_project_CANCEL_button_xpath} xpath=//button[contains(.,'CANCEL')] ${create_project_OK_button_xpath} xpath=//button[contains(.,'OK')] -${delete_confirm_btn} xpath=//confirmation-dialog//button[contains(.,'DELETE')] +${delete_confirm_btn} xpath=//button[contains(.,'DELETE')] ${project_statistics_private_repository_icon} xpath=//project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[2]/statistics/div/span[1] ${repo_delete_confirm_btn} xpath=//clr-modal//button[2] ${repo_retag_confirm_dlg} css=${modal-dialog} @@ -78,4 +78,3 @@ ${project_add_storage_quota_unit_id} xpath=//*[@id='create_project_storage_li ${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')] diff --git a/tests/resources/Util.robot b/tests/resources/Util.robot index 6097717cd..e1c8e25e3 100644 --- a/tests/resources/Util.robot +++ b/tests/resources/Util.robot @@ -35,6 +35,8 @@ Resource Harbor-Pages/Project.robot Resource Harbor-Pages/Project_Elements.robot Resource Harbor-Pages/Project-Members.robot Resource Harbor-Pages/Project-Members_Elements.robot +Resource Harbor-Pages/Project-P2P-Preheat.robot +Resource Harbor-Pages/Project-P2P-Preheat-Elements.robot Resource Harbor-Pages/Project-Webhooks.robot Resource Harbor-Pages/Project-Webhooks_Elements.robot Resource Harbor-Pages/Project-Repository.robot diff --git a/tests/robot-cases/Group1-Nightly/Common.robot b/tests/robot-cases/Group1-Nightly/Common.robot index 40dace4b0..d25a8c09b 100644 --- a/tests/robot-cases/Group1-Nightly/Common.robot +++ b/tests/robot-cases/Group1-Nightly/Common.robot @@ -695,26 +695,61 @@ Test Case - Read Only Mode 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 + ${registry}= Set Variable https://hub.docker.com/ + ${user_namespace}= Set Variable danfengliu + ${image}= Set Variable for_proxy + ${tag}= Set Variable 1.0 + ${manifest_index}= Set Variable index081597864867 + ${manifest_tag}= Set Variable index_tag081597864867 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 + 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 + 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} + Log To Console Start to Sleep 3 minitues...... + Sleep 180 + Go Into Project project${d} + Go Into Repo project${d}/${user_namespace}/${image} + Pull Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ${user_namespace}/${manifest_index} tag=${manifest_tag} + Log To Console Start to Sleep 10 minitues...... + Sleep 600 + Go Into Project project${d} + Go Into Repo project${d}/${user_namespace}/${manifest_index} + Go Into Index And Contain Artifacts ${manifest_tag} limit=1 + Close Browser + +Test Case - Distribution CRUD + ${d}= Get Current Date result_format=%m%s + ${name}= Set Variable distribution${d} + ${endpoint}= Set Variable https://1.1.1.2 + ${endpoint_new}= Set Variable https://10.65.65.42 + Init Chrome Driver + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Create An New Distribution Dragonfly ${name} ${endpoint} + Edit A Distribution ${name} ${endpoint} new_endpoint=${endpoint_new} + Delete A Distribution ${name} ${endpoint_new} + Close Browser + +Test Case - P2P Peheat Policy CRUD + ${d}= Get Current Date result_format=%m%s + ${pro_name}= Set Variable project_p2p${d} + ${dist_name}= Set Variable distribution${d} + ${endpoint}= Set Variable https://1.1.1.2 + ${policy_name}= Set Variable policy${d} + ${repo}= Set Variable alpine + ${repo_new}= Set Variable redis* + ${tag}= Set Variable v1.0 + Init Chrome Driver + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Create An New Distribution Dragonfly ${dist_name} ${endpoint} + Create An New Project And Go Into Project ${pro_name} + Create An New P2P Preheat Policy ${policy_name} ${dist_name} ${repo} ${tag} + Edit A P2P Preheat Policy ${policy_name} ${repo_new} + Delete A Distribution ${dist_name} ${endpoint} deletable=${false} + Go Into Project ${pro_name} has_image=${false} + Delete A P2P Preheat Policy ${policy_name} + Delete A Distribution ${dist_name} ${endpoint} Close Browser