From de2ec7d06387368c225b0f7675c0aa947738d0fa Mon Sep 17 00:00:00 2001 From: danfengliu Date: Tue, 24 Dec 2019 11:40:10 +0800 Subject: [PATCH] Replace keyword without waiting to one which had waiting 1. Replace all keywords without using waiting; 2. Add a debug line in Go Into Repo for UI hung trouble shooting. Signed-off-by: danfengliu --- .../Harbor-Pages/Administration-Users.robot | 14 +++++++------- tests/resources/Harbor-Pages/Configuration.robot | 4 ++-- tests/resources/Harbor-Pages/HomePage.robot | 2 +- tests/resources/Harbor-Pages/LDAP-Mode.robot | 4 ++-- .../resources/Harbor-Pages/Project-Config.robot | 2 +- .../resources/Harbor-Pages/Project-Members.robot | 16 ++++++++-------- .../Project-Repository_Elements.robot | 3 +++ tests/resources/Harbor-Pages/Project.robot | 2 +- tests/resources/Harbor-Pages/UserProfile.robot | 2 +- tests/robot-cases/Group1-Nightly/Common.robot | 4 ++-- tests/robot-cases/Group1-Nightly/LDAP.robot | 3 +++ tests/robot-cases/Group1-Nightly/Nightly.robot | 2 +- tests/robot-cases/Group1-Nightly/UAA.robot | 2 +- 13 files changed, 33 insertions(+), 27 deletions(-) diff --git a/tests/resources/Harbor-Pages/Administration-Users.robot b/tests/resources/Harbor-Pages/Administration-Users.robot index cd15d0af5..be3a67571 100644 --- a/tests/resources/Harbor-Pages/Administration-Users.robot +++ b/tests/resources/Harbor-Pages/Administration-Users.robot @@ -21,28 +21,28 @@ Resource ../../resources/Util.robot *** Keywords *** Assign User Admin [Arguments] ${user} - Click Element xpath=//harbor-user//hbr-filter//clr-icon + Retry Element Click xpath=//harbor-user//hbr-filter//clr-icon Input Text xpath=//harbor-user//hbr-filter//input ${user} Sleep 2 #select checkbox - Click Element //clr-dg-row[contains(.,'${user}')]//label + Retry Element Click //clr-dg-row[contains(.,'${user}')]//label #click assign admin - Click Element //*[@id='set-admin'] + Retry Element Click //*[@id='set-admin'] Sleep 1 Switch to User Tag - Click Element xpath=${administration_user_tag_xpath} + Retry Element Click xpath=${administration_user_tag_xpath} Sleep 1 Administration Tag Should Display - Page Should Contain Element xpath=${administration_tag_xpath} + Retry Wait Until Page Contains Element xpath=${administration_tag_xpath} User Email Should Exist [Arguments] ${email} Sign In Harbor ${HARBOR_URL} %{HARBOR_ADMIN} %{HARBOR_PASSWORD} Switch to User Tag - Page Should Contain Element xpath=//clr-dg-cell[contains(., '${email}')] + Retry Wait Until Page Contains Element xpath=//clr-dg-cell[contains(., '${email}')] Add User Button Should Be Disabled Sleep 1 - Page Should Contain Element //button[contains(.,'New') and @disabled=''] + Retry Wait Until Page Contains Element //button[contains(.,'New') and @disabled=''] diff --git a/tests/resources/Harbor-Pages/Configuration.robot b/tests/resources/Harbor-Pages/Configuration.robot index d619698a1..c59dff789 100644 --- a/tests/resources/Harbor-Pages/Configuration.robot +++ b/tests/resources/Harbor-Pages/Configuration.robot @@ -140,10 +140,10 @@ Self Reg Should Be Enabled Checkbox Should Be Selected xpath=${self_reg_xpath} Project Creation Should Display - Page Should Contain Element xpath=${project_create_xpath} + Retry Wait Until Page Contains Element xpath=${project_create_xpath} Project Creation Should Not Display - Page Should Not Contain Element xpath=${project_create_xpath} + Retry Wait Until Page Not Contains Element xpath=${project_create_xpath} ## System settings Switch To System Settings diff --git a/tests/resources/Harbor-Pages/HomePage.robot b/tests/resources/Harbor-Pages/HomePage.robot index c5f8ad83c..0486efdc1 100644 --- a/tests/resources/Harbor-Pages/HomePage.robot +++ b/tests/resources/Harbor-Pages/HomePage.robot @@ -37,7 +37,7 @@ Capture Screenshot And Source Log Source Sign Up Should Not Display - Page Should Not Contain Element xpath=${sign_up_button_xpath} + Retry Wait Until Page Not Contains Element xpath=${sign_up_button_xpath} Create An New User [Arguments] ${url} ${username} ${email} ${realname} ${newPassword} ${comment} diff --git a/tests/resources/Harbor-Pages/LDAP-Mode.robot b/tests/resources/Harbor-Pages/LDAP-Mode.robot index d14b53430..fa0cf4c43 100644 --- a/tests/resources/Harbor-Pages/LDAP-Mode.robot +++ b/tests/resources/Harbor-Pages/LDAP-Mode.robot @@ -21,8 +21,8 @@ Resource ../../resources/Util.robot *** Keywords *** Ldap User Should Not See Change Password - Click Element //clr-header//clr-dropdown[2]//button - Sleep 1 + Retry Element Click //clr-header//clr-dropdown[2]//button + Sleep 2 Page Should Not Contain Password diff --git a/tests/resources/Harbor-Pages/Project-Config.robot b/tests/resources/Harbor-Pages/Project-Config.robot index 96eb835a9..c0e6c4871 100644 --- a/tests/resources/Harbor-Pages/Project-Config.robot +++ b/tests/resources/Harbor-Pages/Project-Config.robot @@ -42,7 +42,7 @@ Public Should Be Selected Project Should Be Public [Arguments] ${projectName} - Page Should Contain Element //clr-dg-row[contains(.,'${projectName}')]//clr-dg-cell[contains(.,'Public')] + Retry Wait Until Page Contains Element //clr-dg-row[contains(.,'${projectName}')]//clr-dg-cell[contains(.,'Public')] Content Trust Should Be Selected Checkbox Should Be Selected //hbr-project-policy-config//input[@name='content-trust'] diff --git a/tests/resources/Harbor-Pages/Project-Members.robot b/tests/resources/Harbor-Pages/Project-Members.robot index 7d8ef63cb..e506e047e 100644 --- a/tests/resources/Harbor-Pages/Project-Members.robot +++ b/tests/resources/Harbor-Pages/Project-Members.robot @@ -70,13 +70,13 @@ User Can Change Role [arguments] ${username} Retry Element Click xpath=//clr-dg-row[contains(.,'${username}')]//input/../label Retry Element Click xpath=//*[@id='member-action'] - Page Should Not Contain Element xpath=//button[@disabled='' and contains(.,'Admin')] + Retry Wait Until Page Not Contains Element xpath=//button[@disabled='' and contains(.,'Admin')] User Can Not Change Role [arguments] ${username} Retry Element Click xpath=//clr-dg-row[contains(.,'${username}')]//input/../label Retry Element Click xpath=//*[@id='member-action'] - Page Should Contain Element xpath=//button[@disabled='' and contains(.,'Admin')] + Retry Wait Until Page Contains Element xpath=//button[@disabled='' and contains(.,'Admin')] #this keyworkd seems will not use any more, will delete in the future Non-admin View Member Account @@ -84,7 +84,7 @@ Non-admin View Member Account Xpath Should Match X Times //clr-dg-row-master ${times} User Can Not Add Member - Page Should Contain Element xpath=//button[@disabled='' and contains(.,'User')] + Retry Wait Until Page Contains Element xpath=//button[@disabled='' and contains(.,'User')] Add Guest Member To Project [arguments] ${member} @@ -153,7 +153,7 @@ User Should Be Guest Go Into Project ${project} Switch To Member User Can Not Add Member - Page Should Contain Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Guest')] + Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Guest')] Logout Harbor Pull image ${ip} ${user} ${password} ${project} hello-world Cannot Push image ${ip} ${user} ${password} ${project} hello-world @@ -168,7 +168,7 @@ User Should Be Developer Go Into Project ${project} Switch To Member User Can Not Add Member - Page Should Contain Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Developer')] + Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Developer')] Logout Harbor Push Image With Tag ${ip} ${user} ${password} ${project} hello-world v1 @@ -183,7 +183,7 @@ User Should Be Admin Switch To Member Add Guest Member To Project ${guest} User Can Change Role ${guest} - Page Should Contain Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Admin')] + Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Admin')] Logout Harbor Push Image With Tag ${ip} ${user} ${password} ${project} hello-world v2 @@ -197,7 +197,7 @@ User Should Be Master Go Into Project ${project} Delete Repo ${project} Switch To Member - Page Should Contain Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Master')] + Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Master')] Logout Harbor Push Image With Tag ${ip} ${user} ${password} ${project} hello-world v3 @@ -206,5 +206,5 @@ Project Should Have Member Sign In Harbor ${HARBOR_URL} %{HARBOR_ADMIN} %{HARBOR_PASSWORD} Go Into Project ${project} Switch To Member - Page Should Contain Element xpath=//clr-dg-cell[contains(., '${user}')] + Retry Wait Until Page Contains Element xpath=//clr-dg-cell[contains(., '${user}')] Logout Harbor diff --git a/tests/resources/Harbor-Pages/Project-Repository_Elements.robot b/tests/resources/Harbor-Pages/Project-Repository_Elements.robot index 52ab139d9..053133296 100644 --- a/tests/resources/Harbor-Pages/Project-Repository_Elements.robot +++ b/tests/resources/Harbor-Pages/Project-Repository_Elements.robot @@ -21,3 +21,6 @@ ${first_cve_xpath} //clr-dg-row[1]//clr-dg-cell//a ${view_log_xpath} //clr-dg-row[1]//clr-dg-cell[4]//a ${build_history_btn} //button[contains(.,'Build History')] ${build_history_data} //clr-dg-row +${push_image_command_btn} //hbr-push-image-button//button + + diff --git a/tests/resources/Harbor-Pages/Project.robot b/tests/resources/Harbor-Pages/Project.robot index 047e175cd..d09f3dafb 100644 --- a/tests/resources/Harbor-Pages/Project.robot +++ b/tests/resources/Harbor-Pages/Project.robot @@ -27,7 +27,7 @@ Create An New Project Capture Page Screenshot Retry Text Input xpath=${project_name_xpath} ${projectname} ${element_project_public}= Set Variable xpath=${project_public_xpath} - Run Keyword If '${public}' == 'true' Run Keywords Wait Until Element Is Visible And Enabled ${element_project_public} AND Click Element ${element_project_public} + Run Keyword If '${public}' == 'true' Run Keywords Wait Until Element Is Visible And Enabled ${element_project_public} AND Retry Element Click ${element_project_public} Run Keyword If '${count_quota}'!='${null}' Input Count Quota ${count_quota} Run Keyword If '${storage_quota}'!='${null}' Input Storage Quota ${storage_quota} ${storage_quota_unit} Capture Page Screenshot diff --git a/tests/resources/Harbor-Pages/UserProfile.robot b/tests/resources/Harbor-Pages/UserProfile.robot index fc7b3fca0..8525fcca7 100644 --- a/tests/resources/Harbor-Pages/UserProfile.robot +++ b/tests/resources/Harbor-Pages/UserProfile.robot @@ -43,4 +43,4 @@ Logout Harbor Retry Link Click Log Out Capture Page Screenshot Logout.png Sleep 2 - Wait Until Keyword Succeeds 5x 1 Page Should Contain Element ${sign_in_title_xpath} \ No newline at end of file + Wait Until Keyword Succeeds 5x 1 Retry Wait Until Page Contains Element ${sign_in_title_xpath} \ 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 350ed23a4..e7d993046 100644 --- a/tests/robot-cases/Group1-Nightly/Common.robot +++ b/tests/robot-cases/Group1-Nightly/Common.robot @@ -406,7 +406,7 @@ Test Case - Developer Operate Labels Sign In Harbor ${HARBOR_URL} user022 Test1@34 Go Into Project project${d} has_image=${false} Sleep 3 - Page Should Not Contain Element xpath=//a[contains(.,'Labels')] + Retry Wait Until Page Not Contains Element xpath=//a[contains(.,'Labels')] Close Browser Test Case - Retag A Image Tag @@ -431,7 +431,7 @@ Test Case - Retag A Image Tag Page Should Contain ${target_image_name} Go Into Repo project${random_num1}${random_num2}/${target_image_name} Sleep 1 - Page Should Contain Element xpath=${tag_value_xpath} + Retry Wait Until Page Contains Element xpath=${tag_value_xpath} Close Browser Test Case - Create An New Project With Quotas Set diff --git a/tests/robot-cases/Group1-Nightly/LDAP.robot b/tests/robot-cases/Group1-Nightly/LDAP.robot index c077fca48..307565a6d 100644 --- a/tests/robot-cases/Group1-Nightly/LDAP.robot +++ b/tests/robot-cases/Group1-Nightly/LDAP.robot @@ -44,6 +44,7 @@ Test Case - System Admin On-board New Member ${d}= Get Current Date result_format=%m%s Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Switch To User Tag + Sleep 2 Page Should Not Contain mike02 Navigate To Projects Create An New Project project${d} @@ -60,8 +61,10 @@ Test Case - LDAP User On-borad New Member Create An New Project project${d} Go Into Project project${d} has_image=${false} Switch To Member + Sleep 2 Page Should Not Contain mike04 Add Guest Member To Project mike04 + Sleep 2 Page Should Contain mike04 Close Browser diff --git a/tests/robot-cases/Group1-Nightly/Nightly.robot b/tests/robot-cases/Group1-Nightly/Nightly.robot index 8648101a7..a4bb5ca3b 100644 --- a/tests/robot-cases/Group1-Nightly/Nightly.robot +++ b/tests/robot-cases/Group1-Nightly/Nightly.robot @@ -393,7 +393,7 @@ TestCase - Developer Operate Labels Sign In Harbor ${HARBOR_URL} bob${d} Test1@34 Go Into Project project${d} has_image=${false} Sleep 3 - Page Should Not Contain Element xpath=//a[contains(.,'Labels')] + Retry Wait Until Page Not Contains Element xpath=//a[contains(.,'Labels')] Close Browser Test Case - Scan A Tag In The Repo diff --git a/tests/robot-cases/Group1-Nightly/UAA.robot b/tests/robot-cases/Group1-Nightly/UAA.robot index 1d5ba63e3..11c38d901 100644 --- a/tests/robot-cases/Group1-Nightly/UAA.robot +++ b/tests/robot-cases/Group1-Nightly/UAA.robot @@ -36,7 +36,7 @@ Test Case - Home Page Differences With DB Mode Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Logout Harbor Sleep 2 - Page Should Not Contain Sign up + Page Should Not Contain Sign up Page Should Not Contain Forgot password Close Browser