Skip to content

Commit

Permalink
Due to replication NG feature already in master branch, old replicati…
Browse files Browse the repository at this point in the history
…on 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 (goharbor#7611)

Signed-off-by: danfengliu <[email protected]>
  • Loading branch information
danfengliu authored and wy65701436 committed May 9, 2019
1 parent 7e674ec commit dffb2bb
Show file tree
Hide file tree
Showing 8 changed files with 232 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
103 changes: 55 additions & 48 deletions tests/resources/Harbor-Pages/Replication.robot
Original file line number Diff line number Diff line change
Expand Up @@ -44,55 +44,52 @@ 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}
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']//option[contains(.,'${mode}')]
Run Keyword If '${mode}' == 'Scheduled' Setting Replicaiton Schedule ${plan} ${weekday} ${time}
Retry Element Click //select[@id='ruleTrigger']
Retry Element Click //select[@id='ruleTrigger']//option[contains(.,'${mode}')]
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
[Arguments] ${name} ${project_name} ${endpoint} ${mode} ${plan}=Daily ${weekday}=1 ${time}=0800a
#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}')]
Retry Element Click //select[@id='ruleTarget']//option[contains(.,'${endpoint}')]
#set trigger
#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']//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}

Expand All @@ -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}
Expand Down Expand Up @@ -139,50 +136,46 @@ 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}
#change from click to mouse down and up
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}
[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}
Sleep 2

Filter Rule
[Arguments] ${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
Expand All @@ -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
Sleep 1
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
Retry Element Click ${action_bar_delete}
Wait Until Page Contains Element ${dialog_delete}
Retry Element Click ${dialog_delete}
19 changes: 18 additions & 1 deletion tests/resources/Harbor-Pages/Replication_Elements.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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']



38 changes: 14 additions & 24 deletions tests/resources/Harbor-Pages/UserProfile.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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}
28 changes: 28 additions & 0 deletions tests/resources/Harbor-Pages/UserProfile_Elements.robot
Original file line number Diff line number Diff line change
@@ -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']
10 changes: 10 additions & 0 deletions tests/resources/Util.robot
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand All @@ -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}
Expand Down
Loading

0 comments on commit dffb2bb

Please sign in to comment.