Add GUI test script for new feature of master-role, without adding a new case for master-role, I add new test steps in old test case named Manage-Project-Members, because master-role is a sub function in project members. (#6945)

In this PR, I also modify a public action keyword to make it suitble for indefinite numbers of parameters.

Signed-off-by: danfengliu <danfengl@vmware.com>
This commit is contained in:
danfengliu 2019-02-22 14:11:56 +08:00 committed by GitHub
parent f19ad5c522
commit a1063edae6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 90 additions and 57 deletions

View File

@ -47,4 +47,4 @@ Go Back To Versions And Delete
Retry Element Click xpath=${version_checkbox}
Retry Element Click xpath=${version_delete}
Retry Element Click xpath=${version_confirm_delete}
Retry Keyword When Error Wait Until Page Contains Element element=xpath=${helmchart_content}
Retry Wait Until Page Contains Element xpath=${helmchart_content}

View File

@ -22,11 +22,10 @@ ${HARBOR_VERSION} v1.1.1
*** Keywords ***
Go Into Project
[Arguments] ${project} ${has_image}=${true}
Wait Until Element Is Visible And Enabled ${search_input}
Retry Wait Element ${search_input}
Input Text ${search_input} ${project}
Wait Until Page Contains ${project}
Wait Until Element Is Visible And Enabled xpath=//*[@id='project-results']//clr-dg-cell[contains(.,'${project}')]/a
Click Element xpath=//*[@id='project-results']//clr-dg-cell[contains(.,'${project}')]/a
Retry Wait Until Page Contains ${project}
Retry Element Click xpath=//*[@id='project-results']//clr-dg-cell[contains(.,'${project}')]/a
#To prevent waiting for a fixed-period of time for page loading and failure caused by exception, we add loop to re-run <Wait Until Element Is Visible And Enabled> when
# exception was caught.
:For ${n} IN RANGE 1 5
@ -100,13 +99,12 @@ User Can Not Add Member
Add Guest Member To Project
[arguments] ${member}
Click Element xpath=${project_member_add_button_xpath}
Sleep 1
Input Text xpath=${project_member_add_username_xpath} ${member}
Retry Element Click xpath=${project_member_add_button_xpath}
Retry Text Input xpath=${project_member_add_username_xpath} ${member}
#select guest
Mouse Down xpath=${project_member_guest_radio_checkbox}
Mouse Up xpath=${project_member_guest_radio_checkbox}
Click Button xpath=${project_member_add_confirmation_ok_xpath}
Retry Button Click xpath=${project_member_add_confirmation_ok_xpath}
Sleep 1
Delete Project Member
@ -188,6 +186,17 @@ User Should Be Admin
Logout Harbor
Push Image With Tag ${ip} ${user} ${pwd} ${project} hello-world v2
User Should Be Master
[Arguments] ${user} ${pwd} ${project}
Sign In Harbor ${HARBOR_URL} ${user} ${pwd}
Project Should Display ${project}
Go Into Project ${project}
Delete Repo ${project}
Switch To Member
Page Should Contain Element xpath=//clr-dg-row[contains(.,'${user}')]//clr-dg-cell[contains(.,'Master')]
Logout Harbor
Push Image With Tag ${ip} ${user} ${pwd} ${project} hello-world v3
Project Should Have Member
[Arguments] ${project} ${user}
Sign In Harbor ${HARBOR_URL} %{HARBOR_ADMIN} %{HARBOR_PASSWORD}

View File

@ -102,12 +102,10 @@ Make Project Private
Make Project Public
[Arguments] ${projectname}
Go Into Project ${project name}
Sleep 2
Click Element xpath=//project-detail//a[contains(.,'Configuration')]
Retry Element Click xpath=//project-detail//a[contains(.,'Configuration')]
Checkbox Should Not Be Selected xpath=//input[@name='public']
Click Element //div[@id="clr-wrapper-public"]//label[1]
Wait Until Element Is Enabled //button[contains(.,'SAVE')]
Click Element //button[contains(.,'SAVE')]
Retry Element Click //div[@id="clr-wrapper-public"]//label[1]
Retry Element Click //button[contains(.,'SAVE')]
Wait Until Page Contains Configuration has been successfully saved
Delete Repo

View File

@ -68,24 +68,43 @@ Wait Until Element Is Visible And Enabled
Wait Until Element Is Enabled ${element}
Retry Action Keyword
[Arguments] ${keyword} ${element_xpath}
Retry Keyword When Error ${keyword} element=${element_xpath}
Retry Element Click
[Arguments] ${element_xpath}
Retry Action Keyword Element Click ${element_xpath}
[Arguments] ${keyword} @{param}
Retry Keyword When Error ${keyword} @{param}
Retry Wait Element
[Arguments] ${element_xpath}
Retry Action Keyword Wait Until Element Is Visible And Enabled ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Element Is Visible And Enabled @{param}
Retry Wait Element Not Visible
[Arguments] ${element_xpath}
Retry Action Keyword Wait Until Element Is Not Visible ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Element Is Not Visible @{param}
Retry Element Click
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Element Click @{param}
Retry Button Click
[Arguments] ${element_xpath}
Retry Action Keyword Button Click ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Button Click @{param}
Retry Text Input
[Arguments] ${element_xpath} ${text}
@{param} Create List ${element_xpath} ${text}
Retry Action Keyword Text Input @{param}
Retry Wait Until Page Contains
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Page Contains @{param}
Retry Wait Until Page Contains Element
[Arguments] ${element_xpath}
@{param} Create List ${element_xpath}
Retry Action Keyword Wait Until Page Contains Element @{param}
Element Click
[Arguments] ${element_xpath}
@ -97,6 +116,11 @@ Button Click
Wait Until Element Is Visible And Enabled ${element_xpath}
Click button ${element_xpath}
Text Input
[Arguments] ${element_xpath} ${text}
Wait Until Element Is Visible And Enabled ${element_xpath}
Input Text ${element_xpath} ${text}
Wait Unitl Vul Data Ready
[Arguments] ${url} ${timeout} ${interval}
${n}= Evaluate ${timeout}/${interval}
@ -123,11 +147,10 @@ Wait Unitl Command Success
[Return] ${output}
Retry Keyword When Error
[Arguments] ${keyword} ${element}=${None} ${times}=6
:For ${n} IN RANGE 1 ${times}
[Arguments] ${keyword} @{elements}
:For ${n} IN RANGE 1 6
\ Log To Console Trying ${keyword} ${n} times ...
\ ${out} Run Keyword If "${element}"=="${None}" Run Keyword And Ignore Error ${keyword}
\ ... ELSE Run Keyword And Ignore Error ${keyword} ${element}
\ ${out} Run Keyword And Ignore Error ${keyword} @{elements}
\ Log To Console Return value is ${out[0]}
\ Exit For Loop If '${out[0]}'=='PASS'
\ Sleep 2

View File

@ -326,8 +326,11 @@ Test Case - Manage Project Member
User Should Be Developer user005 Test1@34 project${d}
Change User Role In Project user004 Test1@34 project${d} user005 Admin
User Should Be Admin user005 Test1@34 project${d} user006
Change User Role In Project user004 Test1@34 project${d} user005 Master
User Should Be Master user005 Test1@34 project${d}
Manage Project Member user004 Test1@34 project${d} user005 Remove
User Should Not Be A Member Of Project user005 Test1@34 project${d}
Push image ip=${ip} user=user004 pwd=Test1@34 project=project${d} image=hello-world
User Should Be Guest user006 Test1@34 project${d}
Close Browser