Add webhook nightly case

Signed-off-by: Yogi_Wang <yawang@vmware.com>
This commit is contained in:
Yogi_Wang 2019-10-24 17:07:30 +08:00
parent c3c8b03af5
commit 988279cdcb
8 changed files with 107 additions and 11 deletions

View File

@ -24,11 +24,11 @@
</ng-template>
<ng-template [ngSwitchCase]="4">
<button type="button" class="btn btn-outline" (click)="cancel()">{{'BUTTON.CANCEL' | translate}}</button>
<button type="button" class="btn btn-primary" (click)="confirm()">{{'BUTTON.ENABLE' | translate}}</button>
<button type="button" id="dialog-action-enable" class="btn btn-primary" (click)="confirm()">{{'BUTTON.ENABLE' | translate}}</button>
</ng-template>
<ng-template [ngSwitchCase]="5">
<button type="button" class="btn btn-outline" (click)="cancel()">{{'BUTTON.CANCEL' | translate}}</button>
<button type="button" class="btn btn-danger" (click)="confirm()">{{'BUTTON.DISABLE' | translate}}</button>
<button type="button" id="dialog-action-disable" class="btn btn-danger" (click)="confirm()">{{'BUTTON.DISABLE' | translate}}</button>
</ng-template>
<ng-template [ngSwitchCase]="6">
<button type="button" class="btn btn-outline" (click)="cancel()" [hidden]="isDelete">{{'BUTTON.CANCEL' | translate}}</button>

View File

@ -45,12 +45,12 @@
</section>
</form>
<div class="mt-1" *ngIf="!isModify">
<button type="button" class="btn btn-primary" [disabled]="!isValid" (click)="onSubmit()">{{'BUTTON.CONTINUE' | translate}}</button>
<button type="button" id="new-webhook-continue" class="btn btn-primary" [disabled]="!isValid" (click)="onSubmit()">{{'BUTTON.CONTINUE' | translate}}</button>
<button type="button" [clrLoading]="checkBtnState" class="btn btn-outline" (click)="onTestEndpoint()" [disabled]="checking || enpointURL.errors">{{'WEBHOOK.TEST_ENDPOINT_BUTTON' | translate}}</button>
</div>
<div class="mt-1" *ngIf="isModify">
<button type="button" [clrLoading]="checkBtnState" class="btn btn-outline" (click)="onTestEndpoint()" [disabled]="checking || enpointURL.errors">{{'WEBHOOK.TEST_ENDPOINT_BUTTON' | translate}}</button>
<button type="button" class="btn btn-outline" (click)="onCancel()">{{'BUTTON.CANCEL' | translate}}</button>
<button type="button" class="btn btn-primary" [disabled]="!isValid" (click)="onSubmit()">{{'BUTTON.SAVE' | translate}}</button>
<button type="button" [clrLoading]="checkBtnState" class="btn btn-outline" id="webhook-test" (click)="onTestEndpoint()" [disabled]="checking || enpointURL.errors">{{'WEBHOOK.TEST_ENDPOINT_BUTTON' | translate}}</button>
<button type="button" class="btn btn-outline" id="edit-webhook-cancel" (click)="onCancel()">{{'BUTTON.CANCEL' | translate}}</button>
<button type="button" class="btn btn-primary" id="edit-webhook-save" [disabled]="!isValid" (click)="onSubmit()">{{'BUTTON.SAVE' | translate}}</button>
</div>
</div>

View File

@ -8,11 +8,11 @@
<div class="flex-xs-middle option-left">
<div>
<span class="endpoint-label">Webhook endpoint</span>: {{endpoint}}
<button class="btn btn-link" (click)="openAddWebhookModal()">{{'WEBHOOK.EDIT_BUTTON' | translate}}</button>
<button class="btn btn-link" id="edit-webhook" (click)="openAddWebhookModal()">{{'WEBHOOK.EDIT_BUTTON' | translate}}</button>
</div>
<div [ngSwitch]="isEnabled">
<button *ngSwitchCase="false" class="btn btn-link" (click)="switchWebhookStatus(true)">{{'WEBHOOK.ENABLED_BUTTON' | translate}}</button>
<button *ngSwitchCase="true" class="btn btn-link disabled-btn" (click)="switchWebhookStatus(false)">{{'WEBHOOK.DISABLED_BUTTON' | translate}}</button>
<button *ngSwitchCase="false" id="enable-webhook-action" class="btn btn-link" (click)="switchWebhookStatus(true)">{{'WEBHOOK.ENABLED_BUTTON' | translate}}</button>
<button *ngSwitchCase="true" id="disable-webhook-action" class="btn btn-link disabled-btn" (click)="switchWebhookStatus(false)">{{'WEBHOOK.DISABLED_BUTTON' | translate}}</button>
</div>
</div>
</div>

View File

@ -24,11 +24,11 @@
</ng-template>
<ng-template [ngSwitchCase]="4">
<button type="button" class="btn btn-outline" (click)="cancel()">{{'BUTTON.CANCEL' | translate}}</button>
<button type="button" class="btn btn-primary" (click)="confirm()">{{'BUTTON.ENABLE' | translate}}</button>
<button type="button" id="dialog-action-enable" class="btn btn-primary" (click)="confirm()">{{'BUTTON.ENABLE' | translate}}</button>
</ng-template>
<ng-template [ngSwitchCase]="5">
<button type="button" class="btn btn-outline" (click)="cancel()">{{'BUTTON.CANCEL' | translate}}</button>
<button type="button" class="btn btn-danger" (click)="confirm()">{{'BUTTON.DISABLE' | translate}}</button>
<button type="button" id="dialog-action-disable" class="btn btn-danger" (click)="confirm()">{{'BUTTON.DISABLE' | translate}}</button>
</ng-template>
<ng-template [ngSwitchCase]="6">
<button type="button" class="btn btn-outline" (click)="cancel()" [hidden]="isDelete">{{'BUTTON.CANCEL' | translate}}</button>

View File

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

View File

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

View File

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

View File

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