2018-09-19 18:57:15 +02:00
# Copyright Project Harbor Authors
2017-08-07 08:02:38 +02:00
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
*** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot
*** Variables ***
${HARBOR_VERSION} v1.1.1
*** Keywords ***
Create An New Project
2017-09-07 12:29:05 +02:00
[Arguments] ${projectname} ${public}=false
2019-01-28 09:32:45 +01:00
Navigate To Projects
${element_create_project_button}= Set Variable xpath=${create_project_button_xpath}
Wait Until Element Is Visible And Enabled ${element_create_project_button}
Click Button ${element_create_project_button}
2017-09-07 12:29:05 +02:00
Log To Console Project Name: ${projectname}
2019-01-28 09:32:45 +01:00
${elemen_project_name}= Set Variable xpath=${project_name_xpath}
Wait Until Element Is Visible And Enabled ${elemen_project_name}
Input Text ${elemen_project_name} ${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 Click Element ${element_project_public}
${element_create_project_OK_button_xpath}= Set Variable ${create_project_OK_button_xpath}
Wait Until Element Is Visible And Enabled ${element_create_project_OK_button_xpath}
Click Element ${element_create_project_OK_button_xpath}
Wait Until Page Does Not Contain Element ${create_project_CANCEL_button_xpath}
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
2018-03-26 10:27:07 +02:00
Click Element 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
2018-03-26 10:27:07 +02:00
Click Element 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
2018-12-25 08:44:44 +01:00
Wait Until Element Is Enabled xpath=${log_xpath}
Wait Until Element Is Visible xpath=${log_xpath}
2017-09-07 12:29:05 +02:00
Click Element xpath=${log_xpath}
Sleep 1
2017-08-07 08:02:38 +02:00
Switch To Replication
2018-01-04 04:31:25 +01:00
Click Element xpath=${project_replication_xpath}
2017-09-07 12:29:05 +02:00
Sleep 1
2017-08-07 08:02:38 +02:00
2019-01-28 09:32:45 +01:00
Navigate To Projects
2019-02-22 07:11:56 +01:00
${element}= Set Variable xpath=${projects_xpath}
2019-01-11 04:26:10 +01:00
Wait Until Element Is Visible And Enabled ${element}
Click Element ${element}
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-01-11 04:26:10 +01:00
${element}= Set Variable xpath=//project//list-project//clr-dg-cell/a[contains(.,'${projectname}')]
Wait Until Element Is Visible And Enabled ${element}
2017-08-07 08:02:38 +02:00
Project Should Not Display
2017-09-07 12:29:05 +02:00
[Arguments] ${projectname}
Page Should Not Contain Element xpath=//project//list-project//clr-dg-cell/a[contains(.,'${projectname}')]
2017-08-07 08:02:38 +02:00
Search Private Projects
2017-09-07 12:29:05 +02:00
Click element xpath=//select
Click element xpath=//select/option[@value=1]
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-01-09 09:08:56 +01:00
Sleep 2
2017-12-21 04:00:12 +01:00
Click Element xpath=//project-detail//a[contains(.,'Configuration')]
2018-10-10 04:38:48 +02:00
Sleep 1
2017-12-21 04:00:12 +01:00
Checkbox Should Be Selected xpath=//input[@name='public']
2019-01-09 09:08:56 +01:00
Click Element //div[@id="clr-wrapper-public"]//label[1]
2018-10-12 12:29:38 +02:00
Wait Until Element Is Enabled //button[contains(.,'SAVE')]
2017-12-21 04:00:12 +01:00
Click Element //button[contains(.,'SAVE')]
2018-10-12 12:29:38 +02:00
Wait Until Page Contains Configuration has been successfully saved
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-02-22 07:11:56 +01:00
Retry Element Click xpath=//project-detail//a[contains(.,'Configuration')]
2017-12-21 04:00:12 +01:00
Checkbox Should Not Be Selected xpath=//input[@name='public']
2019-02-22 07:11:56 +01:00
Retry Element Click //div[@id="clr-wrapper-public"]//label[1]
Retry Element Click //button[contains(.,'SAVE')]
2018-10-12 12:29:38 +02:00
Wait Until Page Contains Configuration has been successfully saved
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-02-26 06:37:16 +01:00
:For ${n} IN RANGE 1 6
\ Log To Console Trying Delete Repo ${n} times ...
\ ${out1} Run Keyword And Ignore Error Retry Element Click ${element_repo_checkbox}
\ Capture Page Screenshot
\ ${out2} Run Keyword And Ignore Error Retry Element Click ${repo_delete_btn}
\ Capture Page Screenshot
\ Log To Console Return value is ${out1[0]} ${out2[0]}
\ Exit For Loop If '${out1[0]}'=='PASS' and '${out2[0]}'=='PASS'
\ Sleep 2
2019-01-30 07:22:31 +01:00
Retry Element Click ${repo_delete_confirm_btn}
2019-02-26 06:37:16 +01:00
Sleep 2
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
2017-10-27 11:20:20 +02:00
Sleep 1
2019-01-30 07:22:31 +01:00
Click Element xpath=//clr-dg-row[contains(.,'${projectname}')]//clr-checkbox-wrapper//label
2017-12-21 04:00:12 +01:00
Sleep 1
2019-01-30 07:22:31 +01:00
Click Element xpath=//button[contains(.,'Delete')]
2018-01-25 13:35:44 +01:00
Sleep 2
2018-05-24 07:07:19 +02:00
Click Element //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}
Sleep 1
2019-01-30 07:22:31 +01:00
Page Should Contain Element //clr-tab-content//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}
Sleep 2
2019-01-30 07:22:31 +01:00
Page Should Contain Element //clr-tab-content//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-01-30 07:22:31 +01:00
Page Should Contain 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
Sleep 1
2019-01-30 07:22:31 +01:00
Page Should Contain Element xpath=//clr-dg-row[contains(.,'pull')]
Page Should Contain Element xpath=//clr-dg-row[contains(.,'push')]
Page Should Contain Element xpath=//clr-dg-row[contains(.,'create')]
Page Should Contain Element xpath=//clr-dg-row[contains(.,'delete')]
2017-09-07 12:29:05 +02:00
Sleep 1
2019-01-30 07:22:31 +01:00
Click Element xpath=//audit-log//div[@class='flex-xs-middle']/button
2017-08-07 08:02:38 +02:00
Sleep 1
Click Element xpath=//project-detail//audit-log//clr-dropdown/button
Sleep 1
#pull log
Sleep 1
2019-01-30 07:22:31 +01:00
Click Element xpath=//audit-log//clr-dropdown//a[contains(.,'Pull')]
2017-08-07 08:02:38 +02:00
Sleep 1
2019-01-30 07:22:31 +01:00
Page Should Not Contain Element xpath=//clr-dg-row[contains(.,'pull')]
2017-08-07 08:02:38 +02:00
#push log
Click Element xpath=//audit-log//clr-dropdown/button
Sleep 1
2019-01-30 07:22:31 +01:00
Click Element xpath=//audit-log//clr-dropdown//a[contains(.,'Push')]
2017-08-07 08:02:38 +02:00
Sleep 1
2019-01-30 07:22:31 +01:00
Page Should Not Contain Element xpath=//clr-dg-row[contains(.,'push')]
2017-08-07 08:02:38 +02:00
#create log
Click Element xpath=//audit-log//clr-dropdown/button
Sleep 1
2019-01-30 07:22:31 +01:00
Click Element xpath=//audit-log//clr-dropdown//a[contains(.,'Create')]
2017-08-07 08:02:38 +02:00
Sleep 1
2019-01-30 07:22:31 +01:00
Page Should Not Contain Element xpath=//clr-dg-row[contains(.,'create')]
2017-08-07 08:02:38 +02:00
#delete log
Click Element xpath=//audit-log//clr-dropdown/button
Sleep 1
2019-01-30 07:22:31 +01:00
Click Element xpath=//audit-log//clr-dropdown//a[contains(.,'Delete')]
2017-08-07 08:02:38 +02:00
Sleep 1
2019-01-30 07:22:31 +01:00
Page Should Not Contain Element xpath=//clr-dg-row[contains(.,'delete')]
2017-08-07 08:02:38 +02:00
#others
Click Element xpath=//audit-log//clr-dropdown/button
2019-01-30 07:22:31 +01:00
Click Element xpath=//audit-log//clr-dropdown//a[contains(.,'Others')]
2017-08-07 08:02:38 +02:00
Sleep 1
2017-11-13 07:49:06 +01:00
Click Element xpath=//audit-log//hbr-filter//clr-icon
Input Text xpath=//audit-log//hbr-filter//input harbor
Sleep 1
Capture Page Screenshot LogAdvancedSearch2.png
${rc} = Get Matching Xpath Count //audit-log//clr-dg-row
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}
Sleep 2
2018-01-12 03:42:17 +01:00
Click Element xpath=//hbr-filter//clr-icon
2017-12-08 08:05:52 +01:00
Sleep 2
2018-01-12 03:42:17 +01:00
Input Text xpath=//hbr-filter//input ${repoName}
Sleep 3
2017-12-08 08:05:52 +01:00
Wait Until Page Contains ${repoName}
2018-01-12 03:42:17 +01:00
Click Element xpath=//clr-dg-cell[contains(.,${repoName})]/a
2017-12-08 08:05:52 +01:00
Sleep 2
Capture Page Screenshot gointo_${repoName}.png
2018-04-12 13:55:46 +02:00
Switch To CardView
Sleep 2
2018-04-19 04:07:55 +02:00
Click Element 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}
2017-12-25 03:33:52 +01:00
Click Element //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-01-30 07:22:31 +01:00
Click Element //*[@id='repo-info']
2017-12-08 08:05:52 +01:00
Sleep 1
2019-01-30 07:22:31 +01:00
Page Should Contain Element //*[@id='info']/form/div[2]
2017-12-08 08:05:52 +01:00
# Cancel input
2019-01-30 07:22:31 +01:00
Click Element xpath=//*[@id='info-edit-button']/button
Input Text xpath=//*[@id='info']/form/div[2]/textarea test_description_info
Click Element xpath=//*[@id='info']/form/div[3]/button[2]
2017-12-08 08:05:52 +01:00
Sleep 1
2019-01-30 07:22:31 +01:00
Click Element xpath=//*[@id='info']/form/confirmation-dialog/clr-modal/div/div[1]/div[1]/div/div[3]/button[2]
2017-12-08 08:05:52 +01:00
Sleep 1
2019-01-30 07:22:31 +01:00
Page Should Contain Element //*[@id='info']/form/div[2]
2017-12-08 08:05:52 +01:00
# Confirm input
2019-01-30 07:22:31 +01:00
Click Element xpath=//*[@id='info-edit-button']/button
Input Text xpath=//*[@id='info']/form/div[2]/textarea test_description_info
Click Element xpath=//*[@id='info']/form/div[3]/button[1]
2017-12-08 08:05:52 +01:00
Sleep 1
Page Should Contain test_description_info
Capture Page Screenshot RepoInfo.png
2018-04-09 10:10:07 +02:00
Switch To Project Label
Click Element xpath=//project-detail//a[contains(.,'Labels')]
Sleep 1
Switch To Project Repo
Click Element xpath=//project-detail//a[contains(.,'Repositories')]
Sleep 1
2018-04-02 08:45:52 +02:00
Add Labels To Tag
[Arguments] ${tagName} ${labelName}
2019-01-30 07:22:31 +01:00
Click Element xpath=//clr-dg-row[contains(.,'${tagName}')]//label
2018-04-16 03:54:27 +02:00
Capture Page Screenshot add_${labelName}.png
2018-04-02 08:45:52 +02:00
Sleep 1
Click Element xpath=//clr-dg-action-bar//clr-dropdown//button
Sleep 1
2019-01-30 07:22:31 +01:00
Click Element xpath=//clr-dropdown//div//label[contains(.,'${labelName}')]
2018-04-02 08:45:52 +02:00
Sleep 3
2019-01-30 07:22:31 +01:00
Page Should Contain 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}
2018-04-16 03:54:27 +02:00
Sleep 2
2019-01-30 07:22:31 +01:00
Click Element xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
2018-04-16 03:54:27 +02:00
Sleep 2
2019-01-30 07:22:31 +01:00
Page Should Contain Element xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName1}')]
Click Element xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName1}')]
2018-04-16 03:54:27 +02:00
Sleep 2
2019-01-30 07:22:31 +01:00
Click Element xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
Page Should Contain Element xpath=//clr-datagrid//label[contains(.,'${labelName1}')]
2018-04-16 05:37:20 +02:00
2019-01-30 07:22:31 +01:00
Click Element xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
2018-04-16 05:37:20 +02:00
Sleep 2
2019-01-30 07:22:31 +01:00
Click Element xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName2}')]
2018-04-16 03:54:27 +02:00
Sleep 2
2019-01-30 07:22:31 +01:00
Click Element 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-01-30 07:22:31 +01:00
Page Should Contain Element xpath=//clr-dg-row[contains(.,'${labelName2}')]
Page Should Not Contain 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}