diff --git a/tests/apitests/python/library/artifact.py b/tests/apitests/python/library/artifact.py index 15e648dcd..5713d1274 100644 --- a/tests/apitests/python/library/artifact.py +++ b/tests/apitests/python/library/artifact.py @@ -83,6 +83,9 @@ class Artifact(base.Base, object): break artifact = self.get_reference_info(project_name, repo_name, reference, **kwargs) print "artifact", artifact + print "artifact[0]", artifact[0] + print "artifact[0].scan_overview", artifact[0].scan_overview + print "artifact[0].scan_overview['application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0']", artifact[0].scan_overview['application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0'] scan_status = artifact[0].scan_overview['application/vnd.scanner.adapter.vuln.report.harbor+json; version=1.0']["scan_status"] if scan_status == expected_scan_status: return diff --git a/tests/resources/Docker-Util.robot b/tests/resources/Docker-Util.robot index dc76ceb1b..f5088d515 100644 --- a/tests/resources/Docker-Util.robot +++ b/tests/resources/Docker-Util.robot @@ -133,7 +133,7 @@ Docker Login Fail [Arguments] ${ip} ${user} ${pwd} Log To Console \nRunning docker login ${ip} ... ${output}= Command Should be Failed docker login -u ${user} -p ${pwd} ${ip} - Should Contain ${output} unauthorized: authentication required + Should Contain ${output} 401 Unauthorized Should Not Contain ${output} 500 Internal Server Error Docker Login diff --git a/tests/resources/Harbor-Pages/OIDC_Auth.robot b/tests/resources/Harbor-Pages/OIDC_Auth.robot index 866cbc19c..3ef871f11 100644 --- a/tests/resources/Harbor-Pages/OIDC_Auth.robot +++ b/tests/resources/Harbor-Pages/OIDC_Auth.robot @@ -40,10 +40,10 @@ Sign In Harbor With OIDC User Get Secrete By API [Arguments] ${url} ${username}=${OIDC_USERNAME} - ${json}= Run Curl And Return Json curl -s -k -X GET --header 'Accept: application/json' -u '${HARBOR_ADMIN}:${HARBOR_PASSWORD}' '${url}/api/users/search?username=${username}' + ${json}= Run Curl And Return Json curl -s -k -X GET --header 'Accept: application/json' -u '${HARBOR_ADMIN}:${HARBOR_PASSWORD}' '${url}/api/v2.0/users/search?username=${username}' ${user_info}= Set Variable ${json[0]} ${user_id}= Set Variable ${user_info["user_id"]} - ${json}= Run Curl And Return Json curl -s -k -X GET --header 'Accept: application/json' -u '${HARBOR_ADMIN}:${HARBOR_PASSWORD}' '${url}/api/users/${user_id}' + ${json}= Run Curl And Return Json curl -s -k -X GET --header 'Accept: application/json' -u '${HARBOR_ADMIN}:${HARBOR_PASSWORD}' '${url}/api/v2.0/users/${user_id}' ${secret}= Set Variable ${json["oidc_user_meta"]["secret"]} [Return] ${secret} diff --git a/tests/resources/Harbor-Pages/Project_Robot_Account.robot b/tests/resources/Harbor-Pages/Project_Robot_Account.robot index 56c3e8876..7c3f471cb 100644 --- a/tests/resources/Harbor-Pages/Project_Robot_Account.robot +++ b/tests/resources/Harbor-Pages/Project_Robot_Account.robot @@ -16,6 +16,7 @@ Create A Robot Account And Return Token Switch To Project Robot Account Retry Element Click ${project_robot_account_create_btn} Retry Text Input ${project_robot_account_create_name_input} ${robot_account_name} + Retry Element Click ${project_robot_account_never_expired_chkbox} Retry Double Keywords When Error Retry Element Click ${project_robot_account_create_save_btn} Retry Wait Until Page Not Contains Element ${project_robot_account_create_save_btn} ${token}= Get Value ${project_robot_account_token_input} [Return] ${token} diff --git a/tests/resources/Harbor-Pages/Project_Robot_Account_Elements.robot b/tests/resources/Harbor-Pages/Project_Robot_Account_Elements.robot index 0e8cac590..9278f6eb3 100644 --- a/tests/resources/Harbor-Pages/Project_Robot_Account_Elements.robot +++ b/tests/resources/Harbor-Pages/Project_Robot_Account_Elements.robot @@ -5,5 +5,6 @@ Documentation This resource provides any keywords related to the Harbor robot-a ${project_robot_account_tabpage} xpath=//project-detail//a[contains(.,'Robot Accounts')] ${project_robot_account_create_btn} xpath=//project-detail/app-robot-account//button ${project_robot_account_token_input} xpath=//app-robot-account//hbr-copy-input//input +${project_robot_account_never_expired_chkbox} xpath=//add-robot//clr-checkbox-wrapper/label[contains(.,'Never Expired')] ${project_robot_account_create_name_input} //input[@id='robot_name'] ${project_robot_account_create_save_btn} //add-robot//button[contains(.,'SAVE')] diff --git a/tests/resources/Harbor-Util.robot b/tests/resources/Harbor-Util.robot index dea757824..f15f64bf7 100644 --- a/tests/resources/Harbor-Util.robot +++ b/tests/resources/Harbor-Util.robot @@ -159,5 +159,5 @@ Wait for Harbor Ready Fail Harbor failed to come up properly! Get Harbor Version - ${rc} ${output}= Run And Return Rc And Output curl -k -X GET --header 'Accept: application/json' 'https://${ip}/api/systeminfo'|grep -i harbor_version + ${rc} ${output}= Run And Return Rc And Output curl -k -X GET --header 'Accept: application/json' 'https://${ip}/api/v2.0/systeminfo'|grep -i harbor_version Log To Console ${output} diff --git a/tests/resources/Util.robot b/tests/resources/Util.robot index d8b8984bd..e4817d8b4 100644 --- a/tests/resources/Util.robot +++ b/tests/resources/Util.robot @@ -230,8 +230,9 @@ Retry Keyword When Error :For ${n} IN RANGE 1 6 \ Log To Console Trying ${keyword} elements @{elements} ${n} times ... \ ${out} Run Keyword And Ignore Error ${keyword} @{elements} - \ Log To Console Return value is ${out[0]} - \ Exit For Loop If '${out[0]}'=='PASS' + \ Log To Console Return value is ${out} and ${out[0]} + \ Run Keyword If '${keyword}'=='Make Swagger Client' Exit For Loop If '${out[0]}'=='PASS' and '${out[1]}'=='0' + \ ... ELSE Exit For Loop If '${out[0]}'=='PASS' \ Sleep 2 Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot Should Be Equal As Strings '${out[0]}' 'PASS' diff --git a/tests/robot-cases/Group0-BAT/API_DB.robot b/tests/robot-cases/Group0-BAT/API_DB.robot index f99d611dc..5cf0752d1 100644 --- a/tests/robot-cases/Group0-BAT/API_DB.robot +++ b/tests/robot-cases/Group0-BAT/API_DB.robot @@ -17,10 +17,6 @@ ${SERVER_API_ENDPOINT} ${SERVER_URL}/api &{SERVER_CONFIG} endpoint=${SERVER_API_ENDPOINT} verify_ssl=False *** Test Cases *** -Test Case - Scan Image - Harbor API Test ./tests/apitests/python/test_scan_image_artifact.py -Test Case - Scan All Images - Harbor API Test ./tests/apitests/python/test_system_level_scan_all.py Test Case - Garbage Collection Harbor API Test ./tests/apitests/python/test_garbage_collection.py Test Case - Add Private Project Member and Check User Can See It @@ -67,4 +63,7 @@ Test Case - Push Cnab Bundle Harbor API Test ./tests/apitests/python/test_push_cnab_bundle.py Test Case - Create/Delete tag Harbor API Test ./tests/apitests/python/test_create_delete_tag.py - +Test Case - Scan Image + Harbor API Test ./tests/apitests/python/test_scan_image_artifact.py +Test Case - Scan All Images + Harbor API Test ./tests/apitests/python/test_system_level_scan_all.py diff --git a/tests/robot-cases/Group1-Nightly/LDAP.robot b/tests/robot-cases/Group1-Nightly/LDAP.robot index 307565a6d..746c003de 100644 --- a/tests/robot-cases/Group1-Nightly/LDAP.robot +++ b/tests/robot-cases/Group1-Nightly/LDAP.robot @@ -116,4 +116,4 @@ Test Case - Ldap User Can Not login Test Case - Run LDAP Group Related API Test Harbor API Test ./tests/apitests/python/test_ldap_admin_role.py Harbor API Test ./tests/apitests/python/test_user_group.py - Harbor API Test ./tests/apitests/python/test_assign_role_to_ldap_group.py \ No newline at end of file + Harbor API Test ./tests/apitests/python/test_assign_role_to_ldap_group.py