2017-08-07 08:02:38 +02:00
|
|
|
# Copyright 2016-2017 VMware, Inc. All Rights Reserved.
|
|
|
|
#
|
|
|
|
# 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 ***
|
|
|
|
Init LDAP
|
|
|
|
${rc} ${output}= Run And Return Rc And Output ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}'
|
|
|
|
Log ${output}
|
|
|
|
Sleep 2
|
2017-11-01 11:19:58 +01:00
|
|
|
Input Text xpath=//*[@id="ldapUrl"] ldaps://${output}
|
2017-08-07 08:02:38 +02:00
|
|
|
Sleep 1
|
2017-11-01 11:19:58 +01:00
|
|
|
Input Text xpath=//*[@id="ldapSearchDN"] cn=admin,dc=example,dc=com
|
2017-08-07 08:02:38 +02:00
|
|
|
Sleep 1
|
|
|
|
Input Text xpath=//*[@id="ldapSearchPwd"] admin
|
|
|
|
Sleep 1
|
2017-11-01 11:19:58 +01:00
|
|
|
Input Text xpath=//*[@id="ldapBaseDN"] dc=example,dc=com
|
2017-08-07 08:02:38 +02:00
|
|
|
Sleep 1
|
2017-11-29 12:29:51 +01:00
|
|
|
Input Text xpath=//*[@id="ldapFilter"] (&(objectclass=inetorgperson)(memberof=cn=harbor_users,ou=groups,dc=example,dc=com))
|
|
|
|
Sleep 1
|
2017-08-07 08:02:38 +02:00
|
|
|
Input Text xpath=//*[@id="ldapUid"] cn
|
|
|
|
Sleep 1
|
|
|
|
Capture Page Screenshot
|
2017-11-01 11:19:58 +01:00
|
|
|
Disable Ldap Verify Cert Checkbox
|
2018-01-04 04:31:25 +01:00
|
|
|
Click Element xpath=${config_save_button_xpath}
|
2017-08-07 08:02:38 +02:00
|
|
|
Sleep 2
|
|
|
|
Click Element xpath=/html/body/harbor-app/harbor-shell/clr-main-container/div/div/config/div/div/div/button[3]
|
|
|
|
Sleep 1
|
|
|
|
Capture Page Screenshot
|
|
|
|
|
|
|
|
Switch To Configure
|
2018-01-04 04:31:25 +01:00
|
|
|
Click Element xpath=${configuration_xpath}
|
2017-08-07 08:02:38 +02:00
|
|
|
Sleep 2
|
|
|
|
|
2017-11-01 11:19:58 +01:00
|
|
|
Test Ldap Connection
|
|
|
|
${rc} ${output}= Run And Return Rc And Output ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}'
|
|
|
|
Log ${output}
|
|
|
|
Sleep 2
|
|
|
|
Input Text xpath=//*[@id="ldapUrl"] ldaps://${output}
|
|
|
|
Sleep 1
|
|
|
|
Input Text xpath=//*[@id="ldapSearchDN"] cn=admin,dc=example,dc=com
|
|
|
|
Sleep 1
|
|
|
|
Input Text xpath=//*[@id="ldapSearchPwd"] admin
|
|
|
|
Sleep 1
|
|
|
|
Input Text xpath=//*[@id="ldapBaseDN"] dc=example,dc=com
|
|
|
|
Sleep 1
|
|
|
|
Input Text xpath=//*[@id="ldapUid"] cn
|
|
|
|
Sleep 1
|
|
|
|
|
|
|
|
# default is checked, click test connection to verify fail as no cert.
|
|
|
|
Click Element xpath=${test_ldap_xpath}
|
|
|
|
Sleep 1
|
|
|
|
Wait Until Page Contains Failed to verify LDAP server with error
|
|
|
|
Sleep 5
|
|
|
|
|
|
|
|
Disable Ldap Verify Cert Checkbox
|
|
|
|
# ldap checkbox unchecked, click test connection to verify success.
|
|
|
|
Sleep 1
|
|
|
|
Click Element xpath=${test_ldap_xpath}
|
|
|
|
Capture Page Screenshot
|
|
|
|
Wait Until Page Contains Connection to LDAP server is verified timeout=15
|
|
|
|
|
2018-01-23 06:04:19 +01:00
|
|
|
Test LDAP Server Success
|
|
|
|
Click Element xpath=${test_ldap_xpath}
|
|
|
|
Wait Until Page Contains Connection to LDAP server is verified timeout=15
|
|
|
|
|
2017-11-01 11:19:58 +01:00
|
|
|
Disable Ldap Verify Cert Checkbox
|
|
|
|
Mouse Down xpath=//*[@id="clr-checkbox-ldapVerifyCert"]
|
|
|
|
Mouse Up xpath=//*[@id="clr-checkbox-ldapVerifyCert"]
|
|
|
|
Sleep 2
|
|
|
|
Capture Page Screenshot
|
|
|
|
Ldap Verify Cert Checkbox Should Be Disabled
|
|
|
|
|
|
|
|
Ldap Verify Cert Checkbox Should Be Disabled
|
|
|
|
Checkbox Should Not Be Selected xpath=//*[@id="clr-checkbox-ldapVerifyCert"]
|
|
|
|
|
2017-08-07 08:02:38 +02:00
|
|
|
Set Pro Create Admin Only
|
2017-09-07 12:29:05 +02:00
|
|
|
#set limit to admin only
|
|
|
|
Sleep 2
|
2018-01-04 04:31:25 +01:00
|
|
|
Click Element xpath=${configuration_xpath}
|
2017-09-07 12:29:05 +02:00
|
|
|
Sleep 1
|
2017-08-07 08:02:38 +02:00
|
|
|
Click Element xpath=//select[@id="proCreation"]
|
|
|
|
Click Element xpath=//select[@id="proCreation"]//option[@value="adminonly"]
|
2017-09-07 12:29:05 +02:00
|
|
|
Sleep 1
|
2018-01-04 04:31:25 +01:00
|
|
|
Click Element xpath=${config_save_button_xpath}
|
2017-09-07 12:29:05 +02:00
|
|
|
Capture Page Screenshot AdminCreateOnly.png
|
|
|
|
|
2017-08-07 08:02:38 +02:00
|
|
|
Set Pro Create Every One
|
2018-01-05 07:09:03 +01:00
|
|
|
#set limit to Every One
|
2018-01-04 04:31:25 +01:00
|
|
|
Click Element xpath=${configuration_xpath}
|
2017-09-07 12:29:05 +02:00
|
|
|
Sleep 1
|
2017-08-07 08:02:38 +02:00
|
|
|
Click Element xpath=//select[@id="proCreation"]
|
|
|
|
Click Element xpath=//select[@id="proCreation"]//option[@value="everyone"]
|
2017-09-07 12:29:05 +02:00
|
|
|
Sleep 1
|
2018-01-04 04:31:25 +01:00
|
|
|
Click Element xpath=${config_save_button_xpath}
|
2017-08-07 08:02:38 +02:00
|
|
|
Sleep 2
|
2017-09-07 12:29:05 +02:00
|
|
|
Capture Page Screenshot EveryoneCreate.png
|
2017-08-07 08:02:38 +02:00
|
|
|
|
2018-01-05 07:09:03 +01:00
|
|
|
Disable Self Reg
|
2018-01-04 04:31:25 +01:00
|
|
|
Click Element xpath=${configuration_xpath}
|
2017-08-07 08:02:38 +02:00
|
|
|
Mouse Down xpath=${self_reg_xpath}
|
|
|
|
Mouse Up xpath=${self_reg_xpath}
|
2017-09-07 12:29:05 +02:00
|
|
|
Sleep 1
|
|
|
|
Self Reg Should Be Disabled
|
2018-01-04 04:31:25 +01:00
|
|
|
Click Element xpath=${config_save_button_xpath}
|
2017-09-07 12:29:05 +02:00
|
|
|
Capture Page Screenshot DisableSelfReg.png
|
|
|
|
Sleep 1
|
2017-08-07 08:02:38 +02:00
|
|
|
|
|
|
|
Enable Self Reg
|
2017-09-07 12:29:05 +02:00
|
|
|
Mouse Down xpath=${self_reg_xpath}
|
2017-08-07 08:02:38 +02:00
|
|
|
Mouse Up xpath=${self_reg_xpath}
|
2017-09-07 12:29:05 +02:00
|
|
|
Sleep 1
|
|
|
|
Self Reg Should Be Enabled
|
2018-01-04 04:31:25 +01:00
|
|
|
Click Element xpath=${config_save_button_xpath}
|
2017-09-07 12:29:05 +02:00
|
|
|
Capture Page Screenshot EnableSelfReg.png
|
|
|
|
Sleep 1
|
|
|
|
|
2017-08-07 08:02:38 +02:00
|
|
|
Self Reg Should Be Disabled
|
2017-09-07 12:29:05 +02:00
|
|
|
Checkbox Should Not Be Selected xpath=${self_reg_xpath}
|
2017-08-07 08:02:38 +02:00
|
|
|
|
|
|
|
Self Reg Should Be Enabled
|
2017-09-07 12:29:05 +02:00
|
|
|
Checkbox Should Be Selected xpath=${self_reg_xpath}
|
|
|
|
|
2017-08-07 08:02:38 +02:00
|
|
|
Project Creation Should Display
|
|
|
|
Page Should Contain Element xpath=${project_create_xpath}
|
|
|
|
|
|
|
|
Project Creation Should Not Display
|
|
|
|
Page Should Not Contain Element xpath=${project_create_xpath}
|
2017-09-07 12:29:05 +02:00
|
|
|
|
2017-08-07 08:02:38 +02:00
|
|
|
## System settings
|
|
|
|
Switch To System Settings
|
|
|
|
Sleep 1
|
2018-01-04 04:31:25 +01:00
|
|
|
Click Element xpath=${configuration_xpath}
|
2017-09-22 09:08:10 +02:00
|
|
|
Click Element xpath=//*[@id="config-system"]
|
2017-09-07 12:29:05 +02:00
|
|
|
|
2017-08-07 08:02:38 +02:00
|
|
|
Modify Token Expiration
|
2017-09-07 12:29:05 +02:00
|
|
|
[Arguments] ${minutes}
|
|
|
|
Input Text xpath=//*[@id="tokenExpiration"] ${minutes}
|
2018-01-04 04:31:25 +01:00
|
|
|
Click Button xpath=${config_save_button_xpath}
|
2017-09-07 12:29:05 +02:00
|
|
|
Sleep 1
|
|
|
|
|
2017-08-07 08:02:38 +02:00
|
|
|
Token Must Be Match
|
2017-09-07 12:29:05 +02:00
|
|
|
[Arguments] ${minutes}
|
|
|
|
Textfield Value Should Be xpath=//*[@id="tokenExpiration"] ${minutes}
|
2017-08-07 08:02:38 +02:00
|
|
|
|
|
|
|
## Replication
|
|
|
|
Check Verify Remote Cert
|
|
|
|
Mouse Down xpath=//*[@id="clr-checkbox-verifyRemoteCert"]
|
|
|
|
Mouse Up xpath=//*[@id="clr-checkbox-verifyRemoteCert"]
|
2018-01-04 04:31:25 +01:00
|
|
|
Click Element xpath=${config_save_button_xpath}
|
2017-09-07 12:29:05 +02:00
|
|
|
Capture Page Screenshot RemoteCert.png
|
|
|
|
Sleep 1
|
2017-08-07 08:02:38 +02:00
|
|
|
|
|
|
|
Switch To System Replication
|
|
|
|
Sleep 1
|
|
|
|
Switch To Configure
|
|
|
|
Click Element xpath=//*[@id="config-replication"]
|
2017-09-07 12:29:05 +02:00
|
|
|
Sleep 1
|
|
|
|
|
2017-08-07 08:02:38 +02:00
|
|
|
Should Verify Remote Cert Be Enabled
|
2017-09-07 12:29:05 +02:00
|
|
|
Checkbox Should Not Be Selected xpath=//*[@id="clr-checkbox-verifyRemoteCert"]
|
|
|
|
|
2017-08-07 08:02:38 +02:00
|
|
|
## Email
|
|
|
|
Switch To Email
|
2017-09-07 12:29:05 +02:00
|
|
|
Switch To Configure
|
|
|
|
Click Element xpath=//*[@id="config-email"]
|
|
|
|
Sleep 1
|
2017-08-07 08:02:38 +02:00
|
|
|
|
|
|
|
Config Email
|
|
|
|
Input Text xpath=//*[@id="mailServer"] smtp.vmware.com
|
|
|
|
Input Text xpath=//*[@id="emailPort"] 25
|
|
|
|
Input Text xpath=//*[@id="emailUsername"] example@vmware.com
|
|
|
|
Input Text xpath=//*[@id="emailPassword"] example
|
|
|
|
Input Text xpath=//*[@id="emailFrom"] example<example@vmware.com>
|
2017-09-07 12:29:05 +02:00
|
|
|
Sleep 1
|
|
|
|
Mouse Down xpath=//*[@id="clr-checkbox-emailSSL"]
|
2017-08-07 08:02:38 +02:00
|
|
|
Mouse Up xpath=//*[@id="clr-checkbox-emailSSL"]
|
2017-09-07 12:29:05 +02:00
|
|
|
Sleep 1
|
2017-10-30 03:34:43 +01:00
|
|
|
Mouse Down xpath=//*[@id="clr-checkbox-emailInsecure"]
|
|
|
|
Mouse Up xpath=//*[@id="clr-checkbox-emailInsecure"]
|
|
|
|
Sleep 1
|
2018-01-04 04:31:25 +01:00
|
|
|
Click Element xpath=${config_save_button_xpath}
|
2017-09-07 12:29:05 +02:00
|
|
|
Sleep 6
|
|
|
|
|
2017-08-07 08:02:38 +02:00
|
|
|
Verify Email
|
|
|
|
Textfield Value Should Be xpath=//*[@id="mailServer"] smtp.vmware.com
|
|
|
|
Textfield Value Should Be xpath=//*[@id="emailPort"] 25
|
|
|
|
Textfield Value Should Be xpath=//*[@id="emailUsername"] example@vmware.com
|
|
|
|
Textfield Value Should Be xpath=//*[@id="emailFrom"] example<example@vmware.com>
|
2017-10-30 03:34:43 +01:00
|
|
|
Checkbox Should Be Selected xpath=//*[@id="clr-checkbox-emailSSL"]
|
2017-11-01 10:29:02 +01:00
|
|
|
Checkbox Should Not Be Selected xpath=//*[@id="clr-checkbox-emailInsecure"]
|
2017-08-07 08:02:38 +02:00
|
|
|
|
|
|
|
Set Scan All To None
|
|
|
|
click element //vulnerability-config//select
|
|
|
|
click element //vulnerability-config//select/option[@value='none']
|
|
|
|
sleep 1
|
2018-01-04 04:31:25 +01:00
|
|
|
click element ${config_save_button_xpath}
|
2018-03-26 03:22:35 +02:00
|
|
|
|
2017-08-07 08:02:38 +02:00
|
|
|
Set Scan All To Daily
|
|
|
|
click element //vulnerability-config//select
|
|
|
|
click element //vulnerability-config//select/option[@value='daily']
|
|
|
|
sleep 1
|
2018-01-04 04:31:25 +01:00
|
|
|
click element ${config_save_button_xpath}
|
2018-03-26 03:22:35 +02:00
|
|
|
|
2017-08-07 08:02:38 +02:00
|
|
|
Click Scan Now
|
2018-03-26 03:22:35 +02:00
|
|
|
click element //vulnerability-config//button[contains(.,'SCAN')]
|
|
|
|
|
2018-03-30 05:38:45 +02:00
|
|
|
|
2018-03-26 03:22:35 +02:00
|
|
|
Enable Read Only
|
|
|
|
${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X PUT -d '{"read_only":true}' "https://${ip}/api/configurations"
|
|
|
|
Log To Console ${output}
|
|
|
|
Should Be Equal As Integers ${rc} 0
|
|
|
|
|
|
|
|
Disable Read Only
|
|
|
|
${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X PUT -d '{"read_only":false}' "https://${ip}/api/configurations"
|
|
|
|
Log To Console ${output}
|
2018-03-30 05:38:45 +02:00
|
|
|
Should Be Equal As Integers ${rc} 0
|
|
|
|
|
|
|
|
## System labels
|
|
|
|
Switch To System Labels
|
|
|
|
Sleep 1
|
|
|
|
Click Element xpath=${configuration_xpath}
|
|
|
|
Click Element xpath=//*[@id="config-label"]
|
|
|
|
|
|
|
|
Create New Labels
|
|
|
|
[Arguments] ${labelname}
|
2018-04-09 10:10:07 +02:00
|
|
|
Click Element xpath=//button[contains(.,'New Label')]
|
2018-03-30 05:38:45 +02:00
|
|
|
Sleep 1
|
|
|
|
Input Text xpath=//*[@id="name"] ${labelname}
|
|
|
|
Sleep 1
|
2018-04-09 10:10:07 +02:00
|
|
|
Click Element xpath=//div/form/section//clr-dropdown/button
|
2018-03-30 05:38:45 +02:00
|
|
|
Sleep 1
|
2018-04-09 10:10:07 +02:00
|
|
|
Click Element xpath=//div/form/section//clr-dropdown/clr-dropdown-menu/label[1]
|
2018-03-30 05:38:45 +02:00
|
|
|
Sleep 1
|
|
|
|
Input Text xpath=//*[@id="description"] global
|
2018-04-09 10:10:07 +02:00
|
|
|
Click Element xpath=//div/form/section/label[4]/button[2]
|
2018-03-30 05:38:45 +02:00
|
|
|
Capture Page Screenshot
|
|
|
|
Wait Until Page Contains ${labelname}
|
|
|
|
|
|
|
|
Update A Label
|
|
|
|
[Arguments] ${labelname}
|
2018-04-09 10:10:07 +02:00
|
|
|
Click Element xpath=//clr-dg-row[1]/div/clr-dg-cell[1]/clr-checkbox
|
2018-03-30 05:38:45 +02:00
|
|
|
Sleep 1
|
2018-04-09 10:10:07 +02:00
|
|
|
Click Element xpath=//button[contains(.,'Edit')]
|
2018-03-30 05:38:45 +02:00
|
|
|
Sleep 1
|
2018-04-09 10:10:07 +02:00
|
|
|
Input Text xpath=//*[@id="name"] ${labelname}1
|
2018-03-30 05:38:45 +02:00
|
|
|
Sleep 1
|
2018-04-09 10:10:07 +02:00
|
|
|
Click Element xpath=//hbr-create-edit-label//form/section//button[2]
|
2018-03-30 05:38:45 +02:00
|
|
|
Capture Page Screenshot
|
2018-04-09 10:10:07 +02:00
|
|
|
Wait Until Page Contains ${labelname}1
|
2018-03-30 05:38:45 +02:00
|
|
|
|
|
|
|
Delete A Label
|
2018-04-09 10:10:07 +02:00
|
|
|
Click Element xpath=//clr-dg-row[1]/div/clr-dg-cell[1]/clr-checkbox
|
2018-03-30 05:38:45 +02:00
|
|
|
Sleep 1
|
2018-04-09 10:10:07 +02:00
|
|
|
Click ELement xpath=//button[contains(.,'Delete')]
|
2018-03-30 05:38:45 +02:00
|
|
|
Sleep 3
|
|
|
|
Capture Page Screenshot
|
2018-04-09 10:10:07 +02:00
|
|
|
Click Element xpath=//clr-modal//div//button[contains(.,'DELETE')]
|
2018-03-30 05:38:45 +02:00
|
|
|
Wait Until Page Contains Deleted successfully
|