From e342b4ef0bd532ac59bb25675f02dd761ee0ccaa Mon Sep 17 00:00:00 2001 From: AllForNothing Date: Fri, 3 Apr 2020 15:33:40 +0800 Subject: [PATCH] Add new nightly cases for tag CRUD Signed-off-by: AllForNothing --- .../artifact-vulnerabilities.component.ts | 2 +- .../artifact-tag/artifact-tag.component.html | 6 ++--- .../Project-Artifact-Elements.robot | 7 +++++ .../Harbor-Pages/Project-Artifact.robot | 27 ++++++++++++++++++- tests/robot-cases/Group1-Nightly/Common.robot | 18 +++++++++++++ 5 files changed, 55 insertions(+), 5 deletions(-) diff --git a/src/portal/src/app/project/repository/artifact/artifact-additions/artifact-vulnerabilities/artifact-vulnerabilities.component.ts b/src/portal/src/app/project/repository/artifact/artifact-additions/artifact-vulnerabilities/artifact-vulnerabilities.component.ts index a4eeb16c1c..661cdb06c6 100644 --- a/src/portal/src/app/project/repository/artifact/artifact-additions/artifact-vulnerabilities/artifact-vulnerabilities.component.ts +++ b/src/portal/src/app/project/repository/artifact/artifact-additions/artifact-vulnerabilities/artifact-vulnerabilities.component.ts @@ -99,7 +99,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))); diff --git a/src/portal/src/app/project/repository/artifact/artifact-tag/artifact-tag.component.html b/src/portal/src/app/project/repository/artifact/artifact-tag/artifact-tag.component.html index 87c7e1ceea..45f6571f6b 100644 --- a/src/portal/src/app/project/repository/artifact/artifact-tag/artifact-tag.component.html +++ b/src/portal/src/app/project/repository/artifact/artifact-tag/artifact-tag.component.html @@ -2,10 +2,10 @@ - - @@ -32,7 +32,7 @@ - diff --git a/tests/resources/Harbor-Pages/Project-Artifact-Elements.robot b/tests/resources/Harbor-Pages/Project-Artifact-Elements.robot index 390b5f3488..56ba12c59b 100644 --- a/tests/resources/Harbor-Pages/Project-Artifact-Elements.robot +++ b/tests/resources/Harbor-Pages/Project-Artifact-Elements.robot @@ -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')] \ No newline at end of file diff --git a/tests/resources/Harbor-Pages/Project-Artifact.robot b/tests/resources/Harbor-Pages/Project-Artifact.robot index f32e22af98..72e45690d5 100644 --- a/tests/resources/Harbor-Pages/Project-Artifact.robot +++ b/tests/resources/Harbor-Pages/Project-Artifact.robot @@ -16,4 +16,29 @@ Documentation This resource provides any keywords related to the Harbor private registry appliance Resource ../../resources/Util.robot -*** Keywords *** \ No newline at end of file +*** 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} \ No newline at end of file diff --git a/tests/robot-cases/Group1-Nightly/Common.robot b/tests/robot-cases/Group1-Nightly/Common.robot index 697f758f86..fc58cedbc0 100644 --- a/tests/robot-cases/Group1-Nightly/Common.robot +++ b/tests/robot-cases/Group1-Nightly/Common.robot @@ -575,6 +575,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}