From e12fd13c563cd76387da40723edbca2631372f74 Mon Sep 17 00:00:00 2001 From: danfengliu Date: Wed, 30 Jan 2019 14:22:31 +0800 Subject: [PATCH] Encapsulate keyword and add it into keyword , this porblem caused case failure of randomly. (#6834) Signed-off-by: danfengliu --- tests/resources/Admiral-Util.robot | 12 +-- .../Harbor-Pages/Administration-Users.robot | 4 +- .../Harbor-Pages/Configuration.robot | 86 +++++++-------- .../Harbor-Pages/Configuration_Elements.robot | 20 ++-- tests/resources/Harbor-Pages/HomePage.robot | 12 +-- .../Harbor-Pages/HomePage_Elements.robot | 14 +-- .../Harbor-Pages/Project-Helmcharts.robot | 15 ++- .../Project-Helmcharts_Elements.robot | 28 ++--- .../Harbor-Pages/Project-Members.robot | 8 +- .../Project-Members_Elements.robot | 4 +- .../Harbor-Pages/Project-Retag.robot | 2 +- tests/resources/Harbor-Pages/Project.robot | 101 +++++++++--------- .../Harbor-Pages/Project_Elements.robot | 5 +- .../resources/Harbor-Pages/Replication.robot | 18 ++-- .../Harbor-Pages/Replication_Elements.robot | 18 ++-- tests/resources/Harbor-Pages/ToolKit.robot | 4 +- .../Harbor-Pages/ToolKit_Elements.robot | 2 +- .../resources/Harbor-Pages/UserProfile.robot | 10 +- tests/resources/Harbor-Pages/Verify.robot | 12 +-- .../Harbor-Pages/Vulnerability.robot | 22 ++-- tests/resources/Util.robot | 51 ++++++--- 21 files changed, 231 insertions(+), 217 deletions(-) diff --git a/tests/resources/Admiral-Util.robot b/tests/resources/Admiral-Util.robot index 3319675f6..e9d9b82cf 100644 --- a/tests/resources/Admiral-Util.robot +++ b/tests/resources/Admiral-Util.robot @@ -49,9 +49,9 @@ Login To Admiral Add Host To Admiral [Arguments] ${address} ${credentials}=${EMPTY} - Wait Until Element Is Visible css=a[data-cmd="navigation-hosts"] - Wait Until Element Is Enabled css=a[data-cmd="navigation-hosts"] - Click Element css=a[data-cmd="navigation-hosts"] + Wait Until Element Is Visible css=a[data-cmd='navigation-hosts'] + Wait Until Element Is Enabled css=a[data-cmd='navigation-hosts'] + Click Element css=a[data-cmd='navigation-hosts'] Wait Until Element Is Visible css=div.query-search-input-controls.form-control Wait Until Element Is Enabled css=div.query-search-input-controls.form-control @@ -87,9 +87,9 @@ Add Host To Admiral Add Project to Admiral [Arguments] ${name} - Wait Until Element Is Visible css=a[data-cmd="navigation-placements"] - Wait Until Element Is Enabled css=a[data-cmd="navigation-placements"] - Click Element css=a[data-cmd="navigation-placements"] + Wait Until Element Is Visible css=a[data-cmd='navigation-placements'] + Wait Until Element Is Enabled css=a[data-cmd='navigation-placements'] + Click Element css=a[data-cmd='navigation-placements'] Wait Until Element Is Visible css=div.right-context-panel > div.toolbar > div:nth-child(2) > a Wait Until Element Is Enabled css=div.right-context-panel > div.toolbar > div:nth-child(2) > a diff --git a/tests/resources/Harbor-Pages/Administration-Users.robot b/tests/resources/Harbor-Pages/Administration-Users.robot index f44324480..c5d6358a0 100644 --- a/tests/resources/Harbor-Pages/Administration-Users.robot +++ b/tests/resources/Harbor-Pages/Administration-Users.robot @@ -26,9 +26,9 @@ Assign User Admin Input Text xpath=//harbor-user//hbr-filter//input ${user} Sleep 2 #select checkbox - Click Element //clr-dg-row[contains(.,"${user}")]//label + Click Element //clr-dg-row[contains(.,'${user}')]//label #click assign admin - Click Element //*[@id="set-admin"] + Click Element //*[@id='set-admin'] Sleep 1 Switch to User Tag diff --git a/tests/resources/Harbor-Pages/Configuration.robot b/tests/resources/Harbor-Pages/Configuration.robot index 28043c942..a443c3ae3 100644 --- a/tests/resources/Harbor-Pages/Configuration.robot +++ b/tests/resources/Harbor-Pages/Configuration.robot @@ -24,17 +24,17 @@ Init LDAP ${rc} ${output}= Run And Return Rc And Output ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}' Log ${output} Sleep 2 - Input Text xpath=//*[@id="ldapUrl"] ldaps://${output} + Input Text xpath=//*[@id='ldapUrl'] ldaps://${output} Sleep 1 - Input Text xpath=//*[@id="ldapSearchDN"] cn=admin,dc=example,dc=com + Input Text xpath=//*[@id='ldapSearchDN'] cn=admin,dc=example,dc=com Sleep 1 - Input Text xpath=//*[@id="ldapSearchPwd"] admin + Input Text xpath=//*[@id='ldapSearchPwd'] admin Sleep 1 - Input Text xpath=//*[@id="ldapBaseDN"] dc=example,dc=com + Input Text xpath=//*[@id='ldapBaseDN'] dc=example,dc=com Sleep 1 - Input Text xpath=//*[@id="ldapFilter"] (&(objectclass=inetorgperson)(memberof=cn=harbor_users,ou=groups,dc=example,dc=com)) + Input Text xpath=//*[@id='ldapFilter'] (&(objectclass=inetorgperson)(memberof=cn=harbor_users,ou=groups,dc=example,dc=com)) Sleep 1 - Input Text xpath=//*[@id="ldapUid"] cn + Input Text xpath=//*[@id='ldapUid'] cn Sleep 1 Capture Page Screenshot Disable Ldap Verify Cert Checkbox @@ -52,15 +52,15 @@ Test Ldap Connection ${rc} ${output}= Run And Return Rc And Output ip addr s eth0 |grep "inet "|awk '{print $2}' |awk -F "/" '{print $1}' Log ${output} Sleep 2 - Input Text xpath=//*[@id="ldapUrl"] ldaps://${output} + Input Text xpath=//*[@id='ldapUrl'] ldaps://${output} Sleep 1 - Input Text xpath=//*[@id="ldapSearchDN"] cn=admin,dc=example,dc=com + Input Text xpath=//*[@id='ldapSearchDN'] cn=admin,dc=example,dc=com Sleep 1 - Input Text xpath=//*[@id="ldapSearchPwd"] admin + Input Text xpath=//*[@id='ldapSearchPwd'] admin Sleep 1 - Input Text xpath=//*[@id="ldapBaseDN"] dc=example,dc=com + Input Text xpath=//*[@id='ldapBaseDN'] dc=example,dc=com Sleep 1 - Input Text xpath=//*[@id="ldapUid"] cn + Input Text xpath=//*[@id='ldapUid'] cn Sleep 1 # default is checked, click test connection to verify fail as no cert. @@ -81,14 +81,14 @@ Test LDAP Server Success Wait Until Page Contains Connection to LDAP server is verified timeout=15 Disable Ldap Verify Cert Checkbox - Mouse Down xpath=//*[@id="clr-checkbox-ldapVerifyCert"] - Mouse Up xpath=//*[@id="clr-checkbox-ldapVerifyCert"] + Mouse Down xpath=//*[@id='clr-checkbox-ldapVerifyCert'] + Mouse Up xpath=//*[@id='clr-checkbox-ldapVerifyCert'] Sleep 2 Capture Page Screenshot Ldap Verify Cert Checkbox Should Be Disabled Ldap Verify Cert Checkbox Should Be Disabled - Checkbox Should Not Be Selected xpath=//*[@id="clr-checkbox-ldapVerifyCert"] + Checkbox Should Not Be Selected xpath=//*[@id='clr-checkbox-ldapVerifyCert'] Set Pro Create Admin Only #set limit to admin only @@ -96,8 +96,8 @@ Set Pro Create Admin Only Sleep 2 Click Element xpath=${system_config_xpath} Sleep 1 - Click Element xpath=//select[@id="proCreation"] - Click Element xpath=//select[@id="proCreation"]//option[@value="adminonly"] + Click Element xpath=//select[@id='proCreation'] + Click Element xpath=//select[@id='proCreation']//option[@value='adminonly'] Sleep 1 Click Element xpath=${config_system_save_button_xpath} Capture Page Screenshot AdminCreateOnly.png @@ -108,8 +108,8 @@ Set Pro Create Every One #set limit to Every One Click Element xpath=${system_config_xpath} Sleep 1 - Click Element xpath=//select[@id="proCreation"] - Click Element xpath=//select[@id="proCreation"]//option[@value="everyone"] + Click Element xpath=//select[@id='proCreation'] + Click Element xpath=//select[@id='proCreation']//option[@value='everyone'] Sleep 1 Click Element xpath=${config_system_save_button_xpath} Sleep 2 @@ -153,18 +153,18 @@ Switch To System Settings Click Element xpath=${system_config_xpath} Modify Token Expiration [Arguments] ${minutes} - Input Text xpath=//*[@id="tokenExpiration"] ${minutes} + Input Text xpath=//*[@id='tokenExpiration'] ${minutes} Click Button xpath=${config_system_save_button_xpath} Sleep 1 Token Must Be Match [Arguments] ${minutes} - Textfield Value Should Be xpath=//*[@id="tokenExpiration"] ${minutes} + Textfield Value Should Be xpath=//*[@id='tokenExpiration'] ${minutes} ## Replication Check Verify Remote Cert - Mouse Down xpath=//*[@id="clr-checkbox-verifyRemoteCert"] - Mouse Up xpath=//*[@id="clr-checkbox-verifyRemoteCert"] + Mouse Down xpath=//*[@id='clr-checkbox-verifyRemoteCert'] + Mouse Up xpath=//*[@id='clr-checkbox-verifyRemoteCert'] Click Element xpath=${config_save_button_xpath} Capture Page Screenshot RemoteCert.png Sleep 1 @@ -172,39 +172,39 @@ Check Verify Remote Cert Switch To System Replication Sleep 1 Switch To Configure - Click Element xpath=//*[@id="config-replication"] + Click Element xpath=//*[@id='config-replication'] Sleep 1 Should Verify Remote Cert Be Enabled - Checkbox Should Not Be Selected xpath=//*[@id="clr-checkbox-verifyRemoteCert"] + Checkbox Should Not Be Selected xpath=//*[@id='clr-checkbox-verifyRemoteCert'] ## Email Switch To Email Switch To Configure - Click Element xpath=//*[@id="config-email"] + Click Element xpath=//*[@id='config-email'] Sleep 1 Config Email - Input Text xpath=//*[@id="mailServer"] smtp.vmware.com - Input Text xpath=//*[@id="emailPort"] 25 - Input Text xpath=//*[@id="emailUsername"] example@vmware.com - Input Text xpath=//*[@id="emailPassword"] example - Input Text xpath=//*[@id="emailFrom"] example + Input Text xpath=//*[@id='mailServer'] smtp.vmware.com + Input Text xpath=//*[@id='emailPort'] 25 + Input Text xpath=//*[@id='emailUsername'] example@vmware.com + Input Text xpath=//*[@id='emailPassword'] example + Input Text xpath=//*[@id='emailFrom'] example Sleep 1 - Click Element xpath=//clr-checkbox-wrapper[@id="emailSSL-wrapper"]//label + Click Element xpath=//clr-checkbox-wrapper[@id='emailSSL-wrapper']//label Sleep 1 - Click Element xpath=//clr-checkbox-wrapper[@id="emailInsecure-wrapper"]//label + Click Element xpath=//clr-checkbox-wrapper[@id='emailInsecure-wrapper']//label Sleep 1 Click Element xpath=${config_email_save_button_xpath} Sleep 6 Verify Email - Textfield Value Should Be xpath=//*[@id="mailServer"] smtp.vmware.com - Textfield Value Should Be xpath=//*[@id="emailPort"] 25 - Textfield Value Should Be xpath=//*[@id="emailUsername"] example@vmware.com - Textfield Value Should Be xpath=//*[@id="emailFrom"] example - Checkbox Should Be Selected xpath=//*[@id="emailSSL"] - Checkbox Should Not Be Selected xpath=//*[@id="emailInsecure"] + Textfield Value Should Be xpath=//*[@id='mailServer'] smtp.vmware.com + Textfield Value Should Be xpath=//*[@id='emailPort'] 25 + Textfield Value Should Be xpath=//*[@id='emailUsername'] example@vmware.com + Textfield Value Should Be xpath=//*[@id='emailFrom'] example + Checkbox Should Be Selected xpath=//*[@id='emailSSL'] + Checkbox Should Not Be Selected xpath=//*[@id='emailInsecure'] Set Scan All To None click element //vulnerability-config//select @@ -236,19 +236,19 @@ Disable Read Only Switch To System Labels Sleep 1 Click Element xpath=${configuration_xpath} - Click Element xpath=//*[@id="config-label"] + Click Element xpath=//*[@id='config-label'] Create New Labels [Arguments] ${labelname} Click Element xpath=//button[contains(.,'New Label')] Sleep 1 - Input Text xpath=//*[@id="name"] ${labelname} + Input Text xpath=//*[@id='name'] ${labelname} Sleep 1 Click Element xpath=//hbr-create-edit-label//clr-dropdown/clr-icon Sleep 1 Click Element xpath=//hbr-create-edit-label//clr-dropdown-menu/label[1] Sleep 1 - Input Text xpath=//*[@id="description"] global + Input Text xpath=//*[@id='description'] global Click Element xpath=//div/form/section/label[4]/button[2] Capture Page Screenshot Wait Until Page Contains ${labelname} @@ -259,7 +259,7 @@ Update A Label Sleep 1 Click Element xpath=//button[contains(.,'Edit')] Sleep 1 - Input Text xpath=//*[@id="name"] ${labelname}1 + Input Text xpath=//*[@id='name'] ${labelname}1 Sleep 1 Click Element xpath=//hbr-create-edit-label//form/section//button[2] Capture Page Screenshot @@ -273,7 +273,7 @@ Delete A Label Sleep 3 Capture Page Screenshot Click Element xpath=//clr-modal//div//button[contains(.,'DELETE')] - Wait Until Page Contains Element //clr-tab-content//div[contains(.,'${labelname}')]/../div/clr-icon[@shape="success-standard"] + Wait Until Page Contains Element //clr-tab-content//div[contains(.,'${labelname}')]/../div/clr-icon[@shape='success-standard'] ## Garbage Collection Switch To Garbage Collection diff --git a/tests/resources/Harbor-Pages/Configuration_Elements.robot b/tests/resources/Harbor-Pages/Configuration_Elements.robot index ce557e292..bfe072ec0 100644 --- a/tests/resources/Harbor-Pages/Configuration_Elements.robot +++ b/tests/resources/Harbor-Pages/Configuration_Elements.robot @@ -17,15 +17,15 @@ Documentation This resource provides any keywords related to the Harbor private *** Variables *** ${project_create_xpath} //clr-dg-action-bar//button[contains(.,'New')] -${self_reg_xpath} //input[@id="selfReg"] -${test_ldap_xpath} //*[@id="authentication"]/config-auth/div/button[3] +${self_reg_xpath} //input[@id='selfReg'] +${test_ldap_xpath} //*[@id='authentication']/config-auth/div/button[3] ${config_save_button_xpath} //config//div/button[contains(.,'SAVE')] -${config_email_save_button_xpath} //*[@id="config_email_save"] -${config_auth_save_button_xpath} //*[@id="config_auth_save"] -${config_system_save_button_xpath} //*[@id="config_system_save"] -${vulnerbility_save_button_xpath} //*[@id="config_vulnerbility_save"] +${config_email_save_button_xpath} //*[@id='config_email_save'] +${config_auth_save_button_xpath} //*[@id='config_auth_save'] +${config_system_save_button_xpath} //*[@id='config_system_save'] +${vulnerbility_save_button_xpath} //*[@id='config_vulnerbility_save'] ${configuration_xpath} //clr-vertical-nav-group-children/a[contains(.,'Configuration')] -${system_config_xpath} //*[@id="config-system"] -${garbage_collection_xpath} //*[@id="config-gc"] -${gc_now_xpath} //*[@id="gc"]/gc-config/button -${gc_log_details_xpath} //*[@id="clr-dg-row26"]/clr-dg-cell[6]/a \ No newline at end of file +${system_config_xpath} //*[@id='config-system'] +${garbage_collection_xpath} //*[@id='config-gc'] +${gc_now_xpath} //*[@id='gc']/gc-config/button +${gc_log_details_xpath} //*[@id='clr-dg-row26']/clr-dg-cell[6]/a \ No newline at end of file diff --git a/tests/resources/Harbor-Pages/HomePage.robot b/tests/resources/Harbor-Pages/HomePage.robot index 745a9c95f..9095a397a 100644 --- a/tests/resources/Harbor-Pages/HomePage.robot +++ b/tests/resources/Harbor-Pages/HomePage.robot @@ -23,15 +23,15 @@ ${HARBOR_VERSION} v1.1.1 Sign In Harbor [Arguments] ${url} ${user} ${pw} Go To ${url} - Wait Until Element Is Enabled ${harbor_span_title} - Wait Until Element Is Visible ${login_name} - Wait Until Element Is Visible ${login_pwd} + Retry Wait Element ${harbor_span_title} + Retry Wait Element ${login_name} + Retry Wait Element ${login_pwd} Input Text ${login_name} ${user} Input Text ${login_pwd} ${pw} - Wait Until Element Is Visible ${login_btn} - Click button ${login_btn} + Retry Wait Element ${login_btn} + Retry Button Click ${login_btn} Log To Console ${user} - Wait Until Element Is Visible xpath=//span[contains(., '${user}')] + Retry Wait Element xpath=//span[contains(., '${user}')] Capture Screenshot And Source Capture Page Screenshot diff --git a/tests/resources/Harbor-Pages/HomePage_Elements.robot b/tests/resources/Harbor-Pages/HomePage_Elements.robot index 9d94f1e40..91035a400 100644 --- a/tests/resources/Harbor-Pages/HomePage_Elements.robot +++ b/tests/resources/Harbor-Pages/HomePage_Elements.robot @@ -17,13 +17,13 @@ Documentation This resource provides any keywords related to the Harbor private *** Variables *** ${sign_up_for_an_account_xpath} /html/body/harbor-app/harbor-shell/clr-main-container/div/div/sign-in/div/form/div[1]/a -${sign_up_button_xpath} //a[@class="signup"] -${username_xpath} //*[@id="username"] -${email_xpath} //*[@id="email"] -${realname_xpath} //*[@id="realname"] -${newPassword_xpath} //*[@id="newPassword"] -${confirmPassword_xpath} //*[@id="confirmPassword"] -${comment_xpath} //*[@id="comment"] +${sign_up_button_xpath} //a[@class='signup'] +${username_xpath} //*[@id='username'] +${email_xpath} //*[@id='email'] +${realname_xpath} //*[@id='realname'] +${newPassword_xpath} //*[@id='newPassword'] +${confirmPassword_xpath} //*[@id='confirmPassword'] +${comment_xpath} //*[@id='comment'] ${signup_xpath} //clr-modal/div/div[1]/div/div/div[3]/button[2] ${signup_xpath} /html/body/harbor-app/harbor-shell/clr-main-container/div/div/sign-in/sign-up/clr-modal/div/div[1]/div/div[1]/div/div[3]/button[2] diff --git a/tests/resources/Harbor-Pages/Project-Helmcharts.robot b/tests/resources/Harbor-Pages/Project-Helmcharts.robot index 5de53c6cd..556ddd88a 100644 --- a/tests/resources/Harbor-Pages/Project-Helmcharts.robot +++ b/tests/resources/Harbor-Pages/Project-Helmcharts.robot @@ -33,19 +33,18 @@ Upload Chart files Go Into Chart Version [Arguments] ${chart_name} - Click Element xpath=//hbr-helm-chart//a[contains(., "${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}")] + 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} - Wait Until Page Contains Element xpath=${helmchart_content} \ No newline at end of file + Retry Element Click xpath=${version_bread_crumbs} + Retry Element Click xpath=${version_checkbox} + Retry Element Click xpath=${version_delete} + Retry Element Click xpath=${version_confirm_delete} + Retry Keyword When Error Wait Until Page Contains Element element=xpath=${helmchart_content} \ No newline at end of file diff --git a/tests/resources/Harbor-Pages/Project-Helmcharts_Elements.robot b/tests/resources/Harbor-Pages/Project-Helmcharts_Elements.robot index dd6c7f9b0..71bb94748 100644 --- a/tests/resources/Harbor-Pages/Project-Helmcharts_Elements.robot +++ b/tests/resources/Harbor-Pages/Project-Helmcharts_Elements.robot @@ -3,10 +3,10 @@ Documentation This resource provides any keywords related to the Harbor private *** Variables *** -${upload_chart_button} //button[contains(.,"Upload")] -${chart_file_browse} //*[@id="chart"] -${chart_prov_browse} //*[@id="prov"] -${upload_action_button} //clr-modal//form/div/button[contains(.,"Upload")] +${upload_chart_button} //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 @@ -18,19 +18,19 @@ ${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")] +${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 +${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_bread_crumbs} //project-chart-detail//a[contains(.,'Versions')] ${version_checkbox} //clr-dg-row//clr-checkbox-wrapper/label -${version_delete} //clr-dg-action-bar/button[contains(.,"DELETE")] -${version_confirm_delete} //clr-modal//button[contains(.,"DELETE")] +${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 \ No newline at end of file diff --git a/tests/resources/Harbor-Pages/Project-Members.robot b/tests/resources/Harbor-Pages/Project-Members.robot index d246bd990..b01bdb619 100644 --- a/tests/resources/Harbor-Pages/Project-Members.robot +++ b/tests/resources/Harbor-Pages/Project-Members.robot @@ -56,7 +56,7 @@ Search Project Member [Arguments] ${project} ${user} Go Into Project ${project} Sleep 2 - Click Element xpath=//clr-dg-cell//a[contains(.,"${project}")] + Click Element xpath=//clr-dg-cell//a[contains(.,'${project}')] Sleep 1 Click Element xpath=${project_member_search_button_xpath} Sleep 1 @@ -66,14 +66,14 @@ Search Project Member Change Project Member Role [Arguments] ${project} ${user} ${role} - Click Element xpath=//clr-dg-cell//a[contains(.,"${project}")] + Click Element xpath=//clr-dg-cell//a[contains(.,'${project}')] Sleep 2 Click Element xpath=${project_member_tag_xpath} Sleep 1 Click Element xpath=//project-detail//clr-dg-row[contains(.,'${user}')]//label Sleep 1 #change role - Click Element //*[@id="member-action"] + Click Element //*[@id='member-action'] Click Element //button[contains(.,'${role}')] Sleep 2 Wait Until Page Contains ${role} @@ -149,7 +149,7 @@ Manage Project Member Change User Role In Project [Arguments] ${admin} ${pwd} ${project} ${user} ${role} Sign In Harbor ${HARBOR_URL} ${admin} ${pwd} - Wait Until Element Is Visible //clr-dg-cell//a[contains(.,"${project}")] + Wait Until Element Is Visible //clr-dg-cell//a[contains(.,'${project}')] Change Project Member Role ${project} ${user} ${role} Logout Harbor diff --git a/tests/resources/Harbor-Pages/Project-Members_Elements.robot b/tests/resources/Harbor-Pages/Project-Members_Elements.robot index 13640ddf3..8699c1ae2 100644 --- a/tests/resources/Harbor-Pages/Project-Members_Elements.robot +++ b/tests/resources/Harbor-Pages/Project-Members_Elements.robot @@ -18,7 +18,7 @@ Documentation This resource provides any keywords related to the Harbor private *** Variables *** ${project_member_tag_xpath} /html/body/harbor-app/harbor-shell/clr-main-container/div/div/project-detail/nav/ul/li[3]/a ${project_member_add_button_xpath} //project-detail//button[contains(.,'User')] -${project_member_add_username_xpath} //*[@id="member_name"] +${project_member_add_username_xpath} //*[@id='member_name'] ${project_member_add_admin_xpath} /html/body/harbor-app/harbor-shell/clr-main-container/div/div/project-detail/ng-component/div/div[1]/div/div[1]/add-member/clr-modal/div/div[1]/div/div[1]/div/div[2]/form/section/div[2]/div[1]/label ${project_member_add_save_button_xpath} /html/body/harbor-app/harbor-shell/clr-main-container/div/div/project-detail/ng-component/div/div[1]/div/div[1]/add-member/clr-modal/div/div[1]/div/div[1]/div/div[3]/button[2] ${project_member_search_button_xpath} //project-detail//hbr-filter/span/clr-icon @@ -27,4 +27,4 @@ ${project_member_add_confirmation_ok_xpath} //project-detail//add-member//butto ${project_member_search_button_xpath2} //button[contains(.,'New')] ${project_member_add_button_xpath2} //project-detail//add-member//button[2] ${project_member_guest_radio_checkbox} //project-detail//form//input[@id='checkrads_guest'] -${project_member_delete_button_xpath} //button[contains(.,"REMOVE")] +${project_member_delete_button_xpath} //button[contains(.,'REMOVE')] diff --git a/tests/resources/Harbor-Pages/Project-Retag.robot b/tests/resources/Harbor-Pages/Project-Retag.robot index 493f1e985..8a0f75db4 100644 --- a/tests/resources/Harbor-Pages/Project-Retag.robot +++ b/tests/resources/Harbor-Pages/Project-Retag.robot @@ -5,7 +5,7 @@ Resource ../../resources/Util.robot Retag Image [Arguments] ${tag} ${projectname} ${reponame} ${tagname} - Click Element xpath=//clr-dg-row[contains(.,"${tag}")]//label + Click Element xpath=//clr-dg-row[contains(.,'${tag}')]//label Sleep 1 Click Element xpath=${retag_btn} Sleep 1 diff --git a/tests/resources/Harbor-Pages/Project.robot b/tests/resources/Harbor-Pages/Project.robot index 480b04fd0..9b60966f8 100644 --- a/tests/resources/Harbor-Pages/Project.robot +++ b/tests/resources/Harbor-Pages/Project.robot @@ -93,7 +93,7 @@ Make Project Private Click Element xpath=//project-detail//a[contains(.,'Configuration')] Sleep 1 Checkbox Should Be Selected xpath=//input[@name='public'] - Click Element //div[@id="clr-wrapper-public"]//label + Click Element //div[@id='clr-wrapper-public']//label Wait Until Element Is Enabled //button[contains(.,'SAVE')] Click Element //button[contains(.,'SAVE')] Wait Until Page Contains Configuration has been successfully saved @@ -104,22 +104,17 @@ Make Project Public Sleep 1 Click Element xpath=//project-detail//a[contains(.,'Configuration')] Checkbox Should Not Be Selected xpath=//input[@name='public'] - Click Element //div[@id="clr-wrapper-public"]//label + Click Element //div[@id='clr-wrapper-public']//label Wait Until Element Is Enabled //button[contains(.,'SAVE')] Click Element //button[contains(.,'SAVE')] Wait Until Page Contains Configuration has been successfully saved Delete Repo [Arguments] ${projectname} - ${element_repo_checkbox}= Set Variable xpath=//clr-dg-row[contains(.,"${projectname}")]//clr-checkbox-wrapper//label - Retry Keyword With Element When Error Wait Until Element Is Visible And Enabled ${element_repo_checkbox} - Retry Keyword With Element When Error Click Element ${element_repo_checkbox} - ${element_delete_btn}= Set Variable xpath=//button[contains(.,"Delete")] - Retry Keyword With Element When Error Wait Until Element Is Visible And Enabled ${element_delete_btn} - Retry Keyword With Element When Error Click Element ${element_delete_btn} - ${element_delete_confirm_btn}= Set Variable xpath=//clr-modal//button[2] - Retry Keyword With Element When Error Wait Until Element Is Visible And Enabled ${element_delete_confirm_btn} - Retry Keyword With Element When Error Click Element ${element_delete_confirm_btn} + ${element_repo_checkbox}= Set Variable xpath=//clr-dg-row[contains(.,'${projectname}')]//clr-checkbox-wrapper//label + Retry Element Click ${element_repo_checkbox} + Retry Element Click ${repo_delete_btn} + Retry Element Click ${repo_delete_confirm_btn} Delete Repo on CardView [Arguments] ${reponame} @@ -133,9 +128,9 @@ Delete Project [Arguments] ${projectname} Navigate To Projects Sleep 1 - Click Element xpath=//clr-dg-row[contains(.,"${projectname}")]//clr-checkbox-wrapper//label + Click Element xpath=//clr-dg-row[contains(.,'${projectname}')]//clr-checkbox-wrapper//label Sleep 1 - Click Element xpath=//button[contains(.,"Delete")] + Click Element xpath=//button[contains(.,'Delete')] Sleep 2 Click Element //clr-modal//button[contains(.,'DELETE')] Sleep 1 @@ -144,56 +139,56 @@ Project Should Not Be Deleted [Arguments] ${projname} Delete Project ${projname} Sleep 1 - Page Should Contain Element //clr-tab-content//div[contains(.,'${projname}')]/../div/clr-icon[@shape="error-standard"] + Page Should Contain Element //clr-tab-content//div[contains(.,'${projname}')]/../div/clr-icon[@shape='error-standard'] Project Should Be Deleted [Arguments] ${projname} Delete Project ${projname} Sleep 2 - Page Should Contain Element //clr-tab-content//div[contains(.,'${projname}')]/../div/clr-icon[@shape="success-standard"] + Page Should Contain Element //clr-tab-content//div[contains(.,'${projname}')]/../div/clr-icon[@shape='success-standard'] Advanced Search Should Display - Page Should Contain Element xpath=//audit-log//div[@class="flex-xs-middle"]/button + Page Should Contain Element xpath=//audit-log//div[@class='flex-xs-middle']/button # it's not a common keywords, only used into log case. Do Log Advanced Search Capture Page Screenshot LogAdvancedSearch.png Sleep 1 - Page Should Contain Element xpath=//clr-dg-row[contains(.,"pull")] - Page Should Contain Element xpath=//clr-dg-row[contains(.,"push")] - Page Should Contain Element xpath=//clr-dg-row[contains(.,"create")] - Page Should Contain Element xpath=//clr-dg-row[contains(.,"delete")] + Page Should Contain Element xpath=//clr-dg-row[contains(.,'pull')] + Page Should Contain Element xpath=//clr-dg-row[contains(.,'push')] + Page Should Contain Element xpath=//clr-dg-row[contains(.,'create')] + Page Should Contain Element xpath=//clr-dg-row[contains(.,'delete')] Sleep 1 - Click Element xpath=//audit-log//div[@class="flex-xs-middle"]/button + Click Element xpath=//audit-log//div[@class='flex-xs-middle']/button Sleep 1 Click Element xpath=//project-detail//audit-log//clr-dropdown/button Sleep 1 #pull log Sleep 1 - Click Element xpath=//audit-log//clr-dropdown//a[contains(.,"Pull")] + Click Element xpath=//audit-log//clr-dropdown//a[contains(.,'Pull')] Sleep 1 - Page Should Not Contain Element xpath=//clr-dg-row[contains(.,"pull")] + Page Should Not Contain Element xpath=//clr-dg-row[contains(.,'pull')] #push log Click Element xpath=//audit-log//clr-dropdown/button Sleep 1 - Click Element xpath=//audit-log//clr-dropdown//a[contains(.,"Push")] + Click Element xpath=//audit-log//clr-dropdown//a[contains(.,'Push')] Sleep 1 - Page Should Not Contain Element xpath=//clr-dg-row[contains(.,"push")] + Page Should Not Contain Element xpath=//clr-dg-row[contains(.,'push')] #create log Click Element xpath=//audit-log//clr-dropdown/button Sleep 1 - Click Element xpath=//audit-log//clr-dropdown//a[contains(.,"Create")] + Click Element xpath=//audit-log//clr-dropdown//a[contains(.,'Create')] Sleep 1 - Page Should Not Contain Element xpath=//clr-dg-row[contains(.,"create")] + Page Should Not Contain Element xpath=//clr-dg-row[contains(.,'create')] #delete log Click Element xpath=//audit-log//clr-dropdown/button Sleep 1 - Click Element xpath=//audit-log//clr-dropdown//a[contains(.,"Delete")] + Click Element xpath=//audit-log//clr-dropdown//a[contains(.,'Delete')] Sleep 1 - Page Should Not Contain Element xpath=//clr-dg-row[contains(.,"delete")] + Page Should Not Contain Element xpath=//clr-dg-row[contains(.,'delete')] #others Click Element xpath=//audit-log//clr-dropdown/button - Click Element xpath=//audit-log//clr-dropdown//a[contains(.,"Others")] + Click Element xpath=//audit-log//clr-dropdown//a[contains(.,'Others')] Sleep 1 Click Element xpath=//audit-log//hbr-filter//clr-icon Input Text xpath=//audit-log//hbr-filter//input harbor @@ -225,21 +220,21 @@ Expand Repo Sleep 1 Edit Repo Info - Click Element //*[@id="repo-info"] + Click Element //*[@id='repo-info'] Sleep 1 - Page Should Contain Element //*[@id="info"]/form/div[2] + 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 - Click Element xpath=//*[@id="info"]/form/div[3]/button[2] + Click Element xpath=//*[@id='info-edit-button']/button + Input Text xpath=//*[@id='info']/form/div[2]/textarea test_description_info + Click Element xpath=//*[@id='info']/form/div[3]/button[2] Sleep 1 - Click Element xpath=//*[@id="info"]/form/confirmation-dialog/clr-modal/div/div[1]/div[1]/div/div[3]/button[2] + Click Element xpath=//*[@id='info']/form/confirmation-dialog/clr-modal/div/div[1]/div[1]/div/div[3]/button[2] Sleep 1 - Page Should Contain Element //*[@id="info"]/form/div[2] + 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 - Click Element xpath=//*[@id="info"]/form/div[3]/button[1] + Click Element xpath=//*[@id='info-edit-button']/button + Input Text xpath=//*[@id='info']/form/div[2]/textarea test_description_info + Click Element xpath=//*[@id='info']/form/div[3]/button[1] Sleep 1 Page Should Contain test_description_info Capture Page Screenshot RepoInfo.png @@ -254,35 +249,35 @@ Switch To Project Repo Add Labels To Tag [Arguments] ${tagName} ${labelName} - Click Element xpath=//clr-dg-row[contains(.,"${tagName}")]//label + Click Element xpath=//clr-dg-row[contains(.,'${tagName}')]//label Capture Page Screenshot add_${labelName}.png Sleep 1 Click Element xpath=//clr-dg-action-bar//clr-dropdown//button Sleep 1 - Click Element xpath=//clr-dropdown//div//label[contains(.,"${labelName}")] + Click Element xpath=//clr-dropdown//div//label[contains(.,'${labelName}')] Sleep 3 - Page Should Contain Element xpath=//clr-dg-row//label[contains(.,"${labelName}")] + Page Should Contain Element xpath=//clr-dg-row//label[contains(.,'${labelName}')] Filter Labels In Tags [Arguments] ${labelName1} ${labelName2} Sleep 2 - Click Element xpath=//*[@id="filterArea"]//hbr-filter/span/clr-icon + Click Element xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon Sleep 2 - Page Should Contain Element xpath=//*[@id="filterArea"]//div//button[contains(.,"${labelName1}")] - Click Element xpath=//*[@id="filterArea"]//div//button[contains(.,"${labelName1}")] + Page Should Contain Element xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName1}')] + Click Element xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName1}')] Sleep 2 - Click Element xpath=//*[@id="filterArea"]//hbr-filter/span/clr-icon - Page Should Contain Element xpath=//clr-datagrid//label[contains(.,"${labelName1}")] + Click Element xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon + Page Should Contain Element xpath=//clr-datagrid//label[contains(.,'${labelName1}')] - Click Element xpath=//*[@id="filterArea"]//hbr-filter/span/clr-icon + Click Element xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon Sleep 2 - Click Element xpath=//*[@id="filterArea"]//div//button[contains(.,"${labelName2}")] + Click Element xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName2}')] Sleep 2 - Click Element xpath=//*[@id="filterArea"]//hbr-filter/span/clr-icon + Click Element xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon Sleep 2 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}")] + 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] diff --git a/tests/resources/Harbor-Pages/Project_Elements.robot b/tests/resources/Harbor-Pages/Project_Elements.robot index 5ca803263..0b5f5fcee 100644 --- a/tests/resources/Harbor-Pages/Project_Elements.robot +++ b/tests/resources/Harbor-Pages/Project_Elements.robot @@ -17,7 +17,7 @@ Documentation This resource provides any keywords related to the Harbor private *** Variables *** ${create_project_button_xpath} //clr-main-container//button[contains(., 'New Project')] -${project_name_xpath} //*[@id="create_project_name"] +${project_name_xpath} //*[@id='create_project_name'] ${project_public_xpath} //input[@name='public']/..//label ${project_save_css} html body.no-scrolling harbor-app harbor-shell clr-main-container.main-container div.content-container div.content-area.content-area-override project div.row div.col-lg-12.col-md-12.col-sm-12.col-xs-12 div.row.flex-items-xs-between div.option-left create-project clr-modal div.modal div.modal-dialog div.modal-content div.modal-footer button.btn.btn-primary ${log_xpath} //clr-main-container//clr-vertical-nav//a[contains(.,'Logs')] @@ -29,4 +29,5 @@ ${project_member_xpath} //project-detail//li[contains(.,'Members')] ${create_project_OK_button_xpath} xpath=//button[contains(.,'OK')] ${create_project_CANCEL_button_xpath} xpath=//button[contains(.,'CANCEL')] ${project_statistics_private_repository_icon} xpath=//project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[2]/statistics/div/span[1] - +${repo_delete_btn} xpath=//button[contains(.,'Delete')] +${repo_delete_confirm_btn} xpath=//clr-modal//button[2] diff --git a/tests/resources/Harbor-Pages/Replication.robot b/tests/resources/Harbor-Pages/Replication.robot index bdd17f847..583edc1af 100644 --- a/tests/resources/Harbor-Pages/Replication.robot +++ b/tests/resources/Harbor-Pages/Replication.robot @@ -62,8 +62,8 @@ Create A Rule With Existing 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}')] + 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} @@ -88,8 +88,8 @@ Project Create A Rule With Existing 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}')] + 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} @@ -97,16 +97,16 @@ Project Create A Rule With Existing Endpoint Setting Replication Schedule [Arguments] ${plan} ${weekday}=1 ${time}=0800a Click Element ${schedule_type_select} - Wait Until Element Is Visible //select[@name="scheduleType"]/option[@value="${plan}"] - Click Element //select[@name="scheduleType"]/option[@value="${plan}"] + Wait Until Element Is Visible //select[@name='scheduleType']/option[@value='${plan}'] + Click Element //select[@name='scheduleType']/option[@value='${plan}'] Run Keyword If '${plan}' == 'Weekly' Setting Replication Weekday ${weekday} Input Text ${shcedule_time} ${time} Setting Replication Weekday [arguments] ${day} Click Element ${schedule_day_select} - Wait Until Element Is Visible //select[@name="scheduleDay"]/option[@value='${day}'] - Click Element //select[@name="scheduleDay"]/option[@value='${day}'] + Wait Until Element Is Visible //select[@name='scheduleDay']/option[@value='${day}'] + Click Element //select[@name='scheduleDay']/option[@value='${day}'] Endpoint Is Unpingable Click Element ${ping_test_button} @@ -146,7 +146,7 @@ Trigger Replication Manual Mouse Down ${dialog_replicate} Mouse Up ${dialog_replicate} Sleep 2 - Wait Until Page Contains Element //clr-tab-content//div[contains(.,'${rule}')]/../div/clr-icon[@shape="success-standard"] + Wait Until Page Contains Element //clr-tab-content//div[contains(.,'${rule}')]/../div/clr-icon[@shape='success-standard'] Sleep 1 Rename Rule diff --git a/tests/resources/Harbor-Pages/Replication_Elements.robot b/tests/resources/Harbor-Pages/Replication_Elements.robot index 0d614ad68..44fd26d9f 100644 --- a/tests/resources/Harbor-Pages/Replication_Elements.robot +++ b/tests/resources/Harbor-Pages/Replication_Elements.robot @@ -17,8 +17,8 @@ Documentation This resource provides any keywords related to the Harbor private *** Variables *** ${new_name_xpath} //hbr-list-replication-rule//button[contains(.,'New')] -${policy_name_xpath} //*[@id="policy_name"] -${policy_description_xpath} //*[@id="policy_description"] +${policy_name_xpath} //*[@id='policy_name'] +${policy_description_xpath} //*[@id='policy_description'] ${policy_enable_checkbox} //input[@id='policy_enable']/../label ${policy_endpoint_checkbox} //input[@id='check_new']/../label ${destination_name_xpath} //*[@id='destination_name'] @@ -27,22 +27,22 @@ ${destination_username_xpath} //*[@id='destination_username'] ${destination_password_xpath} //*[@id='destination_password'] ${replication_save_xpath} //button[contains(.,'OK')] ${replication_xpath} //clr-vertical-nav-group-children/a[contains(.,'Replication')] -${destination_insecure_xpath} //label[@id="destination_insecure_checkbox"] +${destination_insecure_xpath} //label[@id='destination_insecure_checkbox'] ${new_replication-rule_button} //button[contains(.,'New Replication Rule')] ${link_to_registries} //clr-modal//span[contains(.,'Endpoint')] ${new_endpoint_button} //hbr-endpoint//button[contains(.,'New')] ${rule_name} //input[@id='ruleName'] ${source_project} //input[@value='name'] -${source_image_filter_add} //hbr-create-edit-rule/clr-modal//clr-icon[@id="add-label-list"] +${source_image_filter_add} //hbr-create-edit-rule/clr-modal//clr-icon[@id='add-label-list'] ${source_iamge_repo_filter} //hbr-create-edit-rule//section/div[4]/div/div[1]/div/label/input ${source_image_tag_filter} //hbr-create-edit-rule//section/div[4]/div/div[2]/div/label/input ${rule_target_select} //select[@id='ruleTarget'] -${rule_trigger_select} //select[@id="ruleTrigger"] -${schedule_type_select} //select[@name="scheduleType"] -${schedule_day_select} //select[@name="scheduleDay"] -${shcedule_time} //input[@type="time"] -${destination_insecure_checkbox} //hbr-create-edit-endpoint/clr-modal//input[@id="destination_insecure"] +${rule_trigger_select} //select[@id='ruleTrigger'] +${schedule_type_select} //select[@name='scheduleType'] +${schedule_day_select} //select[@name='scheduleDay'] +${shcedule_time} //input[@type='time'] +${destination_insecure_checkbox} //hbr-create-edit-endpoint/clr-modal//input[@id='destination_insecure'] ${ping_test_button} //button[contains(.,'Test')] ${nav_to_registries} //clr-vertical-nav//span[contains(.,'Registries')] ${nav_to_replications} //clr-vertical-nav//span[contains(.,'Replications')] diff --git a/tests/resources/Harbor-Pages/ToolKit.robot b/tests/resources/Harbor-Pages/ToolKit.robot index fc71d7b48..a2222d387 100644 --- a/tests/resources/Harbor-Pages/ToolKit.robot +++ b/tests/resources/Harbor-Pages/ToolKit.robot @@ -23,14 +23,14 @@ ${HARBOR_VERSION} v1.1.1 Delete Success [Arguments] @{obj} :For ${obj} in @{obj} - \ Wait Until Page Contains Element //clr-tab-content//div[contains(.,'${obj}')]/../div/clr-icon[@shape="success-standard"] + \ Wait Until Page Contains Element //clr-tab-content//div[contains(.,'${obj}')]/../div/clr-icon[@shape='success-standard'] Sleep 1 Capture Page Screenshot Delete Fail [Arguments] @{obj} :For ${obj} in @{obj} - \ Wait Until Page Contains Element //clr-tab-content//div[contains(.,'${obj}')]/../div/clr-icon[@shape="error-standard"] + \ Wait Until Page Contains Element //clr-tab-content//div[contains(.,'${obj}')]/../div/clr-icon[@shape='error-standard'] Sleep 1 Capture Page Screenshot diff --git a/tests/resources/Harbor-Pages/ToolKit_Elements.robot b/tests/resources/Harbor-Pages/ToolKit_Elements.robot index b19fb0450..17d2ceb13 100644 --- a/tests/resources/Harbor-Pages/ToolKit_Elements.robot +++ b/tests/resources/Harbor-Pages/ToolKit_Elements.robot @@ -16,5 +16,5 @@ Documentation This resource provides any keywords related to the Harbor private registry appliance *** Variables *** -${member_action_xpath} //*[@id="member-action"] +${member_action_xpath} //*[@id='member-action'] ${delete_action_xpath} //clr-dropdown/clr-dropdown-menu/button[4] diff --git a/tests/resources/Harbor-Pages/UserProfile.robot b/tests/resources/Harbor-Pages/UserProfile.robot index 6b64cdd2b..6be351bc0 100644 --- a/tests/resources/Harbor-Pages/UserProfile.robot +++ b/tests/resources/Harbor-Pages/UserProfile.robot @@ -25,9 +25,9 @@ Change Password Click Element xpath=/html/body/harbor-app/harbor-shell/clr-main-container/navigator/clr-header/div[3]/clr-dropdown[2]/button/span Click Element xpath=//clr-main-container//clr-dropdown//a[2] Sleep 2 - Input Text xpath=//*[@id="oldPassword"] ${cur_pw} - Input Text xpath=//*[@id="newPassword"] ${new_pw} - Input Text xpath=//*[@id="reNewPassword"] ${new_pw} + Input Text xpath=//*[@id='oldPassword'] ${cur_pw} + Input Text xpath=//*[@id='newPassword'] ${new_pw} + Input Text xpath=//*[@id='reNewPassword'] ${new_pw} Sleep 1 Click Element xpath=//password-setting/clr-modal//button[2] Sleep 2 @@ -39,7 +39,7 @@ Update User Comment Click Element xpath=/html/body/harbor-app/harbor-shell/clr-main-container/navigator/clr-header/div[3]/clr-dropdown[2]/button/span Click Element xpath=//clr-main-container//clr-dropdown//a[1] Sleep 2 - Input Text xpath=//*[@id="account_settings_comments"] ${new_comment} + Input Text xpath=//*[@id='account_settings_comments'] ${new_comment} Sleep 1 Click Element xpath=//account-settings-modal/clr-modal//button[2] Sleep 2 @@ -54,4 +54,4 @@ Logout Harbor Sleep 1 Capture Page Screenshot Logout.png Sleep 2 - Wait Until Keyword Succeeds 5x 1 Page Should Contain Element xpath=//sign-in//form//*[@class="title"] + Wait Until Keyword Succeeds 5x 1 Page Should Contain Element xpath=//sign-in//form//*[@class='title'] diff --git a/tests/resources/Harbor-Pages/Verify.robot b/tests/resources/Harbor-Pages/Verify.robot index 0690abb20..10ed04229 100644 --- a/tests/resources/Harbor-Pages/Verify.robot +++ b/tests/resources/Harbor-Pages/Verify.robot @@ -163,13 +163,13 @@ Verify System Setting Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Switch To Configure Page Should Contain @{authtype}[0] - Run Keyword If @{selfreg}[0] == "True" Checkbox Should Be Checked //clr-checkbox-wrapper[@id='selfReg']//label - Run Keyword If @{selfreg}[0] == "False" Checkbox Should Not Be Checked //clr-checkbox-wrapper[@id='selfReg']//label + Run Keyword If @{selfreg}[0] == 'True' Checkbox Should Be Checked //clr-checkbox-wrapper[@id='selfReg']//label + Run Keyword If @{selfreg}[0] == 'False' Checkbox Should Not Be Checked //clr-checkbox-wrapper[@id='selfReg']//label Switch To Email - Textfield Value Should Be xpath=//*[@id="mailServer"] @{emailserver}[0] - Textfield Value Should Be xpath=//*[@id="emailPort"] @{emailport}[0] - Textfield Value Should Be xpath=//*[@id="emailUsername"] @{emailuser}[0] - Textfield Value Should Be xpath=//*[@id="emailFrom"] @{emailfrom}[0] + Textfield Value Should Be xpath=//*[@id='mailServer'] @{emailserver}[0] + Textfield Value Should Be xpath=//*[@id='emailPort'] @{emailport}[0] + Textfield Value Should Be xpath=//*[@id='emailUsername'] @{emailuser}[0] + Textfield Value Should Be xpath=//*[@id='emailFrom'] @{emailfrom}[0] Switch To System Settings Page Should Contain @{creation}[0] Token Must Be Match @{token}[0] diff --git a/tests/resources/Harbor-Pages/Vulnerability.robot b/tests/resources/Harbor-Pages/Vulnerability.robot index 4e4ed5e31..98618b824 100644 --- a/tests/resources/Harbor-Pages/Vulnerability.robot +++ b/tests/resources/Harbor-Pages/Vulnerability.robot @@ -7,10 +7,10 @@ Resource ../../resources/Util.robot *** Keywords *** Disable Scan Schedule - Click Element //vulnerability-config//button[@id="editSchedule"] - Click Element //vulnerability-config//select[@id="scanAllPolicy"] - Click Element //vulnerability-config//select[@id="scanAllPolicy"]//option[contains(.,'None')] - Click Element //button[@id="config_vulnerbility_save"] + Click Element //vulnerability-config//button[@id='editSchedule'] + Click Element //vulnerability-config//select[@id='scanAllPolicy'] + Click Element //vulnerability-config//select[@id='scanAllPolicy']//option[contains(.,'None')] + Click Element //button[@id='config_vulnerbility_save'] Go To Vulnerability Config Click Element //config//button[contains(.,'Vulnerability')] @@ -24,8 +24,8 @@ Set Vulnerabilty Serverity [Arguments] ${level} Goto Project Config #enable first - Click Element //project-detail//div[@id="prevent-vulenrability-image"]//label - Checkbox Should Be Selected //project-detail//clr-checkbox-wrapper//input[@name="prevent-vulenrability-image-input"] + Click Element //project-detail//div[@id='prevent-vulenrability-image']//label + Checkbox Should Be Selected //project-detail//clr-checkbox-wrapper//input[@name='prevent-vulenrability-image-input'] Click Element //project-detail//select #wait for dropdown popup Sleep 1 @@ -45,7 +45,7 @@ Scan Repo #use fail for image clair can not scan, otherwise use success [Arguments] ${tagname} ${status} #select one tag - Click Element //clr-dg-row[contains(.,"${tagname}")]//label + Click Element //clr-dg-row[contains(.,'${tagname}')]//label Click Element //button[contains(.,'Scan')] Run Keyword If '${status}' == 'Succeed' Wait Until Element Is Visible //hbr-vulnerability-bar//hbr-vulnerability-summary-chart 300 Run Keyword If '${status}' == 'Fail' Wait Until Element Is Visible //hbr-vulnerability-bar//a 300 @@ -56,14 +56,14 @@ Summary Chart Should Display Page Should Contain Element //clr-dg-row[contains(.,'${tagname}')]//hbr-vulnerability-bar//hbr-vulnerability-summary-chart Enable Scan On Push - Checkbox Should Not Be Selected //clr-checkbox-wrapper[@id="scan-image-on-push-wrapper"]//input - Click Element //clr-checkbox-wrapper[@id="scan-image-on-push-wrapper"]//label - Checkbox Should Be Selected //clr-checkbox-wrapper[@id="scan-image-on-push-wrapper"]//input + Checkbox Should Not Be Selected //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//input + Click Element //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//label + Checkbox Should Be Selected //clr-checkbox-wrapper[@id='scan-image-on-push-wrapper']//input Click Element //hbr-project-policy-config//button[contains(.,'SAVE')] Sleep 10 Vulnerability Not Ready Project Hint - ${element}= Set Variable xpath=//span[contains(@class, "db-status-warning")] + ${element}= Set Variable xpath=//span[contains(@class, 'db-status-warning')] Wait Until Element Is Visible And Enabled ${element} Vulnerability Not Ready Config Hint diff --git a/tests/resources/Util.robot b/tests/resources/Util.robot index 7b6ae01e2..84a7741ac 100644 --- a/tests/resources/Util.robot +++ b/tests/resources/Util.robot @@ -67,6 +67,36 @@ Wait Until Element Is Visible And Enabled Wait Until Element Is Visible ${element} Wait Until Element Is Enabled ${element} +Retry Action Keyword + [Arguments] ${keyword} ${element_xpath} + Retry Keyword When Error ${keyword} element=${element_xpath} + +Retry Element Click + [Arguments] ${element_xpath} + Retry Action Keyword Element Click ${element_xpath} + +Retry Wait Element + [Arguments] ${element_xpath} + Retry Action Keyword Wait Element ${element_xpath} + +Retry Button Click + [Arguments] ${element_xpath} + Retry Action Keyword Button Click ${element_xpath} + +Element Click + [Arguments] ${element_xpath} + Wait Until Element Is Visible And Enabled ${element_xpath} + Click Element ${element_xpath} + +Wait Element + [Arguments] ${element_xpath} + Wait Until Element Is Visible And Enabled ${element_xpath} + +Button Click + [Arguments] ${element_xpath} + Wait Until Element Is Visible And Enabled ${element_xpath} + Click button ${element_xpath} + Wait Unitl Vul Data Ready [Arguments] ${url} ${timeout} ${interval} ${n}= Evaluate ${timeout}/${interval} @@ -80,23 +110,12 @@ Wait Unitl Vul Data Ready Run Keyword If ${i+1}==${n} Fail The vul data is not ready Retry Keyword When Error - [Arguments] ${keyword} ${times}=6 + [Arguments] ${keyword} ${element}=${None} ${times}=6 :For ${n} IN RANGE 1 ${times} \ Log To Console Attampt to ${keyword} ${n} times ... - \ ${out} Run Keyword And Ignore Error ${keyword} - \ Log To Console Return value is ${out} + \ ${out} Run Keyword If "${element}"=="${None}" Run Keyword And Ignore Error ${keyword} + \ ... ELSE Run Keyword And Ignore Error ${keyword} ${element} + \ Log To Console Return value is ${out[0]} \ Exit For Loop If '${out[0]}'=='PASS' - \ Sleep 3 - Should Be Equal As Strings '${out[0]}' 'PASS' - -Retry Keyword With Element When Error - [Arguments] ${keyword} ${element} ${times}=6 - #To prevent waiting for a fixed-period of time for page loading and failure caused by exception, we add loop to re-run when - # exception was caught. - :For ${n} IN RANGE 1 ${times} - \ Log To Console Attampt to wait for ${n} times ... - \ ${out} Run Keyword And Ignore Error ${keyword} ${element} - \ Log To Console Return value is ${out} - \ Exit For Loop If '${out[0]}'=='PASS' - \ Sleep 2 + \ Sleep 1 Should Be Equal As Strings '${out[0]}' 'PASS' \ No newline at end of file