Merge pull request #11288 from AllForNothing/nightly-webhook

Fix nightly cases for webhook
This commit is contained in:
Will Sun 2020-04-01 17:37:11 +08:00 committed by GitHub
commit b0d0b292cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 69 additions and 59 deletions

View File

@ -4,34 +4,36 @@
<clr-dg-action-bar>
<div class="clr-row">
<div class="clr-col-7">
<button type="button" class="btn btn-secondary" (click)="newWebhook()">
<button id="new-webhook" type="button" class="btn btn-secondary" (click)="newWebhook()">
<clr-icon shape="plus" size="16"></clr-icon>
{{'WEBHOOK.NEW_WEBHOOK' | translate}}
</button>
<clr-dropdown [clrCloseMenuOnItemClick]="false" class="btn btn-link" clrDropdownTrigger>
<span id="action-scanner">{{'MEMBER.ACTION' | translate}}
<span id="action-webhook">{{'MEMBER.ACTION' | translate}}
<clr-icon class="clr-icon" shape="caret down"></clr-icon></span>
<clr-dropdown-menu *clrIfOpen>
<button clrDropdownItem (click)="switchWebhookStatus()"
[disabled]="!(selectedRow && selectedRow.length === 1)">
<span *ngIf="selectedRow[0] && !selectedRow[0].enabled">
<clr-icon class="margin-top-2" size="16" shape="success-standard"></clr-icon>
<span class="margin-left-10">{{'WEBHOOK.ENABLE' | translate}}</span>
</span>
<span *ngIf="!(selectedRow[0] && !selectedRow[0].enabled)">
<clr-icon class="margin-top-2" size="16" shape="ban"></clr-icon>
<span class="margin-left-10">{{'WEBHOOK.DISABLE' | translate}}</span>
</span>
<span id="toggle-webhook">
<span *ngIf="selectedRow[0] && !selectedRow[0].enabled">
<clr-icon class="margin-top-2" size="16" shape="success-standard"></clr-icon>
<span class="margin-left-10">{{'WEBHOOK.ENABLE' | translate}}</span>
</span>
<span *ngIf="!(selectedRow[0] && !selectedRow[0].enabled)">
<clr-icon class="margin-top-2" size="16" shape="ban"></clr-icon>
<span class="margin-left-10">{{'WEBHOOK.DISABLE' | translate}}</span>
</span>
</span>
</button>
<button clrDropdownItem (click)="editWebhook()"
class="btn btn-secondary" [disabled]="!(selectedRow && selectedRow.length === 1)">
<clr-icon class="margin-top-0" size="16" shape="pencil"></clr-icon>
<span class="margin-left-10">{{'BUTTON.EDIT' | translate}}</span>
<span id="edit-webhook" class="margin-left-10">{{'BUTTON.EDIT' | translate}}</span>
</button>
<button clrDropdownItem (click)="deleteWebhook()"
class="btn btn-secondary" [disabled]="!(selectedRow && selectedRow.length >= 1)">
<clr-icon class="margin-top-0" size="16" shape="times"></clr-icon>
<span id="delete-scanner-action"
<span id="delete-webhook"
class="margin-left-10">{{'BUTTON.DELETE' | translate}}</span>
</button>
</clr-dropdown-menu>

View File

@ -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}
# 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')]

View File

@ -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']

View File

@ -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