[Nightly] Add case for trivy

Signed-off-by: Yogi_Wang <yawang@vmware.com>
This commit is contained in:
Yogi_Wang 2020-03-26 11:48:35 +08:00
parent 033d6dac6b
commit 1f3e00c782
4 changed files with 125 additions and 2 deletions

View File

@ -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}
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}

View File

@ -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"]

View File

@ -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

View File

@ -26,4 +26,101 @@ ${HARBOR_ADMIN} admin
*** Test Cases ***
Test Case - Get Harbor Version
#Just get harbor version and log it
Get Harbor Version
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