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 ***
|
|
|
|
Go Into Project
|
2017-09-07 12:29:05 +02:00
|
|
|
[Arguments] ${project}
|
|
|
|
Sleep 2
|
|
|
|
Click Element xpath=//*[@id="search_input"]
|
|
|
|
Sleep 2
|
|
|
|
Input Text xpath=//*[@id="search_input"] ${project}
|
|
|
|
Sleep 8
|
|
|
|
Wait Until Page Contains ${project}
|
2017-12-25 03:33:52 +01:00
|
|
|
Click Element xpath=//*[@id="results"]/list-project-ro//clr-dg-cell[contains(.,"${project}")]/a
|
2017-09-07 12:29:05 +02:00
|
|
|
Sleep 2
|
|
|
|
Capture Page Screenshot gointo_${project}.png
|
2017-08-07 08:02:38 +02:00
|
|
|
|
|
|
|
Add User To Project Admin
|
2017-09-07 12:29:05 +02:00
|
|
|
[Arguments] ${project} ${user}
|
2017-12-25 03:33:52 +01:00
|
|
|
Go Into Project
|
2017-09-07 12:29:05 +02:00
|
|
|
Sleep 2
|
|
|
|
Click Element xpath=${project_member_tag_xpath}
|
|
|
|
Sleep 1
|
2017-08-07 08:02:38 +02:00
|
|
|
Click Element xpath=${project_member_add_button_xpath}
|
|
|
|
Sleep 2
|
|
|
|
Input Text xpath=${project_member_add_username_xpath} ${user}
|
2017-09-07 12:29:05 +02:00
|
|
|
Sleep 3
|
2017-08-07 08:02:38 +02:00
|
|
|
Click Element xpath=${project_member_add_admin_xpath}
|
|
|
|
Click Element xpath=${project_member_add_save_button_xpath}
|
2017-09-07 12:29:05 +02:00
|
|
|
Sleep 4
|
|
|
|
|
2017-08-07 08:02:38 +02:00
|
|
|
Search Project Member
|
2017-09-07 12:29:05 +02:00
|
|
|
[Arguments] ${project} ${user}
|
|
|
|
Go Into Project ${project}
|
|
|
|
Sleep 2
|
|
|
|
Click Element xpath=//clr-dg-cell//a[contains(.,"${project}")]
|
|
|
|
Sleep 1
|
|
|
|
Click Element xpath=${project_member_search_button_xpath}
|
|
|
|
Sleep 1
|
|
|
|
Click Element xpath=${project_member_search_text_xpath}
|
|
|
|
Sleep 2
|
|
|
|
Wait Until Page Contains ${user}
|
|
|
|
|
2017-08-07 08:02:38 +02:00
|
|
|
Change Project Member Role
|
2017-09-07 12:29:05 +02:00
|
|
|
[Arguments] ${project} ${user} ${role}
|
|
|
|
Click Element xpath=//clr-dg-cell//a[contains(.,"${project}")]
|
2017-08-07 08:02:38 +02:00
|
|
|
Sleep 2
|
2017-09-07 12:29:05 +02:00
|
|
|
Click Element xpath=${project_member_tag_xpath}
|
|
|
|
Sleep 1
|
2017-12-21 04:00:12 +01:00
|
|
|
Click Element xpath=//project-detail//clr-dg-row[contains(.,'${user}')]//label
|
|
|
|
Sleep 1
|
|
|
|
#change role
|
2018-01-25 13:35:44 +01:00
|
|
|
Click Element //*[@id="member-action"]
|
2017-12-21 04:00:12 +01:00
|
|
|
Click Element //button[contains(.,'${role}')]
|
2017-09-07 12:29:05 +02:00
|
|
|
Sleep 2
|
|
|
|
Wait Until Page Contains ${role}
|
|
|
|
|
|
|
|
User Can Change Role
|
|
|
|
[arguments] ${username}
|
2017-12-21 04:00:12 +01:00
|
|
|
Click Element xpath=//clr-dg-row[contains(.,'${username}')]//input/../label
|
2018-01-30 12:04:24 +01:00
|
|
|
Click Element xpath=//clr-dropdown[@id='member-action']
|
2017-12-21 04:00:12 +01:00
|
|
|
Page Should Not Contain Element xpath=//button[@disabled='' and contains(.,'Admin')]
|
2017-09-07 12:29:05 +02:00
|
|
|
|
|
|
|
User Can Not Change Role
|
|
|
|
[arguments] ${username}
|
2017-12-21 04:00:12 +01:00
|
|
|
Click Element xpath=//clr-dg-row[contains(.,'${username}')]//input/../label
|
2018-01-30 12:04:24 +01:00
|
|
|
Click Element xpath=//clr-dropdown[@id='member-action']
|
2017-12-21 04:00:12 +01:00
|
|
|
Page Should Contain Element xpath=//button[@disabled='' and contains(.,'Admin')]
|
2017-09-07 12:29:05 +02:00
|
|
|
|
2017-12-21 04:00:12 +01:00
|
|
|
#this keyworkd seems will not use any more, will delete in the future
|
2017-09-07 12:29:05 +02:00
|
|
|
Non-admin View Member Account
|
|
|
|
[arguments] ${times}
|
2017-12-21 04:00:12 +01:00
|
|
|
Xpath Should Match X Times //clr-dg-row-master ${times}
|
2017-09-07 12:29:05 +02:00
|
|
|
|
|
|
|
User Can Not Add Member
|
2018-08-08 04:40:35 +02:00
|
|
|
Page Should Contain Element xpath=//button[@disabled='' and contains(.,'User')]
|
2017-09-07 12:29:05 +02:00
|
|
|
|
|
|
|
Add Guest Member To Project
|
|
|
|
[arguments] ${member}
|
2017-12-25 03:33:52 +01:00
|
|
|
Click Element xpath=${project_member_add_button_xpath}
|
2017-09-07 12:29:05 +02:00
|
|
|
Sleep 1
|
|
|
|
Input Text 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}
|
2017-12-25 03:33:52 +01:00
|
|
|
Click Button xpath=${project_member_add_confirmation_ok_xpath}
|
2017-09-07 12:29:05 +02:00
|
|
|
Sleep 1
|
|
|
|
|
|
|
|
Delete Project Member
|
|
|
|
[arguments] ${member}
|
2017-12-21 04:00:12 +01:00
|
|
|
Click Element xpath=//clr-dg-row[contains(.,'${member}')]//input/../label
|
2018-07-19 11:02:09 +02:00
|
|
|
Click Element ${member_action_xpath}
|
|
|
|
Sleep 1
|
|
|
|
Click Element ${delete_action_xpath}
|
2018-01-31 09:45:14 +01:00
|
|
|
Sleep 2
|
2018-07-19 11:02:09 +02:00
|
|
|
Click Element //clr-modal//button[contains(.,'DELETE')]
|
|
|
|
Sleep 3
|
2017-09-07 12:29:05 +02:00
|
|
|
|
|
|
|
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}
|
|
|
|
Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
|
|
|
|
Project Should Not Display ${project}
|
|
|
|
Logout Harbor
|
|
|
|
Cannot Pull image ${ip} ${user} ${pwd} ${project} ${ip}/${project}/hello-world
|
|
|
|
Cannot Push image ${ip} ${user} ${pwd} ${project} ${ip}/${project}/hello-world
|
|
|
|
|
|
|
|
Manage Project Member
|
|
|
|
[Arguments] ${admin} ${pwd} ${project} ${user} ${op}
|
|
|
|
Sign In Harbor ${HARBOR_URL} ${admin} ${pwd}
|
|
|
|
Go Into Project ${project}
|
|
|
|
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}
|
|
|
|
Sign In Harbor ${HARBOR_URL} ${admin} ${pwd}
|
|
|
|
Change Project Member Role ${project} ${user} ${role}
|
|
|
|
Logout Harbor
|
|
|
|
|
|
|
|
User Should Be Guest
|
|
|
|
[Arguments] ${user} ${pwd} ${project}
|
|
|
|
Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
|
|
|
|
Project Should Display ${project}
|
|
|
|
Go Into Project ${project}
|
|
|
|
Switch To Member
|
|
|
|
User Can Not Add Member
|
2017-12-21 04:00:12 +01:00
|
|
|
Page Should Contain Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Guest')]
|
2017-09-07 12:29:05 +02:00
|
|
|
Logout Harbor
|
|
|
|
Pull image ${ip} ${user} ${pwd} ${project} hello-world
|
|
|
|
Cannot Push image ${ip} ${user} ${pwd} ${project} hello-world
|
|
|
|
|
|
|
|
User Should Be Developer
|
|
|
|
[Arguments] ${user} ${pwd} ${project}
|
|
|
|
Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
|
|
|
|
Project Should Display ${project}
|
|
|
|
Go Into Project ${project}
|
|
|
|
Switch To Member
|
|
|
|
User Can Not Add Member
|
2017-12-21 04:00:12 +01:00
|
|
|
Page Should Contain Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Developer')]
|
2017-09-07 12:29:05 +02:00
|
|
|
Logout Harbor
|
2018-01-12 03:42:17 +01:00
|
|
|
Push Image With Tag ${ip} ${user} ${pwd} ${project} hello-world v1
|
2017-09-07 12:29:05 +02:00
|
|
|
|
|
|
|
User Should Be Admin
|
|
|
|
[Arguments] ${user} ${pwd} ${project} ${guest}
|
|
|
|
Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
|
|
|
|
Project Should Display ${project}
|
|
|
|
Go Into Project ${project}
|
|
|
|
Switch To Member
|
|
|
|
Add Guest Member To Project ${guest}
|
|
|
|
User Can Change Role ${guest}
|
2017-12-21 04:00:12 +01:00
|
|
|
Page Should Contain Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Admin')]
|
2017-09-07 12:29:05 +02:00
|
|
|
Logout Harbor
|
2018-01-12 03:42:17 +01:00
|
|
|
Push Image With Tag ${ip} ${user} ${pwd} ${project} hello-world v2
|
2018-01-02 11:28:48 +01:00
|
|
|
|
|
|
|
Project Should Have Member
|
|
|
|
[Arguments] ${project} ${user}
|
|
|
|
Sign In Harbor ${HARBOR_URL} %{HARBOR_ADMIN} %{HARBOR_PASSWORD}
|
|
|
|
Go Into Project ${project}
|
|
|
|
Switch To Member
|
|
|
|
Page Should Contain Element xpath=//clr-dg-cell[contains(., '${user}')]
|
|
|
|
Logout Harbor
|