From e6e3f0a6afce5bf8d68f374c311302f52432ec8a Mon Sep 17 00:00:00 2001 From: AllForNothing Date: Tue, 24 Mar 2020 15:17:23 +0800 Subject: [PATCH] Fix nightly cases for webhook Signed-off-by: AllForNothing --- .../project/webhook/webhook.component.html | 26 ++++---- .../Harbor-Pages/Project-Webhooks.robot | 59 ++++++++++++------- .../Project-Webhooks_Elements.robot | 9 +++ tests/robot-cases/Group1-Nightly/Common.robot | 34 +++-------- 4 files changed, 69 insertions(+), 59 deletions(-) diff --git a/src/portal/src/app/project/webhook/webhook.component.html b/src/portal/src/app/project/webhook/webhook.component.html index 9a7c50da2..cd350825e 100644 --- a/src/portal/src/app/project/webhook/webhook.component.html +++ b/src/portal/src/app/project/webhook/webhook.component.html @@ -4,34 +4,36 @@
- - {{'MEMBER.ACTION' | translate}} + {{'MEMBER.ACTION' | translate}} diff --git a/tests/resources/Harbor-Pages/Project-Webhooks.robot b/tests/resources/Harbor-Pages/Project-Webhooks.robot index 0329e1f71..0a069403d 100644 --- a/tests/resources/Harbor-Pages/Project-Webhooks.robot +++ b/tests/resources/Harbor-Pages/Project-Webhooks.robot @@ -11,36 +11,55 @@ Switch To Project Webhooks Sleep 1 Create A New Webhook - [Arguments] ${webhook_endpoint_url} ${auth_header} + [Arguments] ${webhook_name} ${webhook_endpoint_url} + Retry Element Click ${new_webhook_button_xpath} + Retry Text Input ${webhook_name_xpath} ${webhook_name} Retry Text Input ${webhook_endpoint_id_xpath} ${webhook_endpoint_url} - Retry Text Input ${webhook_auth_header_xpath} ${auth_header} - Retry Double Keywords When Error Retry Element Click ${create_webhooks_continue_button_xpath} Retry Wait Until Page Not Contains Element ${create_webhooks_continue_button_xpath} Capture Page Screenshot - Retry Wait Until Page Contains ${webhook_endpoint_url} + Retry Wait Until Page Contains ${webhook_name} Update A Webhook - [Arguments] ${webhook_endpoint_url} ${auth_header} - # Cancel input - Retry Element Click ${project_webhook_edit_id_xpath} - Retry Wait Until Page Contains Element ${webhook_endpoint_id_xpath} - Input Text ${webhook_endpoint_id_xpath} ${webhook_endpoint_url} - Input Text ${webhook_auth_header_xpath} ${auth_header} + [Arguments] ${old_webhook_name} ${new_webhook_name} ${new_webhook_enpoint} + # select one webhook + Retry Element Click xpath=//clr-dg-row[contains(.,'${old_webhook_name}')]//clr-checkbox-wrapper//label[contains(@class,'clr-control-label')] + Retry Element Click ${action_webhook_xpath} + Retry Element Click ${action_webhook_edit_button} + + #cancel1 Retry Double Keywords When Error Retry Element Click ${edit_webhooks_cancel_button_xpath} Retry Wait Until Page Not Contains Element ${edit_webhooks_cancel_button_xpath} - # Confirm input - Retry Element Click ${project_webhook_edit_id_xpath} - Input Text ${webhook_endpoint_id_xpath} ${webhook_endpoint_url} - Input Text ${webhook_auth_header_xpath} ${auth_header} + #confirm + Retry Element Click ${action_webhook_xpath} + Retry Element Click ${action_webhook_edit_button} + Retry Text Input ${webhook_name_xpath} ${new_webhook_name} + Retry Text Input ${webhook_endpoint_id_xpath} ${new_webhook_enpoint} Retry Double Keywords When Error Retry Element Click ${edit_webhooks_save_button_xpath} Retry Wait Until Page Not Contains Element ${edit_webhooks_save_button_xpath} - Retry Wait Until Page Contains ${webhook_endpoint_url} + Retry Wait Until Page Contains ${new_webhook_name} Capture Page Screenshot -Toggle Enable/Disable State of Same Webhook - Retry Element Click ${project_webhook_disable_id_xpath} +Enable/Disable State of Same Webhook + [Arguments] ${webhook_name} + Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//clr-checkbox-wrapper//label[contains(@class,'clr-control-label')] + Retry Element Click ${action_webhook_xpath} + Retry Element Click ${action_webhook_disable_or_enable_button} Retry Wait Until Page Contains Element ${dialog_disable_id_xpath} Retry Element Click ${dialog_disable_id_xpath} - Retry Wait Until Page Contains Element ${project_webhook_enable_id_xpath} - Retry Element Click ${project_webhook_enable_id_xpath} + # contain disabled webhook + Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${webhook_name}')]//span[contains(.,'Disabled')] + + Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//clr-checkbox-wrapper//label[contains(@class,'clr-control-label')] + Retry Element Click ${action_webhook_xpath} + Retry Element Click ${action_webhook_disable_or_enable_button} Retry Wait Until Page Contains Element ${dialog_enable_id_xpath} Retry Element Click ${dialog_enable_id_xpath} - Retry Wait Until Page Contains Element ${project_webhook_disable_id_xpath} \ No newline at end of file + # not contain disabled webhook + Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'${webhook_name}')]//span[contains(.,'Disabled')] + +Delete A Webhook + [Arguments] ${webhook_name} + Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//clr-checkbox-wrapper//label[contains(@class,'clr-control-label')] + Retry Element Click ${action_webhook_xpath} + Retry Element Click ${action_webhook_delete_button} + Retry Wait Until Page Contains Element ${dialog_delete_button} + Retry Element Click ${dialog_delete_button} + Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'${webhook_name}')]//clr-checkbox-wrapper//label[contains(@class,'clr-control-label')] \ No newline at end of file diff --git a/tests/resources/Harbor-Pages/Project-Webhooks_Elements.robot b/tests/resources/Harbor-Pages/Project-Webhooks_Elements.robot index 483f7184c..5811663a0 100644 --- a/tests/resources/Harbor-Pages/Project-Webhooks_Elements.robot +++ b/tests/resources/Harbor-Pages/Project-Webhooks_Elements.robot @@ -2,8 +2,17 @@ Documentation This resource provides any keywords related to the Harbor private registry appliance *** Variables *** +${new_webhook_button_xpath} xpath=//*[@id='new-webhook'] +${webhook_name_xpath} xpath=//*[@id='name'] ${webhook_endpoint_id_xpath} xpath=//*[@id='edit_endpoint_url'] ${webhook_auth_header_xpath} xpath=//*[@id='auth_header'] +${action_webhook_xpath} xpath=//*[@id='action-webhook'] +${action_webhook_edit_button} xpath=//*[@id='edit-webhook'] +${action_webhook_disable_or_enable_button} xpath=//*[@id='toggle-webhook'] +${action_webhook_delete_button} xpath=//*[@id='delete-webhook'] +${dialog_delete_button} xpath=//clr-modal//button[contains(.,'DELETE')] + + ${create_webhooks_continue_button_xpath} xpath=//*[@id='new-webhook-continue'] ${edit_webhooks_cancel_button_xpath} xpath=//*[@id='edit-webhook-cancel'] ${edit_webhooks_save_button_xpath} xpath=//*[@id='edit-webhook-save'] diff --git a/tests/robot-cases/Group1-Nightly/Common.robot b/tests/robot-cases/Group1-Nightly/Common.robot index bf0e9c76a..106e40b00 100644 --- a/tests/robot-cases/Group1-Nightly/Common.robot +++ b/tests/robot-cases/Group1-Nightly/Common.robot @@ -560,39 +560,19 @@ Test Case - Project Quotas Control Under Copy Capture Page Screenshot Close Browser -Test Case - Create New Webhook +Test Case - Webhook CRUD Init Chrome Driver ${d}= Get Current Date result_format=%m%s Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} Create An New Project project${d} Go Into Project project${d} has_image=${false} Switch To Project Webhooks - Create A New Webhook ${HARBOR_URL} auth_header=auth_header${d} - Close Browser - -Test Case - Update Webhook - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Create An New Project project${d} - Go Into Project project${d} has_image=${false} - Switch To Project Webhooks - Create A New Webhook ${HARBOR_URL} auth_header=auth_header${d} - Sleep 3 - ${d1}= Get Current Date - Update A Webhook 101.17.109.20 auth_header=auth_header${d1} - Close Browser - -Test Case - Toggle Enable/Disable State of Webhook - Init Chrome Driver - ${d}= Get Current Date result_format=%m%s - Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Create An New Project project${d} - Go Into Project project${d} has_image=${false} - Switch To Project Webhooks - Create A New Webhook ${HARBOR_URL} auth_header=auth_header${d} - Sleep 3 - Toggle Enable/Disable State of Same Webhook + # create more than one webhooks + Create A New Webhook webhook${d} https://test.com + Create A New Webhook webhook2${d} https://test2.com + Update A Webhook webhook${d} newWebhook${d} https://new-test.com + Enable/Disable State of Same Webhook newWebhook${d} + Delete A Webhook newWebhook${d} Close Browser Test Case - Tag Retention