2018-09-19 18:57:15 +02:00
# Copyright Project Harbor Authors
2017-08-07 08:02:38 +02:00
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot
*** Variables ***
*** Keywords ***
Create An New Project
2019-09-12 07:56:56 +02:00
[Arguments] ${projectname} ${public}=false ${count_quota}=${null} ${storage_quota}=${null} ${storage_quota_unit}=${null}
2019-01-28 09:32:45 +01:00
Navigate To Projects
2019-04-09 04:44:24 +02:00
Retry Button Click xpath=${create_project_button_xpath}
2017-09-07 12:29:05 +02:00
Log To Console Project Name: ${projectname}
2019-09-12 07:56:56 +02:00
Capture Page Screenshot
2019-04-09 04:44:24 +02:00
Retry Text Input xpath=${project_name_xpath} ${projectname}
2019-01-28 09:32:45 +01:00
${element_project_public}= Set Variable xpath=${project_public_xpath}
2019-12-24 04:40:10 +01:00
Run Keyword If '${public}' == 'true' Run Keywords Wait Until Element Is Visible And Enabled ${element_project_public} AND Retry Element Click ${element_project_public}
2019-09-12 07:56:56 +02:00
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
2019-09-20 10:22:10 +02:00
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}
2019-09-12 07:56:56 +02:00
Capture Page Screenshot
2019-01-28 09:32:45 +01:00
Go Into Project ${projectname} has_image=${false}
2017-09-07 12:29:05 +02:00
2017-08-07 08:02:38 +02:00
Create An New Project With New User
2017-09-07 12:29:05 +02:00
[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}
2017-08-07 08:02:38 +02:00
Logout Harbor
Sign In Harbor ${url} ${username} ${newPassword}
2017-09-07 12:29:05 +02:00
Create An New Project ${projectname} ${public}
2019-02-22 07:11:56 +01:00
Sleep 1
2017-08-07 08:02:38 +02:00
#It's the log of project.
Go To Project Log
2020-01-03 07:09:20 +01:00
#Switch To Project Tab Overflow
2019-04-09 04:44:24 +02:00
Retry Element Click xpath=${project_log_xpath}
2017-09-07 12:29:05 +02:00
Sleep 2
Switch To Member
2019-01-09 09:08:56 +01:00
Sleep 3
2019-04-09 04:44:24 +02:00
Retry Element Click xpath=${project_member_xpath}
2017-09-07 12:29:05 +02:00
Sleep 1
2017-08-07 08:02:38 +02:00
Switch To Log
2019-04-09 04:44:24 +02:00
Retry Element Click xpath=${log_xpath}
2017-09-07 12:29:05 +02:00
Sleep 1
2017-08-07 08:02:38 +02:00
Switch To Replication
2019-04-09 04:44:24 +02:00
Retry Element Click xpath=${project_replication_xpath}
2017-09-07 12:29:05 +02:00
Sleep 1
2017-08-07 08:02:38 +02:00
2019-09-24 12:35:19 +02:00
Switch To Project Configuration
Retry Element Click ${project_config_tabsheet}
Sleep 1
2019-11-11 09:58:33 +01:00
Switch To Tag Retention
2020-01-03 07:09:20 +01:00
#Switch To Project Tab Overflow
2019-11-28 05:35:29 +01:00
Retry Element Click xpath=${project_tag_strategy_xpath}
Sleep 1
2020-01-06 04:04:34 +01:00
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
2019-11-28 05:35:29 +01:00
Switch To Project Tab Overflow
Retry Element Click xpath=${project_tab_overflow_btn}
2019-11-11 09:58:33 +01:00
Sleep 1
2019-01-28 09:32:45 +01:00
Navigate To Projects
2019-04-09 04:44:24 +02:00
Retry Element Click xpath=${projects_xpath}
2018-01-23 06:04:19 +01:00
Sleep 2
2017-08-07 08:02:38 +02:00
Project Should Display
2017-09-07 12:29:05 +02:00
[Arguments] ${projectname}
2019-04-09 04:44:24 +02:00
Retry Wait Element xpath=//project//list-project//clr-dg-cell/a[contains(.,'${projectname}')]
2017-08-07 08:02:38 +02:00
Project Should Not Display
2017-09-07 12:29:05 +02:00
[Arguments] ${projectname}
2019-04-09 04:44:24 +02:00
Retry Wait Until Page Not Contains Element xpath=//project//list-project//clr-dg-cell/a[contains(.,'${projectname}')]
2017-08-07 08:02:38 +02:00
Search Private Projects
2019-04-09 04:44:24 +02:00
Retry Element Click xpath=//select
Retry Element Click xpath=//select/option[@value=1]
2017-09-07 12:29:05 +02:00
Sleep 1
Capture Page Screenshot SearchPrivateProjects.png
2017-08-07 08:02:38 +02:00
Make Project Private
2017-09-07 12:29:05 +02:00
[Arguments] ${projectname}
2019-02-22 07:11:56 +01:00
Go Into Project ${project name}
2019-09-24 12:35:19 +02:00
Switch To Project Configuration
2019-03-15 10:18:44 +01:00
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')]
2020-02-06 06:48:16 +01:00
Go Into Project ${project name}
Switch To Project Configuration
Retry Checkbox Should Not Be Selected ${project_config_public_checkbox}
2017-08-07 08:02:38 +02:00
Make Project Public
2017-09-07 12:29:05 +02:00
[Arguments] ${projectname}
2019-01-09 09:08:56 +01:00
Go Into Project ${project name}
2019-09-24 12:35:19 +02:00
Switch To Project Configuration
2019-03-15 10:18:44 +01:00
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}
2019-02-22 07:11:56 +01:00
Retry Element Click //button[contains(.,'SAVE')]
2020-02-06 06:48:16 +01:00
Go Into Project ${project name}
Switch To Project Configuration
Retry Checkbox Should Be Selected ${project_config_public_checkbox}
2017-08-07 08:02:38 +02:00
Delete Repo
2017-09-07 12:29:05 +02:00
[Arguments] ${projectname}
2019-01-30 07:22:31 +01:00
${element_repo_checkbox}= Set Variable xpath=//clr-dg-row[contains(.,'${projectname}')]//clr-checkbox-wrapper//label
2019-03-11 03:34:53 +01:00
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}
2019-05-22 08:06:07 +02:00
Retry Wait Until Page Not Contains Element ${element_repo_checkbox}
2017-08-07 08:02:38 +02:00
2018-04-12 13:55:46 +02:00
Delete Repo on CardView
[Arguments] ${reponame}
2019-02-26 06:37:16 +01:00
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
2018-04-12 13:55:46 +02:00
2017-10-27 11:20:20 +02:00
Delete Project
2017-12-25 03:33:52 +01:00
[Arguments] ${projectname}
2019-01-28 09:32:45 +01:00
Navigate To Projects
2019-04-09 04:44:24 +02:00
Retry Element Click xpath=//clr-dg-row[contains(.,'${projectname}')]//clr-checkbox-wrapper//label
2019-09-05 09:13:13 +02:00
Retry Element Click xpath=//*[@id='delete-project']
2019-04-09 04:44:24 +02:00
Retry Element Click //clr-modal//button[contains(.,'DELETE')]
2018-01-31 09:45:14 +01:00
Sleep 1
2017-10-27 11:20:20 +02:00
Project Should Not Be Deleted
[Arguments] ${projname}
Delete Project ${projname}
2019-09-05 09:13:13 +02:00
Retry Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${projname}')]/../div/clr-icon[@shape='error-standard']
2017-10-27 11:20:20 +02:00
Project Should Be Deleted
[Arguments] ${projname}
Delete Project ${projname}
2019-09-05 09:13:13 +02:00
Retry Wait Until Page Contains Element //*[@id='contentAll']//div[contains(.,'${projname}')]/../div/clr-icon[@shape='success-standard']
2017-10-27 11:20:20 +02:00
2017-08-07 08:02:38 +02:00
Advanced Search Should Display
2019-04-09 04:44:24 +02:00
Retry Wait Until Page Contains Element xpath=//audit-log//div[@class='flex-xs-middle']/button
2017-08-07 08:02:38 +02:00
2019-02-22 07:11:56 +01:00
# it's not a common keywords, only used into log case.
2017-08-07 08:02:38 +02:00
Do Log Advanced Search
2017-09-07 12:29:05 +02:00
Capture Page Screenshot LogAdvancedSearch.png
2020-03-23 04:09:55 +01:00
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')]
2019-04-09 04:44:24 +02:00
Retry Element Click xpath=//audit-log//div[@class='flex-xs-middle']/button
Retry Element Click xpath=//project-detail//audit-log//clr-dropdown/button
2017-08-07 08:02:38 +02:00
#pull log
2019-04-09 04:44:24 +02:00
Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Pull')]
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'pull')]
2017-08-07 08:02:38 +02:00
#push log
2019-04-09 04:44:24 +02:00
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')]
2017-08-07 08:02:38 +02:00
#create log
2019-04-09 04:44:24 +02:00
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')]
2017-08-07 08:02:38 +02:00
#delete log
2019-04-09 04:44:24 +02:00
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')]
2017-08-07 08:02:38 +02:00
#others
2019-04-09 04:44:24 +02:00
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
2017-11-13 07:49:06 +01:00
Sleep 1
Capture Page Screenshot LogAdvancedSearch2.png
2019-12-03 04:33:35 +01:00
${rc} = Get Element Count //audit-log//clr-dg-row
2017-11-13 07:49:06 +01:00
Should Be Equal As Integers ${rc} 0
2017-08-07 08:02:38 +02:00
2017-12-08 08:05:52 +01:00
Go Into Repo
[Arguments] ${repoName}
2019-11-29 07:28:51 +01:00
Sleep 2
Retry Wait Until Page Not Contains Element ${repo_list_spinner}
2019-03-14 11:38:08 +01:00
${repo_name_element}= Set Variable xpath=//clr-dg-cell[contains(.,'${repoName}')]/a
Retry Element Click ${repo_search_icon}
2019-12-24 09:39:37 +01:00
: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
2019-11-29 07:28:51 +01:00
Retry Double Keywords When Error Retry Element Click ${repo_name_element} Retry Wait Until Page Not Contains Element ${repo_name_element}
2020-03-19 10:09:16 +01:00
Retry Wait Element ${tag_table_column_vulnerabilities}
Retry Wait Element ${tag_table_column_size}
2017-12-08 08:05:52 +01:00
Capture Page Screenshot gointo_${repoName}.png
2020-03-30 11:44:56 +02:00
Go Into Index
Retry Wait Element ${artifact_achieve_icon}
2018-04-12 13:55:46 +02:00
Switch To CardView
2019-04-09 04:44:24 +02:00
Retry Element Click xpath=//hbr-repository-gridview//span[@class='card-btn']/clr-icon
2018-04-12 13:55:46 +02:00
Sleep 5
2017-08-07 08:02:38 +02:00
Expand Repo
[Arguments] ${projectname}
2019-04-09 04:44:24 +02:00
Retry Element Click //repository//clr-dg-row[contains(.,'${projectname}')]//button/clr-icon
2017-12-21 04:00:12 +01:00
Sleep 1
2017-09-07 12:29:05 +02:00
2017-12-08 08:05:52 +01:00
Edit Repo Info
2019-04-09 04:44:24 +02:00
Retry Element Click //*[@id='repo-info']
Retry Wait Until Page Contains Element //*[@id='info']/form/div[2]
2017-12-08 08:05:52 +01:00
# Cancel input
2019-04-09 04:44:24 +02:00
Retry Element Click xpath=//*[@id='info-edit-button']/button
2019-09-05 09:13:13 +02:00
Input Text xpath=//*[@id='info-edit-textarea'] test_description_info
2019-09-12 07:56:56 +02:00
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']
2017-12-08 08:05:52 +01:00
# Confirm input
2019-04-09 04:44:24 +02:00
Retry Element Click xpath=//*[@id='info-edit-button']/button
2019-09-05 09:13:13 +02:00
Input Text xpath=//*[@id='info-edit-textarea'] test_description_info
2019-09-12 07:56:56 +02:00
Retry Element Click xpath=//*[@id='edit-save']
2019-04-09 04:44:24 +02:00
Retry Wait Until Page Contains test_description_info
2019-09-20 10:22:10 +02:00
Capture Page Screenshot
2017-12-08 08:05:52 +01:00
2018-04-09 10:10:07 +02:00
Switch To Project Label
2019-04-09 04:44:24 +02:00
Retry Element Click xpath=//project-detail//a[contains(.,'Labels')]
2018-04-09 10:10:07 +02:00
Sleep 1
Switch To Project Repo
2019-04-09 04:44:24 +02:00
Retry Element Click xpath=//project-detail//a[contains(.,'Repositories')]
2018-04-09 10:10:07 +02:00
Sleep 1
2018-04-02 08:45:52 +02:00
Add Labels To Tag
[Arguments] ${tagName} ${labelName}
2019-04-09 04:44:24 +02:00
Retry Element Click xpath=//clr-dg-row[contains(.,'${tagName}')]//label
2018-04-16 03:54:27 +02:00
Capture Page Screenshot add_${labelName}.png
2020-03-20 03:04:14 +01:00
Retry Element Click xpath=//clr-dg-action-bar//clr-dropdown//span
2020-03-24 03:56:18 +01:00
Retry Element Click xpath=//clr-dropdown-menu//clr-dropdown//button[contains(.,'Add Labels')]
2019-04-09 04:44:24 +02:00
Retry Element Click xpath=//clr-dropdown//div//label[contains(.,'${labelName}')]
Retry Wait Until Page Contains Element xpath=//clr-dg-row//label[contains(.,'${labelName}')]
2018-04-16 03:54:27 +02:00
Filter Labels In Tags
2018-04-16 05:37:20 +02:00
[Arguments] ${labelName1} ${labelName2}
2019-04-09 04:44:24 +02:00
Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
2020-03-23 04:09:55 +01:00
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']
2019-04-09 04:44:24 +02:00
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
2018-04-16 05:37:20 +02:00
Sleep 2
Capture Page Screenshot filter_${labelName2}.png
2019-04-09 04:44:24 +02:00
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}')]
2018-04-25 10:24:11 +02:00
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}
2019-09-12 07:56:56 +02:00
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}