In project.robot, many element click or other action keywords missing retry, it will cause innessesary sleep in scripts. (#7274)

Signed-off-by: danfengliu <danfengl@vmware.com>
This commit is contained in:
danfengliu 2019-04-09 10:44:24 +08:00 committed by GitHub
parent a8ff6aa934
commit 0e0c691225
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,19 +23,13 @@ ${HARBOR_VERSION} v1.1.1
Create An New Project Create An New Project
[Arguments] ${projectname} ${public}=false [Arguments] ${projectname} ${public}=false
Navigate To Projects Navigate To Projects
${element_create_project_button}= Set Variable xpath=${create_project_button_xpath} Retry Button Click xpath=${create_project_button_xpath}
Wait Until Element Is Visible And Enabled ${element_create_project_button}
Click Button ${element_create_project_button}
Log To Console Project Name: ${projectname} Log To Console Project Name: ${projectname}
${elemen_project_name}= Set Variable xpath=${project_name_xpath} Retry Text Input xpath=${project_name_xpath} ${projectname}
Wait Until Element Is Visible And Enabled ${elemen_project_name}
Input Text ${elemen_project_name} ${projectname}
${element_project_public}= Set Variable xpath=${project_public_xpath} ${element_project_public}= Set Variable xpath=${project_public_xpath}
Run Keyword If '${public}' == 'true' Run Keywords Wait Until Element Is Visible And Enabled ${element_project_public} AND Click Element ${element_project_public} Run Keyword If '${public}' == 'true' Run Keywords Wait Until Element Is Visible And Enabled ${element_project_public} AND Click Element ${element_project_public}
${element_create_project_OK_button_xpath}= Set Variable ${create_project_OK_button_xpath} Retry Element Click ${create_project_OK_button_xpath}
Wait Until Element Is Visible And Enabled ${element_create_project_OK_button_xpath} Retry Wait Until Page Not Contains Element ${create_project_CANCEL_button_xpath}
Click Element ${element_create_project_OK_button_xpath}
Wait Until Page Does Not Contain Element ${create_project_CANCEL_button_xpath}
Go Into Project ${projectname} has_image=${false} Go Into Project ${projectname} has_image=${false}
Create An New Project With New User Create An New Project With New User
@ -48,42 +42,37 @@ Create An New Project With New User
#It's the log of project. #It's the log of project.
Go To Project Log Go To Project Log
Click Element xpath=${project_log_xpath} Retry Element Click xpath=${project_log_xpath}
Sleep 2 Sleep 2
Switch To Member Switch To Member
Sleep 3 Sleep 3
Click Element xpath=${project_member_xpath} Retry Element Click xpath=${project_member_xpath}
Sleep 1 Sleep 1
Switch To Log Switch To Log
Wait Until Element Is Enabled xpath=${log_xpath} Retry Element Click xpath=${log_xpath}
Wait Until Element Is Visible xpath=${log_xpath}
Click Element xpath=${log_xpath}
Sleep 1 Sleep 1
Switch To Replication Switch To Replication
Click Element xpath=${project_replication_xpath} Retry Element Click xpath=${project_replication_xpath}
Sleep 1 Sleep 1
Navigate To Projects Navigate To Projects
${element}= Set Variable xpath=${projects_xpath} Retry Element Click xpath=${projects_xpath}
Wait Until Element Is Visible And Enabled ${element}
Click Element ${element}
Sleep 2 Sleep 2
Project Should Display Project Should Display
[Arguments] ${projectname} [Arguments] ${projectname}
${element}= Set Variable xpath=//project//list-project//clr-dg-cell/a[contains(.,'${projectname}')] Retry Wait Element xpath=//project//list-project//clr-dg-cell/a[contains(.,'${projectname}')]
Wait Until Element Is Visible And Enabled ${element}
Project Should Not Display Project Should Not Display
[Arguments] ${projectname} [Arguments] ${projectname}
Page Should Not Contain Element xpath=//project//list-project//clr-dg-cell/a[contains(.,'${projectname}')] Retry Wait Until Page Not Contains Element xpath=//project//list-project//clr-dg-cell/a[contains(.,'${projectname}')]
Search Private Projects Search Private Projects
Click element xpath=//select Retry Element Click xpath=//select
Click element xpath=//select/option[@value=1] Retry Element Click xpath=//select/option[@value=1]
Sleep 1 Sleep 1
Capture Page Screenshot SearchPrivateProjects.png Capture Page Screenshot SearchPrivateProjects.png
@ -122,71 +111,53 @@ Delete Repo on CardView
Delete Project Delete Project
[Arguments] ${projectname} [Arguments] ${projectname}
Navigate To Projects Navigate To Projects
Sleep 1 Retry Element Click xpath=//clr-dg-row[contains(.,'${projectname}')]//clr-checkbox-wrapper//label
Click Element xpath=//clr-dg-row[contains(.,'${projectname}')]//clr-checkbox-wrapper//label Retry Element Click xpath=//button[contains(.,'Delete')]
Sleep 1 Retry Element Click //clr-modal//button[contains(.,'DELETE')]
Click Element xpath=//button[contains(.,'Delete')]
Sleep 2
Click Element //clr-modal//button[contains(.,'DELETE')]
Sleep 1 Sleep 1
Project Should Not Be Deleted Project Should Not Be Deleted
[Arguments] ${projname} [Arguments] ${projname}
Delete Project ${projname} Delete Project ${projname}
Sleep 1 Retry Wait Until Page Contains Element //clr-tab-content//div[contains(.,'${projname}')]/../div/clr-icon[@shape='error-standard']
Page Should Contain Element //clr-tab-content//div[contains(.,'${projname}')]/../div/clr-icon[@shape='error-standard']
Project Should Be Deleted Project Should Be Deleted
[Arguments] ${projname} [Arguments] ${projname}
Delete Project ${projname} Delete Project ${projname}
Sleep 2 Retry Wait Until Page Contains Element //clr-tab-content//div[contains(.,'${projname}')]/../div/clr-icon[@shape='success-standard']
Page Should Contain Element //clr-tab-content//div[contains(.,'${projname}')]/../div/clr-icon[@shape='success-standard']
Advanced Search Should Display Advanced Search Should Display
Page Should Contain Element xpath=//audit-log//div[@class='flex-xs-middle']/button Retry Wait Until Page Contains 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 Do Log Advanced Search
Capture Page Screenshot LogAdvancedSearch.png Capture Page Screenshot LogAdvancedSearch.png
Sleep 1 Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'pull')]
Page Should Contain Element xpath=//clr-dg-row[contains(.,'pull')] Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'push')]
Page Should Contain Element xpath=//clr-dg-row[contains(.,'push')] Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'create')]
Page Should Contain Element xpath=//clr-dg-row[contains(.,'create')] Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'delete')]
Page Should Contain Element xpath=//clr-dg-row[contains(.,'delete')] Retry Element Click xpath=//audit-log//div[@class='flex-xs-middle']/button
Sleep 1 Retry Element Click xpath=//project-detail//audit-log//clr-dropdown/button
Click Element xpath=//audit-log//div[@class='flex-xs-middle']/button
Sleep 1
Click Element xpath=//project-detail//audit-log//clr-dropdown/button
Sleep 1
#pull log #pull log
Sleep 1 Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Pull')]
Click Element xpath=//audit-log//clr-dropdown//a[contains(.,'Pull')] Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'pull')]
Sleep 1
Page Should Not Contain Element xpath=//clr-dg-row[contains(.,'pull')]
#push log #push log
Click Element xpath=//audit-log//clr-dropdown/button Retry Element Click xpath=//audit-log//clr-dropdown/button
Sleep 1 Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Push')]
Click Element xpath=//audit-log//clr-dropdown//a[contains(.,'Push')] Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'push')]
Sleep 1
Page Should Not Contain Element xpath=//clr-dg-row[contains(.,'push')]
#create log #create log
Click Element xpath=//audit-log//clr-dropdown/button Retry Element Click xpath=//audit-log//clr-dropdown/button
Sleep 1 Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Create')]
Click Element xpath=//audit-log//clr-dropdown//a[contains(.,'Create')] Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'create')]
Sleep 1
Page Should Not Contain Element xpath=//clr-dg-row[contains(.,'create')]
#delete log #delete log
Click Element xpath=//audit-log//clr-dropdown/button Retry Element Click xpath=//audit-log//clr-dropdown/button
Sleep 1 Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Delete')]
Click Element xpath=//audit-log//clr-dropdown//a[contains(.,'Delete')] Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'delete')]
Sleep 1
Page Should Not Contain Element xpath=//clr-dg-row[contains(.,'delete')]
#others #others
Click Element xpath=//audit-log//clr-dropdown/button Retry Element Click xpath=//audit-log//clr-dropdown/button
Click Element xpath=//audit-log//clr-dropdown//a[contains(.,'Others')] Retry Element Click xpath=//audit-log//clr-dropdown//a[contains(.,'Others')]
Sleep 1 Retry Element Click xpath=//audit-log//hbr-filter//clr-icon
Click Element xpath=//audit-log//hbr-filter//clr-icon Retry Text Input xpath=//audit-log//hbr-filter//input harbor
Input Text xpath=//audit-log//hbr-filter//input harbor
Sleep 1 Sleep 1
Capture Page Screenshot LogAdvancedSearch2.png Capture Page Screenshot LogAdvancedSearch2.png
${rc} = Get Matching Xpath Count //audit-log//clr-dg-row ${rc} = Get Matching Xpath Count //audit-log//clr-dg-row
@ -204,74 +175,61 @@ Go Into Repo
Capture Page Screenshot gointo_${repoName}.png Capture Page Screenshot gointo_${repoName}.png
Switch To CardView Switch To CardView
Sleep 2 Retry Element Click xpath=//hbr-repository-gridview//span[@class='card-btn']/clr-icon
Click Element xpath=//hbr-repository-gridview//span[@class='card-btn']/clr-icon
Sleep 5 Sleep 5
Expand Repo Expand Repo
[Arguments] ${projectname} [Arguments] ${projectname}
Click Element //repository//clr-dg-row[contains(.,'${projectname}')]//button/clr-icon Retry Element Click //repository//clr-dg-row[contains(.,'${projectname}')]//button/clr-icon
Sleep 1 Sleep 1
Edit Repo Info Edit Repo Info
Click Element //*[@id='repo-info'] Retry Element Click //*[@id='repo-info']
Sleep 1 Retry Wait Until Page Contains Element //*[@id='info']/form/div[2]
Page Should Contain Element //*[@id='info']/form/div[2]
# Cancel input # Cancel input
Click Element xpath=//*[@id='info-edit-button']/button Retry Element Click xpath=//*[@id='info-edit-button']/button
Input Text xpath=//*[@id='info']/form/div[2]/textarea test_description_info Input Text xpath=//*[@id='info']/form/div[2]/textarea test_description_info
Click Element xpath=//*[@id='info']/form/div[3]/button[2] Retry Element Click xpath=//*[@id='info']/form/div[3]/button[2]
Sleep 1 Retry Element Click xpath=//*[@id='info']/form/confirmation-dialog/clr-modal/div/div[1]/div[1]/div/div[3]/button[2]
Click Element xpath=//*[@id='info']/form/confirmation-dialog/clr-modal/div/div[1]/div[1]/div/div[3]/button[2] Retry Wait Until Page Contains Element //*[@id='info']/form/div[2]
Sleep 1
Page Should Contain Element //*[@id='info']/form/div[2]
# Confirm input # Confirm input
Click Element xpath=//*[@id='info-edit-button']/button Retry Element Click xpath=//*[@id='info-edit-button']/button
Input Text xpath=//*[@id='info']/form/div[2]/textarea test_description_info Input Text xpath=//*[@id='info']/form/div[2]/textarea test_description_info
Click Element xpath=//*[@id='info']/form/div[3]/button[1] Retry Element Click xpath=//*[@id='info']/form/div[3]/button[1]
Sleep 1 Retry Wait Until Page Contains test_description_info
Page Should Contain test_description_info
Capture Page Screenshot RepoInfo.png Capture Page Screenshot RepoInfo.png
Switch To Project Label Switch To Project Label
Click Element xpath=//project-detail//a[contains(.,'Labels')] Retry Element Click xpath=//project-detail//a[contains(.,'Labels')]
Sleep 1 Sleep 1
Switch To Project Repo Switch To Project Repo
Click Element xpath=//project-detail//a[contains(.,'Repositories')] Retry Element Click xpath=//project-detail//a[contains(.,'Repositories')]
Sleep 1 Sleep 1
Add Labels To Tag Add Labels To Tag
[Arguments] ${tagName} ${labelName} [Arguments] ${tagName} ${labelName}
Click Element xpath=//clr-dg-row[contains(.,'${tagName}')]//label Retry Element Click xpath=//clr-dg-row[contains(.,'${tagName}')]//label
Capture Page Screenshot add_${labelName}.png Capture Page Screenshot add_${labelName}.png
Sleep 1 Retry Element Click xpath=//clr-dg-action-bar//clr-dropdown//button
Click Element xpath=//clr-dg-action-bar//clr-dropdown//button Retry Element Click xpath=//clr-dropdown//div//label[contains(.,'${labelName}')]
Sleep 1 Retry Wait Until Page Contains Element xpath=//clr-dg-row//label[contains(.,'${labelName}')]
Click Element xpath=//clr-dropdown//div//label[contains(.,'${labelName}')]
Sleep 3
Page Should Contain Element xpath=//clr-dg-row//label[contains(.,'${labelName}')]
Filter Labels In Tags Filter Labels In Tags
[Arguments] ${labelName1} ${labelName2} [Arguments] ${labelName1} ${labelName2}
Sleep 2 Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
Click Element xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon Retry Wait Until Page Contains Element xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName1}')]
Sleep 2 Retry Element Click xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName1}')]
Page Should Contain Element xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName1}')] Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
Click Element xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName1}')] Retry Wait Until Page Contains Element xpath=//clr-datagrid//label[contains(.,'${labelName1}')]
Sleep 2
Click Element xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
Page Should Contain Element xpath=//clr-datagrid//label[contains(.,'${labelName1}')]
Click Element xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
Sleep 2 Retry Element Click xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName2}')]
Click Element xpath=//*[@id='filterArea']//div//button[contains(.,'${labelName2}')] Retry Element Click xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
Sleep 2
Click Element xpath=//*[@id='filterArea']//hbr-filter/span/clr-icon
Sleep 2 Sleep 2
Capture Page Screenshot filter_${labelName2}.png Capture Page Screenshot filter_${labelName2}.png
Page Should Contain Element xpath=//clr-dg-row[contains(.,'${labelName2}')] Retry Wait Until Page Contains Element xpath=//clr-dg-row[contains(.,'${labelName2}')]
Page Should Not Contain Element xpath=//clr-dg-row[contains(.,'${labelName1}')] Retry Wait Until Page Not Contains Element xpath=//clr-dg-row[contains(.,'${labelName1}')]
Get Statics Private Repo Get Statics Private Repo
${privaterepo}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[2]/statistics/div/span[1] ${privaterepo}= Get Text //project/div/div/div[1]/div/statistics-panel/div/div[2]/div[1]/div[2]/div[2]/statistics/div/span[1]