diff --git a/tests/resources/Harbor-Pages/Vulnerability.robot b/tests/resources/Harbor-Pages/Vulnerability.robot index c08ca7356..db26be959 100644 --- a/tests/resources/Harbor-Pages/Vulnerability.robot +++ b/tests/resources/Harbor-Pages/Vulnerability.robot @@ -77,8 +77,17 @@ Switch To Scanners Page 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')] +Should Display The Default Trivy Scanner + Retry Wait Until Page Contains Element //clr-datagrid//clr-dg-row//clr-dg-cell[contains(.,'Trivy')]//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} \ No newline at end of file + Retry Double Keywords When Error Retry Element Click ${delete_scanner_confirm_btn} Retry Wait Until Page Contains Element ${immutable_msg_xpath} + +Trivy Is Immutable Scanner + Retry Element Click //clr-dg-row[contains(.,'Trivy')]//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_trivy_msg_xpath} diff --git a/tests/resources/Harbor-Pages/Vulnerability_Elements.robot b/tests/resources/Harbor-Pages/Vulnerability_Elements.robot index 613a56567..35f7cdf92 100644 --- a/tests/resources/Harbor-Pages/Vulnerability_Elements.robot +++ b/tests/resources/Harbor-Pages/Vulnerability_Elements.robot @@ -26,6 +26,7 @@ ${set_default_scanner} //button[@id='set-default'] ${scanner_action_xpath} //span[@id='action-scanner'] ${delete_scanner_action_xpath} //span[@id='delete-scanner-action'] ${immutable_msg_xpath} //span[contains(.,'registration Clair is not allowed to delete as it is immutable: scanner API: delete')] +${immutable_trivy_msg_xpath} //span[contains(.,'registration Trivy is not allowed to delete as it is immutable: scanner API: delete')] ${delete_scanner_confirm_btn} xpath=//clr-modal//button[contains(.,'DELETE')] ${scan_now_result} xpath=//div[@id="scan-result-container"] diff --git a/tests/resources/TestCaseBody.robot b/tests/resources/TestCaseBody.robot index 98e90a9b4..6dea8b9ff 100644 --- a/tests/resources/TestCaseBody.robot +++ b/tests/resources/TestCaseBody.robot @@ -68,6 +68,22 @@ Body Of Scan A Tag In The Repo # Edit Repo Info Close Browser +Body Of Scan A Tag In The Repo Use Trivy + Init Chrome Driver + ${d}= get current date result_format=%m%s + + Sign In Harbor ${HARBOR_URL} user023 Test1@34 + Create An New Project project${d} + Go Into Project project${d} has_image=${false} + Push Image ${ip} user023 Test1@34 project${d} vmware/photon:1.0 + Go Into Project project${d} + Go Into Repo project${d}/vmware/photon + Scan Repo 1.0 Succeed + Summary Chart Should Display 1.0 + Pull Image ${ip} user023 Test1@34 project${d} vmware/photon 1.0 + # Edit Repo Info + Close Browser + Body Of List Helm Charts Init Chrome Driver ${d}= Get Current Date result_format=%m%s diff --git a/tests/robot-cases/Group1-Nightly/Trivy.robot b/tests/robot-cases/Group1-Nightly/Trivy.robot index 6a5872527..a24699f5e 100644 --- a/tests/robot-cases/Group1-Nightly/Trivy.robot +++ b/tests/robot-cases/Group1-Nightly/Trivy.robot @@ -26,4 +26,101 @@ ${HARBOR_ADMIN} admin *** Test Cases *** Test Case - Get Harbor Version #Just get harbor version and log it - Get Harbor Version \ No newline at end of file + Get Harbor Version + +Test Case - Trivy Is Default Scanner And It Is Immutable + Init Chrome Driver + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Switch To Scanners Page + Should Display The Default Trivy Scanner + Trivy Is Immutable Scanner + +Test Case - Disable Scan Schedule + Init Chrome Driver + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Switch To Vulnerability Page + Disable Scan Schedule + Logout Harbor + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Switch To Vulnerability Page + Retry Wait Until Page Contains None + Close Browser + +Test Case - Scan A Tag In The Repo + Body Of Scan A Tag In The Repo Use Trivy + +Test Case - Scan As An Unprivileged User + Init Chrome Driver + Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world + + Sign In Harbor ${HARBOR_URL} user024 Test1@34 + Go Into Project library + Go Into Repo hello-world + Select Object latest + Scan Is Disabled + Close Browser +# # chose a emptyVul repo +# Test Case - Scan Image With Empty Vul +# Init Chrome Driver +# Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library vmware/photon:1.0 +# Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} +# Go Into Project library +# Go Into Repo vmware/photon +# # Go Into Repo busybox +# Scan Repo 1.0 Succeed +# Move To Summary Chart +# Wait Until Page Contains No vulnerability +# Close Browser +Test Case - Manual Scan All + Init Chrome Driver + Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library redis + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Switch To Vulnerability Page + Trigger Scan Now And Wait Until The Result Appears + Navigate To Projects + Go Into Project library + Go Into Repo redis + Summary Chart Should Display latest + Close Browser +Test Case - View Scan Error + Init Chrome Driver + ${d}= get current date result_format=%m%s + + Sign In Harbor ${HARBOR_URL} user026 Test1@34 + Create An New Project project${d} + Push Image ${ip} user026 Test1@34 project${d} busybox:latest + Go Into Project project${d} + Go Into Repo project${d}/busybox + Scan Repo latest Fail + View Scan Error Log + Close Browser + +Test Case - Scan Image On Push + [Tags] run-once + Init Chrome Driver + Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Go Into Project library + Goto Project Config + Enable Scan On Push + Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library memcached + Navigate To Projects + Go Into Project library + Go Into Repo memcached + Summary Chart Should Display latest + Close Browser + +Test Case - View Scan Results + [Tags] run-once + Init Chrome Driver + ${d}= get current date result_format=%m%s + + Sign In Harbor ${HARBOR_URL} user025 Test1@34 + Create An New Project project${d} + Push Image ${ip} user025 Test1@34 project${d} tomcat + Go Into Project project${d} + Go Into Repo project${d}/tomcat + Scan Repo latest Succeed + Summary Chart Should Display latest + View Repo Scan Details + Close Browser