harbor/tests/resources/Harbor-Pages/Vulnerability.robot
Yogi_Wang 58936aae42 Modify nightly case of scanner
Signed-off-by: Yogi_Wang <yawang@vmware.com>
2019-11-11 13:19:37 +08:00

82 lines
3.9 KiB
Plaintext

*** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot
*** Variables ***
*** Keywords ***
Disable Scan Schedule
Retry Double Keywords When Error Retry Element Click ${vulnerability_edit_btn} Retry Wait Until Page Not Contains Element ${vulnerability_edit_btn}
Retry Element Click ${vulnerability_dropdown_list}
Retry Element Click ${vulnerability_dropdown_list_item_none}
Retry Double Keywords When Error Retry Element Click ${vulnerability_save_btn} Retry Wait Until Page Not Contains Element ${vulnerability_save_btn}
Trigger Scan Now
Retry Element Click xpath=${scan_now_button}
Sleep 10
Switch To Vulnerability Page
Retry Element Click xpath=//clr-main-container//clr-vertical-nav//a[contains(.,'Interrogation')]
Retry Element Click xpath=//app-interrogation-services//a[contains(.,'Vulnerability')]
Retry Wait Element ${scan_now_button}
Set Vulnerabilty Serverity
#0 is high 1 is medium 2 is low 3 is negligible
[Arguments] ${level}
Goto Project Config
#enable first
Retry Element Click ${project_config_prevent_vulenrability_checkbox_label}
Checkbox Should Be Selected //project-detail//clr-checkbox-wrapper//input[@name='prevent-vulenrability-image-input']
Retry Element Click //project-detail//select
#wait for dropdown popup
Sleep 1
Select From List By Index //project-detail//select ${level}
Retry Element Click ${project_config_save_btn}
Scan Is Disabled
Retry Wait Until Page Contains Element //button[contains(.,'Scan') and @disabled='']
Move To Summary Chart
Sleep 2
Wait Until Element Is Visible //hbr-vulnerability-bar//hbr-result-tip-histogram
Mouse Over //hbr-result-tip-histogram
Sleep 1
Scan Repo
#use fail for image clair can not scan, otherwise use success
[Arguments] ${tagname} ${status}
#select one tag
Retry Element Click //clr-dg-row[contains(.,'${tagname}')]//label
Retry Element Click //button[contains(.,'Scan')]
Run Keyword If '${status}' == 'Succeed' Wait Until Element Is Visible //hbr-vulnerability-bar//hbr-result-tip-histogram 300
Run Keyword If '${status}' == 'Fail' Wait Until Element Is Visible //hbr-vulnerability-bar//a 300
Summary Chart Should Display
[Arguments] ${tagname}
Retry Wait Until Page Contains Element //clr-dg-row[contains(.,'${tagname}')]//hbr-vulnerability-bar//hbr-result-tip-histogram
Enable Scan On Push
Checkbox Should Not Be Selected //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//input
Retry Element Click //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//label
Checkbox Should Be Selected //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//input
Retry Element Click ${project_config_save_btn}
Sleep 10
Vulnerability Not Ready Project Hint
Sleep 2
${element}= Set Variable xpath=//span[contains(@class, 'db-status-warning')]
Wait Until Element Is Visible And Enabled ${element}
Switch To Scanners Page
Retry Element Click xpath=//clr-main-container//clr-vertical-nav//a[contains(.,'Interrogation')]
Retry Wait Until Page Contains Element ${set_default_scanner}
Should Display The Default Clair Scanner
Retry Wait Until Page Contains Element //clr-datagrid//clr-dg-row//clr-dg-cell[contains(.,'Clair')]//span[contains(.,'Default')]
Clair Is Immutable Scanner
Retry Element Click //clr-dg-row[contains(.,'Clair')]//clr-radio-wrapper/label
Retry Double Keywords When Error Retry Element Click ${scanner_action_xpath} Retry Wait Until Page Contains Element ${delete_scanner_action_xpath}
Retry Double Keywords When Error Retry Element Click ${delete_scanner_action_xpath} Retry Wait Until Page Contains Element ${delete_scanner_confirm_btn}
Retry Double Keywords When Error Retry Element Click ${delete_scanner_confirm_btn} Retry Wait Until Page Contains Element ${immutable_msg_xpath}