Modify nightly case of scanner

Signed-off-by: Yogi_Wang <yawang@vmware.com>
This commit is contained in:
Yogi_Wang 2019-11-07 12:53:24 +08:00
parent a2dcdf8948
commit 58936aae42
7 changed files with 630 additions and 636 deletions

View File

@ -12,7 +12,7 @@
class="btn btn-sm btn-secondary"
(click)="setAsDefault()">{{'SCANNER.SET_AS_DEFAULT' | translate}}</button>
<clr-dropdown [clrCloseMenuOnItemClick]="false" class="btn btn-sm btn-link" clrDropdownTrigger>
<span>{{'MEMBER.ACTION' | translate}}<clr-icon class="clr-icon" shape="caret down"></clr-icon></span>
<span id="action-scanner">{{'MEMBER.ACTION' | translate}}<clr-icon class="clr-icon" shape="caret down"></clr-icon></span>
<clr-dropdown-menu *clrIfOpen>
<button clrDropdownItem
(click)="changeStat()"
@ -36,7 +36,7 @@
(click)="deleteScanners()"
class="btn btn-sm btn-secondary" [disabled]="!selectedRow">
<clr-icon class="margin-top-0" size="16" shape="times"></clr-icon>
<span class="margin-left-10">{{'BUTTON.DELETE' | translate}}</span>
<span id="delete-scanner-action" class="margin-left-10">{{'BUTTON.DELETE' | translate}}</span>
</button>
</clr-dropdown-menu>
</clr-dropdown>

View File

@ -3,8 +3,6 @@ Documentation This resource provides any keywords related to the Harbor private
Resource ../../resources/Util.robot
*** Variables ***
${scan_now_button} //vulnerability-page//button[contains(.,'NOW')]
${vulnerability_page} //clr-vertical-nav-group-children/a[contains(.,'Vulnerability')]
*** Keywords ***
Disable Scan Schedule
@ -41,8 +39,8 @@ Scan Is 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
Wait Until Element Is Visible //hbr-vulnerability-bar//hbr-result-tip-histogram
Mouse Over //hbr-result-tip-histogram
Sleep 1
Scan Repo
@ -51,13 +49,13 @@ Scan Repo
#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-vulnerability-summary-chart 300
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-vulnerability-summary-chart
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
@ -71,6 +69,14 @@ Vulnerability Not Ready Project Hint
${element}= Set Variable xpath=//span[contains(@class, 'db-status-warning')]
Wait Until Element Is Visible And Enabled ${element}
Vulnerability Not Ready Config Hint
${element}= Set Variable xpath=//vulnerability-config//clr-tooltip
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}

View File

@ -20,6 +20,12 @@ ${vulnerability_edit_btn} xpath=//vulnerability-config//cron-selection//button[
${vulnerability_dropdown_list} xpath=//vulnerability-config//cron-selection//select[@id='selectPolicy']
${vulnerability_dropdown_list_item_none} xpath=//vulnerability-config//cron-selection//select[@id='selectPolicy']//option[contains(.,'None')]
${vulnerability_save_btn} xpath=//cron-selection//button[contains(.,'SAVE')]
${scan_now_button} //vulnerability-config//button[contains(.,'NOW')]
${vulnerability_page} //clr-vertical-nav-group-children/a[contains(.,'Vulnerability')]
${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')]
${delete_scanner_confirm_btn} xpath=//clr-modal//button[contains(.,'DELETE')]

View File

@ -203,18 +203,6 @@ Clear Field Of Characters
: FOR ${index} IN RANGE ${character count}
\ Press Key ${field} \\8
Wait Unitl Vul Data Ready
[Arguments] ${url} ${timeout} ${interval}
${n}= Evaluate ${timeout}/${interval}
:FOR ${i} IN RANGE ${n}
\ Log Checking the vul data: ${i} ... console=True
\ ${rc} ${output}= Run And Return Rc And Output curl -k ${url}/api/systeminfo
\ Should Be Equal As Integers ${rc} 0
\ ${contains}= Run Keyword And Return Status Should Contain ${output} overall_last_update
\ Exit For Loop If ${contains}
\ Sleep ${interval}
Run Keyword If ${i+1}==${n} Fail The vul data is not ready
Wait Unitl Command Success
[Arguments] ${cmd} ${times}=8
:FOR ${n} IN RANGE 1 ${times}

View File

@ -24,14 +24,12 @@ ${SSH_USER} root
${HARBOR_ADMIN} admin
*** Test Cases ***
Test Case - Vulnerability Data Not Ready
#This case must run before vulnerability db ready
Test Case - Clair Is Default Scanner And It Is Immutable
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Go Into Project library has_image=${false}
Vulnerability Not Ready Project Hint
Switch To Vulnerability Page
Vulnerability Not Ready Config Hint
Switch To Scanners Page
Should Display The Default Clair Scanner
Clair Is Immutable Scanner
Test Case - Disable Scan Schedule
Init Chrome Driver
@ -66,7 +64,7 @@ Test Case - Scan Image With Empty Vul
Go Into Repo busybox
Scan Repo latest Succeed
Move To Summary Chart
Wait Until Page Contains Unknow
Wait Until Page Contains No vulnerability
Close Browser
Test Case - Manual Scan All
@ -96,7 +94,6 @@ Test Case - View Scan Error
Test Case - Scan Image On Push
[Tags] run-once
Wait Unitl Vul Data Ready ${HARBOR_URL} 7200 30
Init Chrome Driver
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}

File diff suppressed because it is too large Load Diff

View File

@ -28,15 +28,12 @@ ${HARBOR_ADMIN} admin
Test Case - Get Harbor Version
#Just get harbor version and log it
Get Harbor Version
Test Case - Vulnerability Data Not Ready
#This case must run before vulnerability db ready
Test Case - Clair Is Default Scanner And It Is immutable
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
Go Into Project library has_image=${false}
Vulnerability Not Ready Project Hint
Switch To Vulnerability Page
Vulnerability Not Ready Config Hint
Switch To Scanners Page
Should Display The Default Clair Scanner
Clair Is Immutable Scanner
Test Case - Read Only Mode
Init Chrome Driver
@ -431,7 +428,7 @@ Test Case - Scan Image With Empty Vul
Go Into Repo hello-world
Scan Repo latest Succeed
Move To Summary Chart
Wait Until Page Contains Unknow
Wait Until Page Contains No vulnerability
Close Browser
###
Test Case - Disable Scan Schedule