In nightly test, 2 errors occurred, chrome webdrive initializtion failed, and delete repoitory on card view failed too, so add a retry for ffailure and add some sleep. (#7012)

Add retry in keyword "Delete Repo".

Signed-off-by: danfengliu <danfengl@vmware.com>
This commit is contained in:
danfengliu 2019-02-26 13:37:16 +08:00 committed by Yan
parent 091ed91ad8
commit a9b27b0071
4 changed files with 26 additions and 13 deletions

View File

@ -111,20 +111,24 @@ Make Project Public
Delete Repo
[Arguments] ${projectname}
${element_repo_checkbox}= Set Variable xpath=//clr-dg-row[contains(.,'${projectname}')]//clr-checkbox-wrapper//label
Retry Element Click ${element_repo_checkbox}
Capture Page Screenshot
Sleep 2
Capture Page Screenshot
Retry Element Click ${repo_delete_btn}
:For ${n} IN RANGE 1 6
\ Log To Console Trying Delete Repo ${n} times ...
\ ${out1} Run Keyword And Ignore Error Retry Element Click ${element_repo_checkbox}
\ Capture Page Screenshot
\ ${out2} Run Keyword And Ignore Error Retry Element Click ${repo_delete_btn}
\ Capture Page Screenshot
\ Log To Console Return value is ${out1[0]} ${out2[0]}
\ Exit For Loop If '${out1[0]}'=='PASS' and '${out2[0]}'=='PASS'
\ Sleep 2
Retry Element Click ${repo_delete_confirm_btn}
Sleep 2
Delete Repo on CardView
[Arguments] ${reponame}
Click Element //hbr-gridview//span[contains(.,'${reponame}')]//clr-dropdown/button
Wait Until Element Is Visible //hbr-gridview//span[contains(.,'${reponame}')]//clr-dropdown/clr-dropdown-menu/button[contains(.,'Delete')]
Click Element //hbr-gridview//span[contains(.,'${reponame}')]//clr-dropdown/clr-dropdown-menu/button[contains(.,'Delete')]
Wait Until Element Is Visible //clr-modal//button[contains(.,'DELETE')]
Click Element //clr-modal//button[contains(.,'DELETE')]
Retry Element Click //hbr-gridview//span[contains(.,'${reponame}')]//clr-dropdown/button
Retry Element Click //hbr-gridview//span[contains(.,'${reponame}')]//clr-dropdown/clr-dropdown-menu/button[contains(.,'Delete')]
Retry Element Click ${repo_delete_on_card_view_btn}
Sleep 2
Delete Project
[Arguments] ${projectname}

View File

@ -32,3 +32,4 @@ ${project_statistics_private_repository_icon} xpath=//project/div/div/div[1]/di
${repo_delete_btn} xpath=//button[contains(.,'Delete')]
${repo_delete_confirm_btn} xpath=//clr-modal//button[2]
${repo_retag_confirm_dlg} css=${modal-dialog}
${repo_delete_on_card_view_btn} //clr-modal//button[contains(.,'DELETE')]

View File

@ -36,5 +36,13 @@ Init Chrome Driver
Call Method ${chrome options} add_argument --no-sandbox
Call Method ${chrome options} add_argument --window-size\=1600,900
${chrome options.binary_location} Set Variable /usr/bin/google-chrome
Create Webdriver Chrome Chrome_headless chrome_options=${chrome options} desired_capabilities=${capabilities}
#Create Webdriver Chrome Chrome_headless chrome_options=${chrome options} desired_capabilities=${capabilities}
:For ${n} IN RANGE 1 6
\ Log To Console Trying Create Webdriver ${n} times ...
\ ${out} Run Keyword And Ignore Error Create Webdriver Chrome Chrome_headless chrome_options=${chrome options} desired_capabilities=${capabilities}
\ Log To Console Return value is ${out[0]}
\ Exit For Loop If '${out[0]}'=='PASS'
\ Sleep 2
Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot
Should Be Equal As Strings '${out[0]}' 'PASS'
Sleep 5

View File

@ -141,7 +141,7 @@ Wait Unitl Command Success
\ Run Keyword If ${positive} == ${true} Exit For Loop If '${rc}'=='0'
\ ... ELSE Exit For Loop If '${rc}'!='0'
\ Sleep 2
Log ${output}
Log Command Result is ${output}
Run Keyword If ${positive} == ${true} Should Be Equal As Strings '${rc}' '0'
... ELSE Should Not Be Equal As Strings '${rc}' '0'
[Return] ${output}
@ -155,4 +155,4 @@ Retry Keyword When Error
\ Exit For Loop If '${out[0]}'=='PASS'
\ Sleep 2
Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot
Should Be Equal As Strings '${out[0]}' 'PASS'
Should Be Equal As Strings '${out[0]}' 'PASS'