From 988279cdcbbcdcce866f49113a8cff444c5f417b Mon Sep 17 00:00:00 2001 From: Yogi_Wang Date: Thu, 24 Oct 2019 17:07:30 +0800 Subject: [PATCH] Add webhook nightly case Signed-off-by: Yogi_Wang --- .../confirmation-dialog.component.html | 4 +- .../add-webhook-form.component.html | 8 ++-- .../project/webhook/webhook.component.html | 6 +-- .../confirmation-dialog.component.html | 4 +- .../Harbor-Pages/Project-Webhooks.robot | 45 +++++++++++++++++++ .../Project-Webhooks_Elements.robot | 14 ++++++ tests/resources/Util.robot | 2 + tests/robot-cases/Group1-Nightly/Common.robot | 35 +++++++++++++++ 8 files changed, 107 insertions(+), 11 deletions(-) create mode 100644 tests/resources/Harbor-Pages/Project-Webhooks.robot create mode 100644 tests/resources/Harbor-Pages/Project-Webhooks_Elements.robot diff --git a/src/portal/lib/src/confirmation-dialog/confirmation-dialog.component.html b/src/portal/lib/src/confirmation-dialog/confirmation-dialog.component.html index 343001220..878f11268 100644 --- a/src/portal/lib/src/confirmation-dialog/confirmation-dialog.component.html +++ b/src/portal/lib/src/confirmation-dialog/confirmation-dialog.component.html @@ -24,11 +24,11 @@ - + - + diff --git a/src/portal/src/app/project/webhook/add-webhook-form/add-webhook-form.component.html b/src/portal/src/app/project/webhook/add-webhook-form/add-webhook-form.component.html index fb34b999f..596a6044d 100644 --- a/src/portal/src/app/project/webhook/add-webhook-form/add-webhook-form.component.html +++ b/src/portal/src/app/project/webhook/add-webhook-form/add-webhook-form.component.html @@ -45,12 +45,12 @@
- +
- - - + + +
\ No newline at end of file diff --git a/src/portal/src/app/project/webhook/webhook.component.html b/src/portal/src/app/project/webhook/webhook.component.html index c720b8187..6becf8adc 100644 --- a/src/portal/src/app/project/webhook/webhook.component.html +++ b/src/portal/src/app/project/webhook/webhook.component.html @@ -8,11 +8,11 @@
Webhook endpoint: {{endpoint}} - +
- - + +
diff --git a/src/portal/src/app/shared/confirmation-dialog/confirmation-dialog.component.html b/src/portal/src/app/shared/confirmation-dialog/confirmation-dialog.component.html index 004d8acf7..cb8eb9e7e 100644 --- a/src/portal/src/app/shared/confirmation-dialog/confirmation-dialog.component.html +++ b/src/portal/src/app/shared/confirmation-dialog/confirmation-dialog.component.html @@ -24,11 +24,11 @@
- + - + diff --git a/tests/resources/Harbor-Pages/Project-Webhooks.robot b/tests/resources/Harbor-Pages/Project-Webhooks.robot new file mode 100644 index 000000000..1d913498e --- /dev/null +++ b/tests/resources/Harbor-Pages/Project-Webhooks.robot @@ -0,0 +1,45 @@ +*** Settings *** +Documentation Harbor Webhooks +Resource ../../resources/Util.robot + +*** Variables *** + +*** Keywords *** +Switch To Project Webhooks + Retry Element Click xpath=//project-detail//a[contains(.,'Webhooks')] + Sleep 1 + +Create A New Webhook + [Arguments] ${webhook_endpoint_url} ${auth_header} + 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} + +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} + 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} + 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} + Capture Page Screenshot + +Toggle Enable/Disable State of Same Webhook + Retry Element Click ${project_webhook_disable_id_xpath} + 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} + 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 diff --git a/tests/resources/Harbor-Pages/Project-Webhooks_Elements.robot b/tests/resources/Harbor-Pages/Project-Webhooks_Elements.robot new file mode 100644 index 000000000..483f7184c --- /dev/null +++ b/tests/resources/Harbor-Pages/Project-Webhooks_Elements.robot @@ -0,0 +1,14 @@ +*** Settings *** +Documentation This resource provides any keywords related to the Harbor private registry appliance + +*** Variables *** +${webhook_endpoint_id_xpath} xpath=//*[@id='edit_endpoint_url'] +${webhook_auth_header_xpath} xpath=//*[@id='auth_header'] +${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'] +${project_webhook_edit_id_xpath} xpath=//*[@id='edit-webhook'] +${project_webhook_enable_id_xpath} xpath=//*[@id='enable-webhook-action'] +${project_webhook_disable_id_xpath} xpath=//*[@id='disable-webhook-action'] +${dialog_disable_id_xpath} xpath=//*[@id='dialog-action-disable'] +${dialog_enable_id_xpath} xpath=//*[@id='dialog-action-enable'] diff --git a/tests/resources/Util.robot b/tests/resources/Util.robot index aeda8ca11..7a6ca21ff 100644 --- a/tests/resources/Util.robot +++ b/tests/resources/Util.robot @@ -35,6 +35,8 @@ Resource Harbor-Pages/Project.robot Resource Harbor-Pages/Project_Elements.robot Resource Harbor-Pages/Project-Members.robot Resource Harbor-Pages/Project-Members_Elements.robot +Resource Harbor-Pages/Project-Webhooks.robot +Resource Harbor-Pages/Project-Webhooks_Elements.robot Resource Harbor-Pages/Project-Repository.robot Resource Harbor-Pages/Project-Repository_Elements.robot Resource Harbor-Pages/Project-Config.robot diff --git a/tests/robot-cases/Group1-Nightly/Common.robot b/tests/robot-cases/Group1-Nightly/Common.robot index 4a3929cd9..cd3fbb09a 100644 --- a/tests/robot-cases/Group1-Nightly/Common.robot +++ b/tests/robot-cases/Group1-Nightly/Common.robot @@ -585,3 +585,38 @@ Test Case - Can Not Retag Image In ReadOnly Mode Go Into Project project${random_num2} has_image=${false} Disable Read Only Close Browser + +Test Case - Create New 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} + 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 + Close Browser