2018-03-12 07:20:37 +01:00
*** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot
*** Variables ***
2019-09-12 07:56:56 +02:00
2018-03-12 07:20:37 +01:00
*** Keywords ***
Disable Scan Schedule
2019-06-24 12:09:34 +02:00
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}
2018-03-12 07:20:37 +01:00
2019-11-12 11:47:15 +01:00
Trigger Scan Now And Wait Until The Result Appears
2019-03-28 13:36:44 +01:00
Retry Element Click xpath=${scan_now_button}
2019-11-21 07:03:59 +01:00
Sleep 60
2019-11-12 11:47:15 +01:00
Retry Wait Until Page Contains Element ${scan_now_result}
2018-03-12 07:20:37 +01:00
2019-03-28 13:36:44 +01:00
Switch To Vulnerability Page
2019-10-30 06:56:55 +01:00
Retry Element Click xpath=//clr-main-container//clr-vertical-nav//a[contains(.,'Interrogation')]
Retry Element Click xpath=//app-interrogation-services//a[contains(.,'Vulnerability')]
2019-03-28 13:36:44 +01:00
Retry Wait Element ${scan_now_button}
2018-03-12 07:20:37 +01:00
Set Vulnerabilty Serverity
2019-11-15 09:30:08 +01:00
#0 is critical, 1 is high, 2 is medium, 3 is low, 4 is negligible.
2018-03-12 07:20:37 +01:00
[Arguments] ${level}
Goto Project Config
#enable first
2019-08-21 08:12:12 +02:00
Retry Element Click ${project_config_prevent_vulenrability_checkbox_label}
2019-01-30 07:22:31 +01:00
Checkbox Should Be Selected //project-detail//clr-checkbox-wrapper//input[@name='prevent-vulenrability-image-input']
2019-03-27 08:33:31 +01:00
Retry Element Click //project-detail//select
2018-03-12 07:20:37 +01:00
#wait for dropdown popup
Sleep 1
Select From List By Index //project-detail//select ${level}
2019-08-21 08:12:12 +02:00
Retry Element Click ${project_config_save_btn}
2018-03-12 07:20:37 +01:00
Scan Is Disabled
2019-03-27 08:33:31 +01:00
Retry Wait Until Page Contains Element //button[contains(.,'Scan') and @disabled='']
2018-03-12 07:20:37 +01:00
Move To Summary Chart
2018-03-20 06:25:03 +01:00
Sleep 2
2019-11-07 05:53:24 +01:00
Wait Until Element Is Visible //hbr-vulnerability-bar//hbr-result-tip-histogram
Mouse Over //hbr-result-tip-histogram
2018-03-12 07:20:37 +01:00
Sleep 1
Scan Repo
#use fail for image clair can not scan, otherwise use success
[Arguments] ${tagname} ${status}
#select one tag
2019-03-27 08:33:31 +01:00
Retry Element Click //clr-dg-row[contains(.,'${tagname}')]//label
Retry Element Click //button[contains(.,'Scan')]
2019-11-07 05:53:24 +01:00
Run Keyword If '${status}' == 'Succeed' Wait Until Element Is Visible //hbr-vulnerability-bar//hbr-result-tip-histogram 300
2018-10-10 04:38:48 +02:00
Run Keyword If '${status}' == 'Fail' Wait Until Element Is Visible //hbr-vulnerability-bar//a 300
2018-03-12 07:20:37 +01:00
Summary Chart Should Display
[Arguments] ${tagname}
2020-03-22 03:48:52 +01:00
Retry Wait Until Page Contains Element //artifact-list-tab//clr-dg-row[contains(.,'${tagname}')]//clr-dg-cell//clr-tooltip
2018-03-12 07:20:37 +01:00
Enable Scan On Push
2019-01-30 07:22:31 +01:00
Checkbox Should Not Be Selected //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//input
2019-03-27 08:33:31 +01:00
Retry Element Click //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//label
2019-01-30 07:22:31 +01:00
Checkbox Should Be Selected //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//input
2019-08-21 08:12:12 +02:00
Retry Element Click ${project_config_save_btn}
2018-07-19 11:02:09 +02:00
Sleep 10
2018-03-12 07:20:37 +01:00
Vulnerability Not Ready Project Hint
2019-01-09 09:08:56 +01:00
Sleep 2
2019-01-30 07:22:31 +01:00
${element}= Set Variable xpath=//span[contains(@class, 'db-status-warning')]
2019-01-11 04:26:10 +01:00
Wait Until Element Is Visible And Enabled ${element}
2019-11-07 05:53:24 +01:00
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}