Add new nightly case admin add new users

Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
AllForNothing 2020-04-27 17:38:04 +08:00
parent 87f006d3a9
commit 8ff4003438
5 changed files with 37 additions and 5 deletions

View File

@ -7,6 +7,6 @@
<div class="modal-footer"> <div class="modal-footer">
<span class="spinner spinner-inline loading-top" [hidden]="inProgress === false"> </span> <span class="spinner spinner-inline loading-top" [hidden]="inProgress === false"> </span>
<button type="button" class="btn btn-outline" (click)="close()">{{'BUTTON.CANCEL' | translate}}</button> <button type="button" class="btn btn-outline" (click)="close()">{{'BUTTON.CANCEL' | translate}}</button>
<button type="button" class="btn btn-primary" [disabled]="!isValid || inProgress" (click)="create()">{{'BUTTON.OK' | translate}}</button> <button type="button" id="save-button" class="btn btn-primary" [disabled]="!isValid || inProgress" (click)="create()">{{'BUTTON.OK' | translate}}</button>
</div> </div>
</clr-modal> </clr-modal>

View File

@ -11,7 +11,7 @@
<div> <div>
<clr-datagrid (clrDgRefresh)="load($event)" [clrDgLoading]="inProgress" [(clrDgSelected)]="selectedRow"> <clr-datagrid (clrDgRefresh)="load($event)" [clrDgLoading]="inProgress" [(clrDgSelected)]="selectedRow">
<clr-dg-action-bar> <clr-dg-action-bar>
<button type="button" class="btn btn-secondary" (click)="addNewUser()" [disabled]="!canCreateUser"><clr-icon shape="plus" size="16"></clr-icon>&nbsp;{{'USER.ADD_ACTION' | translate}}</button> <button type="button" class="btn btn-secondary" id="add-new-user" (click)="addNewUser()" [disabled]="!canCreateUser"><clr-icon shape="plus" size="16"></clr-icon>&nbsp;{{'USER.ADD_ACTION' | translate}}</button>
<button type="button" class="btn btn-secondary" id="set-admin" [disabled]="!ifSameRole" (click)="changeAdminRole()" ><clr-icon shape="wrench" size="16"></clr-icon>&nbsp;{{ISADMNISTRATOR | translate}}</button> <button type="button" class="btn btn-secondary" id="set-admin" [disabled]="!ifSameRole" (click)="changeAdminRole()" ><clr-icon shape="wrench" size="16"></clr-icon>&nbsp;{{ISADMNISTRATOR | translate}}</button>
<clr-dropdown [clrCloseMenuOnItemClick]="false" class="btn btn-link" clrDropdownTrigger> <clr-dropdown [clrCloseMenuOnItemClick]="false" class="btn btn-link" clrDropdownTrigger>
<span id='member-action'>{{'BUTTON.ACTIONS' | translate}}<clr-icon shape="caret down"></clr-icon></span> <span id='member-action'>{{'BUTTON.ACTIONS' | translate}}<clr-icon shape="caret down"></clr-icon></span>

View File

@ -46,3 +46,15 @@ User Email Should Exist
Add User Button Should Be Disabled Add User Button Should Be Disabled
Sleep 1 Sleep 1
Retry Wait Until Page Contains Element //button[contains(.,'New') and @disabled=''] Retry Wait Until Page Contains Element //button[contains(.,'New') and @disabled='']
Add A New User
[Arguments] ${username} ${email} ${realname} ${newPassword} ${comment}
Retry Element Click xpath=${add_new_user_button}
Retry Text Input xpath=${username_xpath} ${username}
Retry Text Input xpath=${email_xpath} ${email}
Retry Text Input xpath=${realname_xpath} ${realname}
Retry Text Input xpath=${newPassword_xpath} ${newPassword}
Retry Text Input xpath=${confirmPassword_xpath} ${newPassword}
Retry Text Input xpath=${comment_xpath} ${comment}
Retry Element Click xpath=${save_new_user_button}
Retry Wait Until Page Contains Element xpath=//harbor-user//clr-dg-row//clr-dg-cell[contains(., '${username}')]

View File

@ -17,4 +17,6 @@ Documentation This resource provides any keywords related to the Harbor private
*** Variables *** *** Variables ***
${administration_user_tag_xpath} //clr-vertical-nav-group-children/a[contains(.,'Users')] ${administration_user_tag_xpath} //clr-vertical-nav-group-children/a[contains(.,'Users')]
${administration_tag_xpath} //clr-vertical-nav-group[contains(.,'Admin')] ${administration_tag_xpath} //clr-vertical-nav-group[contains(.,'Admin')]
${add_new_user_button} //*[@id='add-new-user']
${save_new_user_button} //*[@id='save-button']

View File

@ -755,4 +755,22 @@ Test Case - Read Only Mode
Disable Read Only Disable Read Only
Sleep 5 Sleep 5
Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} busybox:latest Push image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} busybox:latest
Close Browser Close Browser
Test Case - Admin Add New Users
Init Chrome Driver
${d}= Get Current Date result_format=%m%s
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
# can add a new user when self-reg is enbled
Switch To Configure
Self Reg Should Be Enabled
Switch to User Tag
Add A New User username=tester${d} email=tester${d}@vmware.com realname=harbortest newPassword=Test1@34 comment=harbortest
# can add a new user when self-reg is disabled
Switch To Configure
Self Reg Should Be Enabled
Sleep 1
Disable Self Reg
Self Reg Should Be Disabled
Switch to User Tag
Add A New User username=tester2${d} email=tester2${d}@vmware.com realname=harbortest2 newPassword=Test1@34 comment=harbortest2
Close Browser