mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 18:25:56 +01:00
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:
parent
f19ad5c522
commit
a1063edae6
@ -1,13 +1,13 @@
|
||||
*** Keywords ***
|
||||
Make Swagger Client
|
||||
${rc} ${output}= Run And Return Rc And Output make swagger_client
|
||||
${rc} ${output}= Run And Return Rc And Output make swagger_client
|
||||
Log ${output}
|
||||
[Return] ${rc}
|
||||
|
||||
Setup API Test
|
||||
Retry Keyword When Error Make Swagger Client
|
||||
|
||||
Harbor API Test
|
||||
Harbor API Test
|
||||
[Arguments] ${testcase_name}
|
||||
${current_dir}= Run pwd
|
||||
Log To Console ${current_dir}
|
||||
|
@ -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}
|
@ -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
|
||||
@ -41,35 +40,35 @@ Go Into Project
|
||||
Add User To Project Admin
|
||||
[Arguments] ${project} ${user}
|
||||
Go Into Project
|
||||
Sleep 2
|
||||
Sleep 2
|
||||
Click Element xpath=${project_member_tag_xpath}
|
||||
Sleep 1
|
||||
Click Element xpath=${project_member_add_button_xpath}
|
||||
Sleep 2
|
||||
Sleep 2
|
||||
Input Text xpath=${project_member_add_username_xpath} ${user}
|
||||
Sleep 3
|
||||
Click Element xpath=${project_member_add_admin_xpath}
|
||||
Click Element xpath=${project_member_add_save_button_xpath}
|
||||
Sleep 4
|
||||
|
||||
|
||||
Search Project Member
|
||||
[Arguments] ${project} ${user}
|
||||
Go Into Project ${project}
|
||||
Sleep 2
|
||||
Sleep 2
|
||||
Click Element xpath=//clr-dg-cell//a[contains(.,'${project}')]
|
||||
Sleep 1
|
||||
Sleep 1
|
||||
Click Element xpath=${project_member_search_button_xpath}
|
||||
Sleep 1
|
||||
Sleep 1
|
||||
Click Element xpath=${project_member_search_text_xpath}
|
||||
Sleep 2
|
||||
Wait Until Page Contains ${user}
|
||||
|
||||
Wait Until Page Contains ${user}
|
||||
|
||||
Change Project Member Role
|
||||
[Arguments] ${project} ${user} ${role}
|
||||
Click Element xpath=//clr-dg-cell//a[contains(.,'${project}')]
|
||||
Sleep 2
|
||||
Sleep 2
|
||||
Click Element xpath=${project_member_tag_xpath}
|
||||
Sleep 1
|
||||
Sleep 1
|
||||
Click Element xpath=//project-detail//clr-dg-row[contains(.,'${user}')]//label
|
||||
Sleep 1
|
||||
#change role
|
||||
@ -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}
|
||||
|
@ -44,7 +44,7 @@ Create An New Project With New User
|
||||
Logout Harbor
|
||||
Sign In Harbor ${url} ${username} ${newPassword}
|
||||
Create An New Project ${projectname} ${public}
|
||||
Sleep 1
|
||||
Sleep 1
|
||||
|
||||
#It's the log of project.
|
||||
Go To Project Log
|
||||
@ -67,7 +67,7 @@ Switch To Replication
|
||||
Sleep 1
|
||||
|
||||
Navigate To Projects
|
||||
${element}= Set Variable xpath=${projects_xpath}
|
||||
${element}= Set Variable xpath=${projects_xpath}
|
||||
Wait Until Element Is Visible And Enabled ${element}
|
||||
Click Element ${element}
|
||||
Sleep 2
|
||||
@ -89,7 +89,7 @@ Search Private Projects
|
||||
|
||||
Make Project Private
|
||||
[Arguments] ${projectname}
|
||||
Go Into Project ${project name}
|
||||
Go Into Project ${project name}
|
||||
Sleep 2
|
||||
Click Element xpath=//project-detail//a[contains(.,'Configuration')]
|
||||
Sleep 1
|
||||
@ -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
|
||||
@ -151,7 +149,7 @@ Project Should Be Deleted
|
||||
Advanced Search Should Display
|
||||
Page Should Contain Element xpath=//audit-log//div[@class='flex-xs-middle']/button
|
||||
|
||||
# it's not a common keywords, only used into log case.
|
||||
# it's not a common keywords, only used into log case.
|
||||
Do Log Advanced Search
|
||||
Capture Page Screenshot LogAdvancedSearch.png
|
||||
Sleep 1
|
||||
|
@ -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}
|
||||
@ -119,15 +143,14 @@ Wait Unitl Command Success
|
||||
\ Sleep 2
|
||||
Log ${output}
|
||||
Run Keyword If ${positive} == ${true} Should Be Equal As Strings '${rc}' '0'
|
||||
... ELSE Should Not Be Equal As Strings '${rc}' '0'
|
||||
... ELSE Should Not Be Equal As Strings '${rc}' '0'
|
||||
[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
|
||||
|
@ -41,7 +41,7 @@ Test Case - Vulnerability Data Not Ready
|
||||
Test Case - Garbage Collection
|
||||
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}
|
||||
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} project${d} hello-world
|
||||
@ -66,7 +66,7 @@ Test Case - Garbage Collection
|
||||
Should Contain ${output} success to run gc in job.
|
||||
|
||||
Close Browser
|
||||
|
||||
|
||||
Test Case - Create An New Project
|
||||
Init Chrome Driver
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
@ -294,7 +294,7 @@ Test Case - User View Logs
|
||||
|
||||
Sign In Harbor ${HARBOR_URL} user002 Test1@34
|
||||
Create An New Project project${d}
|
||||
|
||||
|
||||
Push image ${ip} user002 Test1@34 project${d} busybox:latest
|
||||
Pull image ${ip} user002 Test1@34 project${d} busybox:latest
|
||||
|
||||
@ -313,7 +313,7 @@ Test Case - User View Logs
|
||||
Test Case - Manage Project Member
|
||||
Init Chrome Driver
|
||||
${d}= Get current Date result_format=%m%s
|
||||
|
||||
|
||||
Sign In Harbor ${HARBOR_URL} user004 Test1@34
|
||||
Create An New Project project${d}
|
||||
Push image ip=${ip} user=user004 pwd=Test1@34 project=project${d} image=hello-world
|
||||
@ -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
|
||||
@ -403,7 +406,7 @@ Test Case - Edit Project Creation
|
||||
Test Case - Edit Repo Info
|
||||
Init Chrome Driver
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
|
||||
|
||||
Sign In Harbor ${HARBOR_URL} user011 Test1@34
|
||||
Create An New Project project${d}
|
||||
Push Image ${ip} user011 Test1@34 project${d} hello-world
|
||||
@ -415,7 +418,7 @@ Test Case - Edit Repo Info
|
||||
Test Case - Delete Multi Project
|
||||
Init Chrome Driver
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
|
||||
|
||||
Sign In Harbor ${HARBOR_URL} user012 Test1@34
|
||||
Create An New Project projecta${d}
|
||||
Create An New Project projectb${d}
|
||||
@ -432,7 +435,7 @@ Test Case - Delete Multi Project
|
||||
Test Case - Delete Multi Repo
|
||||
Init Chrome Driver
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
|
||||
|
||||
Sign In Harbor ${HARBOR_URL} user013 Test1@34
|
||||
Create An New Project project${d}
|
||||
Push Image ${ip} user013 Test1@34 project${d} hello-world
|
||||
@ -447,7 +450,7 @@ Test Case - Delete Multi Repo
|
||||
Test Case - Delete Multi Tag
|
||||
Init Chrome Driver
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
|
||||
|
||||
Sign In Harbor ${HARBOR_URL} user014 Test1@34
|
||||
Create An New Project project${d}
|
||||
Push Image With Tag ${ip} user014 Test1@34 project${d} redis 3.2.10-alpine 3.2.10-alpine
|
||||
@ -476,7 +479,7 @@ Test Case - Delete Repo on CardView
|
||||
Test Case - Delete Multi Member
|
||||
Init Chrome Driver
|
||||
${d}= Get Current Date result_format=%m%s
|
||||
Sign In Harbor ${HARBOR_URL} user016 Test1@34
|
||||
Sign In Harbor ${HARBOR_URL} user016 Test1@34
|
||||
Create An New Project project${d}
|
||||
Go Into Project project${d} has_image=${false}
|
||||
Switch To Member
|
||||
@ -530,7 +533,7 @@ Test Case - Developer Operate Labels
|
||||
Sign In Harbor ${HARBOR_URL} user021 Test1@34
|
||||
Create An New Project project${d}
|
||||
Logout Harbor
|
||||
|
||||
|
||||
Manage Project Member user021 Test1@34 project${d} user022 Add ${false}
|
||||
Change User Role In Project user021 Test1@34 project${d} user022 Developer
|
||||
|
||||
@ -546,7 +549,7 @@ Test Case - Scan A Tag In The Repo
|
||||
|
||||
Sign In Harbor ${HARBOR_URL} user023 Test1@34
|
||||
Create An New Project project${d}
|
||||
Go Into Project project${d} has_image=${false}
|
||||
Go Into Project project${d} has_image=${false}
|
||||
Push Image ${ip} user023 Test1@34 project${d} hello-world
|
||||
Go Into Project project${d}
|
||||
Go Into Repo project${d}/hello-world
|
||||
@ -560,7 +563,7 @@ Test Case - Scan As An Unprivileged User
|
||||
Init Chrome Driver
|
||||
${d}= get current date result_format=%m%s
|
||||
Push Image ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} library hello-world
|
||||
|
||||
|
||||
Sign In Harbor ${HARBOR_URL} user024 Test1@34
|
||||
Go Into Project library
|
||||
Go Into Repo hello-world
|
||||
@ -697,7 +700,7 @@ Test Case - View Scan Results
|
||||
${d}= get current date result_format=%m%s
|
||||
|
||||
Sign In Harbor ${HARBOR_URL} user025 Test1@34
|
||||
Create An New Project project${d}
|
||||
Create An New Project project${d}
|
||||
Push Image ${ip} user025 Test1@34 project${d} tomcat
|
||||
Go Into Project project${d}
|
||||
Go Into Repo project${d}/tomcat
|
||||
|
Loading…
Reference in New Issue
Block a user