2018-06-29 09:01:26 +02:00
|
|
|
*** settings ***
|
|
|
|
Resource ../../resources/Util.robot
|
|
|
|
|
|
|
|
*** Keywords ***
|
|
|
|
#for jsonpath refer to http://goessner.net/articles/JsonPath/ or https://nottyo.github.io/robotframework-jsonlibrary/JSONLibrary.html
|
|
|
|
|
|
|
|
Verify User
|
2018-07-25 11:46:09 +02:00
|
|
|
[Arguments] ${json}
|
|
|
|
Init Chrome Driver
|
|
|
|
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
2018-06-29 09:01:26 +02:00
|
|
|
Switch To User Tag
|
2018-07-25 11:46:09 +02:00
|
|
|
@{user}= Get Value From Json ${json} $.users..name
|
|
|
|
:FOR ${user} IN @{user}
|
|
|
|
\ Page Should Contain ${user}
|
2018-06-29 09:01:26 +02:00
|
|
|
Logout Harbor
|
|
|
|
#verify user can login
|
2018-07-25 11:46:09 +02:00
|
|
|
@{user}= Get Value From Json ${json} $.users..name
|
|
|
|
:FOR ${user} IN @{user}
|
|
|
|
\ Sign In Harbor ${HARBOR_URL} ${user} ${HARBOR_PASSWORD}
|
2018-06-29 09:01:26 +02:00
|
|
|
\ Logout Harbor
|
2018-07-25 11:46:09 +02:00
|
|
|
Close Browser
|
2018-06-29 09:01:26 +02:00
|
|
|
|
|
|
|
Verify Project
|
2018-07-25 11:46:09 +02:00
|
|
|
[Arguments] ${json}
|
2018-06-29 09:01:26 +02:00
|
|
|
@{project}= Get Value From Json ${json} $.projects.[*].name
|
2018-07-25 11:46:09 +02:00
|
|
|
Init Chrome Driver
|
|
|
|
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
|
|
|
:FOR ${project} IN @{project}
|
|
|
|
\ Page Should Contain ${project}
|
2019-09-24 12:35:19 +02:00
|
|
|
Verify Project Metadata ${json}
|
2018-07-25 11:46:09 +02:00
|
|
|
Close Browser
|
2018-06-29 09:01:26 +02:00
|
|
|
|
|
|
|
Verify Image Tag
|
2018-07-25 11:46:09 +02:00
|
|
|
[Arguments] ${json}
|
2018-06-29 09:01:26 +02:00
|
|
|
@{project}= Get Value From Json ${json} $.projects.[*].name
|
2018-07-25 11:46:09 +02:00
|
|
|
Init Chrome Driver
|
|
|
|
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
|
|
|
:FOR ${project} IN @{project}
|
2019-01-16 06:39:36 +01:00
|
|
|
\ @{out_has_image}= Get Value From Json ${json} $.projects[?(@.name=${project})].has_image
|
|
|
|
\ ${has_image} Set Variable If @{out_has_image}[0] == ${true} ${true} ${false}
|
|
|
|
\ Go Into Project ${project} has_image=${has_image}
|
2019-09-24 12:35:19 +02:00
|
|
|
\ @{repo}= Get Value From Json ${json} $.projects[?(@.name=${project})]..repo..name
|
|
|
|
\ Run Keyword If ${has_image} == ${true} Loop Image Repo @{repo}
|
2019-01-28 09:32:45 +01:00
|
|
|
\ Navigate To Projects
|
2018-07-25 11:46:09 +02:00
|
|
|
Close Browser
|
|
|
|
|
2019-09-24 12:35:19 +02:00
|
|
|
Verify Project Metadata
|
|
|
|
[Arguments] ${json}
|
|
|
|
@{project}= Get Value From Json ${json} $.projects.[*].name
|
|
|
|
Init Chrome Driver
|
|
|
|
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
|
|
|
:FOR ${project} IN @{project}
|
|
|
|
\ @{out_has_image}= Get Value From Json ${json} $.projects[?(@.name=${project})].has_image
|
|
|
|
\ ${has_image} Set Variable If @{out_has_image}[0] == ${true} ${true} ${false}
|
|
|
|
\ Go Into Project ${project} has_image=${has_image}
|
|
|
|
\ Switch To Project Configuration
|
|
|
|
\ Verify Checkbox ${json} $.projects[?(@.name=${project})].configuration.public ${project_config_public_checkbox}
|
|
|
|
\ Verify Checkbox ${json} $.projects[?(@.name=${project})].configuration.enable_content_trust ${project_config_content_trust_checkbox}
|
|
|
|
\ Verify Checkbox ${json} $.projects[?(@.name=${project})].configuration.automatically_scan_images_on_push ${project_config_scan_images_on_push_checkbox}
|
|
|
|
\ Verify Checkbox ${json} $.projects[?(@.name=${project})].configuration.prevent_vulnerable_images_from_running ${project_config_prevent_vulnerable_images_from_running_checkbox}
|
|
|
|
\ ${ret} Get Selected List Value ${project_config_severity_select}
|
|
|
|
\ @{severity}= Get Value From Json ${json} $.projects[?(@.name=${project})].configuration.prevent_vlunerable_images_from_running_severity
|
|
|
|
\ Should Contain ${ret} @{severity}[0]
|
|
|
|
\ Navigate To Projects
|
|
|
|
Close Browser
|
|
|
|
|
|
|
|
Verify Checkbox
|
|
|
|
[Arguments] ${json} ${key} ${checkbox}
|
|
|
|
@{out}= Get Value From Json ${json} ${key}
|
|
|
|
Run Keyword If '@{out}[0]'=='true' Checkbox Should Be Selected ${checkbox}
|
|
|
|
... ELSE Checkbox Should Not Be Selected ${checkbox}
|
|
|
|
|
|
|
|
|
2018-07-25 11:46:09 +02:00
|
|
|
Loop Image Repo
|
|
|
|
[Arguments] @{repo}
|
|
|
|
:For ${repo} In @{repo}
|
|
|
|
\ Page Should Contain ${repo}
|
2018-06-29 09:01:26 +02:00
|
|
|
|
|
|
|
Verify Member Exist
|
2018-07-25 11:46:09 +02:00
|
|
|
[Arguments] ${json}
|
2018-06-29 09:01:26 +02:00
|
|
|
@{project}= Get Value From Json ${json} $.projects.[*].name
|
2018-07-25 11:46:09 +02:00
|
|
|
Init Chrome Driver
|
|
|
|
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
|
|
|
:For ${project} In @{project}
|
2019-01-16 06:39:36 +01:00
|
|
|
\ @{out_has_image}= Get Value From Json ${json} $.projects[?(@.name=${project})].has_image
|
|
|
|
\ ${has_image} Set Variable If @{out_has_image}[0] == ${true} ${true} ${false}
|
|
|
|
\ Go Into Project ${project} has_image=${has_image}
|
2018-06-29 09:01:26 +02:00
|
|
|
\ Switch To Member
|
2019-09-24 12:35:19 +02:00
|
|
|
\ @{members}= Get Value From Json ${json} $.projects[?(@.name=${project})].member..name
|
2018-07-25 11:46:09 +02:00
|
|
|
\ Loop Member @{members}
|
2019-01-28 09:32:45 +01:00
|
|
|
\ Navigate To Projects
|
2018-07-25 11:46:09 +02:00
|
|
|
Close Browser
|
|
|
|
|
|
|
|
Loop Member
|
|
|
|
[Arguments] @{members}
|
|
|
|
:For ${member} In @{members}
|
|
|
|
\ Page Should Contain ${member}
|
2018-06-29 09:01:26 +02:00
|
|
|
|
|
|
|
Verify User System Admin Role
|
2018-07-25 11:46:09 +02:00
|
|
|
[Arguments] ${json}
|
2018-06-29 09:01:26 +02:00
|
|
|
@{user}= Get Value From Json ${json} $.admin..name
|
2018-07-25 11:46:09 +02:00
|
|
|
Init Chrome Driver
|
|
|
|
:FOR ${user} IN @{user}
|
|
|
|
\ Sign In Harbor ${HARBOR_URL} ${user} ${HARBOR_PASSWORD}
|
2019-09-24 12:35:19 +02:00
|
|
|
\ Page Should Contain Administration
|
2018-06-29 09:01:26 +02:00
|
|
|
\ Logout Harbor
|
2018-07-25 11:46:09 +02:00
|
|
|
Close Browser
|
2019-09-24 12:35:19 +02:00
|
|
|
|
2018-06-29 09:01:26 +02:00
|
|
|
Verify System Label
|
2018-07-25 11:46:09 +02:00
|
|
|
[Arguments] ${json}
|
2018-06-29 09:01:26 +02:00
|
|
|
@{label}= Get Value From Json ${json} $..syslabel..name
|
2018-07-25 11:46:09 +02:00
|
|
|
Init Chrome Driver
|
|
|
|
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
2018-06-29 09:01:26 +02:00
|
|
|
Switch To Configure
|
|
|
|
Switch To System Labels
|
2018-07-25 11:46:09 +02:00
|
|
|
:For ${label} In @{label}
|
|
|
|
\ Page Should Contain ${label}
|
|
|
|
Close Browser
|
2018-06-29 09:01:26 +02:00
|
|
|
|
|
|
|
Verify Project Label
|
2018-07-25 11:46:09 +02:00
|
|
|
[Arguments] ${json}
|
2018-06-29 09:01:26 +02:00
|
|
|
@{project}= Get Value From Json ${json} $.peoject.[*].name
|
2018-07-25 11:46:09 +02:00
|
|
|
Init Chrome Driver
|
|
|
|
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
|
|
|
:For ${project} In @{project}
|
2019-01-16 06:39:36 +01:00
|
|
|
\ @{out_has_image}= Get Value From Json ${json} $.projects[?(@.name=${project})].has_image
|
|
|
|
\ ${has_image} Set Variable If @{out_has_image}[0] == ${true} ${true} ${false}
|
|
|
|
\ Go Into Project ${project} has_image=${has_image}
|
|
|
|
\ Switch To Project Label
|
|
|
|
\ @{projectlabel}= Get Value From Json ${json} $.projects[?(@.name=${project})]..labels..name
|
|
|
|
\ :For ${label} In @{label}
|
|
|
|
\ \ Page Should Contain ${projectlabel}
|
2019-01-28 09:32:45 +01:00
|
|
|
\ Navigate To Projects
|
2018-07-25 11:46:09 +02:00
|
|
|
Close Browser
|
2019-09-24 12:35:19 +02:00
|
|
|
|
2018-06-29 09:01:26 +02:00
|
|
|
Verify Endpoint
|
2018-07-25 11:46:09 +02:00
|
|
|
[Arguments] ${json}
|
2018-06-29 09:01:26 +02:00
|
|
|
@{endpoint}= Get Value From Json ${json} $.endpoint..name
|
2018-07-25 11:46:09 +02:00
|
|
|
Init Chrome Driver
|
|
|
|
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
2018-06-29 09:01:26 +02:00
|
|
|
Switch To Registries
|
2018-07-25 11:46:09 +02:00
|
|
|
:For ${endpoint} In @{endpoint}
|
|
|
|
\ Page Should Contain ${endpoint}
|
|
|
|
Close Browser
|
2018-06-29 09:01:26 +02:00
|
|
|
|
|
|
|
Verify Replicationrule
|
2018-07-25 11:46:09 +02:00
|
|
|
[Arguments] ${json}
|
2018-06-29 09:01:26 +02:00
|
|
|
@{replicationrule}= Get Value From Json ${json} $.replicationrule..name
|
2018-07-25 11:46:09 +02:00
|
|
|
Init Chrome Driver
|
|
|
|
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
|
|
|
Switch To Replication Manage
|
|
|
|
:For ${replicationrule} IN @{replicationrule}
|
|
|
|
\ Page Should Contain ${replicationrule}
|
|
|
|
Close Browser
|
2018-06-29 09:01:26 +02:00
|
|
|
|
|
|
|
Verify Project Setting
|
2018-07-25 11:46:09 +02:00
|
|
|
[Arguments] ${json}
|
2018-06-29 09:01:26 +02:00
|
|
|
@{projects}= Get Value From Json ${json} $.projects.[*].name
|
2018-07-25 11:46:09 +02:00
|
|
|
:For ${project} In @{Projects}
|
|
|
|
\ ${public}= Get Value From Json ${json} $.projects[?(@.name=${project})].accesslevel
|
|
|
|
\ ${contenttrust}= Get Value From Json ${json} $.projects[?(@.name=${project})]..enable_content_trust
|
|
|
|
\ ${preventrunning}= Get Value From Json ${json} $.projects[?(@.name=${project})]..prevent_vulnerable_images_from_running
|
|
|
|
\ ${scanonpush}= Get Value From Json ${json} $.projects[?(@.name=${project})]..automatically_scan_images_on_push
|
2019-09-24 12:35:19 +02:00
|
|
|
\ Init Chrome Driver
|
2018-07-25 11:46:09 +02:00
|
|
|
\ Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
2019-01-16 06:39:36 +01:00
|
|
|
\ @{out_has_image}= Get Value From Json ${json} $.projects[?(@.name=${project})].has_image
|
|
|
|
\ ${has_image} Set Variable If @{out_has_image}[0] == ${true} ${true} ${false}
|
|
|
|
\ Go Into Project ${project} has_image=${has_image}
|
2018-06-29 09:01:26 +02:00
|
|
|
\ Goto Project Config
|
2018-12-29 10:01:43 +01:00
|
|
|
\ Run Keyword If ${public} == "public" Checkbox Should Be Checked //clr-checkbox-wrapper[@name='public']//label
|
|
|
|
\ Run Keyword If ${contenttrust} == "true" Checkbox Should Be Checked //clr-checkbox-wrapper[@name='content-trust']//label
|
|
|
|
\ Run Keyword If ${contenttrust} == "false" Checkbox Should Not Be Checked //clr-checkbox-wrapper[@name='content-trust']//label
|
2019-09-05 09:13:13 +02:00
|
|
|
\ Run Keyword If ${preventrunning} == "true" Checkbox Should Be Checked //*[@id='prevent-vulenrability-image']//clr-checkbox-wrapper//label
|
|
|
|
\ Run Keyword If ${preventrunning} == "false" Checkbox Should Not Be Checked //*[@id='prevent-vulenrability-image']//clr-checkbox-wrapper//label
|
2019-01-09 12:34:13 +01:00
|
|
|
\ Run Keyword If ${scanonpush} == "true" Checkbox Should Be Checked //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//input
|
|
|
|
\ Run Keyword If ${scanonpush} == "true" Checkbox Should Not Be Checked //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//input
|
2018-07-25 11:46:09 +02:00
|
|
|
\ Close Browser
|
2018-06-29 09:01:26 +02:00
|
|
|
|
|
|
|
Verify System Setting
|
2018-07-25 11:46:09 +02:00
|
|
|
[Arguments] ${json}
|
|
|
|
@{authtype}= Get Value From Json ${json} $.configuration.authmode
|
|
|
|
@{creation}= Get Value From Json ${json} $.configuration..projectcreation
|
|
|
|
@{selfreg}= Get Value From Json ${json} $.configuration..selfreg
|
|
|
|
@{emailserver}= Get Value From Json ${json} $.configuration..emailserver
|
|
|
|
@{emailport}= Get Value From Json ${json} $.configuration..emailport
|
|
|
|
@{emailuser}= Get Value From Json ${json} $.configuration..emailuser
|
|
|
|
@{emailfrom}= Get Value From Json ${json} $.configuration..emailfrom
|
|
|
|
@{token}= Get Value From Json ${json} $.configuration..token
|
|
|
|
@{scanschedule}= Get Value From Json ${json} $.configuration..scanall
|
|
|
|
Init Chrome Driver
|
|
|
|
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
2018-06-29 09:01:26 +02:00
|
|
|
Switch To Configure
|
2018-07-25 11:46:09 +02:00
|
|
|
Page Should Contain @{authtype}[0]
|
2019-01-30 07:22:31 +01:00
|
|
|
Run Keyword If @{selfreg}[0] == 'True' Checkbox Should Be Checked //clr-checkbox-wrapper[@id='selfReg']//label
|
|
|
|
Run Keyword If @{selfreg}[0] == 'False' Checkbox Should Not Be Checked //clr-checkbox-wrapper[@id='selfReg']//label
|
2018-06-29 09:01:26 +02:00
|
|
|
Switch To Email
|
2019-01-30 07:22:31 +01:00
|
|
|
Textfield Value Should Be xpath=//*[@id='mailServer'] @{emailserver}[0]
|
|
|
|
Textfield Value Should Be xpath=//*[@id='emailPort'] @{emailport}[0]
|
|
|
|
Textfield Value Should Be xpath=//*[@id='emailUsername'] @{emailuser}[0]
|
|
|
|
Textfield Value Should Be xpath=//*[@id='emailFrom'] @{emailfrom}[0]
|
2018-06-29 09:01:26 +02:00
|
|
|
Switch To System Settings
|
2019-09-20 08:55:53 +02:00
|
|
|
${ret} Get Selected List Value xpath=//select[@id='proCreation']
|
|
|
|
Should Be Equal As Strings ${ret} @{creation}[0]
|
2018-07-25 11:46:09 +02:00
|
|
|
Token Must Be Match @{token}[0]
|
2019-09-23 10:14:01 +02:00
|
|
|
#ToDo:These 2 lines below should be uncommented right after issue 9211 was fixed
|
|
|
|
#Switch To Vulnerability Page
|
|
|
|
#Page Should Contain None
|
2018-07-25 11:46:09 +02:00
|
|
|
Close Browser
|
2018-06-29 09:01:26 +02:00
|
|
|
|