Add retry for keyword go into index

1. Add retry for keyword go into index;
2. Add retry for keyword go into project.
Signed-off-by: danfengliu <danfengl@vmware.com>
This commit is contained in:
danfengliu 2020-05-22 02:56:03 +00:00
parent 2ff0638f8b
commit 5d8a308158
12 changed files with 1793 additions and 1789 deletions

View File

@ -5,7 +5,7 @@ Make Swagger Client
[Return] ${rc}
Setup API Test
Retry Keyword When Error Make Swagger Client
Retry Keyword N Times When Error 10 Make Swagger Client
Harbor API Test
[Arguments] ${testcase_name}

View File

@ -149,7 +149,7 @@ Docker Login
Docker Pull
[Arguments] ${image}
${output}= Retry Keyword When Error Wait Unitl Command Success docker pull ${image}
${output}= Retry Keyword N Times When Error 10 Wait Unitl Command Success docker pull ${image}
Log ${output}
Log To Console Docker Pull: \n ${output}
[Return] ${output}

View File

@ -36,7 +36,7 @@ GC Now
Retry GC Should Be Successful
[Arguments] ${history_id} ${expected_msg}
Retry Keyword When Error GC Should Be Successful ${history_id} ${expected_msg}
Retry Keyword N Times When Error 15 GC Should Be Successful ${history_id} ${expected_msg}
GC Should Be Successful
[Arguments] ${history_id} ${expected_msg}

View File

@ -1,210 +1,215 @@
# 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 ***
Go Into Project
[Arguments] ${project} ${has_image}=${true}
Sleep 2
Retry Element Click xpath=//harbor-app/harbor-shell/clr-main-container/navigator/clr-header/div[1]/a/span
Sleep 2
Retry Text Input ${search_input} ${project}
:For ${n} IN RANGE 1 5
\ Sleep 2
\ ${out} Run Keyword If ${has_image}==${false} Retry Double Keywords When Error Retry Element Click xpath=//*[@id='project-results']//clr-dg-cell[contains(.,'${project}')]/a Wait Until Element Is Visible And Enabled xpath=//clr-dg-placeholder[contains(.,\"We couldn\'t find any repositories!\")] DoAssert=${false}
\ ... ELSE Retry Double Keywords When Error Retry Element Click xpath=//*[@id='project-results']//clr-dg-cell[contains(.,'${project}')]/a Wait Until Element Is Visible And Enabled xpath=//project-detail//hbr-repository-gridview//clr-dg-cell[contains(.,'${project}/')] DoAssert=${false}
\ Log To Console ${out}
\ Run Keyword If ${out} == 'PASS' Exit For Loop
\ Sleep 1
Should Be Equal ${out} 'PASS'
Sleep 1
Add User To Project Admin
[Arguments] ${project} ${user}
# *** this keyword has not been used ***
Go Into Project
Retry Element Click xpath=${project_member_tag_xpath}
Retry Element Click xpath=${project_member_add_button_xpath}
Retry Text Input xpath=${project_member_add_username_xpath} ${user}
Retry Element Click xpath=${project_member_add_admin_xpath}
Retry Element Click xpath=${project_member_add_save_button_xpath}
Sleep 4
Search Project Member
[Arguments] ${project} ${user}
# *** this keyword has not been used ***
Go Into Project ${project}
Retry Element Click xpath=//clr-dg-cell//a[contains(.,'${project}')]
Retry Element Click xpath=${project_member_search_button_xpath}
Retry Element Click xpath=${project_member_search_text_xpath}
Retry Wait Until Page Contains ${user}
Change Project Member Role
[Arguments] ${project} ${user} ${role}
Retry Element Click xpath=//clr-dg-cell//a[contains(.,'${project}')]
Retry Element Click xpath=${project_member_tag_xpath}
Retry Element Click xpath=//project-detail//clr-dg-row[contains(.,'${user}')]//clr-checkbox-wrapper
#change role
Retry Element Click ${project_member_action_xpath}
Retry Element Click //button[contains(.,'${role}')]
Retry Wait Until Page Not Contains Element ${project_member_set_role_xpath}
#Precondition is that only 1 member is in the list.
Retry Wait Until Page Contains ${role}
User Can Change Role
[arguments] ${username}
Retry Element Click xpath=//clr-dg-row[contains(.,'${username}')]//input/../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=//*[@id='member-action']
Retry Wait Until Page Contains Element xpath=//button[@disabled='' and contains(.,'Admin')]
#this keyworkd seems will not use any more, will delete in the future
Non-admin View Member Account
[arguments] ${times}
Xpath Should Match X Times //clr-dg-row-master ${times}
User Can Not Add Member
Retry Wait Until Page Contains Element xpath=//button[@disabled='' and contains(.,'User')]
Add Guest Member To Project
[arguments] ${member}
Retry Double Keywords When Error Retry Element Click xpath=${project_member_add_button_xpath} Retry Wait Until Page Contains Element xpath=${project_member_add_button_xpath}
Retry Text Input xpath=${project_member_add_username_xpath} ${member}
#select guest
Mouse Down xpath=${project_member_guest_radio_checkbox}
Mouse Up xpath=${project_member_guest_radio_checkbox}
Retry Double Keywords When Error Retry Element Click xpath=${project_member_add_confirmation_ok_xpath} Retry Wait Until Page Not Contains Element xpath=${project_member_add_confirmation_ok_xpath}
Delete Project Member
[arguments] ${member}
Retry Element Click xpath=//clr-dg-row[contains(.,'${member}')]//input/../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}
Sleep 1
User Should Be Owner Of Project
[Arguments] ${user} ${pwd} ${project}
Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
Go Into Project ${project}
Switch To Member
User Can Not Change Role ${user}
Push image ${ip} ${user} ${pwd} ${project} hello-world
Logout Harbor
User Should Not Be A Member Of Project
[Arguments] ${user} ${pwd} ${project} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user}
${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL}
${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd}
Project Should Not Display ${project}
Logout Harbor
Cannot Pull image ${ip} ${user} ${password} ${project} ${ip}/${project}/hello-world
Cannot Push image ${ip} ${user} ${password} ${project} hello-world
Manage Project Member
[Arguments] ${admin} ${pwd} ${project} ${user} ${op} ${has_image}=${true} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${admin} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${admin}
Go Into Project ${project} ${has_image}
Switch To Member
Run Keyword If '${op}' == 'Add' Add Guest Member To Project ${user}
... ELSE IF '${op}' == 'Remove' Delete Project Member ${user}
... ELSE Change Project Member Role ${project} ${user} ${role}
Logout Harbor
Change User Role In Project
[Arguments] ${admin} ${pwd} ${project} ${user} ${role} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${admin} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${admin}
Retry Wait Element Visible //clr-dg-cell//a[contains(.,'${project}')]
Change Project Member Role ${project} ${user} ${role}
Logout Harbor
User Should Be Guest
[Arguments] ${user} ${pwd} ${project} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user}
${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL}
${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd}
Project Should Display ${project}
Go Into Project ${project}
Switch To Member
User Can Not Add Member
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Guest')]
Logout Harbor
Pull image ${ip} ${user} ${password} ${project} hello-world
Cannot Push image ${ip} ${user} ${password} ${project} hello-world
User Should Be Developer
[Arguments] ${user} ${pwd} ${project} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user}
${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL}
${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd}
Project Should Display ${project}
Go Into Project ${project}
Switch To Member
User Can Not Add Member
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Developer')]
Logout Harbor
Push Image With Tag ${ip} ${user} ${password} ${project} hello-world v1
User Should Be Admin
[Arguments] ${user} ${pwd} ${project} ${guest} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user}
${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL}
${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd}
Project Should Display ${project}
Go Into Project ${project}
Switch To Member
Add Guest Member To Project ${guest}
User Can Change Role ${guest}
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Admin')]
Logout Harbor
Push Image With Tag ${ip} ${user} ${password} ${project} hello-world v2
User Should Be Master
[Arguments] ${user} ${pwd} ${project} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user}
${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL}
${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd}
Project Should Display ${project}
Go Into Project ${project}
Delete Repo ${project}
Switch To Member
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Master')]
Logout Harbor
Push Image With Tag ${ip} ${user} ${password} ${project} hello-world v3
Project Should Have Member
[Arguments] ${project} ${user}
Sign In Harbor ${HARBOR_URL} %{HARBOR_ADMIN} %{HARBOR_PASSWORD}
Go Into Project ${project}
Switch To Member
Retry Wait Until Page Contains Element xpath=//clr-dg-cell[contains(., '${user}')]
Logout Harbor
# 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 ***
Go Into Project
[Arguments] ${project} ${has_image}=${true}
Retry Keyword N Times When Error 5 Clear Search Input And Go Into Project ${project} ${has_image}
Clear Search Input And Go Into Project
[Arguments] ${project} ${has_image}
# Close prompt in header
Sleep 2
#go To ${url}
Reload Page
Sleep 2
# Clear Search Input
Retry Element Click xpath=//harbor-app/harbor-shell/clr-main-container/navigator/clr-header/div[1]/a/span
Sleep 2
Retry Text Input ${search_input} ${project}
Sleep 2
# Go Into Project
${out} Run Keyword If ${has_image}==${false} Run Keywords Retry Element Click xpath=//*[@id='project-results']//clr-dg-cell[contains(.,'${project}')]/a AND Wait Until Element Is Visible And Enabled xpath=//clr-dg-placeholder[contains(.,\"We couldn\'t find any repositories!\")]
... ELSE Run Keywords Retry Element Click xpath=//*[@id='project-results']//clr-dg-cell[contains(.,'${project}')]/a AND Wait Until Element Is Visible And Enabled xpath=//project-detail//hbr-repository-gridview//clr-dg-cell[contains(.,'${project}/')]
Sleep 1
Add User To Project Admin
[Arguments] ${project} ${user}
# *** this keyword has not been used ***
Go Into Project
Retry Element Click xpath=${project_member_tag_xpath}
Retry Element Click xpath=${project_member_add_button_xpath}
Retry Text Input xpath=${project_member_add_username_xpath} ${user}
Retry Element Click xpath=${project_member_add_admin_xpath}
Retry Element Click xpath=${project_member_add_save_button_xpath}
Sleep 4
Search Project Member
[Arguments] ${project} ${user}
# *** this keyword has not been used ***
Go Into Project ${project}
Retry Element Click xpath=//clr-dg-cell//a[contains(.,'${project}')]
Retry Element Click xpath=${project_member_search_button_xpath}
Retry Element Click xpath=${project_member_search_text_xpath}
Retry Wait Until Page Contains ${user}
Change Project Member Role
[Arguments] ${project} ${user} ${role}
Retry Element Click xpath=//clr-dg-cell//a[contains(.,'${project}')]
Retry Element Click xpath=${project_member_tag_xpath}
Retry Element Click xpath=//project-detail//clr-dg-row[contains(.,'${user}')]//clr-checkbox-wrapper
#change role
Retry Element Click ${project_member_action_xpath}
Retry Element Click //button[contains(.,'${role}')]
Retry Wait Until Page Not Contains Element ${project_member_set_role_xpath}
#Precondition is that only 1 member is in the list.
Retry Wait Until Page Contains ${role}
User Can Change Role
[arguments] ${username}
Retry Element Click xpath=//clr-dg-row[contains(.,'${username}')]//input/../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=//*[@id='member-action']
Retry Wait Until Page Contains Element xpath=//button[@disabled='' and contains(.,'Admin')]
#this keyworkd seems will not use any more, will delete in the future
Non-admin View Member Account
[arguments] ${times}
Xpath Should Match X Times //clr-dg-row-master ${times}
User Can Not Add Member
Retry Wait Until Page Contains Element xpath=//button[@disabled='' and contains(.,'User')]
Add Guest Member To Project
[arguments] ${member}
Retry Double Keywords When Error Retry Element Click xpath=${project_member_add_button_xpath} Retry Wait Until Page Contains Element xpath=${project_member_add_button_xpath}
Retry Text Input xpath=${project_member_add_username_xpath} ${member}
#select guest
Mouse Down xpath=${project_member_guest_radio_checkbox}
Mouse Up xpath=${project_member_guest_radio_checkbox}
Retry Double Keywords When Error Retry Element Click xpath=${project_member_add_confirmation_ok_xpath} Retry Wait Until Page Not Contains Element xpath=${project_member_add_confirmation_ok_xpath}
Delete Project Member
[arguments] ${member}
Retry Element Click xpath=//clr-dg-row[contains(.,'${member}')]//input/../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}
Sleep 1
User Should Be Owner Of Project
[Arguments] ${user} ${pwd} ${project}
Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
Go Into Project ${project}
Switch To Member
User Can Not Change Role ${user}
Push image ${ip} ${user} ${pwd} ${project} hello-world
Logout Harbor
User Should Not Be A Member Of Project
[Arguments] ${user} ${pwd} ${project} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user}
${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL}
${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd}
Project Should Not Display ${project}
Logout Harbor
Cannot Pull image ${ip} ${user} ${password} ${project} ${ip}/${project}/hello-world
Cannot Push image ${ip} ${user} ${password} ${project} hello-world
Manage Project Member
[Arguments] ${admin} ${pwd} ${project} ${user} ${op} ${has_image}=${true} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${admin} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${admin}
Go Into Project ${project} ${has_image}
Switch To Member
Run Keyword If '${op}' == 'Add' Add Guest Member To Project ${user}
... ELSE IF '${op}' == 'Remove' Delete Project Member ${user}
... ELSE Change Project Member Role ${project} ${user} ${role}
Logout Harbor
Change User Role In Project
[Arguments] ${admin} ${pwd} ${project} ${user} ${role} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${admin} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${admin}
Retry Wait Element Visible //clr-dg-cell//a[contains(.,'${project}')]
Change Project Member Role ${project} ${user} ${role}
Logout Harbor
User Should Be Guest
[Arguments] ${user} ${pwd} ${project} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user}
${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL}
${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd}
Project Should Display ${project}
Go Into Project ${project}
Switch To Member
User Can Not Add Member
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Guest')]
Logout Harbor
Pull image ${ip} ${user} ${password} ${project} hello-world
Cannot Push image ${ip} ${user} ${password} ${project} hello-world
User Should Be Developer
[Arguments] ${user} ${pwd} ${project} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user}
${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL}
${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd}
Project Should Display ${project}
Go Into Project ${project}
Switch To Member
User Can Not Add Member
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Developer')]
Logout Harbor
Push Image With Tag ${ip} ${user} ${password} ${project} hello-world v1
User Should Be Admin
[Arguments] ${user} ${pwd} ${project} ${guest} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user}
${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL}
${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd}
Project Should Display ${project}
Go Into Project ${project}
Switch To Member
Add Guest Member To Project ${guest}
User Can Change Role ${guest}
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Admin')]
Logout Harbor
Push Image With Tag ${ip} ${user} ${password} ${project} hello-world v2
User Should Be Master
[Arguments] ${user} ${pwd} ${project} ${is_oidc_mode}=${false}
Run Keyword If ${is_oidc_mode} == ${false} Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
... ELSE Sign In Harbor With OIDC User ${HARBOR_URL} username=${user}
${pwd_oidc}= Run Keyword And Return If ${is_oidc_mode} == ${true} Get Secrete By API ${HARBOR_URL}
${password}= Set Variable If ${is_oidc_mode} == ${true} ${pwd_oidc} ${pwd}
Project Should Display ${project}
Go Into Project ${project}
Delete Repo ${project}
Switch To Member
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Master')]
Logout Harbor
Push Image With Tag ${ip} ${user} ${password} ${project} hello-world v3
Project Should Have Member
[Arguments] ${project} ${user}
Sign In Harbor ${HARBOR_URL} %{HARBOR_ADMIN} %{HARBOR_PASSWORD}
Go Into Project ${project}
Switch To Member
Retry Wait Until Page Contains Element xpath=//clr-dg-cell[contains(., '${user}')]
Logout Harbor

View File

@ -1,323 +1,334 @@
# 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 ***
Create An New Project And Go Into Project
[Arguments] ${projectname} ${public}=false ${count_quota}=${null} ${storage_quota}=${null} ${storage_quota_unit}=${null}
Navigate To Projects
Retry Button Click xpath=${create_project_button_xpath}
Log To Console Project Name: ${projectname}
Capture Page Screenshot
Retry Text Input xpath=${project_name_xpath} ${projectname}
${element_project_public}= Set Variable xpath=${project_public_xpath}
Run Keyword If '${public}' == 'true' Run Keywords Wait Until Element Is Visible And Enabled ${element_project_public} AND Retry Element Click ${element_project_public}
Run Keyword If '${count_quota}'!='${null}' Input Count Quota ${count_quota}
Run Keyword If '${storage_quota}'!='${null}' Input Storage Quota ${storage_quota} ${storage_quota_unit}
Capture Page Screenshot
Retry Double Keywords When Error Retry Element Click ${create_project_OK_button_xpath} Retry Wait Until Page Not Contains Element ${create_project_OK_button_xpath}
Capture Page Screenshot
Go Into Project ${projectname} has_image=${false}
Create An New Project With New User
[Arguments] ${url} ${username} ${email} ${realname} ${newPassword} ${comment} ${projectname} ${public}
Create An New User url=${url} username=${username} email=${email} realname=${realname} newPassword=${newPassword} comment=${comment}
Logout Harbor
Sign In Harbor ${url} ${username} ${newPassword}
Create An New Project And Go Into Project ${projectname} ${public}
Sleep 1
#It's the log of project.
Go To Project Log
#Switch To Project Tab Overflow
Retry Element Click xpath=${project_log_xpath}
Sleep 2
Switch To Member
Sleep 3
Retry Element Click xpath=${project_member_xpath}
Sleep 1
Switch To Log
Retry Element Click xpath=${log_xpath}
Sleep 1
Switch To Replication
Retry Element Click xpath=${project_replication_xpath}
Sleep 1
Switch To Project Configuration
Retry Element Click ${project_config_tabsheet}
Sleep 1
Switch To Tag Retention
#Switch To Project Tab Overflow
Retry Element Click xpath=${project_tag_strategy_xpath}
Sleep 1
Switch To Tag Immutability
#Switch To Project Tab Overflow
Retry Double Keywords When Error Retry Element Click xpath=${project_tag_strategy_xpath} Retry Wait Until Page Contains Element ${project_tag_immutability_switch}
Retry Double Keywords When Error Retry Element Click xpath=${project_tag_immutability_switch} Retry Wait Until Page Contains Immutability rules
Sleep 1
Switch To Project Tab Overflow
Retry Element Click xpath=${project_tab_overflow_btn}
Sleep 1
Navigate To Projects
Retry Element Click xpath=${projects_xpath}
Sleep 2
Project Should Display
[Arguments] ${projectname}
Retry Wait Element xpath=//project//list-project//clr-dg-cell/a[contains(.,'${projectname}')]
Project Should Not Display
[Arguments] ${projectname}
Retry Wait Until Page Not Contains Element xpath=//project//list-project//clr-dg-cell/a[contains(.,'${projectname}')]
Search Private Projects
Retry Element Click xpath=//select
Retry Element Click xpath=//select/option[@value=1]
Sleep 1
Capture Page Screenshot SearchPrivateProjects.png
Make Project Private
[Arguments] ${projectname}
Go Into Project ${project name}
Switch To Project Configuration
Retry Checkbox Should Be Selected ${project_config_public_checkbox}
Retry Double Keywords When Error Retry Element Click ${project_config_public_checkbox_label} Retry Checkbox Should Not Be Selected ${project_config_public_checkbox}
Retry Element Click //button[contains(.,'SAVE')]
Go Into Project ${project name}
Switch To Project Configuration
Retry Checkbox Should Not Be Selected ${project_config_public_checkbox}
Make Project Public
[Arguments] ${projectname}
Go Into Project ${project name}
Switch To Project Configuration
Retry Checkbox Should Not Be Selected ${project_config_public_checkbox}
Retry Double Keywords When Error Retry Element Click ${project_config_public_checkbox_label} Retry Checkbox Should Be Selected ${project_config_public_checkbox}
Retry Element Click //button[contains(.,'SAVE')]
Go Into Project ${project name}
Switch To Project Configuration
Retry Checkbox Should Be Selected ${project_config_public_checkbox}
Delete Repo
[Arguments] ${projectname}
${element_repo_checkbox}= Set Variable xpath=//clr-dg-row[contains(.,'${projectname}')]//clr-checkbox-wrapper//label
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}
Retry Double Keywords When Error Retry Element Click ${delete_confirm_btn} Retry Wait Until Page Not Contains Element ${delete_confirm_btn}
Retry Wait Until Page Not Contains Element ${element_repo_checkbox}
Delete Repo on CardView
[Arguments] ${reponame}
Retry Element Click //hbr-gridview//span[contains(.,'${reponame}')]//clr-dropdown/button
Retry Element Click //hbr-gridview//span[contains(.,'${reponame}')]//clr-dropdown/clr-dropdown-menu/button[contains(.,'Delete')]
Retry Element Click ${repo_delete_on_card_view_btn}
Sleep 2
Delete Project
[Arguments] ${projectname}
Navigate To Projects
Retry Element Click xpath=//clr-dg-row[contains(.,'${projectname}')]//clr-checkbox-wrapper//label
Retry Element Click xpath=//*[@id='delete-project']
Retry Element Click //clr-modal//button[contains(.,'DELETE')]
Sleep 1
Project Should Not Be Deleted
[Arguments] ${projname}
Delete Project ${projname}
Retry Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${projname}')]/../div/clr-icon[@shape='error-standard']
Project Should Be Deleted
[Arguments] ${projname}
Delete Project ${projname}
Retry Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${projname}')]/../div/clr-icon[@shape='success-standard']
Advanced Search Should Display
Retry Wait Until Page Contains Element xpath=//audit-log//div[@class='flex-xs-middle']/button
# it's not a common keywords, only used into log case.
Do Log Advanced Search
Capture Page Screenshot LogAdvancedSearch.png
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'artifact') and contains(.,'pull')]
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'artifact') and contains(.,'create')]
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'artifact') and contains(.,'delete')]
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'project') and contains(.,'create')]
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'repository') and contains(.,'delete')]
Retry Element Click xpath=//audit-log//div[@class='flex-xs-middle']/button
Retry Element Click xpath=//project-detail//audit-log//clr-dropdown/button
#pull log
Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Pull')]
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'pull')]
#push log
Retry Element Click xpath=//audit-log//clr-dropdown/button
Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Push')]
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'push')]
#create log
Retry Element Click xpath=//audit-log//clr-dropdown/button
Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Create')]
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'create')]
#delete log
Retry Element Click xpath=//audit-log//clr-dropdown/button
Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Delete')]
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'delete')]
#others
Retry Element Click xpath=//audit-log//clr-dropdown/button
Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Others')]
Retry Element Click xpath=//audit-log//hbr-filter//clr-icon
Retry Text Input xpath=//audit-log//hbr-filter//input harbor
Sleep 1
Capture Page Screenshot LogAdvancedSearch2.png
${rc} = Get Element Count //audit-log//clr-dg-row
Should Be Equal As Integers ${rc} 0
Go Into Repo
[Arguments] ${repoName}
Sleep 2
Retry Wait Until Page Not Contains Element ${repo_list_spinner}
${repo_name_element}= Set Variable xpath=//clr-dg-cell[contains(.,'${repoName}')]/a
Retry Element Click ${repo_search_icon}
:For ${n} IN RANGE 1 10
\ Retry Clear Element Text ${repo_search_input}
\ Retry Text Input ${repo_search_input} ${repoName}
\ ${out} Run Keyword And Ignore Error Retry Wait Until Page Contains Element ${repo_name_element}
\ Exit For Loop If '${out[0]}'=='PASS'
\ Capture Page Screenshot gointo_${repoName}.png
\ Sleep 2
Retry Double Keywords When Error Retry Element Click ${repo_name_element} Retry Wait Until Page Not Contains Element ${repo_name_element}
Retry Wait Element ${tag_table_column_vulnerabilities}
Retry Wait Element ${tag_table_column_size}
Capture Page Screenshot gointo_${repoName}.png
Go Into Index
[Arguments] ${index_name}=${null}
Retry Element Click ${artifact_achieve_icon}
Switch To CardView
Retry Element Click xpath=//hbr-repository-gridview//span[@class='card-btn']/clr-icon
Sleep 5
Expand Repo
[Arguments] ${projectname}
Retry Element Click //repository//clr-dg-row[contains(.,'${projectname}')]//button/clr-icon
Sleep 1
Edit Repo Info
Retry Element Click //*[@id='repo-info']
Retry Wait Until Page Contains Element //*[@id='info']/form/div[2]
# Cancel input
Retry Element Click xpath=//*[@id='info-edit-button']/button
Input Text xpath=//*[@id='info-edit-textarea'] test_description_info
Retry Element Click xpath=//*[@id='edit-cancel']
Retry Element Click xpath=//clr-modal//button[contains(.,'CONFIRM')]
Retry Wait Until Page Contains Element //*[@id='no-editing']
# Confirm input
Retry Element Click xpath=//*[@id='info-edit-button']/button
Input Text xpath=//*[@id='info-edit-textarea'] test_description_info
Retry Element Click xpath=//*[@id='edit-save']
Retry Wait Until Page Contains test_description_info
Capture Page Screenshot
Switch To Project Label
Retry Element Click xpath=//project-detail//a[contains(.,'Labels')]
Sleep 1
Switch To Project Repo
Retry Element Click xpath=//project-detail//a[contains(.,'Repositories')]
Sleep 1
Add Labels To Tag
[Arguments] ${tagName} ${labelName}
Retry Element Click xpath=//clr-dg-row[contains(.,'${tagName}')]//label
Capture Page Screenshot add_${labelName}.png
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}')]
Retry Wait Until Page Contains Element xpath=//clr-dg-row//label[contains(.,'${labelName}')]
Filter Labels In Tags
[Arguments] ${labelName1} ${labelName2}
Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
Retry Element Click xpath=//clr-main-container//artifact-list-tab//clr-select-container//select
Retry Element Click xpath=//clr-main-container//artifact-list-tab//clr-select-container//select/option[@value='labels']
Retry Wait Until Page Contains Element xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName1}')]
Retry Element Click xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName1}')]
Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
Retry Wait Until Page Contains Element xpath=//clr-datagrid//label[contains(.,'${labelName1}')]
Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
Retry Element Click xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName2}')]
Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
Sleep 2
Capture Page Screenshot filter_${labelName2}.png
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${labelName2}')]
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'${labelName1}')]
Get Statics Private Repo
${privaterepo}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[2]/statistics/div/span[1]
Convert To Integer ${privaterepo}
[Return] ${privaterepo}
Get Statics Private Project
${privateproj}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[1]/statistics/div/span[1]
Convert To Integer ${privateproj}
[Return] ${privateproj}
Get Statics Public Repo
${publicrepo}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[3]/div[2]/statistics/div/span[1]
Convert To Integer ${publicrepo}
[Return] ${publicrepo}
Get Statics Public Project
${publicproj}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[3]/div[1]/statistics/div/span[1]
Convert To Integer ${publicproj}
[Return] ${publicproj}
Get Statics Total Repo
${totalrepo}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[4]/div[2]/statistics/div/span[1]
Convert To Integer ${totalrepo}
[Return] ${totalrepo}
Get Statics Total Project
${totalproj}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[4]/div[1]/statistics/div/span[1]
Convert To Integer ${totalproj}
[Return] ${totalproj}
Input Count Quota
[Arguments] ${text}
${element_xpath}= Set Variable ${project_add_count_quota_input_text_id}
Retry Clear Element Text ${element_xpath}
Retry Text Input ${element_xpath} ${text}
Input Storage Quota
[Arguments] ${text} ${unit}=${null}
${element_xpath}= Set Variable ${project_add_storage_quota_input_text_id}
Retry Clear Element Text ${element_xpath}
Retry Text Input ${element_xpath} ${text}
Run Keyword If '${unit}'!='${null}' Select Storage Quota unit ${unit}
Select Storage Quota unit
[Arguments] ${unit}
Select From List By Value ${project_add_storage_quota_unit_id} ${unit}
# 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 ***
Create An New Project And Go Into Project
[Arguments] ${projectname} ${public}=false ${count_quota}=${null} ${storage_quota}=${null} ${storage_quota_unit}=${null}
Navigate To Projects
Retry Button Click xpath=${create_project_button_xpath}
Log To Console Project Name: ${projectname}
Capture Page Screenshot
Retry Text Input xpath=${project_name_xpath} ${projectname}
${element_project_public}= Set Variable xpath=${project_public_xpath}
Run Keyword If '${public}' == 'true' Run Keywords Wait Until Element Is Visible And Enabled ${element_project_public} AND Retry Element Click ${element_project_public}
Run Keyword If '${count_quota}'!='${null}' Input Count Quota ${count_quota}
Run Keyword If '${storage_quota}'!='${null}' Input Storage Quota ${storage_quota} ${storage_quota_unit}
Capture Page Screenshot
Retry Double Keywords When Error Retry Element Click ${create_project_OK_button_xpath} Retry Wait Until Page Not Contains Element ${create_project_OK_button_xpath}
Capture Page Screenshot
Go Into Project ${projectname} has_image=${false}
Create An New Project With New User
[Arguments] ${url} ${username} ${email} ${realname} ${newPassword} ${comment} ${projectname} ${public}
Create An New User url=${url} username=${username} email=${email} realname=${realname} newPassword=${newPassword} comment=${comment}
Logout Harbor
Sign In Harbor ${url} ${username} ${newPassword}
Create An New Project And Go Into Project ${projectname} ${public}
Sleep 1
#It's the log of project.
Go To Project Log
#Switch To Project Tab Overflow
Retry Element Click xpath=${project_log_xpath}
Sleep 2
Switch To Member
Sleep 3
Retry Element Click xpath=${project_member_xpath}
Sleep 1
Switch To Log
Retry Element Click xpath=${log_xpath}
Sleep 1
Switch To Replication
Retry Element Click xpath=${project_replication_xpath}
Sleep 1
Switch To Project Configuration
Retry Element Click ${project_config_tabsheet}
Sleep 1
Switch To Tag Retention
#Switch To Project Tab Overflow
Retry Element Click xpath=${project_tag_strategy_xpath}
Sleep 1
Switch To Tag Immutability
#Switch To Project Tab Overflow
Retry Double Keywords When Error Retry Element Click xpath=${project_tag_strategy_xpath} Retry Wait Until Page Contains Element ${project_tag_immutability_switch}
Retry Double Keywords When Error Retry Element Click xpath=${project_tag_immutability_switch} Retry Wait Until Page Contains Immutability rules
Sleep 1
Switch To Project Tab Overflow
Retry Element Click xpath=${project_tab_overflow_btn}
Sleep 1
Navigate To Projects
Retry Element Click xpath=${projects_xpath}
Sleep 2
Project Should Display
[Arguments] ${projectname}
Retry Wait Element xpath=//project//list-project//clr-dg-cell/a[contains(.,'${projectname}')]
Project Should Not Display
[Arguments] ${projectname}
Retry Wait Until Page Not Contains Element xpath=//project//list-project//clr-dg-cell/a[contains(.,'${projectname}')]
Search Private Projects
Retry Element Click xpath=//select
Retry Element Click xpath=//select/option[@value=1]
Sleep 1
Capture Page Screenshot SearchPrivateProjects.png
Make Project Private
[Arguments] ${projectname}
Go Into Project ${project name}
Switch To Project Configuration
Retry Checkbox Should Be Selected ${project_config_public_checkbox}
Retry Double Keywords When Error Retry Element Click ${project_config_public_checkbox_label} Retry Checkbox Should Not Be Selected ${project_config_public_checkbox}
Retry Element Click //button[contains(.,'SAVE')]
Go Into Project ${project name}
Switch To Project Configuration
Retry Checkbox Should Not Be Selected ${project_config_public_checkbox}
Make Project Public
[Arguments] ${projectname}
Go Into Project ${project name}
Switch To Project Configuration
Retry Checkbox Should Not Be Selected ${project_config_public_checkbox}
Retry Double Keywords When Error Retry Element Click ${project_config_public_checkbox_label} Retry Checkbox Should Be Selected ${project_config_public_checkbox}
Retry Element Click //button[contains(.,'SAVE')]
Go Into Project ${project name}
Switch To Project Configuration
Retry Checkbox Should Be Selected ${project_config_public_checkbox}
Delete Repo
[Arguments] ${projectname}
${element_repo_checkbox}= Set Variable xpath=//clr-dg-row[contains(.,'${projectname}')]//clr-checkbox-wrapper//label
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}
Retry Double Keywords When Error Retry Element Click ${delete_confirm_btn} Retry Wait Until Page Not Contains Element ${delete_confirm_btn}
Retry Wait Until Page Not Contains Element ${element_repo_checkbox}
Delete Repo on CardView
[Arguments] ${reponame}
Retry Element Click //hbr-gridview//span[contains(.,'${reponame}')]//clr-dropdown/button
Retry Element Click //hbr-gridview//span[contains(.,'${reponame}')]//clr-dropdown/clr-dropdown-menu/button[contains(.,'Delete')]
Retry Element Click ${repo_delete_on_card_view_btn}
Sleep 2
Delete Project
[Arguments] ${projectname}
Navigate To Projects
Retry Element Click xpath=//clr-dg-row[contains(.,'${projectname}')]//clr-checkbox-wrapper//label
Retry Element Click xpath=//*[@id='delete-project']
Retry Element Click //clr-modal//button[contains(.,'DELETE')]
Sleep 1
Project Should Not Be Deleted
[Arguments] ${projname}
Delete Project ${projname}
Retry Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${projname}')]/../div/clr-icon[@shape='error-standard']
Project Should Be Deleted
[Arguments] ${projname}
Delete Project ${projname}
Retry Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${projname}')]/../div/clr-icon[@shape='success-standard']
Advanced Search Should Display
Retry Wait Until Page Contains Element xpath=//audit-log//div[@class='flex-xs-middle']/button
# it's not a common keywords, only used into log case.
Do Log Advanced Search
Capture Page Screenshot LogAdvancedSearch.png
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'artifact') and contains(.,'pull')]
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'artifact') and contains(.,'create')]
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'artifact') and contains(.,'delete')]
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'project') and contains(.,'create')]
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'repository') and contains(.,'delete')]
Retry Element Click xpath=//audit-log//div[@class='flex-xs-middle']/button
Retry Element Click xpath=//project-detail//audit-log//clr-dropdown/button
#pull log
Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Pull')]
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'pull')]
#push log
Retry Element Click xpath=//audit-log//clr-dropdown/button
Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Push')]
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'push')]
#create log
Retry Element Click xpath=//audit-log//clr-dropdown/button
Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Create')]
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'create')]
#delete log
Retry Element Click xpath=//audit-log//clr-dropdown/button
Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Delete')]
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'delete')]
#others
Retry Element Click xpath=//audit-log//clr-dropdown/button
Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Others')]
Retry Element Click xpath=//audit-log//hbr-filter//clr-icon
Retry Text Input xpath=//audit-log//hbr-filter//input harbor
Sleep 1
Capture Page Screenshot LogAdvancedSearch2.png
${rc} = Get Element Count //audit-log//clr-dg-row
Should Be Equal As Integers ${rc} 0
Go Into Repo
[Arguments] ${repoName}
Sleep 2
Retry Wait Until Page Not Contains Element ${repo_list_spinner}
${repo_name_element}= Set Variable xpath=//clr-dg-cell[contains(.,'${repoName}')]/a
Retry Element Click ${repo_search_icon}
:For ${n} IN RANGE 1 10
\ Retry Clear Element Text ${repo_search_input}
\ Retry Text Input ${repo_search_input} ${repoName}
\ ${out} Run Keyword And Ignore Error Retry Wait Until Page Contains Element ${repo_name_element}
\ Exit For Loop If '${out[0]}'=='PASS'
\ Capture Page Screenshot gointo_${repoName}.png
\ Sleep 2
Retry Double Keywords When Error Retry Element Click ${repo_name_element} Retry Wait Until Page Not Contains Element ${repo_name_element}
Retry Wait Element ${tag_table_column_vulnerabilities}
Retry Wait Element ${tag_table_column_size}
Capture Page Screenshot gointo_${repoName}.png
Click Index Achieve
[Arguments] ${tag_name}
Retry Element Click //artifact-list-tab//clr-datagrid//clr-dg-row[contains(.,'sha256') and contains(.,'${tag_name}')]//clr-dg-cell[1]//clr-tooltip//a
Go Into Index And Contain Artifacts
[Arguments] ${tag_name} ${limit}=3
Retry Double Keywords When Error Click Index Achieve ${tag_name} Page Should Contain Element ${tag_table_column_os_arch}
:For ${n} IN RANGE 1 10
\ ${out} Run Keyword And Ignore Error Page Should Contain Element ${artifact_rows} limit=${limit}
\ Exit For Loop If '${out[0]}'=='PASS'
\ Capture Page Screenshot gointo_${tag_name}.png
\ Sleep 3
Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot
Should Be Equal As Strings '${out[0]}' 'PASS'
Switch To CardView
Retry Element Click xpath=//hbr-repository-gridview//span[@class='card-btn']/clr-icon
Sleep 5
Expand Repo
[Arguments] ${projectname}
Retry Element Click //repository//clr-dg-row[contains(.,'${projectname}')]//button/clr-icon
Sleep 1
Edit Repo Info
Retry Element Click //*[@id='repo-info']
Retry Wait Until Page Contains Element //*[@id='info']/form/div[2]
# Cancel input
Retry Element Click xpath=//*[@id='info-edit-button']/button
Input Text xpath=//*[@id='info-edit-textarea'] test_description_info
Retry Element Click xpath=//*[@id='edit-cancel']
Retry Element Click xpath=//clr-modal//button[contains(.,'CONFIRM')]
Retry Wait Until Page Contains Element //*[@id='no-editing']
# Confirm input
Retry Element Click xpath=//*[@id='info-edit-button']/button
Input Text xpath=//*[@id='info-edit-textarea'] test_description_info
Retry Element Click xpath=//*[@id='edit-save']
Retry Wait Until Page Contains test_description_info
Capture Page Screenshot
Switch To Project Label
Retry Element Click xpath=//project-detail//a[contains(.,'Labels')]
Sleep 1
Switch To Project Repo
Retry Element Click xpath=//project-detail//a[contains(.,'Repositories')]
Sleep 1
Add Labels To Tag
[Arguments] ${tagName} ${labelName}
Retry Element Click xpath=//clr-dg-row[contains(.,'${tagName}')]//label
Capture Page Screenshot add_${labelName}.png
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}')]
Retry Wait Until Page Contains Element xpath=//clr-dg-row//label[contains(.,'${labelName}')]
Filter Labels In Tags
[Arguments] ${labelName1} ${labelName2}
Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
Retry Element Click xpath=//clr-main-container//artifact-list-tab//clr-select-container//select
Retry Element Click xpath=//clr-main-container//artifact-list-tab//clr-select-container//select/option[@value='labels']
Retry Wait Until Page Contains Element xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName1}')]
Retry Element Click xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName1}')]
Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
Retry Wait Until Page Contains Element xpath=//clr-datagrid//label[contains(.,'${labelName1}')]
Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
Retry Element Click xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName2}')]
Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
Sleep 2
Capture Page Screenshot filter_${labelName2}.png
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${labelName2}')]
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'${labelName1}')]
Get Statics Private Repo
${privaterepo}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[2]/statistics/div/span[1]
Convert To Integer ${privaterepo}
[Return] ${privaterepo}
Get Statics Private Project
${privateproj}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[1]/statistics/div/span[1]
Convert To Integer ${privateproj}
[Return] ${privateproj}
Get Statics Public Repo
${publicrepo}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[3]/div[2]/statistics/div/span[1]
Convert To Integer ${publicrepo}
[Return] ${publicrepo}
Get Statics Public Project
${publicproj}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[3]/div[1]/statistics/div/span[1]
Convert To Integer ${publicproj}
[Return] ${publicproj}
Get Statics Total Repo
${totalrepo}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[4]/div[2]/statistics/div/span[1]
Convert To Integer ${totalrepo}
[Return] ${totalrepo}
Get Statics Total Project
${totalproj}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[4]/div[1]/statistics/div/span[1]
Convert To Integer ${totalproj}
[Return] ${totalproj}
Input Count Quota
[Arguments] ${text}
${element_xpath}= Set Variable ${project_add_count_quota_input_text_id}
Retry Clear Element Text ${element_xpath}
Retry Text Input ${element_xpath} ${text}
Input Storage Quota
[Arguments] ${text} ${unit}=${null}
${element_xpath}= Set Variable ${project_add_storage_quota_input_text_id}
Retry Clear Element Text ${element_xpath}
Retry Text Input ${element_xpath} ${text}
Run Keyword If '${unit}'!='${null}' Select Storage Quota unit ${unit}
Select Storage Quota unit
[Arguments] ${unit}
Select From List By Value ${project_add_storage_quota_unit_id} ${unit}

View File

@ -1,21 +1,24 @@
# 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 public
*** Variables ***
${delete_btn} //clr-modal//button[contains(.,'DELETE')]
${delete_btn_2} //button[contains(.,'Delete')]
# 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 public
*** Variables ***
${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

View File

@ -1,259 +1,259 @@
# 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 ***
Filter Replicatin Rule
[Arguments] ${ruleName}
${rule_name_element}= Set Variable xpath=//clr-dg-cell[contains(.,'${ruleName}')]
Retry Element Click ${filter_rules_btn}
Retry Text Input ${filter_rules_input} ${ruleName}
Retry Wait Until Page Contains Element ${rule_name_element}
Capture Page Screenshot filter_replic_${ruleName}.png
Select Dest Registry
[Arguments] ${endpoint}
Retry Element Click ${dest_registry_dropdown_list}
Retry Element Click ${dest_registry_dropdown_list}//option[contains(.,'${endpoint}')]
Select Source Registry
[Arguments] ${endpoint}
Retry Element Click ${src_registry_dropdown_list}
Retry Element Click ${src_registry_dropdown_list}//option[contains(.,'${endpoint}')]
Select Trigger
[Arguments] ${mode}
Retry Element Click ${rule_trigger_select}
Retry Element Click ${rule_trigger_select}//option[contains(.,'${mode}')]
Select Destination URL
[Arguments] ${type}
Retry Element Click ${destination_url_xpath}
Retry Element Click //div[contains(@class, 'selectBox')]//li[contains(.,'${type}')]
Check New Rule UI Without Endpoint
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}
Create A New Endpoint
[Arguments] ${provider} ${name} ${url} ${username} ${pwd} ${save}=Y
#click new button
Retry Element Click xpath=${new_endpoint_button}
#input necessary info
Select From List By Value ${provider_selector} ${provider}
Retry Text Input xpath=${destination_name_xpath} ${name}
Run Keyword If '${provider}' == 'harbor' Run keyword Retry Text Input xpath=${destination_url_xpath} ${url}
Run Keyword If '${provider}' == 'aws-ecr' or '${provider}' == 'google-gcr' Run keyword Select Destination URL ${url}
Run Keyword If '${provider}' != 'google-gcr' Retry Text Input xpath=${destination_username_xpath} ${username}
Retry Text Input xpath=${destination_password_xpath} ${pwd}
#cancel verify cert since we use a selfsigned cert
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}
Run Keyword If '${save}' == 'Y' Run keyword Retry Wait Until Page Contains ${name}
Run Keyword If '${save}' == 'N' No Operation
Create A Rule With Existing Endpoint
[Arguments] ${name} ${replication_mode} ${project_name} ${resource_type} ${endpoint} ${dest_namespace}
... ${mode}=Manual
#click new
Retry Element Click ${new_name_xpath}
#input name
Retry Text Input ${rule_name} ${name}
Run Keyword If '${replication_mode}' == 'push' Run Keywords Retry Element Click ${replication_mode_radio_push}
... AND Select Dest Registry ${endpoint}
... ELSE Run Keywords Retry Element Click ${replication_mode_radio_pull}
... AND Select Source Registry ${endpoint}
#set filter
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}
#set trigger
Select Trigger ${mode}
Run Keyword If '${mode}' == 'Scheduled' Log To Console Scheduled
#click save
Retry Double Keywords When Error Retry Element Click ${rule_save_button} Retry Wait Until Page Not Contains Element ${rule_save_button}
Sleep 2
Endpoint Is Unpingable
Retry Element Click ${ping_test_button}
Wait Until Page Contains Failed
Endpoint Is Pingable
Retry Element Click ${ping_test_button}
Wait Until Page Contains successfully
Disable Certificate Verification
Checkbox Should Be Selected ${destination_insecure_checkbox}
Retry Element Click ${destination_insecure_xpath}
Sleep 1
Enable Certificate Verification
Checkbox Should Not Be Selected ${destination_insecure_checkbox}
Retry Element Click ${destination_insecure_xpath}
Sleep 1
Switch To Registries
Retry Element Click ${nav_to_registries}
Sleep 1
Switch To Replication Manage
Retry Element Click ${nav_to_replications}
Sleep 1
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 ${action_bar_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
Retry Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${rule}')]/../div/clr-icon[@shape='success-standard']
Sleep 1
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 ${action_bar_edit}
Retry Text Input ${rule_name} ${newname}
Retry Element Click ${rule_save_button}
Delete Rule
[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 ${action_bar_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}
Retry Element Click ${rule_filter_search}
Retry Text Input ${rule_filter_input} ${rule}
Sleep 1
Select Rule
[Arguments] ${rule}
Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label
Stop Jobs
Retry Element Click ${stop_jobs_button}
View Job Log
[arguments] ${job}
Retry Element Click ${job_filter_search}
Retry Text Input ${job_filter_input} ${job}
Retry Link Click //clr-dg-row[contains(.,'${job}')]//a
Find Item And Click Edit Button
[Arguments] ${name}
Filter Object ${name}
Retry Select Object ${name}
Retry Element Click ${action_bar_edit}
Find Item And Click Delete Button
[Arguments] ${name}
Filter Object ${name}
Retry Select Object ${name}
Retry Element Click ${action_bar_delete}
Switch To Replication Manage Page
[Arguments] ${name}
Switch To Registries
Switch To Replication Manage
Edit Replication Rule By Name
[Arguments] ${name}
Retry Double Keywords When Error Switch To Replication Manage Page "NULL" Find Item And Click Edit Button ${name}
Delete Replication Rule By Name
[Arguments] ${name}
Switch To Registries
Switch To Replication Manage
Find Item And Click Delete Button ${name}
Ensure Delete Replication Rule By Name
[Arguments] ${name}
Delete Replication Rule By Name ${name}
Retry Double Keywords When Error Retry Element Click ${delete_confirm_btn} Retry Wait Until Page Not Contains Element ${delete_confirm_btn}
Retry Wait Element xpath=//clr-dg-placeholder[contains(.,\"We couldn\'t find any replication rules!\")]
Rename Endpoint
[arguments] ${name} ${newname}
Find Item And Click Edit Button ${name}
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}
Retry Text Input ${endpoint_filter_input} ${name}
#click checkbox before target endpoint
Retry Double Keywords When Error Retry Element Click //clr-dg-row[contains(.,'${name}')]//clr-checkbox-wrapper Retry Wait Element ${action_bar_delete}
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}
Select Rule And Click Edit Button
[Arguments] ${rule_name}
Retry Element Click //clr-dg-row[contains(.,'${rule_name}')]//clr-radio-wrapper/label
Retry Element Click ${edit_replication_rule_id}
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}
Image Should Be Replicated To Project
[Arguments] ${project} ${image} ${period}=60 ${times}=10
:For ${n} IN RANGE 1 ${times}
\ Sleep ${period}
\ Go Into Project ${project}
\ Switch To Project Repo
\ #In AWS-ECR, under repository a, there're only several images: httpd,alpine,hello-world.
\ ${out} Run Keyword And Ignore Error Retry Wait Until Page Contains ${project}/${image}
\ Log To Console Return value is ${out[0]}
\ Exit For Loop If '${out[0]}'=='PASS'
\ Sleep 5
Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot
# 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 ***
Filter Replicatin Rule
[Arguments] ${ruleName}
${rule_name_element}= Set Variable xpath=//clr-dg-cell[contains(.,'${ruleName}')]
Retry Element Click ${filter_rules_btn}
Retry Text Input ${filter_rules_input} ${ruleName}
Retry Wait Until Page Contains Element ${rule_name_element}
Capture Page Screenshot filter_replic_${ruleName}.png
Select Dest Registry
[Arguments] ${endpoint}
Retry Element Click ${dest_registry_dropdown_list}
Retry Element Click ${dest_registry_dropdown_list}//option[contains(.,'${endpoint}')]
Select Source Registry
[Arguments] ${endpoint}
Retry Element Click ${src_registry_dropdown_list}
Retry Element Click ${src_registry_dropdown_list}//option[contains(.,'${endpoint}')]
Select Trigger
[Arguments] ${mode}
Retry Element Click ${rule_trigger_select}
Retry Element Click ${rule_trigger_select}//option[contains(.,'${mode}')]
Select Destination URL
[Arguments] ${type}
Retry Element Click ${destination_url_xpath}
Retry Element Click //div[contains(@class, 'selectBox')]//li[contains(.,'${type}')]
Check New Rule UI Without Endpoint
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}
Create A New Endpoint
[Arguments] ${provider} ${name} ${url} ${username} ${pwd} ${save}=Y
#click new button
Retry Element Click xpath=${new_endpoint_button}
#input necessary info
Select From List By Value ${provider_selector} ${provider}
Retry Text Input xpath=${destination_name_xpath} ${name}
Run Keyword If '${provider}' == 'harbor' Run keyword Retry Text Input xpath=${destination_url_xpath} ${url}
Run Keyword If '${provider}' == 'aws-ecr' or '${provider}' == 'google-gcr' Run keyword Select Destination URL ${url}
Run Keyword If '${provider}' != 'google-gcr' Retry Text Input xpath=${destination_username_xpath} ${username}
Retry Text Input xpath=${destination_password_xpath} ${pwd}
#cancel verify cert since we use a selfsigned cert
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}
Run Keyword If '${save}' == 'Y' Run keyword Retry Wait Until Page Contains ${name}
Run Keyword If '${save}' == 'N' No Operation
Create A Rule With Existing Endpoint
[Arguments] ${name} ${replication_mode} ${project_name} ${resource_type} ${endpoint} ${dest_namespace}
... ${mode}=Manual
#click new
Retry Element Click ${new_name_xpath}
#input name
Retry Text Input ${rule_name} ${name}
Run Keyword If '${replication_mode}' == 'push' Run Keywords Retry Element Click ${replication_mode_radio_push}
... AND Select Dest Registry ${endpoint}
... ELSE Run Keywords Retry Element Click ${replication_mode_radio_pull}
... AND Select Source Registry ${endpoint}
#set filter
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}
#set trigger
Select Trigger ${mode}
Run Keyword If '${mode}' == 'Scheduled' Log To Console Scheduled
#click save
Retry Double Keywords When Error Retry Element Click ${rule_save_button} Retry Wait Until Page Not Contains Element ${rule_save_button}
Sleep 2
Endpoint Is Unpingable
Retry Element Click ${ping_test_button}
Wait Until Page Contains Failed
Endpoint Is Pingable
Retry Element Click ${ping_test_button}
Wait Until Page Contains successfully
Disable Certificate Verification
Checkbox Should Be Selected ${destination_insecure_checkbox}
Retry Element Click ${destination_insecure_xpath}
Sleep 1
Enable Certificate Verification
Checkbox Should Not Be Selected ${destination_insecure_checkbox}
Retry Element Click ${destination_insecure_xpath}
Sleep 1
Switch To Registries
Retry Element Click ${nav_to_registries}
Sleep 1
Switch To Replication Manage
Retry Element Click ${nav_to_replications}
Sleep 1
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 ${action_bar_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
Retry Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${rule}')]/../div/clr-icon[@shape='success-standard']
Sleep 1
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 ${action_bar_edit}
Retry Text Input ${rule_name} ${newname}
Retry Element Click ${rule_save_button}
Delete Rule
[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 ${action_bar_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}
Retry Element Click ${rule_filter_search}
Retry Text Input ${rule_filter_input} ${rule}
Sleep 1
Select Rule
[Arguments] ${rule}
Retry Element Click //clr-dg-row[contains(.,'${rule}')]//label
Stop Jobs
Retry Element Click ${stop_jobs_button}
View Job Log
[arguments] ${job}
Retry Element Click ${job_filter_search}
Retry Text Input ${job_filter_input} ${job}
Retry Link Click //clr-dg-row[contains(.,'${job}')]//a
Find Item And Click Edit Button
[Arguments] ${name}
Filter Object ${name}
Retry Select Object ${name}
Retry Element Click ${action_bar_edit}
Find Item And Click Delete Button
[Arguments] ${name}
Filter Object ${name}
Retry Select Object ${name}
Retry Element Click ${action_bar_delete}
Switch To Replication Manage Page
[Arguments] ${name}
Switch To Registries
Switch To Replication Manage
Edit Replication Rule By Name
[Arguments] ${name}
Retry Double Keywords When Error Switch To Replication Manage Page "NULL" Find Item And Click Edit Button ${name}
Delete Replication Rule By Name
[Arguments] ${name}
Switch To Registries
Switch To Replication Manage
Find Item And Click Delete Button ${name}
Ensure Delete Replication Rule By Name
[Arguments] ${name}
Delete Replication Rule By Name ${name}
Retry Double Keywords When Error Retry Element Click ${delete_confirm_btn} Retry Wait Until Page Not Contains Element ${delete_confirm_btn}
Retry Wait Element xpath=//clr-dg-placeholder[contains(.,\"We couldn\'t find any replication rules!\")]
Rename Endpoint
[arguments] ${name} ${newname}
Find Item And Click Edit Button ${name}
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}
Retry Text Input ${endpoint_filter_input} ${name}
#click checkbox before target endpoint
Retry Double Keywords When Error Retry Element Click //clr-dg-row[contains(.,'${name}')]//clr-checkbox-wrapper Retry Wait Element ${action_bar_delete}
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}
Select Rule And Click Edit Button
[Arguments] ${rule_name}
Retry Element Click //clr-dg-row[contains(.,'${rule_name}')]//clr-radio-wrapper/label
Retry Element Click ${edit_replication_rule_id}
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}
Image Should Be Replicated To Project
[Arguments] ${project} ${image} ${period}=60 ${times}=10
:For ${n} IN RANGE 1 ${times}
\ Sleep ${period}
\ Go Into Project ${project}
\ Switch To Project Repo
\ #In AWS-ECR, under repository a, there're only several images: httpd,alpine,hello-world.
\ ${out} Run Keyword And Ignore Error Retry Wait Until Page Contains ${project}/${image}
\ Log To Console Return value is ${out[0]}
\ Exit For Loop If '${out[0]}'=='PASS'
\ Sleep 5
Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot
Should Be Equal As Strings '${out[0]}' 'PASS'

View File

@ -1,317 +1,317 @@
# 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 wrap test case body
*** Variables ***
*** Keywords ***
Body Of Manage project publicity
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} user007 Test1@34
Create An New Project And Go Into Project project${d} public=true
Push image ${ip} user007 Test1@34 project${d} hello-world:latest
Pull image ${ip} user008 Test1@34 project${d} hello-world:latest
Logout Harbor
Sign In Harbor ${HARBOR_URL} user008 Test1@34
Project Should Display project${d}
Search Private Projects
Project Should Not Display project${d}
Logout Harbor
Sign In Harbor ${HARBOR_URL} user007 Test1@34
Make Project Private project${d}
Logout Harbor
Sign In Harbor ${HARBOR_URL} user008 Test1@34
Project Should Not Display project${d}
Cannot Pull image ${ip} user008 Test1@34 project${d} hello-world:latest
Logout Harbor
Sign In Harbor ${HARBOR_URL} user007 Test1@34
Make Project Public project${d}
Logout Harbor
Sign In Harbor ${HARBOR_URL} user008 Test1@34
Project Should Display project${d}
Close Browser
Body Of Scan A Tag In The Repo
[Arguments] ${image_argument} ${tag_argument} ${is_no_vulerabilty}=${false}
Init Chrome Driver
${d}= get current date result_format=%m%s
Sign In Harbor ${HARBOR_URL} user023 Test1@34
Create An New Project And Go Into Project project${d}
Push Image ${ip} user023 Test1@34 project${d} ${image_argument}:${tag_argument}
Go Into Project project${d}
Go Into Repo project${d}/${image_argument}
Scan Repo ${tag_argument} Succeed
Scan Result Should Display In List Row ${tag_argument} is_no_vulerabilty=${is_no_vulerabilty}
Pull Image ${ip} user023 Test1@34 project${d} ${image_argument} ${tag_argument}
# Edit Repo Info
Close Browser
Body Of Scan Image With Empty Vul
[Arguments] ${image_argument} ${tag_argument}
Init Chrome Driver
${tag}= Set Variable ${tag_argument}
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library ${image_argument}:${tag_argument}
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Go Into Project library
Go Into Repo ${image_argument}
Scan Repo ${tag} Succeed
Move To Summary Chart
Scan Result Should Display In List Row ${tag} is_no_vulerabilty=${true}
Close Browser
Body Of Manual Scan All
[Arguments] @{vulnerability_levels}
Init Chrome Driver
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library redis
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Vulnerability Page
Trigger Scan Now And Wait Until The Result Appears
Navigate To Projects
Go Into Project library
Go Into Repo redis
Scan Result Should Display In List Row latest
View Repo Scan Details @{vulnerability_levels}
Close Browser
Body Of View Scan Results
[Arguments] @{vulnerability_levels}
Init Chrome Driver
${d}= get current date result_format=%m%s
Sign In Harbor ${HARBOR_URL} user025 Test1@34
Create An New Project And Go Into Project project${d}
Push Image ${ip} user025 Test1@34 project${d} tomcat
Go Into Project project${d}
Go Into Repo project${d}/tomcat
Scan Repo latest Succeed
Scan Result Should Display In List Row latest
View Repo Scan Details @{vulnerability_levels}
Close Browser
Body Of Scan Image On Push
[Arguments] @{vulnerability_levels}
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Go Into Project library
Goto Project Config
Enable Scan On Push
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library memcached
Navigate To Projects
Go Into Project library
Go Into Repo memcached
Scan Result Should Display In List Row latest
View Repo Scan Details @{vulnerability_levels}
Close Browser
Body Of List Helm Charts
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} user027 Test1@34
Create An New Project And Go Into Project project${d}
Switch To Project Charts
Upload Chart files
Go Into Chart Version ${prometheus_chart_name}
Retry Wait Until Page Contains ${prometheus_chart_version}
Go Into Chart Detail ${prometheus_chart_version}
# Summary tab
Retry Wait Until Page Contains Element ${summary_markdown}
Retry Wait Until Page Contains Element ${summary_container}
# Dependency tab
Retry Double Keywords When Error Retry Element Click xpath=${detail_dependency} Retry Wait Until Page Contains Element ${dependency_content}
# Values tab
Retry Double Keywords When Error Retry Element Click xpath=${detail_value} Retry Wait Until Page Contains Element ${value_content}
Go Into Project project${d} has_image=${false}
Switch To Project Charts
Multi-delete Chart Files ${prometheus_chart_name} ${harbor_chart_name}
Close Browser
Body Of Admin Push Signed Image
[Arguments] ${image}=tomcat ${project}=library ${with_remove}=${false}
Enable Notary Client
Docker Pull ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-push-image.sh ${ip} ${project} ${image} latest ${notaryServerEndpoint} ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}:latest
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/v2.0/projects/${project}/repositories/${image}/artifacts/latest?with_signature=true"
Log To Console ${output}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} "signed":true
Run Keyword If ${with_remove} == ${true} Remove Notary Signature ${ip} ${image}
Delete A Project Without Sign In Harbor
[Arguments] ${harbor_ip}=${ip} ${username}=${HARBOR_ADMIN} ${password}=${HARBOR_PASSWORD}
${d}= Get Current Date result_format=%m%s
${project_name}= Set Variable 000${d}
Create An New Project And Go Into Project ${project_name}
Push Image ${harbor_ip} ${username} ${password} ${project_name} hello-world
Project Should Not Be Deleted ${project_name}
Go Into Project ${project_name}
Delete Repo ${project_name}
Navigate To Projects
Project Should Be Deleted ${project_name}
Manage Project Member Without Sign In Harbor
[Arguments] ${sign_in_user} ${sign_in_pwd} ${test_user1}=user005 ${test_user2}=user006 ${is_oidc_mode}=${false}
${d}= Get current Date result_format=%m%s
Create An New Project And Go Into Project project${d}
Push image ip=${ip} user=${sign_in_user} pwd=${sign_in_pwd} project=project${d} image=hello-world
Logout Harbor
User Should Not Be A Member Of Project ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Manage Project Member ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Add is_oidc_mode=${is_oidc_mode}
User Should Be Guest ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Change User Role In Project ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Developer is_oidc_mode=${is_oidc_mode}
User Should Be Developer ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Change User Role In Project ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Admin is_oidc_mode=${is_oidc_mode}
User Should Be Admin ${test_user1} ${sign_in_pwd} project${d} ${test_user2} is_oidc_mode=${is_oidc_mode}
Change User Role In Project ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Master is_oidc_mode=${is_oidc_mode}
User Should Be Master ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Manage Project Member ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Remove is_oidc_mode=${is_oidc_mode}
User Should Not Be A Member Of Project ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Push image ip=${ip} user=${sign_in_user} pwd=${sign_in_pwd} project=project${d} image=hello-world
User Should Be Guest ${test_user2} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Helm CLI Push Without Sign In Harbor
[Arguments] ${sign_in_user} ${sign_in_pwd}
${d}= Get Current Date result_format=%m%s
Create An New Project And Go Into Project project${d}
Helm Repo Add ${HARBOR_URL} ${sign_in_user} ${sign_in_pwd} project_name=project${d}
Helm Repo Push ${sign_in_user} ${sign_in_pwd} ${harbor_chart_filename}
Switch To Project Charts
Go Into Chart Version ${harbor_chart_name}
Retry Wait Until Page Contains ${harbor_chart_version}
Capture Page Screenshot
Helm3 CLI Push Without Sign In Harbor
[Arguments] ${sign_in_user} ${sign_in_pwd}
${d}= Get Current Date result_format=%m%s
Create An New Project And Go Into Project project${d}
Helm Repo Push ${sign_in_user} ${sign_in_pwd} ${harbor_chart_filename} helm_repo_name=${HARBOR_URL}/chartrepo/project${d} helm_cmd=helm3
Switch To Project Charts
Retry Double Keywords When Error Go Into Chart Version ${harbor_chart_name} Retry Wait Until Page Contains ${harbor_chart_version}
Capture Page Screenshot
#Important Note: All CVE IDs in CVE Whitelist cases must unique!
Body Of Verfiy System Level CVE Whitelist
[Arguments] ${image_argument} ${sha256_argument} ${most_cve_list} ${single_cve}
[Tags] run-once
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${image}= Set Variable ${image_argument}
# ${image}= Set Variable goharbor/harbor-portal
${sha256}= Set Variable ${sha256_argument}
# ${sha256}= Set Variable 2cb6a1c24dd6b88f11fd44ccc6560cb7be969f8ac5f752802c99cae6bcd592bb
${signin_user}= Set Variable user025
${signin_pwd}= Set Variable Test1@34
Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd}
Create An New Project And Go Into Project project${d}
Push Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} sha256=${sha256}
Go Into Project project${d}
Set Vulnerabilty Serverity 2
Cannot Pull image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Go Into Project project${d}
Go Into Repo project${d}/${image}
Scan Repo ${sha256} Succeed
Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Configure
Switch To Configuration System Setting
# Add Items To System CVE Whitelist CVE-2019-19317\nCVE-2019-19646 \nCVE-2019-5188 \nCVE-2019-20387 \nCVE-2019-17498 \nCVE-2019-20372 \nCVE-2019-19244 \nCVE-2019-19603 \nCVE-2019-19880 \nCVE-2019-19923 \nCVE-2019-19925 \nCVE-2019-19926 \nCVE-2019-19959 \nCVE-2019-20218 \nCVE-2019-19232 \nCVE-2019-19234 \nCVE-2019-19645
Add Items To System CVE Whitelist ${most_cve_list}
Cannot Pull image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
# Add Items To System CVE Whitelist CVE-2019-18276
Add Items To System CVE Whitelist ${single_cve}
Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Delete Top Item In System CVE Whitelist count=6
Cannot Pull image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Close Browser
Body Of Verfiy Project Level CVE Whitelist
[Arguments] ${image_argument} ${sha256_argument} ${most_cve_list} ${single_cve}
[Tags] run-once
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${image}= Set Variable ${image_argument}
${sha256}= Set Variable ${sha256_argument}
${signin_user}= Set Variable user025
${signin_pwd}= Set Variable Test1@34
Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd}
Create An New Project And Go Into Project project${d}
Push Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} sha256=${sha256}
Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Go Into Project project${d}
Set Vulnerabilty Serverity 2
Cannot Pull image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Go Into Project project${d}
Go Into Repo project${d}/${image}
Scan Repo ${sha256} Succeed
Go Into Project project${d}
Add Items to Project CVE Whitelist ${most_cve_list}
Cannot Pull image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Add Items to Project CVE Whitelist ${single_cve}
Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Delete Top Item In Project CVE Whitelist
Cannot Pull image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Close Browser
Body Of Verfiy Project Level CVE Whitelist By Quick Way of Add System
[Arguments] ${image_argument} ${sha256_argument} ${cve_list}
[Tags] run-once
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${image}= Set Variable ${image_argument}
${sha256}= Set Variable ${sha256_argument}
${signin_user}= Set Variable user025
${signin_pwd}= Set Variable Test1@34
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Configure
Switch To Configuration System Setting
Add Items To System CVE Whitelist ${cve_list}
Logout Harbor
Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd}
Create An New Project And Go Into Project project${d}
Push Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} sha256=${sha256}
Go Into Project project${d}
Set Vulnerabilty Serverity 2
Go Into Project project${d}
Go Into Repo project${d}/${image}
Scan Repo ${sha256} Succeed
Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Go Into Project project${d}
Set Project To Project Level CVE Whitelist
Cannot Pull image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Add System CVE Whitelist to Project CVE Whitelist By Add System Button Click
Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
# 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 wrap test case body
*** Variables ***
*** Keywords ***
Body Of Manage project publicity
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} user007 Test1@34
Create An New Project And Go Into Project project${d} public=true
Push image ${ip} user007 Test1@34 project${d} hello-world:latest
Pull image ${ip} user008 Test1@34 project${d} hello-world:latest
Logout Harbor
Sign In Harbor ${HARBOR_URL} user008 Test1@34
Project Should Display project${d}
Search Private Projects
Project Should Not Display project${d}
Logout Harbor
Sign In Harbor ${HARBOR_URL} user007 Test1@34
Make Project Private project${d}
Logout Harbor
Sign In Harbor ${HARBOR_URL} user008 Test1@34
Project Should Not Display project${d}
Cannot Pull image ${ip} user008 Test1@34 project${d} hello-world:latest
Logout Harbor
Sign In Harbor ${HARBOR_URL} user007 Test1@34
Make Project Public project${d}
Logout Harbor
Sign In Harbor ${HARBOR_URL} user008 Test1@34
Project Should Display project${d}
Close Browser
Body Of Scan A Tag In The Repo
[Arguments] ${image_argument} ${tag_argument} ${is_no_vulerabilty}=${false}
Init Chrome Driver
${d}= get current date result_format=%m%s
Sign In Harbor ${HARBOR_URL} user023 Test1@34
Create An New Project And Go Into Project project${d}
Push Image ${ip} user023 Test1@34 project${d} ${image_argument}:${tag_argument}
Go Into Project project${d}
Go Into Repo project${d}/${image_argument}
Scan Repo ${tag_argument} Succeed
Scan Result Should Display In List Row ${tag_argument} is_no_vulerabilty=${is_no_vulerabilty}
Pull Image ${ip} user023 Test1@34 project${d} ${image_argument} ${tag_argument}
# Edit Repo Info
Close Browser
Body Of Scan Image With Empty Vul
[Arguments] ${image_argument} ${tag_argument}
Init Chrome Driver
${tag}= Set Variable ${tag_argument}
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library ${image_argument}:${tag_argument}
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Go Into Project library
Go Into Repo ${image_argument}
Scan Repo ${tag} Succeed
Move To Summary Chart
Scan Result Should Display In List Row ${tag} is_no_vulerabilty=${true}
Close Browser
Body Of Manual Scan All
[Arguments] @{vulnerability_levels}
Init Chrome Driver
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library redis
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Vulnerability Page
Trigger Scan Now And Wait Until The Result Appears
Navigate To Projects
Go Into Project library
Go Into Repo redis
Scan Result Should Display In List Row latest
View Repo Scan Details @{vulnerability_levels}
Close Browser
Body Of View Scan Results
[Arguments] @{vulnerability_levels}
Init Chrome Driver
${d}= get current date result_format=%m%s
Sign In Harbor ${HARBOR_URL} user025 Test1@34
Create An New Project And Go Into Project project${d}
Push Image ${ip} user025 Test1@34 project${d} tomcat
Go Into Project project${d}
Go Into Repo project${d}/tomcat
Scan Repo latest Succeed
Scan Result Should Display In List Row latest
View Repo Scan Details @{vulnerability_levels}
Close Browser
Body Of Scan Image On Push
[Arguments] @{vulnerability_levels}
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Go Into Project library
Goto Project Config
Enable Scan On Push
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library memcached
Navigate To Projects
Go Into Project library
Go Into Repo memcached
Scan Result Should Display In List Row latest
View Repo Scan Details @{vulnerability_levels}
Close Browser
Body Of List Helm Charts
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} user027 Test1@34
Create An New Project And Go Into Project project${d}
Switch To Project Charts
Upload Chart files
Go Into Chart Version ${prometheus_chart_name}
Retry Wait Until Page Contains ${prometheus_chart_version}
Go Into Chart Detail ${prometheus_chart_version}
# Summary tab
Retry Wait Until Page Contains Element ${summary_markdown}
Retry Wait Until Page Contains Element ${summary_container}
# Dependency tab
Retry Double Keywords When Error Retry Element Click xpath=${detail_dependency} Retry Wait Until Page Contains Element ${dependency_content}
# Values tab
Retry Double Keywords When Error Retry Element Click xpath=${detail_value} Retry Wait Until Page Contains Element ${value_content}
Go Into Project project${d} has_image=${false}
Switch To Project Charts
Multi-delete Chart Files ${prometheus_chart_name} ${harbor_chart_name}
Close Browser
Body Of Admin Push Signed Image
[Arguments] ${image}=tomcat ${project}=library ${with_remove}=${false}
Enable Notary Client
Docker Pull ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}
${rc} ${output}= Run And Return Rc And Output ./tests/robot-cases/Group0-Util/notary-push-image.sh ${ip} ${project} ${image} latest ${notaryServerEndpoint} ${LOCAL_REGISTRY}/${LOCAL_REGISTRY_NAMESPACE}/${image}:latest
Log ${output}
Should Be Equal As Integers ${rc} 0
${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/v2.0/projects/${project}/repositories/${image}/artifacts/latest?with_signature=true"
Log To Console ${output}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} "signed":true
Run Keyword If ${with_remove} == ${true} Remove Notary Signature ${ip} ${image}
Delete A Project Without Sign In Harbor
[Arguments] ${harbor_ip}=${ip} ${username}=${HARBOR_ADMIN} ${password}=${HARBOR_PASSWORD}
${d}= Get Current Date result_format=%m%s
${project_name}= Set Variable 000${d}
Create An New Project And Go Into Project ${project_name}
Push Image ${harbor_ip} ${username} ${password} ${project_name} hello-world
Project Should Not Be Deleted ${project_name}
Go Into Project ${project_name}
Delete Repo ${project_name}
Navigate To Projects
Project Should Be Deleted ${project_name}
Manage Project Member Without Sign In Harbor
[Arguments] ${sign_in_user} ${sign_in_pwd} ${test_user1}=user005 ${test_user2}=user006 ${is_oidc_mode}=${false}
${d}= Get current Date result_format=%m%s
Create An New Project And Go Into Project project${d}
Push image ip=${ip} user=${sign_in_user} pwd=${sign_in_pwd} project=project${d} image=hello-world
Logout Harbor
User Should Not Be A Member Of Project ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Manage Project Member ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Add is_oidc_mode=${is_oidc_mode}
User Should Be Guest ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Change User Role In Project ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Developer is_oidc_mode=${is_oidc_mode}
User Should Be Developer ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Change User Role In Project ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Admin is_oidc_mode=${is_oidc_mode}
User Should Be Admin ${test_user1} ${sign_in_pwd} project${d} ${test_user2} is_oidc_mode=${is_oidc_mode}
Change User Role In Project ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Master is_oidc_mode=${is_oidc_mode}
User Should Be Master ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Manage Project Member ${sign_in_user} ${sign_in_pwd} project${d} ${test_user1} Remove is_oidc_mode=${is_oidc_mode}
User Should Not Be A Member Of Project ${test_user1} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Push image ip=${ip} user=${sign_in_user} pwd=${sign_in_pwd} project=project${d} image=hello-world
User Should Be Guest ${test_user2} ${sign_in_pwd} project${d} is_oidc_mode=${is_oidc_mode}
Helm CLI Push Without Sign In Harbor
[Arguments] ${sign_in_user} ${sign_in_pwd}
${d}= Get Current Date result_format=%m%s
Create An New Project And Go Into Project project${d}
Helm Repo Add ${HARBOR_URL} ${sign_in_user} ${sign_in_pwd} project_name=project${d}
Helm Repo Push ${sign_in_user} ${sign_in_pwd} ${harbor_chart_filename}
Switch To Project Charts
Go Into Chart Version ${harbor_chart_name}
Retry Wait Until Page Contains ${harbor_chart_version}
Capture Page Screenshot
Helm3 CLI Push Without Sign In Harbor
[Arguments] ${sign_in_user} ${sign_in_pwd}
${d}= Get Current Date result_format=%m%s
Create An New Project And Go Into Project project${d}
Helm Repo Push ${sign_in_user} ${sign_in_pwd} ${harbor_chart_filename} helm_repo_name=${HARBOR_URL}/chartrepo/project${d} helm_cmd=helm3
Switch To Project Charts
Retry Double Keywords When Error Go Into Chart Version ${harbor_chart_name} Retry Wait Until Page Contains ${harbor_chart_version}
Capture Page Screenshot
#Important Note: All CVE IDs in CVE Whitelist cases must unique!
Body Of Verfiy System Level CVE Whitelist
[Arguments] ${image_argument} ${sha256_argument} ${most_cve_list} ${single_cve}
[Tags] run-once
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${image}= Set Variable ${image_argument}
# ${image}= Set Variable goharbor/harbor-portal
${sha256}= Set Variable ${sha256_argument}
# ${sha256}= Set Variable 2cb6a1c24dd6b88f11fd44ccc6560cb7be969f8ac5f752802c99cae6bcd592bb
${signin_user}= Set Variable user025
${signin_pwd}= Set Variable Test1@34
Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd}
Create An New Project And Go Into Project project${d}
Push Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} sha256=${sha256}
Go Into Project project${d}
Set Vulnerabilty Serverity 2
Cannot Pull image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Go Into Project project${d}
Go Into Repo project${d}/${image}
Scan Repo ${sha256} Succeed
Logout Harbor
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Configure
Switch To Configuration System Setting
# Add Items To System CVE Whitelist CVE-2019-19317\nCVE-2019-19646 \nCVE-2019-5188 \nCVE-2019-20387 \nCVE-2019-17498 \nCVE-2019-20372 \nCVE-2019-19244 \nCVE-2019-19603 \nCVE-2019-19880 \nCVE-2019-19923 \nCVE-2019-19925 \nCVE-2019-19926 \nCVE-2019-19959 \nCVE-2019-20218 \nCVE-2019-19232 \nCVE-2019-19234 \nCVE-2019-19645
Add Items To System CVE Whitelist ${most_cve_list}
Cannot Pull image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
# Add Items To System CVE Whitelist CVE-2019-18276
Add Items To System CVE Whitelist ${single_cve}
Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Delete Top Item In System CVE Whitelist count=6
Cannot Pull image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Close Browser
Body Of Verfiy Project Level CVE Whitelist
[Arguments] ${image_argument} ${sha256_argument} ${most_cve_list} ${single_cve}
[Tags] run-once
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${image}= Set Variable ${image_argument}
${sha256}= Set Variable ${sha256_argument}
${signin_user}= Set Variable user025
${signin_pwd}= Set Variable Test1@34
Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd}
Create An New Project And Go Into Project project${d}
Push Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} sha256=${sha256}
Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Go Into Project project${d}
Set Vulnerabilty Serverity 2
Cannot Pull image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Go Into Project project${d}
Go Into Repo project${d}/${image}
Scan Repo ${sha256} Succeed
Go Into Project project${d}
Add Items to Project CVE Whitelist ${most_cve_list}
Cannot Pull image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Add Items to Project CVE Whitelist ${single_cve}
Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Delete Top Item In Project CVE Whitelist
Cannot Pull image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Close Browser
Body Of Verfiy Project Level CVE Whitelist By Quick Way of Add System
[Arguments] ${image_argument} ${sha256_argument} ${cve_list}
[Tags] run-once
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${image}= Set Variable ${image_argument}
${sha256}= Set Variable ${sha256_argument}
${signin_user}= Set Variable user025
${signin_pwd}= Set Variable Test1@34
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Configure
Switch To Configuration System Setting
Add Items To System CVE Whitelist ${cve_list}
Logout Harbor
Sign In Harbor ${HARBOR_URL} ${signin_user} ${signin_pwd}
Create An New Project And Go Into Project project${d}
Push Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} sha256=${sha256}
Go Into Project project${d}
Set Vulnerabilty Serverity 2
Go Into Project project${d}
Go Into Repo project${d}/${image}
Scan Repo ${sha256} Succeed
Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Go Into Project project${d}
Set Project To Project Level CVE Whitelist
Cannot Pull image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Add System CVE Whitelist to Project CVE Whitelist By Add System Button Click
Pull Image ${ip} ${signin_user} ${signin_pwd} project${d} ${image} tag=${sha256}
Close Browser

View File

@ -1,289 +1,276 @@
f# 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 ***
Library OperatingSystem
Library String
Library Collections
Library requests
Library Process
Library SSHLibrary 1 minute
Library DateTime
Library Selenium2Library 60 10
Library JSONLibrary
Resource Nimbus-Util.robot
Resource Vsphere-Util.robot
Resource VCH-Util.robot
Resource Drone-Util.robot
Resource Github-Util.robot
Resource Harbor-Util.robot
Resource Harbor-Pages/Public_Elements.robot
Resource Harbor-Pages/HomePage.robot
Resource Harbor-Pages/HomePage_Elements.robot
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-Webhooks.robot
Resource Harbor-Pages/Project-Webhooks_Elements.robot
Resource Harbor-Pages/Project-Repository.robot
Resource Harbor-Pages/Project-Repository_Elements.robot
Resource Harbor-Pages/Project-Artifact.robot
Resource Harbor-Pages/Project-Artifact-Elements.robot
Resource Harbor-Pages/Project-Config.robot
Resource Harbor-Pages/Project-Config-Elements.robot
Resource Harbor-Pages/Project-Helmcharts.robot
Resource Harbor-Pages/Project-Helmcharts_Elements.robot
Resource Harbor-Pages/Project-Copy.robot
Resource Harbor-Pages/Project-Copy-Elements.robot
Resource Harbor-Pages/Project-Tag-Retention.robot
Resource Harbor-Pages/Project-Tag-Retention_Elements.robot
Resource Harbor-Pages/Project_Robot_Account.robot
Resource Harbor-Pages/Project_Robot_Account_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/GC.robot
Resource Harbor-Pages/Configuration.robot
Resource Harbor-Pages/Configuration_Elements.robot
Resource Harbor-Pages/ToolKit.robot
Resource Harbor-Pages/ToolKit_Elements.robot
Resource Harbor-Pages/Vulnerability.robot
Resource Harbor-Pages/Vulnerability_Elements.robot
Resource Harbor-Pages/LDAP-Mode.robot
Resource Harbor-Pages/OIDC_Auth.robot
Resource Harbor-Pages/OIDC_Auth_Elements.robot
Resource Harbor-Pages/Verify.robot
Resource Docker-Util.robot
Resource CNAB_Util.robot
Resource Helm-Util.robot
Resource OVA-Util.robot
Resource Cert-Util.robot
Resource SeleniumUtil.robot
Resource Nightly-Util.robot
Resource APITest-Util.robot
Resource TestCaseBody.robot
*** Keywords ***
Wait Until Element Is Visible And Enabled
[Arguments] ${element}
Wait Until Element Is Visible ${element}
Wait Until Element Is Enabled ${element}
Retry Action Keyword
[Arguments] ${keyword} @{param}
Retry Keyword When Error ${keyword} @{param}
Retry Wait Element
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Element Is Visible And Enabled @{param}
Retry Wait Element Visible
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Element Is Visible @{param}
Retry Wait Element Not Visible
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Element Is Not Visible @{param}
Retry Wait Element Should Be Disabled
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Element Should Be Disabled @{param}
Retry Element Click
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Element Click @{param}
Retry Button Click
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Button Click @{param}
Retry Text Input
[Arguments] ${element_xpath} ${text}
@{param} Create List ${element_xpath} ${text}
Retry Action Keyword Text Input @{param}
Retry Clear Element Text
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Clear Element Text @{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}
Retry Action Keyword Checkbox Should Be Selected @{param}
Retry Checkbox Should Not Be Selected
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Checkbox Should Not Be Selected @{param}
Retry Wait Until Page Contains
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Page Contains @{param}
Retry Wait Until Page Contains Element
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Page Contains Element @{param}
Retry Wait Until Page Not Contains Element
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Page Does Not Contain Element @{param}
Retry Select Object
[Arguments] ${obj_name}
@{param} Create List ${obj_name}
Retry Action Keyword Select Object @{param}
Retry Textfield Value Should Be
[Arguments] ${element} ${text}
@{param} Create List ${element} ${text}
Retry Action Keyword Wait And Textfield Value Should Be @{param}
Retry List Selection Should Be
[Arguments] ${element} ${text}
@{param} Create List ${element} ${text}
Retry Action Keyword Wait And List Selection Should Be @{param}
Link Click
[Arguments] ${element_xpath}
Click Link ${element_xpath}
Wait And List Selection Should Be
[Arguments] ${element} ${text}
Wait Until Element Is Visible And Enabled ${element}
List Selection Should Be ${element} ${text}
Wait And Textfield Value Should Be
[Arguments] ${element} ${text}
Wait Until Element Is Visible And Enabled ${element}
Textfield Value Should Be ${element} ${text}
Element Click
[Arguments] ${element_xpath}
Wait Until Element Is Visible And Enabled ${element_xpath}
Click Element ${element_xpath}
Sleep 1
Button Click
[Arguments] ${element_xpath}
Wait Until Element Is Visible And Enabled ${element_xpath}
Click button ${element_xpath}
Text Input
[Arguments] ${element_xpath} ${text}
Wait Until Element Is Visible And Enabled ${element_xpath}
Input Text ${element_xpath} ${text}
Clear Field Of Characters
[Arguments] ${field} ${character count}
[Documentation] This keyword pushes the delete key (ascii: \8) a specified number of times in a specified field.
: FOR ${index} IN RANGE ${character count}
\ Press Keys ${field} \\8
Wait Unitl Command Success
[Arguments] ${cmd} ${times}=8
:FOR ${n} IN RANGE 1 ${times}
\ Log Trying ${cmd}: ${n} ... console=True
\ ${rc} ${output}= Run And Return Rc And Output ${cmd}
\ Exit For Loop If '${rc}'=='0'
\ Sleep 2
Log Command Result is ${output}
Should Be Equal As Strings '${rc}' '0'
[Return] ${output}
Command Should be Failed
[Arguments] ${cmd}
${rc} ${output}= Run And Return Rc And Output ${cmd}
Should Not Be Equal As Strings '${rc}' '0'
[Return] ${output}
Retry Keyword When Error
[Arguments] ${keyword} @{elements}
:For ${n} IN RANGE 1 10
\ Log To Console Trying ${keyword} elements @{elements} ${n} times ...
\ ${out} Run Keyword And Ignore Error ${keyword} @{elements}
\ Log To Console Return value is ${out} and ${out[0]}
\ Run Keyword If '${keyword}'=='Make Swagger Client' Exit For Loop If '${out[0]}'=='PASS' and '${out[1]}'=='0'
\ ... ELSE Exit For Loop If '${out[0]}'=='PASS'
\ Sleep 10
Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot
Should Be Equal As Strings '${out[0]}' 'PASS'
[Return] ${out[1]}
Retry Keyword N Times When Error
[Arguments] ${times} ${keyword} @{elements}
:For ${n} IN RANGE 1 ${times}
\ Log To Console Trying ${keyword} elements @{elements} ${n} times ...
\ ${out} Run Keyword And Ignore Error ${keyword} @{elements}
\ Log To Console Return value is ${out} and ${out[0]}
\ Run Keyword If '${keyword}'=='Make Swagger Client' Exit For Loop If '${out[0]}'=='PASS' and '${out[1]}'=='0'
\ ... ELSE Exit For Loop If '${out[0]}'=='PASS'
\ Sleep 10
Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot
Should Be Equal As Strings '${out[0]}' 'PASS'
[Return] ${out[1]}
Retry Keyword When Return Value Mismatch
[Arguments] ${keyword} ${expected_value} ${count} @{elements}
:For ${n} IN RANGE 1 ${count}
\ Log To Console Trying ${keyword} ${n} times ...
\ ${out} Run Keyword And Ignore Error ${keyword} @{elements}
\ Log To Console Return value is ${out[1]}
\ ${status}= Set Variable If '${out[1]}'=='${expected_value}' 'PASS' 'FAIL'
\ Exit For Loop If '${out[1]}'=='${expected_value}'
\ Sleep 2
Run Keyword If ${status}=='FAIL' Capture Page Screenshot
Should Be Equal As Strings ${status} 'PASS'
Retry Double Keywords When Error
[Arguments] ${keyword1} ${element1} ${keyword2} ${element2} ${DoAssert}=${true} ${times}=3
:For ${n} IN RANGE 1 ${times}
\ Log To Console Trying ${keyword1} and ${keyword2} ${n} times ...
\ ${out1} Run Keyword And Ignore Error ${keyword1} ${element1}
\ Capture Page Screenshot
\ Sleep 1
\ ${out2} Run Keyword And Ignore Error ${keyword2} ${element2}
\ Capture Page Screenshot
\ Log To Console Return value is ${out1[0]} ${out2[0]}
\ Exit For Loop If '${out2[0]}'=='PASS'
\ Sleep 1
Return From Keyword If ${DoAssert} == ${false} '${out2[0]}'
Should Be Equal As Strings '${out2[0]}' 'PASS'
Run Curl And Return Json
[Arguments] ${curl_cmd}
${json_data_file}= Set Variable ${CURDIR}${/}cur_user_info.json
${rc} ${output}= Run And Return Rc And Output ${curl_cmd}
Should Be Equal As Integers 0 ${rc}
Create File ${json_data_file} ${output}
${json}= Load Json From File ${json_data_file}
[Return] ${json}
f# 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 ***
Library OperatingSystem
Library String
Library Collections
Library requests
Library Process
Library SSHLibrary 1 minute
Library DateTime
Library Selenium2Library 60 10
Library JSONLibrary
Resource Nimbus-Util.robot
Resource Vsphere-Util.robot
Resource VCH-Util.robot
Resource Drone-Util.robot
Resource Github-Util.robot
Resource Harbor-Util.robot
Resource Harbor-Pages/Public_Elements.robot
Resource Harbor-Pages/HomePage.robot
Resource Harbor-Pages/HomePage_Elements.robot
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-Webhooks.robot
Resource Harbor-Pages/Project-Webhooks_Elements.robot
Resource Harbor-Pages/Project-Repository.robot
Resource Harbor-Pages/Project-Repository_Elements.robot
Resource Harbor-Pages/Project-Artifact.robot
Resource Harbor-Pages/Project-Artifact-Elements.robot
Resource Harbor-Pages/Project-Config.robot
Resource Harbor-Pages/Project-Config-Elements.robot
Resource Harbor-Pages/Project-Helmcharts.robot
Resource Harbor-Pages/Project-Helmcharts_Elements.robot
Resource Harbor-Pages/Project-Copy.robot
Resource Harbor-Pages/Project-Copy-Elements.robot
Resource Harbor-Pages/Project-Tag-Retention.robot
Resource Harbor-Pages/Project-Tag-Retention_Elements.robot
Resource Harbor-Pages/Project_Robot_Account.robot
Resource Harbor-Pages/Project_Robot_Account_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/GC.robot
Resource Harbor-Pages/Configuration.robot
Resource Harbor-Pages/Configuration_Elements.robot
Resource Harbor-Pages/ToolKit.robot
Resource Harbor-Pages/ToolKit_Elements.robot
Resource Harbor-Pages/Vulnerability.robot
Resource Harbor-Pages/Vulnerability_Elements.robot
Resource Harbor-Pages/LDAP-Mode.robot
Resource Harbor-Pages/OIDC_Auth.robot
Resource Harbor-Pages/OIDC_Auth_Elements.robot
Resource Harbor-Pages/Verify.robot
Resource Docker-Util.robot
Resource CNAB_Util.robot
Resource Helm-Util.robot
Resource OVA-Util.robot
Resource Cert-Util.robot
Resource SeleniumUtil.robot
Resource Nightly-Util.robot
Resource APITest-Util.robot
Resource TestCaseBody.robot
*** Keywords ***
Wait Until Element Is Visible And Enabled
[Arguments] ${element}
Wait Until Element Is Visible ${element}
Wait Until Element Is Enabled ${element}
Retry Action Keyword
[Arguments] ${keyword} @{param}
Retry Keyword N Times When Error 3 ${keyword} @{param}
Retry Wait Element
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Element Is Visible And Enabled @{param}
Retry Wait Element Visible
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Element Is Visible @{param}
Retry Wait Element Not Visible
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Element Is Not Visible @{param}
Retry Wait Element Should Be Disabled
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Element Should Be Disabled @{param}
Retry Element Click
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Element Click @{param}
Retry Button Click
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Button Click @{param}
Retry Text Input
[Arguments] ${element_xpath} ${text}
@{param} Create List ${element_xpath} ${text}
Retry Action Keyword Text Input @{param}
Retry Clear Element Text
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Clear Element Text @{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}
Retry Action Keyword Checkbox Should Be Selected @{param}
Retry Checkbox Should Not Be Selected
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Checkbox Should Not Be Selected @{param}
Retry Wait Until Page Contains
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Page Contains @{param}
Retry Wait Until Page Contains Element
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Page Contains Element @{param}
Retry Wait Until Page Not Contains Element
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Page Does Not Contain Element @{param}
Retry Select Object
[Arguments] ${obj_name}
@{param} Create List ${obj_name}
Retry Action Keyword Select Object @{param}
Retry Textfield Value Should Be
[Arguments] ${element} ${text}
@{param} Create List ${element} ${text}
Retry Action Keyword Wait And Textfield Value Should Be @{param}
Retry List Selection Should Be
[Arguments] ${element} ${text}
@{param} Create List ${element} ${text}
Retry Action Keyword Wait And List Selection Should Be @{param}
Link Click
[Arguments] ${element_xpath}
Click Link ${element_xpath}
Wait And List Selection Should Be
[Arguments] ${element} ${text}
Wait Until Element Is Visible And Enabled ${element}
List Selection Should Be ${element} ${text}
Wait And Textfield Value Should Be
[Arguments] ${element} ${text}
Wait Until Element Is Visible And Enabled ${element}
Textfield Value Should Be ${element} ${text}
Element Click
[Arguments] ${element_xpath}
Wait Until Element Is Visible And Enabled ${element_xpath}
Click Element ${element_xpath}
Sleep 1
Button Click
[Arguments] ${element_xpath}
Wait Until Element Is Visible And Enabled ${element_xpath}
Click button ${element_xpath}
Text Input
[Arguments] ${element_xpath} ${text}
Wait Until Element Is Visible And Enabled ${element_xpath}
Input Text ${element_xpath} ${text}
Clear Field Of Characters
[Arguments] ${field} ${character count}
[Documentation] This keyword pushes the delete key (ascii: \8) a specified number of times in a specified field.
: FOR ${index} IN RANGE ${character count}
\ Press Keys ${field} \\8
Wait Unitl Command Success
[Arguments] ${cmd} ${times}=8
:FOR ${n} IN RANGE 1 ${times}
\ Log Trying ${cmd}: ${n} ... console=True
\ ${rc} ${output}= Run And Return Rc And Output ${cmd}
\ Exit For Loop If '${rc}'=='0'
\ Sleep 2
Log Command Result is ${output}
Should Be Equal As Strings '${rc}' '0'
[Return] ${output}
Command Should be Failed
[Arguments] ${cmd}
${rc} ${output}= Run And Return Rc And Output ${cmd}
Should Not Be Equal As Strings '${rc}' '0'
[Return] ${output}
Retry Keyword N Times When Error
[Arguments] ${times} ${keyword} @{elements}
:For ${n} IN RANGE 1 ${times}
\ Log To Console Trying ${keyword} elements @{elements} ${n} times ...
\ ${out} Run Keyword And Ignore Error ${keyword} @{elements}
\ Log To Console Return value is ${out} and ${out[0]}
\ Run Keyword If '${keyword}'=='Make Swagger Client' Exit For Loop If '${out[0]}'=='PASS' and '${out[1]}'=='0'
\ ... ELSE Exit For Loop If '${out[0]}'=='PASS'
\ Sleep 10
Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot
Should Be Equal As Strings '${out[0]}' 'PASS'
[Return] ${out[1]}
Retry Keyword When Return Value Mismatch
[Arguments] ${keyword} ${expected_value} ${count} @{elements}
:For ${n} IN RANGE 1 ${count}
\ Log To Console Trying ${keyword} ${n} times ...
\ ${out} Run Keyword And Ignore Error ${keyword} @{elements}
\ Log To Console Return value is ${out[1]}
\ ${status}= Set Variable If '${out[1]}'=='${expected_value}' 'PASS' 'FAIL'
\ Exit For Loop If '${out[1]}'=='${expected_value}'
\ Sleep 2
Run Keyword If ${status}=='FAIL' Capture Page Screenshot
Should Be Equal As Strings ${status} 'PASS'
Retry Double Keywords When Error
[Arguments] ${keyword1} ${element1} ${keyword2} ${element2} ${DoAssert}=${true} ${times}=3
:For ${n} IN RANGE 1 ${times}
\ Log To Console Trying ${keyword1} and ${keyword2} ${n} times ...
\ ${out1} Run Keyword And Ignore Error ${keyword1} ${element1}
\ Capture Page Screenshot
\ Sleep 1
\ ${out2} Run Keyword And Ignore Error ${keyword2} ${element2}
\ Capture Page Screenshot
\ Log To Console Return value is ${out1[0]} ${out2[0]}
\ Exit For Loop If '${out2[0]}'=='PASS'
\ Sleep 1
Return From Keyword If ${DoAssert} == ${false} '${out2[0]}'
Should Be Equal As Strings '${out2[0]}' 'PASS'
Run Curl And Return Json
[Arguments] ${curl_cmd}
${json_data_file}= Set Variable ${CURDIR}${/}cur_user_info.json
${rc} ${output}= Run And Return Rc And Output ${curl_cmd}
Should Be Equal As Integers 0 ${rc}
Create File ${json_data_file} ${output}
${json}= Load Json From File ${json_data_file}
[Return] ${json}

View File

@ -611,8 +611,7 @@ Test Case - Push Docker Manifest Index and Display
Go Into Project test${d}
Wait Until Page Contains test${d}/index${d}
Go Into Repo test${d}/index${d}
Retry Double Keywords When Error Go Into Index index_name=${null} Page Should Contain Element ${tag_table_column_os_arch}
Page Should Contain Element ${artifact_rows} limit=2
Go Into Index And Contain Artifacts index_tag${d} limit=2
Close Browser
Test Case - Push CNAB Bundle and Display
@ -633,8 +632,7 @@ Test Case - Push CNAB Bundle and Display
Go Into Project test${d}
Wait Until Page Contains test${d}/cnab${d}
Go Into Repo test${d}/cnab${d}
Retry Double Keywords When Error Go Into Index index_name=${null} Page Should Contain Element ${tag_table_column_os_arch}
Page Should Contain Element ${artifact_rows} limit=3
Go Into Index And Contain Artifacts cnab_tag${d} limit=3
Close Browser
Test Case - Push Helm Chart and Display

View File

@ -1,91 +1,91 @@
// 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 Harbor BATs
Resource ../../resources/Util.robot
Default Tags Nightly
*** Variables ***
${HARBOR_URL} https://${OIDC_HOSTNAME}
${HARBOR_ADMIN} admin
*** Test Cases ***
Test Case - Get Harbor Version
#Just get harbor version and log it
Get Harbor Version
Test Case - OIDC User Sign In
#Sign in with all 9 users is for user population, other test cases might use these users.
Sign In Harbor With OIDC User ${HARBOR_URL}
Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test2
Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test3
Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test4
Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test5
Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test6
Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test7
Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test8
Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test9
Sleep 2
Close Browser
Test Case - Create An New Project
Sign In Harbor With OIDC User ${HARBOR_URL}
${d}= Get Current Date result_format=%m%s
Create An New Project And Go Into Project test${d}
Close Browser
Test Case - Delete A Project
Init Chrome Driver
Sign In Harbor With OIDC User ${HARBOR_URL}
${secret}= Get Secrete By API ${HARBOR_URL}
Delete A Project Without Sign In Harbor harbor_ip=${OIDC_HOSTNAME} username=${OIDC_USERNAME} password=${secret}
Close Browser
Test Case - Manage Project Member
Init Chrome Driver
Sign In Harbor With OIDC User ${HARBOR_URL}
${secret}= Get Secrete By API ${HARBOR_URL}
Manage Project Member Without Sign In Harbor sign_in_user=${OIDC_USERNAME} sign_in_pwd=${secret} test_user1=test2 test_user2=test3 is_oidc_mode=${true}
Close Browser
Test Case - Generate User CLI Secret
Init Chrome Driver
${d}= Get current Date result_format=%m%s
${image}= Set Variable hello-world
Sign In Harbor With OIDC User ${HARBOR_URL}
Create An New Project And Go Into Project project${d}
${secret_old}= Get Secrete By API ${HARBOR_URL}
Push image ip=${ip} user=${OIDC_USERNAME} pwd=${secret_old} project=project${d} image=${image}
${secret_new}= Generate And Return Secret ${HARBOR_URL}
Log To Console ${secret_old}
Log To Console ${secret_new}
Should Not Be Equal As Strings '${secret_old}' '${secret_new}'
Cannot Docker Login Harbor ${ip} ${OIDC_USERNAME} ${secret_old}
Pull image ${ip} ${OIDC_USERNAME} ${secret_new} project${d} ${image}
Push image ${ip} ${OIDC_USERNAME} ${secret_new} project${d} ${image}
Test Case - Helm CLI Push
Init Chrome Driver
Sign In Harbor With OIDC User ${HARBOR_URL}
${secret}= Get Secrete By API ${HARBOR_URL}
// 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 Harbor BATs
Resource ../../resources/Util.robot
Default Tags Nightly
*** Variables ***
${HARBOR_URL} https://${OIDC_HOSTNAME}
${HARBOR_ADMIN} admin
*** Test Cases ***
Test Case - Get Harbor Version
#Just get harbor version and log it
Get Harbor Version
Test Case - OIDC User Sign In
#Sign in with all 9 users is for user population, other test cases might use these users.
Sign In Harbor With OIDC User ${HARBOR_URL}
Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test2
Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test3
Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test4
Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test5
Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test6
Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test7
Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test8
Sleep 2
Sign In Harbor With OIDC User ${HARBOR_URL} test9
Sleep 2
Close Browser
Test Case - Create An New Project
Sign In Harbor With OIDC User ${HARBOR_URL}
${d}= Get Current Date result_format=%m%s
Create An New Project And Go Into Project test${d}
Close Browser
Test Case - Delete A Project
Init Chrome Driver
Sign In Harbor With OIDC User ${HARBOR_URL}
${secret}= Get Secrete By API ${HARBOR_URL}
Delete A Project Without Sign In Harbor harbor_ip=${OIDC_HOSTNAME} username=${OIDC_USERNAME} password=${secret}
Close Browser
Test Case - Manage Project Member
Init Chrome Driver
Sign In Harbor With OIDC User ${HARBOR_URL}
${secret}= Get Secrete By API ${HARBOR_URL}
Manage Project Member Without Sign In Harbor sign_in_user=${OIDC_USERNAME} sign_in_pwd=${secret} test_user1=test2 test_user2=test3 is_oidc_mode=${true}
Close Browser
Test Case - Generate User CLI Secret
Init Chrome Driver
${d}= Get current Date result_format=%m%s
${image}= Set Variable hello-world
Sign In Harbor With OIDC User ${HARBOR_URL}
Create An New Project And Go Into Project project${d}
${secret_old}= Get Secrete By API ${HARBOR_URL}
Push image ip=${ip} user=${OIDC_USERNAME} pwd=${secret_old} project=project${d} image=${image}
${secret_new}= Generate And Return Secret ${HARBOR_URL}
Log To Console ${secret_old}
Log To Console ${secret_new}
Should Not Be Equal As Strings '${secret_old}' '${secret_new}'
Cannot Docker Login Harbor ${ip} ${OIDC_USERNAME} ${secret_old}
Pull image ${ip} ${OIDC_USERNAME} ${secret_new} project${d} ${image}
Push image ${ip} ${OIDC_USERNAME} ${secret_new} project${d} ${image}
Test Case - Helm CLI Push
Init Chrome Driver
Sign In Harbor With OIDC User ${HARBOR_URL}
${secret}= Get Secrete By API ${HARBOR_URL}
Helm CLI Push Without Sign In Harbor ${OIDC_USERNAME} ${secret}

View File

@ -1,275 +1,275 @@
// 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 Harbor BATs
Library ../../apitests/python/library/Harbor.py ${SERVER_CONFIG}
Resource ../../resources/Util.robot
Default Tags Replication
*** Variables ***
${HARBOR_URL} https://${ip}
${SSH_USER} root
${HARBOR_ADMIN} admin
${SERVER} ${ip}
${SERVER_URL} https://${SERVER}
${SERVER_API_ENDPOINT} ${SERVER_URL}/api
&{SERVER_CONFIG} endpoint=${SERVER_API_ENDPOINT} verify_ssl=False
${REMOTE_SERVER} ${ip1}
${REMOTE_SERVER_URL} https://${REMOTE_SERVER}
${REMOTE_SERVER_API_ENDPOINT} ${REMOTE_SERVER_URL}/api
*** Test Cases ***
Test Case - Get Harbor Version
#Just get harbor version and log it
Get Harbor Version
Test Case - Pro Replication Rules Add
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries
Capture Page Screenshot
Switch To Replication Manage
Check New Rule UI Without Endpoint
Close Browser
Test Case - Harbor Endpoint Verification
#This case need vailid info and selfsign cert
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries
Create A New Endpoint harbor edp1${d} https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} N
Endpoint Is Pingable
Enable Certificate Verification
Endpoint Is Unpingable
Close Browser
Test Case - DockerHub Endpoint Add
#This case need vailid info and selfsign cert
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries
Create A New Endpoint docker-hub edp1${d} https://hub.docker.com/ danfengliu Aa123456 Y
Close Browser
Test Case - Harbor Endpoint Add
#This case need vailid info and selfsign cert
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries
Create A New Endpoint harbor testabc https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Y
Close Browser
Test Case - Harbor Endpoint Edit
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries
Rename Endpoint testabc deletea
Retry Wait Until Page Contains deletea
Close Browser
Test Case - Harbor Endpoint Delete
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries
Delete Endpoint deletea
Delete Success deletea
Close Browser
Test Case - Replication Rule Edit
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${endpoint1}= Set Variable e1${d}
${endpoint2}= Set Variable e2${d}
${rule_name_old}= Set Variable rule_testabc${d}
${rule_name_new}= Set Variable rule_abctest${d}
${resource_type}= Set Variable chart
${dest_namespace}= Set Variable dest_namespace${d}
${mode}= Set Variable Scheduled
${cron_str}= Set Variable 10 10 10 * * *
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries
Create A New Endpoint docker-hub ${endpoint1} https://hub.docker.com/ danfengliu Aa123456 Y
Create A New Endpoint harbor ${endpoint2} https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Y
Switch To Replication Manage
Create A Rule With Existing Endpoint ${rule_name_old} pull danfengliu/* image ${endpoint1} project${d}
Edit Replication Rule By Name ${rule_name_old}
# Change rule-name, source-registry, filter, trigger-mode for edition verification
Clear Field Of Characters ${rule_name_input} 30
Retry Text Input ${rule_name_input} ${rule_name_new}
Select Source Registry ${endpoint2}
#Source Resource Filter
Retry Text Input ${source_project} project${d}
Select From List By Value ${rule_resource_selector} ${resource_type}
Retry Text Input ${dest_namespace_xpath} ${dest_namespace}
Select Trigger ${mode}
Retry Text Input ${targetCron_id} ${cron_str}
Retry Double Keywords When Error Retry Element Click ${rule_save_button} Retry Wait Until Page Not Contains Element ${rule_save_button}
# verify all items were changed as expected
Edit Replication Rule By Name ${rule_name_new}
Retry Textfield Value Should Be ${rule_name_input} ${rule_name_new}
Retry List Selection Should Be ${src_registry_dropdown_list} ${endpoint2}-https://${ip}
Retry Textfield Value Should Be ${source_project} project${d}
Retry Textfield Value Should Be ${dest_namespace_xpath} ${dest_namespace}
Retry List Selection Should Be ${rule_resource_selector} ${resource_type}
Retry List Selection Should Be ${rule_trigger_select} ${mode}
Retry Textfield Value Should Be ${targetCron_id} ${cron_str}
Retry Element Click ${rule_cancel_btn}
Ensure Delete Replication Rule By Name ${rule_name_new}
Close Browser
Test Case - Replication Rule Delete
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${endpoint1}= Set Variable e1${d}
${rule_name}= Set Variable rule_testabc${d}
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries
Create A New Endpoint docker-hub ${endpoint1} https://hub.docker.com/ danfengliu Aa123456 Y
Switch To Replication Manage
Create A Rule With Existing Endpoint ${rule_name} pull danfengliu/* image ${endpoint1} project${d}
Ensure Delete Replication Rule By Name ${rule_name}
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 And Go Into 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}
#In docker-hub, under repository danfengliu, there're only 2 images: centos,mariadb.
Image Should Be Replicated To Project project${d} centos
Image Should Be Replicated To Project 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 And Go Into 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 And Go Into 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}
Image Should Be Replicated To Project project_dest${d} hello-world
Image Should Be Replicated To Project 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 And Go Into Project project${d}
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 And Go Into 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 And Go Into 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 And Go Into Project project_dest${d}
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} centos
Image Should Be Replicated To Project project_dest${d} centos
Close Browser
Test Case - Replication Of Pull Images from AWS-ECR 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 And Go Into Project project${d}
Switch To Registries
Create A New Endpoint aws-ecr e${d} us-east-2 ${ecr_ac_id} ${ecr_ac_key} Y
Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} pull a/* image e${d} project${d}
Select Rule And Replicate rule${d}
Image Should Be Replicated To Project project${d} httpd
Image Should Be Replicated To Project project${d} alpine
Image Should Be Replicated To Project project${d} hello-world
Close Browser
Test Case - Replication Of Pull Images from Google-GCR 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 And Go Into Project project${d}
Switch To Registries
Create A New Endpoint google-gcr e${d} asia.gcr.io ${null} ${gcr_ac_key} Y
Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} pull eminent-nation-87317/* image e${d} project${d}
Filter Replicatin Rule rule${d}
Select Rule And Replicate rule${d}
Image Should Be Replicated To Project project${d} httpd
Image Should Be Replicated To Project project${d} tomcat
Close Browser
// 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 Harbor BATs
Library ../../apitests/python/library/Harbor.py ${SERVER_CONFIG}
Resource ../../resources/Util.robot
Default Tags Replication
*** Variables ***
${HARBOR_URL} https://${ip}
${SSH_USER} root
${HARBOR_ADMIN} admin
${SERVER} ${ip}
${SERVER_URL} https://${SERVER}
${SERVER_API_ENDPOINT} ${SERVER_URL}/api
&{SERVER_CONFIG} endpoint=${SERVER_API_ENDPOINT} verify_ssl=False
${REMOTE_SERVER} ${ip1}
${REMOTE_SERVER_URL} https://${REMOTE_SERVER}
${REMOTE_SERVER_API_ENDPOINT} ${REMOTE_SERVER_URL}/api
*** Test Cases ***
Test Case - Get Harbor Version
#Just get harbor version and log it
Get Harbor Version
Test Case - Pro Replication Rules Add
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries
Capture Page Screenshot
Switch To Replication Manage
Check New Rule UI Without Endpoint
Close Browser
Test Case - Harbor Endpoint Verification
#This case need vailid info and selfsign cert
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries
Create A New Endpoint harbor edp1${d} https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} N
Endpoint Is Pingable
Enable Certificate Verification
Endpoint Is Unpingable
Close Browser
Test Case - DockerHub Endpoint Add
#This case need vailid info and selfsign cert
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries
Create A New Endpoint docker-hub edp1${d} https://hub.docker.com/ danfengliu Aa123456 Y
Close Browser
Test Case - Harbor Endpoint Add
#This case need vailid info and selfsign cert
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries
Create A New Endpoint harbor testabc https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Y
Close Browser
Test Case - Harbor Endpoint Edit
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries
Rename Endpoint testabc deletea
Retry Wait Until Page Contains deletea
Close Browser
Test Case - Harbor Endpoint Delete
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries
Delete Endpoint deletea
Delete Success deletea
Close Browser
Test Case - Replication Rule Edit
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${endpoint1}= Set Variable e1${d}
${endpoint2}= Set Variable e2${d}
${rule_name_old}= Set Variable rule_testabc${d}
${rule_name_new}= Set Variable rule_abctest${d}
${resource_type}= Set Variable chart
${dest_namespace}= Set Variable dest_namespace${d}
${mode}= Set Variable Scheduled
${cron_str}= Set Variable 10 10 10 * * *
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries
Create A New Endpoint docker-hub ${endpoint1} https://hub.docker.com/ danfengliu Aa123456 Y
Create A New Endpoint harbor ${endpoint2} https://${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Y
Switch To Replication Manage
Create A Rule With Existing Endpoint ${rule_name_old} pull danfengliu/* image ${endpoint1} project${d}
Edit Replication Rule By Name ${rule_name_old}
# Change rule-name, source-registry, filter, trigger-mode for edition verification
Clear Field Of Characters ${rule_name_input} 30
Retry Text Input ${rule_name_input} ${rule_name_new}
Select Source Registry ${endpoint2}
#Source Resource Filter
Retry Text Input ${source_project} project${d}
Select From List By Value ${rule_resource_selector} ${resource_type}
Retry Text Input ${dest_namespace_xpath} ${dest_namespace}
Select Trigger ${mode}
Retry Text Input ${targetCron_id} ${cron_str}
Retry Double Keywords When Error Retry Element Click ${rule_save_button} Retry Wait Until Page Not Contains Element ${rule_save_button}
# verify all items were changed as expected
Edit Replication Rule By Name ${rule_name_new}
Retry Textfield Value Should Be ${rule_name_input} ${rule_name_new}
Retry List Selection Should Be ${src_registry_dropdown_list} ${endpoint2}-https://${ip}
Retry Textfield Value Should Be ${source_project} project${d}
Retry Textfield Value Should Be ${dest_namespace_xpath} ${dest_namespace}
Retry List Selection Should Be ${rule_resource_selector} ${resource_type}
Retry List Selection Should Be ${rule_trigger_select} ${mode}
Retry Textfield Value Should Be ${targetCron_id} ${cron_str}
Retry Element Click ${rule_cancel_btn}
Ensure Delete Replication Rule By Name ${rule_name_new}
Close Browser
Test Case - Replication Rule Delete
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
${endpoint1}= Set Variable e1${d}
${rule_name}= Set Variable rule_testabc${d}
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Switch To Registries
Create A New Endpoint docker-hub ${endpoint1} https://hub.docker.com/ danfengliu Aa123456 Y
Switch To Replication Manage
Create A Rule With Existing Endpoint ${rule_name} pull danfengliu/* image ${endpoint1} project${d}
Ensure Delete Replication Rule By Name ${rule_name}
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 And Go Into 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}
#In docker-hub, under repository danfengliu, there're only 2 images: centos,mariadb.
Image Should Be Replicated To Project project${d} centos
Image Should Be Replicated To Project 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 And Go Into 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 And Go Into 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}
Image Should Be Replicated To Project project_dest${d} hello-world
Image Should Be Replicated To Project 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 And Go Into Project project${d}
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 And Go Into 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 And Go Into 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 And Go Into Project project_dest${d}
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} centos
Image Should Be Replicated To Project project_dest${d} centos
Close Browser
Test Case - Replication Of Pull Images from AWS-ECR 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 And Go Into Project project${d}
Switch To Registries
Create A New Endpoint aws-ecr e${d} us-east-2 ${ecr_ac_id} ${ecr_ac_key} Y
Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} pull a/* image e${d} project${d}
Select Rule And Replicate rule${d}
Image Should Be Replicated To Project project${d} httpd
Image Should Be Replicated To Project project${d} alpine
Image Should Be Replicated To Project project${d} hello-world
Close Browser
Test Case - Replication Of Pull Images from Google-GCR 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 And Go Into Project project${d}
Switch To Registries
Create A New Endpoint google-gcr e${d} asia.gcr.io ${null} ${gcr_ac_key} Y
Switch To Replication Manage
Create A Rule With Existing Endpoint rule${d} pull eminent-nation-87317/* image e${d} project${d}
Filter Replicatin Rule rule${d}
Select Rule And Replicate rule${d}
Image Should Be Replicated To Project project${d} httpd
Image Should Be Replicated To Project project${d} tomcat
Close Browser