Add retry for keyword go into index

1. Add retry for keyword go into index;
2. Add retry for keyword go into project.
Signed-off-by: danfengliu <danfengl@vmware.com>
This commit is contained in:
danfengliu 2020-05-22 02:56:03 +00:00
parent 2ff0638f8b
commit 5d8a308158
12 changed files with 1793 additions and 1789 deletions

View File

@ -5,7 +5,7 @@ Make Swagger Client
[Return] ${rc}
Setup API Test
Retry Keyword When Error Make Swagger Client
Retry Keyword N Times When Error 10 Make Swagger Client
Harbor API Test
[Arguments] ${testcase_name}

View File

@ -149,7 +149,7 @@ Docker Login
Docker Pull
[Arguments] ${image}
${output}= Retry Keyword When Error Wait Unitl Command Success docker pull ${image}
${output}= Retry Keyword N Times When Error 10 Wait Unitl Command Success docker pull ${image}
Log ${output}
Log To Console Docker Pull: \n ${output}
[Return] ${output}

View File

@ -36,7 +36,7 @@ GC Now
Retry GC Should Be Successful
[Arguments] ${history_id} ${expected_msg}
Retry Keyword When Error GC Should Be Successful ${history_id} ${expected_msg}
Retry Keyword N Times When Error 15 GC Should Be Successful ${history_id} ${expected_msg}
GC Should Be Successful
[Arguments] ${history_id} ${expected_msg}

View File

@ -21,18 +21,23 @@ Resource ../../resources/Util.robot
*** Keywords ***
Go Into Project
[Arguments] ${project} ${has_image}=${true}
Retry Keyword N Times When Error 5 Clear Search Input And Go Into Project ${project} ${has_image}
Clear Search Input And Go Into Project
[Arguments] ${project} ${has_image}
# Close prompt in header
Sleep 2
#go To ${url}
Reload Page
Sleep 2
# Clear Search Input
Retry Element Click xpath=//harbor-app/harbor-shell/clr-main-container/navigator/clr-header/div[1]/a/span
Sleep 2
Retry Text Input ${search_input} ${project}
:For ${n} IN RANGE 1 5
\ Sleep 2
\ ${out} Run Keyword If ${has_image}==${false} Retry Double Keywords When Error Retry Element Click xpath=//*[@id='project-results']//clr-dg-cell[contains(.,'${project}')]/a Wait Until Element Is Visible And Enabled xpath=//clr-dg-placeholder[contains(.,\"We couldn\'t find any repositories!\")] DoAssert=${false}
\ ... ELSE Retry Double Keywords When Error Retry Element Click xpath=//*[@id='project-results']//clr-dg-cell[contains(.,'${project}')]/a Wait Until Element Is Visible And Enabled xpath=//project-detail//hbr-repository-gridview//clr-dg-cell[contains(.,'${project}/')] DoAssert=${false}
\ Log To Console ${out}
\ Run Keyword If ${out} == 'PASS' Exit For Loop
\ Sleep 1
Should Be Equal ${out} 'PASS'
Sleep 2
# Go Into Project
${out} Run Keyword If ${has_image}==${false} Run Keywords Retry Element Click xpath=//*[@id='project-results']//clr-dg-cell[contains(.,'${project}')]/a AND Wait Until Element Is Visible And Enabled xpath=//clr-dg-placeholder[contains(.,\"We couldn\'t find any repositories!\")]
... ELSE Run Keywords Retry Element Click xpath=//*[@id='project-results']//clr-dg-cell[contains(.,'${project}')]/a AND Wait Until Element Is Visible And Enabled xpath=//project-detail//hbr-repository-gridview//clr-dg-cell[contains(.,'${project}/')]
Sleep 1
Add User To Project Admin

View File

@ -210,9 +210,20 @@ Go Into Repo
Retry Wait Element ${tag_table_column_size}
Capture Page Screenshot gointo_${repoName}.png
Go Into Index
[Arguments] ${index_name}=${null}
Retry Element Click ${artifact_achieve_icon}
Click Index Achieve
[Arguments] ${tag_name}
Retry Element Click //artifact-list-tab//clr-datagrid//clr-dg-row[contains(.,'sha256') and contains(.,'${tag_name}')]//clr-dg-cell[1]//clr-tooltip//a
Go Into Index And Contain Artifacts
[Arguments] ${tag_name} ${limit}=3
Retry Double Keywords When Error Click Index Achieve ${tag_name} Page Should Contain Element ${tag_table_column_os_arch}
:For ${n} IN RANGE 1 10
\ ${out} Run Keyword And Ignore Error Page Should Contain Element ${artifact_rows} limit=${limit}
\ Exit For Loop If '${out[0]}'=='PASS'
\ Capture Page Screenshot gointo_${tag_name}.png
\ Sleep 3
Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot
Should Be Equal As Strings '${out[0]}' 'PASS'
Switch To CardView
Retry Element Click xpath=//hbr-repository-gridview//span[@class='card-btn']/clr-icon

View File

@ -18,4 +18,7 @@ Documentation This resource provides any keywords related to public
*** Variables ***
${delete_btn} //clr-modal//button[contains(.,'DELETE')]
${delete_btn_2} //button[contains(.,'Delete')]
${default_scanner_info_close_icon} /html/body/harbor-app/harbor-shell/clr-main-container/div[1]/div[3]/clr-icon
${back_to_home_link} /html/body/harbor-app/harbor-shell/clr-main-container/div[2]/div/search-result/div/div[2]/a

View File

@ -86,7 +86,7 @@ Wait Until Element Is Visible And Enabled
Retry Action Keyword
[Arguments] ${keyword} @{param}
Retry Keyword When Error ${keyword} @{param}
Retry Keyword N Times When Error 3 ${keyword} @{param}
Retry Wait Element
[Arguments] ${element_xpath}
@ -226,19 +226,6 @@ Command Should be Failed
Should Not Be Equal As Strings '${rc}' '0'
[Return] ${output}
Retry Keyword When Error
[Arguments] ${keyword} @{elements}
:For ${n} IN RANGE 1 10
\ Log To Console Trying ${keyword} elements @{elements} ${n} times ...
\ ${out} Run Keyword And Ignore Error ${keyword} @{elements}
\ Log To Console Return value is ${out} and ${out[0]}
\ Run Keyword If '${keyword}'=='Make Swagger Client' Exit For Loop If '${out[0]}'=='PASS' and '${out[1]}'=='0'
\ ... ELSE Exit For Loop If '${out[0]}'=='PASS'
\ Sleep 10
Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot
Should Be Equal As Strings '${out[0]}' 'PASS'
[Return] ${out[1]}
Retry Keyword N Times When Error
[Arguments] ${times} ${keyword} @{elements}
:For ${n} IN RANGE 1 ${times}

View File

@ -611,8 +611,7 @@ Test Case - Push Docker Manifest Index and Display
Go Into Project test${d}
Wait Until Page Contains test${d}/index${d}
Go Into Repo test${d}/index${d}
Retry Double Keywords When Error Go Into Index index_name=${null} Page Should Contain Element ${tag_table_column_os_arch}
Page Should Contain Element ${artifact_rows} limit=2
Go Into Index And Contain Artifacts index_tag${d} limit=2
Close Browser
Test Case - Push CNAB Bundle and Display
@ -633,8 +632,7 @@ Test Case - Push CNAB Bundle and Display
Go Into Project test${d}
Wait Until Page Contains test${d}/cnab${d}
Go Into Repo test${d}/cnab${d}
Retry Double Keywords When Error Go Into Index index_name=${null} Page Should Contain Element ${tag_table_column_os_arch}
Page Should Contain Element ${artifact_rows} limit=3
Go Into Index And Contain Artifacts cnab_tag${d} limit=3
Close Browser
Test Case - Push Helm Chart and Display