2018-09-19 18:57:15 +02:00
# Copyright Project Harbor Authors
2017-08-07 08:02:38 +02:00
#
# 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 ***
${HARBOR_VERSION} v1.1.1
*** Keywords ***
2018-03-20 06:25:03 +01:00
Check New Rule UI Without Endpoint
2019-04-22 03:58:02 +02:00
Retry Element Click ${new_replication-rule_button}
Page Should Contain Please add an endpoint first
Retry Element Click ${link_to_registries}
Retry Wait Until Page Contains Endpoint URL
Retry Wait Element ${new_endpoint_button}
2018-01-03 06:41:31 +01:00
2018-03-20 06:25:03 +01:00
Create A New Endpoint
2019-04-23 09:33:04 +02:00
[Arguments] ${provider} ${name} ${url} ${username} ${pwd} ${save}=Y
2018-03-20 06:25:03 +01:00
#click new button
2019-04-23 09:33:04 +02:00
Retry Element Click xpath=${new_endpoint_button}
2018-03-20 06:25:03 +01:00
#input necessary info
2019-04-23 09:33:04 +02:00
Select From List By Value ${provider_selector} ${provider}
Retry Text Input xpath=${destination_name_xpath} ${name}
Run Keyword If '${provider}' != 'dockerHub' Run keyword Retry Text Input xpath=${destination_url_xpath} ${url}
Retry Text Input xpath=${destination_username_xpath} ${username}
Retry Text Input xpath=${destination_password_xpath} ${pwd}
2018-03-20 06:25:03 +01:00
#cancel verify cert since we use a selfsigned cert
2019-04-23 09:33:04 +02:00
Retry Element Click ${destination_insecure_xpath}
Run Keyword If '${save}' == 'Y' Run keyword Retry Double Keywords When Error Retry Element Click ${replication_save_xpath} Retry Wait Until Page Not Contains Element ${replication_save_xpath}
2019-04-24 05:20:26 +02:00
Run Keyword If '${save}' == 'Y' Run keyword Retry Wait Until Page Contains ${name}
2018-03-20 06:25:03 +01:00
Run Keyword If '${save}' == 'N' No Operation
2017-09-07 12:29:05 +02:00
2018-03-20 06:25:03 +01:00
Create A Rule With Existing Endpoint
2019-04-22 03:58:02 +02:00
# day 1=Monday..7=Sunday timeformat 12hour+am/pm
2018-03-20 06:25:03 +01:00
[Arguments] ${name} ${project_name} ${endpoint} ${mode} ${plan}=Daily ${weekday}=1 ${time}=0800a
#click new
2019-04-23 09:33:04 +02:00
Retry Element Click ${new_name_xpath}
2018-03-20 06:25:03 +01:00
#input name
Input Text ${rule_name} ${name}
#input descripiton,here skip, leave it blank
#source projects, input
Input Text ${source_project} ${project_name}
#set filter
2019-04-23 09:33:04 +02:00
Retry Element Click ${source_image_filter_add}
2018-03-20 06:25:03 +01:00
Input Text ${source_iamge_repo_filter} *
2019-04-23 09:33:04 +02:00
Retry Element Click ${source_image_filter_add}
2018-03-20 06:25:03 +01:00
Input Text ${source_image_tag_filter} *
#select endpoint
2019-04-23 09:33:04 +02:00
Retry Element Click ${rule_target_select}
2018-03-20 06:25:03 +01:00
Wait Until Element Is Visible //select[@id='ruleTarget']//option[contains(.,'${endpoint}')]
2019-04-23 09:33:04 +02:00
Retry Element Click //select[@id='ruleTarget']//option[contains(.,'${endpoint}')]
#set trigger
Retry Element Click ${rule_trigger_select}
2019-01-30 07:22:31 +01:00
Wait Until Element Is Visible //select[@id='ruleTrigger']//option[contains(.,'${mode}')]
2019-04-23 09:33:04 +02:00
Retry Element Click //select[@id='ruleTrigger']//option[contains(.,'${mode}')]
2018-04-25 10:24:11 +02:00
Run Keyword If '${mode}' == 'Scheduled' Setting Replicaiton Schedule ${plan} ${weekday} ${time}
#click save
2019-04-23 09:33:04 +02:00
Retry Element Click ${rule_save_button}
2018-04-25 10:24:11 +02:00
Project Create A Rule With Existing Endpoint
2019-04-23 09:33:04 +02:00
# day 1=Monday..7=Sunday timeformat 12hour+am/pm
2018-04-25 10:24:11 +02:00
[Arguments] ${name} ${project_name} ${endpoint} ${mode} ${plan}=Daily ${weekday}=1 ${time}=0800a
#click new
2019-04-23 09:33:04 +02:00
Retry Element Click ${new_name_xpath}
2018-04-25 10:24:11 +02:00
#input name
Input Text ${rule_name} ${name}
#input descripiton,here skip, leave it blank
#in this keyword, source project is not need to input
#set filter
2019-04-23 09:33:04 +02:00
Retry Element Click ${source_image_filter_add}
2018-04-25 10:24:11 +02:00
Input Text ${source_iamge_repo_filter} *
2019-04-23 09:33:04 +02:00
Retry Element Click ${source_image_filter_add}
2018-04-25 10:24:11 +02:00
Input Text ${source_image_tag_filter} *
#select endpoint
2019-04-23 09:33:04 +02:00
Retry Element Click ${rule_target_select}
2018-04-25 10:24:11 +02:00
Wait Until Element Is Visible //select[@id='ruleTarget']//option[contains(.,'${endpoint}')]
2019-04-23 09:33:04 +02:00
Retry Element Click //select[@id='ruleTarget']//option[contains(.,'${endpoint}')]
2018-04-25 10:24:11 +02:00
#set trigger
2019-04-23 09:33:04 +02:00
Retry Element Click ${rule_trigger_select}
2019-01-30 07:22:31 +01:00
Wait Until Element Is Visible //select[@id='ruleTrigger']//option[contains(.,'${mode}')]
2019-04-23 09:33:04 +02:00
Retry Element Click //select[@id='ruleTrigger']//option[contains(.,'${mode}')]
2018-03-20 06:25:03 +01:00
Run Keyword If '${mode}' == 'Scheduled' Setting Replicaiton Schedule ${plan} ${weekday} ${time}
#click save
2019-04-23 09:33:04 +02:00
Retry Element Click ${rule_save_button}
2017-11-30 04:05:44 +01:00
2018-03-20 06:25:03 +01:00
Setting Replication Schedule
[Arguments] ${plan} ${weekday}=1 ${time}=0800a
2019-04-23 09:33:04 +02:00
Retry Element Click ${schedule_type_select}
2019-01-30 07:22:31 +01:00
Wait Until Element Is Visible //select[@name='scheduleType']/option[@value='${plan}']
2019-04-23 09:33:04 +02:00
Retry Element Click //select[@name='scheduleType']/option[@value='${plan}']
2018-03-20 06:25:03 +01:00
Run Keyword If '${plan}' == 'Weekly' Setting Replication Weekday ${weekday}
Input Text ${shcedule_time} ${time}
2017-09-07 12:29:05 +02:00
2018-03-20 06:25:03 +01:00
Setting Replication Weekday
[arguments] ${day}
2019-04-23 09:33:04 +02:00
Retry Element Click ${schedule_day_select}
2019-01-30 07:22:31 +01:00
Wait Until Element Is Visible //select[@name='scheduleDay']/option[@value='${day}']
2019-04-23 09:33:04 +02:00
Retry Element Click //select[@name='scheduleDay']/option[@value='${day}']
2018-01-03 06:41:31 +01:00
2018-03-20 06:25:03 +01:00
Endpoint Is Unpingable
2019-04-23 09:33:04 +02:00
Retry Element Click ${ping_test_button}
2018-03-20 06:25:03 +01:00
Wait Until Page Contains Failed
Endpoint Is Pingable
2019-04-23 09:33:04 +02:00
Retry Element Click ${ping_test_button}
2018-03-20 06:25:03 +01:00
Wait Until Page Contains successfully
Disable Certificate Verification
Checkbox Should Be Selected ${destination_insecure_checkbox}
2019-04-23 09:33:04 +02:00
Retry Element Click ${destination_insecure_xpath}
2018-03-20 06:25:03 +01:00
Sleep 1
Enable Certificate Verification
Checkbox Should Not Be Selected ${destination_insecure_checkbox}
2019-04-23 09:33:04 +02:00
Retry Element Click ${destination_insecure_xpath}
2018-03-20 06:25:03 +01:00
Sleep 1
Switch To Registries
2019-04-23 09:33:04 +02:00
Retry Element Click ${nav_to_registries}
2018-03-20 06:25:03 +01:00
Sleep 1
Switch To Replication Manage
2019-04-23 09:33:04 +02:00
Retry Element Click ${nav_to_replications}
2018-03-20 06:25:03 +01:00
Sleep 1
Trigger Replication Manual
[Arguments] ${rule}
2019-04-23 09:33:04 +02:00
Retry Element Click ${rule_filter_search}
2018-03-20 06:25:03 +01:00
Input Text ${rule_filter_input} ${rule}
Sleep 1
2019-04-23 09:33:04 +02:00
Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label
Retry Element Click ${action_bar_replicate}
2018-03-20 06:25:03 +01:00
Wait Until Page Contains Element ${dialog_replicate}
2018-06-05 12:51:11 +02:00
#change from click to mouse down and up
Mouse Down ${dialog_replicate}
Mouse Up ${dialog_replicate}
2018-05-24 13:53:23 +02:00
Sleep 2
2019-01-30 07:22:31 +01:00
Wait Until Page Contains Element //clr-tab-content//div[contains(.,'${rule}')]/../div/clr-icon[@shape='success-standard']
2018-05-24 13:53:23 +02:00
Sleep 1
2018-03-20 06:25:03 +01:00
Rename Rule
[Arguments] ${rule} ${newname}
2019-04-23 09:33:04 +02:00
Retry Element Click ${rule_filter_search}
2018-03-20 06:25:03 +01:00
Input Text ${rule_filter_input} ${rule}
Sleep 1
2019-04-23 09:33:04 +02:00
Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label
Retry Element Click ${action_bar_edit}
2018-03-20 06:25:03 +01:00
Input Text ${rule_name} ${newname}
2019-04-23 09:33:04 +02:00
Retry Element Click ${rule_save_button}
2018-03-20 06:25:03 +01:00
Delete Rule
[Arguments] ${rule}
2019-04-23 09:33:04 +02:00
Retry Element Click ${rule_filter_search}
2018-03-20 06:25:03 +01:00
Input Text ${rule_filter_input} ${rule}
Sleep 1
2019-04-23 09:33:04 +02:00
Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label
Retry Element Click ${action_bar_delete}
2018-03-20 06:25:03 +01:00
Wait Until Page Contains Element ${dialog_delete}
2018-06-05 12:51:11 +02:00
#change from click to mouse down and up
Mouse Down ${dialog_delete}
Mouse Up ${dialog_delete}
2018-05-21 13:04:02 +02:00
Sleep 2
2018-03-20 06:25:03 +01:00
2018-03-20 11:11:39 +01:00
Filter Rule
[Arguments] ${rule}
2019-04-23 09:33:04 +02:00
Retry Element Click ${rule_filter_search}
2018-03-20 11:11:39 +01:00
Input Text ${rule_filter_input} ${rule}
Sleep 1
Select Rule
[Arguments] ${rule}
Sleep 1
2019-04-23 09:33:04 +02:00
Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label
2018-03-20 11:11:39 +01:00
2018-03-20 06:25:03 +01:00
Stop Jobs
2019-04-23 09:33:04 +02:00
Retry Element Click ${stop_jobs_button}
2018-03-20 06:25:03 +01:00
View Job Log
[arguments] ${job}
2019-04-23 09:33:04 +02:00
Retry Element Click ${job_filter_search}
2018-03-20 06:25:03 +01:00
Input Text ${job_filter_input} ${job}
2018-10-26 10:20:00 +02:00
Click Link //clr-dg-row[contains(.,'${job}')]//a
2018-03-20 06:25:03 +01:00
Rename Endpoint
[arguments] ${name} ${newname}
Filter Object ${name}
Select Object ${name}
2019-04-23 09:33:04 +02:00
Retry Element Click ${action_bar_edit}
2018-03-20 06:25:03 +01:00
Wait Until Page Contains Element ${destination_name_xpath}
Input Text ${destination_name_xpath} ${newname}
2019-04-23 09:33:04 +02:00
Retry Element Click ${replication_save_xpath}
2018-03-20 06:25:03 +01:00
Delete Endpoint
[Arguments] ${name}
2019-04-23 09:33:04 +02:00
Retry Element Click ${endpoint_filter_search}
2018-03-20 06:25:03 +01:00
Input Text ${endpoint_filter_input} ${name}
Sleep 1
#click checkbox before target endpoint
2019-04-23 09:33:04 +02:00
Retry Element Click //clr-dg-row[contains(.,'${name}')]//label
2018-04-10 13:41:48 +02:00
Sleep 1
2019-04-23 09:33:04 +02:00
Retry Element Click ${action_bar_delete}
2018-03-20 06:25:03 +01:00
Wait Until Page Contains Element ${dialog_delete}
2019-04-23 09:33:04 +02:00
Retry Element Click ${dialog_delete}