2021-04-08 09:32:31 +02:00
*** Settings ***
Documentation Harbor Webhooks
Resource ../../resources/Util.robot
*** Variables ***
*** Keywords ***
Switch To Project Webhooks
Retry Element Click xpath=//project-detail//a[contains(.,'Webhooks')]
Create A New Webhook
2022-06-21 08:28:43 +02:00
[Arguments] ${webhook_name} ${webhook_endpoint_url} ${event_type}=@{EMPTY}
Retry Element Click ${new_webhook_button_xpath}
Retry Text Input ${webhook_name_xpath} ${webhook_name}
2021-04-08 09:32:31 +02:00
Retry Text Input ${webhook_endpoint_id_xpath} ${webhook_endpoint_url}
2022-06-07 11:10:11 +02:00
${len}= Get Length ${event_type}
Run Keyword If ${len} > 0 Select Event Type @{event_type}
2021-04-08 09:32:31 +02:00
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}
Retry Wait Until Page Contains ${webhook_name}
2022-06-07 11:10:11 +02:00
Select Event Type
[Arguments] @{event_type}
2022-06-21 08:28:43 +02:00
${elements}= Get WebElements //form//div[contains(@class,'clr-control-inline')]//label
2022-06-07 11:10:11 +02:00
FOR ${element} IN @{elements}
Retry Element Click ${element}
END
FOR ${element} IN @{event_type}
Retry Element Click //form//div[contains(@class,'clr-control-inline')]//label[contains(.,'${element}')]
END
2021-04-08 09:32:31 +02:00
Update A Webhook
[Arguments] ${old_webhook_name} ${new_webhook_name} ${new_webhook_enpoint}
# select one webhook
2023-03-31 05:00:16 +02:00
Retry Element Click xpath=//clr-dg-row[contains(.,'${old_webhook_name}')]//div[contains(@class,'datagrid-select')]
2021-04-08 09:32:31 +02:00
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
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 ${new_webhook_name}
2022-03-24 07:28:57 +01:00
Enable/Deactivate State of Same Webhook
2021-04-08 09:32:31 +02:00
[Arguments] ${webhook_name}
2023-03-31 05:00:16 +02:00
Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//div[contains(@class,'datagrid-select')]
2021-04-08 09:32:31 +02:00
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}
2022-03-24 07:28:57 +01:00
# contain deactivated webhook
Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${webhook_name}')]//span[contains(.,'Deactivated')]
2021-04-08 09:32:31 +02:00
2023-03-31 05:00:16 +02:00
Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//div[contains(@class,'datagrid-select')]
2021-04-08 09:32:31 +02:00
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}
2022-03-24 07:28:57 +01:00
# not contain deactivated webhook
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'${webhook_name}')]//span[contains(.,'Deactivated')]
2021-04-08 09:32:31 +02:00
Delete A Webhook
[Arguments] ${webhook_name}
2023-03-31 05:00:16 +02:00
Retry Element Click xpath=//clr-dg-row[contains(.,'${webhook_name}')]//div[contains(@class,'datagrid-select')]
2021-04-08 09:32:31 +02:00
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}
2023-03-31 05:00:16 +02:00
Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'${webhook_name}')]//div[contains(@class,'datagrid-select')]