From 9bf38c248646f413ac56d5c46859d63a175a8197 Mon Sep 17 00:00:00 2001 From: sigsbee <23101283+sigsbee@users.noreply.github.com> Date: Wed, 25 Apr 2018 16:24:11 +0800 Subject: [PATCH] Add autotest case (#4603) Add test case large image replicate Add test case Download CA Add test case repo description Add test case project level replication Add test case repo size Add test case statistics info --- .../Harbor-Pages/Project-Repository.robot | 2 + tests/resources/Harbor-Pages/Project.robot | 35 ++++++++++- .../resources/Harbor-Pages/Replication.robot | 26 ++++++++ .../robot-cases/Group11-Nightly/Nightly.robot | 61 +++++++++++++++++++ .../Group11-Nightly/Replication.robot | 54 +++++++++++++--- 5 files changed, 166 insertions(+), 12 deletions(-) diff --git a/tests/resources/Harbor-Pages/Project-Repository.robot b/tests/resources/Harbor-Pages/Project-Repository.robot index d12d50015..32530a77e 100644 --- a/tests/resources/Harbor-Pages/Project-Repository.robot +++ b/tests/resources/Harbor-Pages/Project-Repository.robot @@ -33,3 +33,5 @@ View Scan Error Log Capture Page Screenshot viewlog.png Wait Until Page Contains View Scanning Job Log Wait Until Page Contains ERROR + + diff --git a/tests/resources/Harbor-Pages/Project.robot b/tests/resources/Harbor-Pages/Project.robot index 790ef985e..c6b53499b 100644 --- a/tests/resources/Harbor-Pages/Project.robot +++ b/tests/resources/Harbor-Pages/Project.robot @@ -212,7 +212,7 @@ Expand Repo Edit Repo Info Click Element //*[@id="repo-info"] Sleep 1 - Page Should Contain Element //*[@id="info"]/form/div[2]/h3 + Page Should Contain Element //*[@id="info"]/form/div[2] # Cancel input Click Element xpath=//*[@id="info-edit-button"]/button Input Text xpath=//*[@id="info"]/form/div[2]/textarea test_description_info @@ -220,7 +220,7 @@ Edit Repo Info Sleep 1 Click Element xpath=//*[@id="info"]/form/confirmation-dialog/clr-modal/div/div[1]/div/div[1]/div/div[3]/button[2] Sleep 1 - Page Should Contain Element //*[@id="info"]/form/div[2]/h3 + Page Should Contain Element //*[@id="info"]/form/div[2] # Confirm input Click Element xpath=//*[@id="info-edit-button"]/button Input Text xpath=//*[@id="info"]/form/div[2]/textarea test_description_info @@ -268,3 +268,34 @@ Filter Labels In Tags Capture Page Screenshot filter_${labelName2}.png Page Should Contain Element xpath=//clr-dg-row[contains(.,"${labelName2}")] Page Should Not Contain Element xpath=//clr-dg-row[contains(.,"${labelName1}")] + +Get Statics Private Repo + ${privaterepo}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[2]/statistics/div/span[1] + Convert To Integer ${privaterepo} + [Return] ${privaterepo} + +Get Statics Private Project + ${privateproj}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[1]/statistics/div/span[1] + Convert To Integer ${privateproj} + [Return] ${privateproj} + +Get Statics Public Repo + ${publicrepo}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[3]/div[2]/statistics/div/span[1] + Convert To Integer ${publicrepo} + [Return] ${publicrepo} + +Get Statics Public Project + ${publicproj}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[3]/div[1]/statistics/div/span[1] + Convert To Integer ${publicproj} + [Return] ${publicproj} + +Get Statics Total Repo + ${totalrepo}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[4]/div[2]/statistics/div/span[1] + Convert To Integer ${totalrepo} + [Return] ${totalrepo} + +Get Statics Total Project + ${totalproj}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[4]/div[1]/statistics/div/span[1] + Convert To Integer ${totalproj} + [Return] ${totalproj} + diff --git a/tests/resources/Harbor-Pages/Replication.robot b/tests/resources/Harbor-Pages/Replication.robot index 8570530f6..ddd6bcd1d 100644 --- a/tests/resources/Harbor-Pages/Replication.robot +++ b/tests/resources/Harbor-Pages/Replication.robot @@ -67,6 +67,32 @@ Create A Rule With Existing Endpoint #click save Click Element ${rule_save_button} +Project Create A Rule With Existing Endpoint +# day 1=Monday..7=Sunday timeformat 12hour+am/pm + [Arguments] ${name} ${project_name} ${endpoint} ${mode} ${plan}=Daily ${weekday}=1 ${time}=0800a + #click new + Click Element ${new_name_xpath} + #input name + Input Text ${rule_name} ${name} + #input descripiton,here skip, leave it blank + #in this keyword, source project is not need to input + #set filter + Click Element ${source_image_filter_add} + Input Text ${source_iamge_repo_filter} * + Click Element ${source_image_filter_add} + Input Text ${source_image_tag_filter} * + #select endpoint + Click Element ${rule_target_select} + Wait Until Element Is Visible //select[@id='ruleTarget']//option[contains(.,'${endpoint}')] + Click Element //select[@id='ruleTarget']//option[contains(.,'${endpoint}')] + #set trigger + Click Element ${rule_trigger_select} + Wait Until Element Is Visible //select[@id="ruleTrigger"]//option[contains(.,'${mode}')] + Click Element //select[@id="ruleTrigger"]//option[contains(.,'${mode}')] + Run Keyword If '${mode}' == 'Scheduled' Setting Replicaiton Schedule ${plan} ${weekday} ${time} + #click save + Click Element ${rule_save_button} + Setting Replication Schedule [Arguments] ${plan} ${weekday}=1 ${time}=0800a Click Element ${schedule_type_select} diff --git a/tests/robot-cases/Group11-Nightly/Nightly.robot b/tests/robot-cases/Group11-Nightly/Nightly.robot index 158ae647f..4c6046c73 100644 --- a/tests/robot-cases/Group11-Nightly/Nightly.robot +++ b/tests/robot-cases/Group11-Nightly/Nightly.robot @@ -47,6 +47,50 @@ Test Case - Read Only Mode Push image ${ip} tester${d} Test1@34 project${d} busybox:latest Close Browser +Test Case - Repo Size + Init Chrome Driver + ${d}= Get Current Date result_format=%m%s + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library alpine 2.6 2.6 + Go Into Project library + Go Into Repo alpine + Page Should Contain 1.92MB + Close Browser + +Test Case - Staticsinfo + Init Chrome Driver + ${d}= Get Current Date result_format=%m%s + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + ${privaterepocount1}= Get Statics Private Repo + ${privateprojcount1}= Get Statics Private Project + ${publicrepocount1}= Get Statics Public Repo + ${publicprojcount1}= Get Statics Public Project + ${totalrepocount1}= Get Statics Total Repo + ${totalprojcount1}= Get Statics Total Project + Create An New Project private${d} + Create An New Project public${d} true + Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} private${d} hello-world + Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} public${d} hello-world + Reload Page + ${privaterepocount2}= Get Statics Private Repo + ${privateprojcount2}= get statics private project + ${publicrepocount2}= get statics public repo + ${publicprojcount2}= get statics public project + ${totalrepocount2}= get statics total repo + ${totalprojcount2}= get statics total project + ${privateprojcount}= evaluate ${privateprojcount1}+1 + ${privaterepocount}= evaluate ${privaterepocount1}+1 + ${publicprojcount}= evaluate ${publicprojcount1}+1 + ${publicrepocount}= evaluate ${publicrepocount1}+1 + ${totalrepocount}= evaluate ${totalrepocount1}+2 + ${totalprojcount}= evaluate ${totalprojcount1}+2 + Should Be Equal As Integers ${privateprojcount2} ${privateprojcount} + Should be equal as integers ${privaterepocount2} ${privaterepocount} + Should be equal as integers ${publicprojcount2} ${publicprojcount} + Should be equal as integers ${publicrepocount2} ${publicrepocount} + Should be equal as integers ${totalprojcount2} ${totalprojcount} + Should be equal as integers ${totalrepocount2} ${totalrepocount} + Test Case - Create An New User Init Chrome Driver ${d}= Get Current Date result_format=%m%s @@ -440,6 +484,23 @@ Test Case - Scan Image On Push Summary Chart Should Display latest Close Browser +Test Case - Verify Download Ca Link + Init Chrome Driver + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Switch To System Settings + Page Should Contain Registry Root Certificate + Close Browser + +Test Case - Edit Repo Info + Init Chrome Driver + ${d}= Get Current Date result_format=%m%s + Create An New Project With New User url=${HARBOR_URL} username=tester${d} email=tester${d}@vmware.com realname=tester${d} newPassword=Test1@34 comment=harbor projectname=project${d} public=false + Push Image ${ip} tester${d} Test1@34 project${d} hello-world + Go Into Project project${d} + Go Into Repo project${d}/hello-world + Edit Repo Info + Close Browser + Test Case - Manage Project Member Init Chrome Driver ${d}= Get current Date result_format=%m%s diff --git a/tests/robot-cases/Group11-Nightly/Replication.robot b/tests/robot-cases/Group11-Nightly/Replication.robot index 0b136f63b..904505320 100644 --- a/tests/robot-cases/Group11-Nightly/Replication.robot +++ b/tests/robot-cases/Group11-Nightly/Replication.robot @@ -62,14 +62,14 @@ Test Case - Endpoint Edit Wait Until Page Contains deletea Close Browser -#Test Case - Endpoint Delete #Temp disable for ui is unstable -# Init Chrome Driver -# ${d}= Get Current Date result_format=%m%s -# Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} -# Switch To Registries -# Delete Endpoint deletea -# Wait Until Page Does Not Contain deletea -# Close Browser +Test Case - Endpoint Delete + Init Chrome Driver + ${d}= Get Current Date result_format=%m%s + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Switch To Registries + Delete Endpoint deletea + Wait Until Page Does Not Contain deletea + Close Browser Test Case - Rule Edit Init Chrome Driver @@ -111,7 +111,7 @@ Test Case - Trigger Immediate Page Should Contain hello-world Go Into Repo hello-world Page Should Contain latest - Close browser + Close Browser Test Case - Trigger Manual Init Chrome Driver @@ -130,8 +130,24 @@ Test Case - Trigger Manual Page Should Contain hello-world Go Into Repo hello-world Page Should Contain latest - Close browser + Close Browser +Test Case - Large Image Replicate + Init Chrome Driver + ${d}= Get Current Date result_format=%m%s + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Create An New Project project${d} + Push Image with tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} ubuntu 16.04 16.04 + Switch To Replication Manage + Create A Rule With Existing Endpoint rule${d} project${d} edp Immediate + Logout Harbor + #logout and login target + Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Go Into Project project${d} + Page Should Contain ubuntu + Go Into Repo ubuntu + Page Should Contain 16.04 + Close Browser Test Case - Proj Replication Jobs Log View Init Chrome Driver @@ -150,3 +166,21 @@ Test Case - Proj Replication Jobs Log View Wait Until Page Contains error View Job Log busybox Close Browser + +Test Case - Project LeveL Replication Operation + Init Chrome Driver + ${d} = Get Current Date result_format=%m%s + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Create An New Project proj${d} + Go Into Project proj${d} + Switch To Replication + Project Create A Rule With Existing Endpoint rule${d} proj${d} edp Manual + Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} proj${d} hello-world + Trigger Replication Manual rule${d} + Logout Harbor + Sign In Harbor https://${ip1} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Go Into Project proj${d} + Page Should Contain hello-world + Go Into Repo hello-world + Page Should Contain latest + Close Browser