Add E2E test for helmchart (#5746)

Add E2E test for helmchart repo

Signed-off-by: Qian Deng <dengq@vmware.com>
This commit is contained in:
Qian Deng 2018-09-04 15:08:51 +08:00 committed by Yan
parent 2f573beb91
commit 4d601292d1
4 changed files with 123 additions and 1 deletions

View File

@ -0,0 +1,52 @@
*** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot
*** Keywords ***
Switch To Project Charts
Click Element xpath=//project-detail//a[contains(.,'Charts')]
Sleep 1
Page Should Contain Element xpath=//hbr-helm-chart
Upload Chart files
${current_dir}= Run pwd
Run wget ${harbor_chart_file_url}
Run wget ${harbor_chart_prov_file_url}
Run wget ${prometheus_chart_file_url}
Click Element xpath=${upload_chart_button}
${prometheus_file_path} Set Variable ${current_dir}/${prometheus_chart_filename}
Choose File xpath=${chart_file_browse} ${prometheus_file_path}
Click Element xpath=${upload_action_button}
Sleep 2
Click Element xpath=${upload_chart_button}
${harbor_file_path} Set Variable ${current_dir}/${harbor_chart_filename}
${harbor_prov_file_path} Set Variable ${current_dir}/${harbor_chart_prov_filename}
Choose File xpath=${chart_file_browse} ${harbor_file_path}
Choose File xpath=${chart_prov_browse} ${harbor_prov_file_path}
Click Element xpath=${upload_action_button}
Sleep 2
Wait Until Page Contains ${prometheus_chart_name}
Go Into Chart Version
[Arguments] ${chart_name}
Click Element xpath=//hbr-helm-chart//a[contains(., "${chart_name}")]
Capture Page Screenshot viewchartversion.png
Go Into Chart Detail
[Arguments] ${version_name}
Click Element xpath=//hbr-helm-chart-version//a[contains(., "${version_name}")]
Sleep 2
Page Should Contain Element ${chart_detail}
Go Back To Versions And Delete
Click Element xpath=${version_bread_crumbs}
Sleep 2
Click Element xpath=${version_checkbox}
Click Element xpath=${version_delete}
Click Element xpath=${version_confirm_delete}
Sleep 2
Page Should Contain Element xpath=${helmchart_content}

View File

@ -0,0 +1,36 @@
*** Settings ***
Documentation This resource provides any keywords related to the Harbor private registry appliance
*** Variables ***
${upload_chart_button} //project-list-charts/hbr-helm-chart//clr-dg-action-bar/button[contains(.,"upload")]
${chart_file_browse} //*[@id="chart"]
${chart_prov_browse} //*[@id="prov"]
${upload_action_button} //clr-modal//form/div/button[contains(.,"Upload")]
${harbor_chart_name} harbor
${harbor_chart_filename} harbor-0.2.0.tgz
${harbor_chart_prov_filename} harbor-0.2.0.tgz.prov
${harbor_chart_file_url} https://storage.googleapis.com/harbor-builds/helm-chart-test-files/harbor-0.2.0.tgz
${harbor_chart_prov_file_url} https://storage.googleapis.com/harbor-builds/helm-chart-test-files/harbor-0.2.0.tgz.prov
${prometheus_chart_name} prometheus
${prometheus_chart_filename} prometheus-7.0.2.tgz
${prometheus_chart_version} 7.0.2
${prometheus_chart_file_url} https://storage.googleapis.com/harbor-builds/helm-chart-test-files/prometheus-7.0.2.tgz
${prometheus_version} //hbr-helm-chart//a[contains(.,"prometheus")]
${chart_detail} //hbr-chart-detail
${summary_markdown} //*[@id="summary-content"]//div[contains(@class,'md-div')]
${summary_container} //*[@id="summary-content"]//div[contains(@class,'summary-container')]
${detail_dependency} //*[@id="depend-link"]
${dependency_content} //*[@id="depend-content"]/hbr-chart-detail-dependency
${detail_value} //*[@id="value-link"]
${value_content} //*[@id="value-content"]/hbr-chart-detail-value
${version_bread_crumbs} //project-chart-detail//a[contains(.,"Versions")]
${version_checkbox} //list-chart-version//clr-dg-cell[1]/clr-checkbox
${version_delete} //clr-dg-action-bar/button[contains(.,"DELETE")]
${version_confirm_delete} //clr-modal//button[contains(.,"DELETE")]
${helmchart_content} //project-detail/project-list-charts/hbr-helm-chart

View File

@ -37,6 +37,8 @@ Resource Harbor-Pages/Project-Members_Elements.robot
Resource Harbor-Pages/Project-Repository.robot
Resource Harbor-Pages/Project-Repository_Elements.robot
Resource Harbor-Pages/Project-Config.robot
Resource Harbor-Pages/Project-Helmcharts.robot
Resource Harbor-Pages/Project-Helmcharts_Elements.robot
Resource Harbor-Pages/Replication.robot
Resource Harbor-Pages/Replication_Elements.robot
Resource Harbor-Pages/UserProfile.robot

View File

@ -623,4 +623,36 @@ Test Case - Admin Push Signed Image
${rc} ${output}= Run And Return Rc And Output curl -u admin:Harbor12345 -s --insecure -H "Content-Type: application/json" -X GET "https://${ip}/api/repositories/library/tomcat/signatures"
Log To Console ${output}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} sha256
Should Contain ${output} sha256
Test Case - List Helm Charts
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} user027 Test1@34
Create An New Project project${d}
Go Into Project project${d}
Sleep 2
Switch To Project Charts
Upload Chart files
Go Into Chart Version ${prometheus_chart_name}
Wait Until Page Contains ${prometheus_chart_version}
Go Into Chart Detail ${prometheus_chart_version}
# Summary tab
Page Should Contain Element ${summary_markdown}
Page Should Contain Element ${summary_container}
# Dependency tab
Click Element xpath=${detail_dependency}
Sleep 1
Page Should Contain Element ${dependency_content}
# Values tab
Click Element xpath=${detail_value}
Sleep 1
Page Should Contain Element ${value_content}
Go Back To Versions And Delete
Close Browser