Due to replication NG feature already in master branch, old replication UI test cases have been moved out of Jenkins pipeline, and here test case <Replication Of Pull Images from DockerHub To Self> and <Replication Of Push Images from Self To Harbor> has been finished and ready for duty. Other modification is add retry for keywords in UserProfile.robot (#7611)

Signed-off-by: danfengliu <danfengl@vmware.com>
This commit is contained in:
danfengliu 2019-05-09 15:44:48 +08:00 committed by Wang Yan
parent 7e674ec389
commit dffb2bbd98
8 changed files with 239 additions and 82 deletions

View File

@ -11,6 +11,7 @@ ${upload_action_button} //clr-modal//form/div/button[contains(.,'Upload')]
${harbor_chart_name} harbor
${harbor_chart_filename} harbor-0.2.0.tgz
${harbor_chart_version} 0.2.0
${harbor_chart_prov_filename} harbor-0.2.0.tgz.prov
${harbor_chart_file_url} https://storage.googleapis.com/harbor-builds/helm-chart-test-files/harbor-0.2.0.tgz
${harbor_chart_prov_file_url} https://storage.googleapis.com/harbor-builds/helm-chart-test-files/harbor-0.2.0.tgz.prov

View File

@ -44,31 +44,28 @@ Create A New Endpoint
Run Keyword If '${save}' == 'N' No Operation
Create A Rule With Existing Endpoint
# day 1=Monday..7=Sunday timeformat 12hour+am/pm
[Arguments] ${name} ${project_name} ${endpoint} ${mode} ${plan}=Daily ${weekday}=1 ${time}=0800a
[Arguments] ${name} ${replication_mode} ${project_name} ${resource_type} ${endpoint} ${dest_namespace_input}
... ${mode}=Manual
#click new
Retry Element Click ${new_name_xpath}
#input name
Input Text ${rule_name} ${name}
#input descripiton,here skip, leave it blank
#source projects, input
Input Text ${source_project} ${project_name}
Retry Text Input ${rule_name} ${name}
Run Keyword If '${replication_mode}' == 'push' Run Keywords Retry Element Click ${replication_mode_radio_push}
... AND Retry Element Click //select[@id='dest_registry']
... AND Retry Element Click //select[@id='dest_registry']//option[contains(.,'${endpoint}')]
... ELSE Run Keywords Retry Element Click ${replication_mode_radio_pull}
... AND Retry Element Click //select[@id='src_registry_id']
... AND Retry Element Click //select[@id='src_registry_id']//option[contains(.,'${endpoint}')]
#set filter
Retry Element Click ${source_image_filter_add}
Input Text ${source_iamge_repo_filter} *
Retry Element Click ${source_image_filter_add}
Input Text ${source_image_tag_filter} *
#select endpoint
Retry Element Click ${rule_target_select}
Wait Until Element Is Visible //select[@id='ruleTarget']//option[contains(.,'${endpoint}')]
Retry Element Click //select[@id='ruleTarget']//option[contains(.,'${endpoint}')]
Retry Text Input ${source_project} ${project_name}
Run Keyword And Ignore Error Select From List By Value ${rule_resource_selector} ${resource_type}
Retry Text Input ${dest_namespace_xpath} ${dest_namespace_input}
#set trigger
Retry Element Click ${rule_trigger_select}
Wait Until Element Is Visible //select[@id='ruleTrigger']//option[contains(.,'${mode}')]
Retry Element Click //select[@id='ruleTrigger']
Retry Element Click //select[@id='ruleTrigger']//option[contains(.,'${mode}')]
Run Keyword If '${mode}' == 'Scheduled' Setting Replicaiton Schedule ${plan} ${weekday} ${time}
Run Keyword If '${mode}' == 'Scheduled' Log To Console Scheduled
#click save
Retry Element Click ${rule_save_button}
Retry Double Keywords When Error Retry Element Click ${rule_save_button} Retry Wait Until Page Not Contains Element ${rule_save_button}
Project Create A Rule With Existing Endpoint
# day 1=Monday..7=Sunday timeformat 12hour+am/pm
@ -76,14 +73,14 @@ Project Create A Rule With Existing Endpoint
#click new
Retry Element Click ${new_name_xpath}
#input name
Input Text ${rule_name} ${name}
Retry Text Input ${rule_name} ${name}
#input descripiton,here skip, leave it blank
#in this keyword, source project is not need to input
#set filter
Retry Element Click ${source_image_filter_add}
Input Text ${source_iamge_repo_filter} *
Retry Text Input ${source_iamge_repo_filter} *
Retry Element Click ${source_image_filter_add}
Input Text ${source_image_tag_filter} *
Retry Text Input ${source_image_tag_filter} *
#select endpoint
Retry Element Click ${rule_target_select}
Wait Until Element Is Visible //select[@id='ruleTarget']//option[contains(.,'${endpoint}')]
@ -92,7 +89,7 @@ Project Create A Rule With Existing Endpoint
Retry Element Click ${rule_trigger_select}
Wait Until Element Is Visible //select[@id='ruleTrigger']//option[contains(.,'${mode}')]
Retry Element Click //select[@id='ruleTrigger']//option[contains(.,'${mode}')]
Run Keyword If '${mode}' == 'Scheduled' Setting Replicaiton Schedule ${plan} ${weekday} ${time}
Run Keyword If '${mode}' == 'Scheduled' Setting Replication Schedule ${plan} ${weekday} ${time}
#click save
Retry Element Click ${rule_save_button}
@ -102,7 +99,7 @@ Setting Replication Schedule
Wait Until Element Is Visible //select[@name='scheduleType']/option[@value='${plan}']
Retry Element Click //select[@name='scheduleType']/option[@value='${plan}']
Run Keyword If '${plan}' == 'Weekly' Setting Replication Weekday ${weekday}
Input Text ${shcedule_time} ${time}
Retry Text Input ${shcedule_time} ${time}
Setting Replication Weekday
[arguments] ${day}
@ -139,36 +136,33 @@ Switch To Replication Manage
Trigger Replication Manual
[Arguments] ${rule}
Retry Element Click ${rule_filter_search}
Input Text ${rule_filter_input} ${rule}
Sleep 1
Retry Text Input ${rule_filter_input} ${rule}
Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label
Retry Element Click ${action_bar_replicate}
Wait Until Page Contains Element ${dialog_replicate}
Retry Wait Until Page Contains Element ${dialog_replicate}
#change from click to mouse down and up
Mouse Down ${dialog_replicate}
Mouse Up ${dialog_replicate}
Sleep 2
Wait Until Page Contains Element //clr-tab-content//div[contains(.,'${rule}')]/../div/clr-icon[@shape='success-standard']
Retry Wait Until Page Contains Element //clr-tab-content//div[contains(.,'${rule}')]/../div/clr-icon[@shape='success-standard']
Sleep 1
Rename Rule
[Arguments] ${rule} ${newname}
Retry Element Click ${rule_filter_search}
Input Text ${rule_filter_input} ${rule}
Sleep 1
Retry Text Input ${rule_filter_input} ${rule}
Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label
Retry Element Click ${action_bar_edit}
Input Text ${rule_name} ${newname}
Retry Text Input ${rule_name} ${newname}
Retry Element Click ${rule_save_button}
Delete Rule
[Arguments] ${rule}
Retry Element Click ${rule_filter_search}
Input Text ${rule_filter_input} ${rule}
Sleep 1
Retry Text Input ${rule_filter_input} ${rule}
Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label
Retry Element Click ${action_bar_delete}
Wait Until Page Contains Element ${dialog_delete}
Retry Wait Until Page Contains Element ${dialog_delete}
#change from click to mouse down and up
Mouse Down ${dialog_delete}
Mouse Up ${dialog_delete}
@ -177,12 +171,11 @@ Delete Rule
Filter Rule
[Arguments] ${rule}
Retry Element Click ${rule_filter_search}
Input Text ${rule_filter_input} ${rule}
Retry Text Input ${rule_filter_input} ${rule}
Sleep 1
Select Rule
[Arguments] ${rule}
Sleep 1
Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label
Stop Jobs
@ -191,26 +184,40 @@ Stop Jobs
View Job Log
[arguments] ${job}
Retry Element Click ${job_filter_search}
Input Text ${job_filter_input} ${job}
Click Link //clr-dg-row[contains(.,'${job}')]//a
Retry Text Input ${job_filter_input} ${job}
Retry Link Click //clr-dg-row[contains(.,'${job}')]//a
Rename Endpoint
[arguments] ${name} ${newname}
Filter Object ${name}
Select Object ${name}
Retry Element Click ${action_bar_edit}
Wait Until Page Contains Element ${destination_name_xpath}
Input Text ${destination_name_xpath} ${newname}
Retry Wait Until Page Contains Element ${destination_name_xpath}
Retry Text Input ${destination_name_xpath} ${newname}
Retry Element Click ${replication_save_xpath}
Delete Endpoint
[Arguments] ${name}
Retry Element Click ${endpoint_filter_search}
Input Text ${endpoint_filter_input} ${name}
Sleep 1
Retry Text Input ${endpoint_filter_input} ${name}
#click checkbox before target endpoint
Retry Element Click //clr-dg-row[contains(.,'${name}')]//label
Retry Element Click ${action_bar_delete}
Wait Until Page Contains Element ${dialog_delete}
Retry Element Click ${dialog_delete}
Select Rule And Replicate
[Arguments] ${rule_name}
Retry Element Click //hbr-list-replication-rule//clr-dg-cell[contains(.,'${rule_name}')]
Retry Element Click ${replication_exec_id}
Retry Double Keywords When Error Retry Element Click xpath=${dialog_replicate} Retry Wait Until Page Not Contains Element xpath=${dialog_replicate}
Delete Replication Rule
[Arguments] ${name}
Retry Element Click ${endpoint_filter_search}
Retry Text Input ${endpoint_filter_input} ${name}
#click checkbox before target endpoint
Retry Element Click //clr-dg-row[contains(.,'${name}')]//label
Sleep 1
Retry Element Click ${action_bar_delete}
Wait Until Page Contains Element ${dialog_delete}
Retry Element Click ${dialog_delete}

View File

@ -33,7 +33,6 @@ ${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')]
${rule_name} //input[@id='ruleName']
${source_project} //input[@value='name']
${source_image_filter_add} //hbr-create-edit-rule/clr-modal//clr-icon[@id='add-label-list']
${source_iamge_repo_filter} //hbr-create-edit-rule//section/div[4]/div/div[1]/div/label/input
${source_image_tag_filter} //hbr-create-edit-rule//section/div[4]/div/div[2]/div/label/input
@ -61,3 +60,21 @@ ${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')]
${source_project} //input[@id='filter_name']
${rule_resource_selector} //*[@id='select_resource']
${trigger_mode_selector} //*[@id='ruleTrigger']
${dest_namespace_xpath} //*[@id='dest_namespace']
${new_replication_rule_id} //*[@id='new_replication_rule_id']
${edit_replication_rule_id} //*[@id='edit_replication_rule_id']
${delete_replication_rule_id} //*[@id='delete_replication_rule_id']
${replication_exec_id} //*[@id='replication_exe_id']
${replication_task_line_1} //clr-datagrid//clr-dg-row/div/div[2]//clr-checkbox-wrapper/label[1]
${filter_tag} //*[@id='filter_tag']
${is_overide_xpath} //label[contains(.,'Replace the destination resources if name exists')]
${enable_rule_xpath} //label[contains(.,'Enable rule')]
${targetCron_id} //*[@id='targetCron']

View File

@ -22,36 +22,26 @@ ${HARBOR_VERSION} v1.1.1
*** Keywords ***
Change Password
[Arguments] ${cur_pw} ${new_pw}
Click Element xpath=/html/body/harbor-app/harbor-shell/clr-main-container/navigator/clr-header/div[3]/clr-dropdown[2]/button/span
Click Element xpath=//clr-main-container//clr-dropdown//a[2]
Sleep 2
Input Text xpath=//*[@id='oldPassword'] ${cur_pw}
Input Text xpath=//*[@id='newPassword'] ${new_pw}
Input Text xpath=//*[@id='reNewPassword'] ${new_pw}
Sleep 1
Click Element xpath=//password-setting/clr-modal//button[2]
Sleep 2
Click Element xpath=${log_xpath}
Retry Element Click ${head_admin_xpath}
Retry Element Click ${change_password_xpath}
Retry Text Input ${old_password_xpath} ${cur_pw}
Retry Text Input ${new_password_xpath} ${new_pw}
Retry Text Input ${renew_password_xpath} ${new_pw}
Retry Element Click ${change_password_confirm_btn_xpath}
Retry Element Click xpath=${log_xpath}
Sleep 1
Update User Comment
[Arguments] ${new_comment}
Click Element xpath=/html/body/harbor-app/harbor-shell/clr-main-container/navigator/clr-header/div[3]/clr-dropdown[2]/button/span
Click Element xpath=//clr-main-container//clr-dropdown//a[1]
Sleep 2
Input Text xpath=//*[@id='account_settings_comments'] ${new_comment}
Sleep 1
Click Element xpath=//account-settings-modal/clr-modal//button[2]
Retry Element Click ${head_admin_xpath}
Retry Element Click ${user_profile_xpath}
Retry Text Input ${account_settings_comments_xpath} ${new_comment}
Retry Element Click ${user_profile_confirm_btn_xpath}
Sleep 2
Logout Harbor
Wait Until Element Is Visible xpath=/html/body/harbor-app/harbor-shell/clr-main-container/navigator/clr-header/div[3]/clr-dropdown[2]/button/span
Wait Until Element Is Enabled xpath=/html/body/harbor-app/harbor-shell/clr-main-container/navigator/clr-header/div[3]/clr-dropdown[2]/button/span
Click Element xpath=/html/body/harbor-app/harbor-shell/clr-main-container/navigator/clr-header/div[3]/clr-dropdown[2]/button/span
Sleep 2
Click Link Log Out
#Click Element xpath=//harbor-app/harbor-shell/clr-main-container/navigator/clr-header//clr-dropdown//a[4]
Sleep 1
Retry Element Click ${head_admin_xpath}
Retry Link Click Log Out
Capture Page Screenshot Logout.png
Sleep 2
Wait Until Keyword Succeeds 5x 1 Page Should Contain Element xpath=//sign-in//form//*[@class='title']
Wait Until Keyword Succeeds 5x 1 Page Should Contain Element ${sign_in_title_xpath}

View File

@ -0,0 +1,28 @@
# 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 ***
${head_admin_xpath} xpath=/html/body/harbor-app/harbor-shell/clr-main-container/navigator/clr-header/div[3]/clr-dropdown[2]/button/span
${change_password_xpath} xpath=//clr-main-container//clr-dropdown//a[2]
${user_profile_xpath} xpath=//clr-main-container//clr-dropdown//a[1]
${old_password_xpath} xpath=//*[@id='oldPassword']
${new_password_xpath} xpath=//*[@id='newPassword']
${renew_password_xpath} xpath=//*[@id='reNewPassword']
${change_password_confirm_btn_xpath} xpath=//password-setting/clr-modal//button[2]
${user_profile_confirm_btn_xpath} xpath=//account-settings-modal/clr-modal//button[2]
${sign_in_title_xpath} xpath=//sign-in//form//*[@class='title']
${account_settings_comments_xpath} xpath=//*[@id='account_settings_comments']

View File

@ -45,6 +45,7 @@ Resource Harbor-Pages/Project-Retag_Elements.robot
Resource Harbor-Pages/Replication.robot
Resource Harbor-Pages/Replication_Elements.robot
Resource Harbor-Pages/UserProfile.robot
Resource Harbor-Pages/UserProfile_Elements.robot
Resource Harbor-Pages/Administration-Users.robot
Resource Harbor-Pages/Administration-Users_Elements.robot
Resource Harbor-Pages/Configuration.robot
@ -98,6 +99,11 @@ Retry Text Input
@{param} Create List ${element_xpath} ${text}
Retry Action Keyword Text Input @{param}
Retry Link Click
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Link Click @{param}
Retry Checkbox Should Be Selected
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
@ -123,6 +129,10 @@ Retry Wait Until Page Not Contains Element
@{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Page Does Not Contain Element @{param}
Link Click
[Arguments] ${element_xpath}
Click Link ${element_xpath}
Element Click
[Arguments] ${element_xpath}
Wait Until Element Is Visible And Enabled ${element_xpath}

View File

@ -60,7 +60,7 @@ Test Case - DockerHub Endpoint Add
${d}= Get Current Date result_format=%M%S
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries
Create A New Endpoint dockerHub edp1${d} https://hub.docker.com/ danfengliu Aa123456 Y
Create A New Endpoint docker-hub edp1${d} https://hub.docker.com/ danfengliu Aa123456 Y
Close Browser
Test Case - Harbor Endpoint Add
@ -89,3 +89,107 @@ Test Case - Harbor Endpoint Delete
Delete Endpoint deletea
Delete Success deletea
Close Browser
Test Case - Replication Of Pull Images from DockerHub To Self
Init Chrome Driver
${d}= Get Current Date result_format=%M%S
#login source
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project project${d}
Switch To Registries
Create A New Endpoint docker-hub e${d} https://hub.docker.com/ danfengliu Aa123456 Y
Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} pull danfengliu/* image e${d} project${d}
Select Rule And Replicate rule${d}
Sleep 20
Go Into Project project${d}
Switch To Project Repo
#In docker-hub, under repository danfengliu, there're only 2 images: centos,mariadb.
Retry Wait Until Page Contains project${d}/centos
Retry Wait Until Page Contains project${d}/mariadb
Close Browser
Test Case - Replication Of Push Images from Self To Harbor
Init Chrome Driver
${d}= Get Current Date result_format=%M%S
#login source
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project project${d}
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} hello-world
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} busybox:latest
Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} hello-world v1
Switch To Registries
Create A New Endpoint harbor e${d} https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} push project${d}/* image e${d} project_dest${d}
#logout and login target
Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project project_dest${d}
#logout and login source
Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Replication Manage
Select Rule And Replicate rule${d}
Sleep 20
Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Go Into Project project_dest${d}
Switch To Project Repo
Retry Wait Until Page Contains project_dest${d}/hello-world
Retry Wait Until Page Contains project_dest${d}/busybox
Close Browser
Test Case - Replication Of Push Chart from Self To Harbor
Init Chrome Driver
${d}= Get Current Date result_format=%M%S
#login source
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project project${d}
Go Into Project project${d} has_image=${false}
Switch To Project Charts
Upload Chart files
Switch To Registries
Create A New Endpoint harbor e${d} https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} push project${d}/* chart e${d} project_dest${d}
#logout and login target
Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project project_dest${d}
#logout and login source
Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Replication Manage
Select Rule And Replicate rule${d}
Sleep 20
Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Go Into Project project_dest${d} has_image=${false}
Switch To Project Charts
Go Into Chart Version ${harbor_chart_name}
Retry Wait Until Page Contains ${harbor_chart_version}
Go Into Chart Detail ${harbor_chart_version}
Close Browser
Test Case - Replication Of Push Images from Self To Harbor By Push Event
Init Chrome Driver
${d}= Get Current Date result_format=%M%S
#login source
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project project${d}
Switch To Registries
Create A New Endpoint harbor e${d} https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} push project${d}/* image e${d} project_dest${d}
... Event Based
#logout and login target
Logout Harbor
Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Create An New Project project_dest${d}
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} centos
Sleep 10
Go Into Project project_dest${d}
Switch To Project Repo
Retry Wait Until Page Contains project_dest${d}/centos
Close Browser