Merge pull request #15545 from YangJiao0817/add-test-cases-to-download-helm-charts-from-UI

Add TestCase to download helmchart from UI
This commit is contained in:
Yang Jiao 2021-09-15 11:00:06 +08:00 committed by GitHub
commit 192a97c85f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 31 additions and 6 deletions

View File

@ -37,6 +37,16 @@ Go Into Chart Detail
Retry Element Click xpath=//hbr-helm-chart-version//a[contains(., '${version_name}')] Retry Element Click xpath=//hbr-helm-chart-version//a[contains(., '${version_name}')]
Retry Wait Until Page Contains Element ${chart_detail} Retry Wait Until Page Contains Element ${chart_detail}
Download Chart File
[Arguments] ${chart_name} ${chart_filename}
Switch To Project Charts
${out} Run Keyword And Ignore Error OperatingSystem.File Should Not Exist ${download_directory}/${chart_filename}
Run Keyword If '${out[0]}'=='FAIL' Run rm -rf ${download_directory}/${chart_filename}
Retry File Should Not Exist ${download_directory}/${chart_filename}
Retry Element Click //clr-dg-row[contains(.,'${chart_name}')]//label
Retry Double Keywords When Error Retry Element Click ${download_chart_button} Retry File Should Exist ${download_directory}/${chart_filename}
Retry Element Click //clr-dg-row[contains(.,'${chart_name}')]//label
Multi-delete Chart Files Multi-delete Chart Files
[Arguments] @{obj} [Arguments] @{obj}
Switch To Project Charts Switch To Project Charts

View File

@ -5,6 +5,7 @@ Documentation This resource provides any keywords related to the Harbor private
${project_chart_tabpage} xpath=//project-detail//a[contains(.,'Charts')] ${project_chart_tabpage} xpath=//project-detail//a[contains(.,'Charts')]
${project_chart_list} xpath=//hbr-helm-chart ${project_chart_list} xpath=//hbr-helm-chart
${upload_chart_button} //*[@id='helm-chart-upload'] ${upload_chart_button} //*[@id='helm-chart-upload']
${download_chart_button} //clr-dg-action-bar/button[contains(.,'Download')]
${chart_file_browse} //*[@id='chart'] ${chart_file_browse} //*[@id='chart']
${chart_prov_browse} //*[@id='prov'] ${chart_prov_browse} //*[@id='prov']
${upload_action_button} //*[@id='upload-chart'] ${upload_action_button} //*[@id='upload-chart']

View File

@ -16,6 +16,9 @@
Documentation This resource provides helper functions for docker operations Documentation This resource provides helper functions for docker operations
Resource Util.robot Resource Util.robot
*** Variables ***
${download_directory} /drone/download
*** Keywords *** *** Keywords ***
Start Selenium Standalone Server Locally Start Selenium Standalone Server Locally
OperatingSystem.File Should Exist /go/selenium-server-standalone-3.4.0.jar OperatingSystem.File Should Exist /go/selenium-server-standalone-3.4.0.jar
@ -25,11 +28,14 @@ Start Selenium Standalone Server Locally
[Return] ${handle} [Return] ${handle}
Init Chrome Driver Init Chrome Driver
Create Directory ${download_directory}
Run pkill chromedriver Run pkill chromedriver
Run pkill chrome Run pkill chrome
${chrome options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys ${chrome options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys
${capabilities}= Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.CHROME sys ${capabilities}= Evaluate sys.modules['selenium.webdriver'].DesiredCapabilities.CHROME sys
${prefs} Create Dictionary download.default_directory=${download_directory}
Set To Dictionary ${capabilities} acceptInsecureCerts ${True} Set To Dictionary ${capabilities} acceptInsecureCerts ${True}
Call Method ${chrome options} add_experimental_option prefs ${prefs}
Call Method ${chrome options} add_argument --headless Call Method ${chrome options} add_argument --headless
Call Method ${chrome options} add_argument --disable-gpu Call Method ${chrome options} add_argument --disable-gpu
Call Method ${chrome options} add_argument --start-maximized Call Method ${chrome options} add_argument --start-maximized

View File

@ -151,7 +151,7 @@ Body Of List Helm Charts
Retry Double Keywords When Error Retry Element Click xpath=${detail_value} Retry Wait Until Page Contains Element ${value_content} Retry Double Keywords When Error Retry Element Click xpath=${detail_value} Retry Wait Until Page Contains Element ${value_content}
Go Into Project project${d} has_image=${false} Go Into Project project${d} has_image=${false}
Switch To Project Charts Retry Keyword N Times When Error 4 Download Chart File ${prometheus_chart_name} ${prometheus_chart_filename}
Multi-delete Chart Files ${prometheus_chart_name} ${harbor_chart_name} Multi-delete Chart Files ${prometheus_chart_name} ${harbor_chart_name}
Close Browser Close Browser

View File

@ -273,6 +273,14 @@ Retry Double Keywords When Error
Return From Keyword If ${DoAssert} == ${false} '${out2[0]}' Return From Keyword If ${DoAssert} == ${false} '${out2[0]}'
Should Be Equal As Strings '${out2[0]}' 'PASS' Should Be Equal As Strings '${out2[0]}' 'PASS'
Retry File Should Exist
[Arguments] ${path}
Retry Keyword N Times When Error 4 OperatingSystem.File Should Exist ${path}
Retry File Should Not Exist
[Arguments] ${path}
Retry Keyword N Times When Error 4 OperatingSystem.File Should Not Exist ${path}
Run Curl And Return Json Run Curl And Return Json
[Arguments] ${curl_cmd} [Arguments] ${curl_cmd}
${json_data_file}= Set Variable ${CURDIR}${/}cur_user_info.json ${json_data_file}= Set Variable ${CURDIR}${/}cur_user_info.json

View File

@ -23,7 +23,7 @@ ${SSH_USER} root
${HARBOR_ADMIN} admin ${HARBOR_ADMIN} admin
*** Test Cases *** *** Test Cases ***
Test Case - List Helm Charts And Delete Chart Files Test Case - List Helm Charts And Download And Delete Chart Files
Body Of List Helm Charts Body Of List Helm Charts
Test Case - Helm CLI Push Test Case - Helm CLI Push

View File

@ -60,8 +60,8 @@ RUN pwd && mkdir /tool/binary && \
pwd pwd
#ubuntu #ubuntu
RUN wget https://github.com/sylabs/singularity/releases/download/v3.3.0/singularity-3.3.0.tar.gz && \ RUN wget https://github.com/sylabs/singularity/releases/download/v3.7.4/singularity-3.7.4.tar.gz && \
tar -xzf singularity-3.3.0.tar.gz && \ tar -xzf singularity-3.7.4.tar.gz && \
cd singularity && \ cd singularity && \
./mconfig && \ ./mconfig && \
make -C builddir && \ make -C builddir && \

View File

@ -33,8 +33,8 @@ RUN pip3 install --upgrade pip pyasn1 google-apitools==0.5.31 gsutil \
requests dbbot robotframework-seleniumlibrary==4.3.0 robotframework-pabot \ requests dbbot robotframework-seleniumlibrary==4.3.0 robotframework-pabot \
robotframework-JSONLibrary hurry.filesize --upgrade && \ robotframework-JSONLibrary hurry.filesize --upgrade && \
apt-get clean all apt-get clean all
# Because the old version of chromedriver cant download files, upgrade it to version 93.0.4577.15, which can download files normally.
RUN wget -N http://chromedriver.storage.googleapis.com/2.40/chromedriver_linux64.zip && \ RUN wget -N http://chromedriver.storage.googleapis.com/93.0.4577.15/chromedriver_linux64.zip && \
unzip chromedriver_linux64.zip && \ unzip chromedriver_linux64.zip && \
chmod +x chromedriver && \ chmod +x chromedriver && \
mv -f chromedriver /usr/local/share/chromedriver && \ mv -f chromedriver /usr/local/share/chromedriver && \