mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 18:25:56 +01:00
Keyword <Go Into Project> has modified, but verify.robot didn't adapt this keyword.
Modifications: 1.Add paramenter hasimage in data.json 2.Modify Harbor-Pages\Verify.robot to pass it to <Go Into Project> 3.Add loop and exception-catch in <Go Into Project> to prevent using Sleep and failure by exception(this exception was caused by short time of paga loading) Signed-off-by: danfengliu <danfengl@vmware.com>
This commit is contained in:
parent
1987d7cb8f
commit
f29960628a
@ -22,14 +22,21 @@ ${HARBOR_VERSION} v1.1.1
|
||||
*** Keywords ***
|
||||
Go Into Project
|
||||
[Arguments] ${project} ${has_image}=${true}
|
||||
Wait Until Element Is Visible ${search_input}
|
||||
Wait Until Element Is Visible And Enabled ${search_input}
|
||||
Input Text ${search_input} ${project}
|
||||
Wait Until Page Contains ${project}
|
||||
Wait Until Element Is Visible xpath=//*[@id='project-results']//clr-dg-cell[contains(.,'${project}')]/a
|
||||
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
|
||||
Run Keyword If ${has_image}==${false} Wait Until Element Is Visible xpath=//clr-dg-placeholder[contains(.,\"We couldn\'t find any repositories!\")]
|
||||
... ELSE Wait Until Element Is Visible xpath=//clr-dg-cell[contains(.,'${project}/')]
|
||||
Capture Page Screenshot gointo_${project}.png
|
||||
#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
|
||||
\ ${out} Run Keyword If ${has_image}==${false} Run Keyword And Ignore Error Wait Until Element Is Visible And Enabled xpath=//clr-dg-placeholder[contains(.,\"We couldn\'t find any repositories!\")]
|
||||
\ ... ELSE Run Keyword And Ignore Error Wait Until Element Is Visible And Enabled xpath=//clr-dg-cell[contains(.,'${project}/')]
|
||||
\ Log To Console ${out[0]}
|
||||
\ ${result} Set Variable If '${out[0]}'=='PASS' ${true} ${false}
|
||||
\ Run Keyword If ${result} == ${true} Exit For Loop
|
||||
\ Sleep 1
|
||||
Should Be Equal ${result} ${true}
|
||||
|
||||
Add User To Project Admin
|
||||
[Arguments] ${project} ${user}
|
||||
|
@ -35,7 +35,9 @@ Verify Image Tag
|
||||
Init Chrome Driver
|
||||
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
||||
:FOR ${project} IN @{project}
|
||||
\ Go Into Project ${project}
|
||||
\ @{out_has_image}= Get Value From Json ${json} $.projects[?(@.name=${project})].has_image
|
||||
\ ${has_image} Set Variable If @{out_has_image}[0] == ${true} ${true} ${false}
|
||||
\ Go Into Project ${project} has_image=${has_image}
|
||||
\ @{repo}= Get Value From Json ${json} $.projects[?(@name=${project})]..repo..name
|
||||
\ Loop Image Repo @{repo}
|
||||
\ Back To Projects
|
||||
@ -52,7 +54,9 @@ Verify Member Exist
|
||||
Init Chrome Driver
|
||||
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
||||
:For ${project} In @{project}
|
||||
\ Go Into Project ${project}
|
||||
\ @{out_has_image}= Get Value From Json ${json} $.projects[?(@.name=${project})].has_image
|
||||
\ ${has_image} Set Variable If @{out_has_image}[0] == ${true} ${true} ${false}
|
||||
\ Go Into Project ${project} has_image=${has_image}
|
||||
\ Switch To Member
|
||||
\ @{members}= Get Value From Json ${json} $.projects[?(@name=${project})].member..name
|
||||
\ Loop Member @{members}
|
||||
@ -91,12 +95,14 @@ Verify Project Label
|
||||
Init Chrome Driver
|
||||
Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
||||
:For ${project} In @{project}
|
||||
\ Go Into Project ${project}
|
||||
\ Switch To Project Label
|
||||
\ @{projectlabel}= Get Value From Json ${json} $.projects[?(@.name=${project})]..labels..name
|
||||
\ :For ${label} In @{label}
|
||||
\ \ Page Should Contain ${projectlabel}
|
||||
\ Back To Projects
|
||||
\ @{out_has_image}= Get Value From Json ${json} $.projects[?(@.name=${project})].has_image
|
||||
\ ${has_image} Set Variable If @{out_has_image}[0] == ${true} ${true} ${false}
|
||||
\ Go Into Project ${project} has_image=${has_image}
|
||||
\ Switch To Project Label
|
||||
\ @{projectlabel}= Get Value From Json ${json} $.projects[?(@.name=${project})]..labels..name
|
||||
\ :For ${label} In @{label}
|
||||
\ \ Page Should Contain ${projectlabel}
|
||||
\ Back To Projects
|
||||
Close Browser
|
||||
|
||||
Verify Endpoint
|
||||
@ -129,7 +135,9 @@ Verify Project Setting
|
||||
\ ${scanonpush}= Get Value From Json ${json} $.projects[?(@.name=${project})]..automatically_scan_images_on_push
|
||||
\ Init Chrome Driver
|
||||
\ Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD}
|
||||
\ Go Into Project ${project}
|
||||
\ @{out_has_image}= Get Value From Json ${json} $.projects[?(@.name=${project})].has_image
|
||||
\ ${has_image} Set Variable If @{out_has_image}[0] == ${true} ${true} ${false}
|
||||
\ Go Into Project ${project} has_image=${has_image}
|
||||
\ Goto Project Config
|
||||
\ Run Keyword If ${public} == "public" Checkbox Should Be Checked //clr-checkbox-wrapper[@name='public']//label
|
||||
\ Run Keyword If ${contenttrust} == "true" Checkbox Should Be Checked //clr-checkbox-wrapper[@name='content-trust']//label
|
||||
|
@ -92,6 +92,7 @@
|
||||
"projects":[
|
||||
{
|
||||
"name":"project1",
|
||||
"has_image":true,
|
||||
"accesslevel":"public",
|
||||
"repocounts":2,
|
||||
"repo":[
|
||||
@ -151,6 +152,7 @@
|
||||
},
|
||||
{
|
||||
"name":"project2",
|
||||
"has_image":false,
|
||||
"accesslevel":"public",
|
||||
"repocounts":2,
|
||||
"repo":[
|
||||
|
Loading…
Reference in New Issue
Block a user