diff --git a/tests/resources/Harbor-Pages/Project-Members.robot b/tests/resources/Harbor-Pages/Project-Members.robot index 5b34e4162..d246bd990 100644 --- a/tests/resources/Harbor-Pages/Project-Members.robot +++ b/tests/resources/Harbor-Pages/Project-Members.robot @@ -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 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} diff --git a/tests/resources/Harbor-Pages/Verify.robot b/tests/resources/Harbor-Pages/Verify.robot index 1d0aeee29..99625844c 100644 --- a/tests/resources/Harbor-Pages/Verify.robot +++ b/tests/resources/Harbor-Pages/Verify.robot @@ -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 diff --git a/tests/robot-cases/Group3-Upgrade/data.json b/tests/robot-cases/Group3-Upgrade/data.json index a0a2858d2..20f27cf84 100644 --- a/tests/robot-cases/Group3-Upgrade/data.json +++ b/tests/robot-cases/Group3-Upgrade/data.json @@ -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":[