Merge pull request #11426 from AllForNothing/nightly-tag

Add new nightly cases for tag CRUD
This commit is contained in:
Will Sun 2020-04-13 12:15:18 +08:00 committed by GitHub
commit 009662a317
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 55 additions and 5 deletions

View File

@ -104,7 +104,7 @@ export class ArtifactVulnerabilitiesComponent implements OnInit, OnDestroy {
res => {
this.scan_overview = res;
if (this.scan_overview && this.scan_overview[DEFAULT_SUPPORTED_MIME_TYPE]) {
this.scanningResults = this.scan_overview[DEFAULT_SUPPORTED_MIME_TYPE].vulnerabilities;
this.scanningResults = this.scan_overview[DEFAULT_SUPPORTED_MIME_TYPE].vulnerabilities || [];
// sort
if (this.scanningResults) {
this.scanningResults.sort(((a, b) => this.getLevel(b) - this.getLevel(a)));

View File

@ -2,10 +2,10 @@
<clr-datagrid [clrDgLoading]="loading" (clrDgRefresh)="getCurrentArtifactTags($event)" [(clrDgSelected)]="selectedRow" [clrDgRowSelection]="true">
<clr-dg-action-bar>
<button type="button" [disabled]="!hasCreateTagPermission" class="btn btn-secondary" (click)="addTag()">
<button id="new-tag" type="button" [disabled]="!hasCreateTagPermission" class="btn btn-secondary" (click)="addTag()">
<clr-icon shape="plus" size="16"></clr-icon>&nbsp;{{'TAG.ADD_TAG' | translate}}
</button>
<button type="button" class="btn btn-secondary" [disabled]="!(selectedRow.length>=1&& !hasImmutableOnTag() && hasDeleteTagPermission)" (click)="removeTag()">
<button id="delete-tag" type="button" class="btn btn-secondary" [disabled]="!(selectedRow.length>=1&& !hasImmutableOnTag() && hasDeleteTagPermission)" (click)="removeTag()">
<clr-icon shape="trash" size="16"></clr-icon>&nbsp;{{'TAG.REMOVE_TAG' | translate}}
</button>
<span class="refresh-btn" (click)="refresh()">
@ -32,7 +32,7 @@
<button type="button" class="btn btn-sm btn-outline" (click)="cancelAddTag()">{{
'BUTTON.CANCEL' | translate }}
</button>
<button type="submit" class="btn btn-sm btn-primary" (click)="saveAddTag()"
<button id="add-ok" type="submit" class="btn btn-sm btn-primary" (click)="saveAddTag()"
[disabled]="isTagNameExist || tagNameCheckOnGoing || !newTagName.name ||tagForm.invalid">{{
'BUTTON.OK' | translate }}
</button>

View File

@ -22,3 +22,10 @@ ${artifact_action_copy_xpath} //clr-dropdown-menu//div[contains(.,'Copy') and @
${artifact_achieve_icon} //artifact-list-tab//clr-datagrid//clr-dg-row[contains(.,'sha256')]//clr-dg-cell[1]//clr-tooltip//a
${artifact_rows} //artifact-list-tab//clr-datagrid//clr-dg-row[contains(.,'sha256')]
${artifact_list_spinner} xpath=//clr-datagrid//clr-spinner
${artifact_tag_component} xpath=//artifact-tag
${add_tag_button} xpath=//*[@id='new-tag']
${tag_name_xpath} xpath=//*[@id='name']
${add_ok_button} xpath=//*[@id='add-ok']
${delete_tag_button} xpath=//*[@id='delete-tag']
${dialog_delete_button} xpath=//clr-modal//button[contains(.,'DELETE')]

View File

@ -16,4 +16,29 @@
Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot
*** Keywords ***
*** Keywords ***
Go Into Artifact
[Arguments] ${tag}
Retry Wait Until Page Not Contains Element ${artifact_list_spinner}
Retry Element Click xpath=//clr-dg-row[contains(.,'${tag}')]//a[contains(.,'sha256')]
Retry Wait Until Page Contains Element ${artifact_tag_component}
Should Contain Tag
[Arguments] ${tag}
Retry Wait Until Page Contains Element xpath=//artifact-tag//clr-dg-row//clr-dg-cell[contains(.,'${tag}')]
Should Not Contain Tag
[Arguments] ${tag}
Retry Wait Until Page Not Contains Element xpath=//artifact-tag//clr-dg-row//clr-dg-cell[contains(.,'${tag}')]
Add A New Tag
[Arguments] ${tag}
Retry Element Click ${add_tag_button}
Retry Text Input ${tag_name_xpath} ${tag}
Retry Element Click ${add_ok_button}
Delete A Tag
[Arguments] ${tag}
Retry Element Click xpath=//clr-dg-row[contains(.,'${tag}')]//clr-checkbox-wrapper//label[contains(@class,'clr-control-label')]
Retry Element Click ${delete_tag_button}
Retry Wait Until Page Contains Element ${dialog_delete_button}
Retry Element Click ${dialog_delete_button}

View File

@ -539,6 +539,24 @@ Test Case - Webhook CRUD
Delete A Webhook newWebhook${d}
Close Browser
Test Case - Tag CRUD
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
${d}= Get Current Date result_format=%m%s
Create An New Project project${d}
Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} hello-world latest
Switch To Project Repo
Go Into Repo hello-world
Go Into Artifact latest
Should Contain Tag latest
# add more than one tag
Add A New Tag 123
Should Contain Tag 123
Add A New Tag 456
Should Contain Tag 456
Delete A Tag latest
Should Not Contain Tag latest
Test Case - Tag Retention
Init Chrome Driver
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}