harbor/tests/resources/Harbor-Pages/Vulnerability.robot
Meina Zhou 0ba9856c66 fix nightly test
Signed-off-by: Meina Zhou <meinaz@vmware.com>
2018-11-01 14:07:55 +08:00

69 lines
2.8 KiB
Plaintext

*** 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 ***
Disable Scan Schedule
Click Element //vulnerability-config//button[@id="editSchedule"]
Click Element //vulnerability-config//select[@id="scanAllPolicy"]
Click Element //vulnerability-config//select[@id="scanAllPolicy"]//option[contains(.,'None')]
Click Element //button[@id="config_vulnerbility_save"]
Go To Vulnerability Config
Click Element //config//button[contains(.,'Vulnerability')]
Trigger Scan Now
Click Element //config//button[contains(.,'NOW')]
Sleep 10
Set Vulnerabilty Serverity
#0 is high 1 is medium 2 is low 3 is negligible
[Arguments] ${level}
Goto Project Config
#enable first
Click Element //project-detail//clr-checkbox[@name="prevent-vulenrability-image"]//label
Checkbox Should Be Selected //project-detail//clr-checkbox//input[@name="prevent-vulenrability-image"]
Click Element //project-detail//select
#wait for dropdown popup
Sleep 1
Select From List By Index //project-detail//select ${level}
Click Element //hbr-project-policy-config//button[contains(.,'SAVE')]
Scan Is Disabled
Page Should Contain Element //button[contains(.,'Scan') and @disabled='']
Move To Summary Chart
Sleep 2
Wait Until Element Is Visible //hbr-vulnerability-bar//hbr-vulnerability-summary-chart
Mouse Over //hbr-vulnerability-summary-chart
Sleep 1
Scan Repo
#use fail for image clair can not scan, otherwise use success
[Arguments] ${tagname} ${status}
#select one tag
Click Element //clr-dg-row[contains(.,"${tagname}")]//label
Click Element //button[contains(.,'Scan')]
Run Keyword If '${status}' == 'Succeed' Wait Until Element Is Visible //hbr-vulnerability-bar//hbr-vulnerability-summary-chart 300
Run Keyword If '${status}' == 'Fail' Wait Until Element Is Visible //hbr-vulnerability-bar//a 300
Summary Chart Should Display
[Arguments] ${tagname}
Page Should Contain Element //clr-dg-row[contains(.,'${tagname}')]//hbr-vulnerability-bar//hbr-vulnerability-summary-chart
Enable Scan On Push
Checkbox Should Not Be Selected //clr-checkbox[@name="scan-image-on-push"]//input
Click Element //clr-checkbox[@name="scan-image-on-push"]//label
Checkbox Should Be Selected //clr-checkbox[@name="scan-image-on-push"]//input
Click Element //hbr-project-policy-config//button[contains(.,'SAVE')]
Sleep 10
Vulnerability Not Ready Project Hint
Page Should Contain Element //span[contains(@class, "db-status-warning")]
Vulnerability Not Ready Config Hint
Page Should Contain Element //vulnerability-config//clr-tooltip