mirror of
				https://github.com/amix/vimrc
				synced 2025-10-31 06:33:35 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			356 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			356 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| ##############################################################################
 | |
| #                   Robot Framework Snippets for UltiSnips                   #
 | |
| ##############################################################################
 | |
| 
 | |
| priority -50
 | |
| 
 | |
| ######################
 | |
| #  Built In library  #
 | |
| ######################
 | |
| snippet cat "Catenate"
 | |
| \${${1:name}}=    Catenate    SEPARATOR=${2:---}    ${3:Hello}    ${4:world}
 | |
| endsnippet
 | |
| 
 | |
| snippet eval "Evaluate"
 | |
| \${${1:val}}=    Evaluate    ${2:${x} - 10}
 | |
| endsnippet
 | |
| 
 | |
| snippet for "FOR loop" b
 | |
| :FOR    ${${1:element}}    IN    ${2:@{ELEMENTS}}
 | |
| \    ${0:${VISUAL:Start Element}}    ${$1}
 | |
| endsnippet
 | |
| 
 | |
| snippet nop "No Operation"
 | |
| No Operation
 | |
| endsnippet
 | |
| 
 | |
| snippet rfk "Return From Keyword"
 | |
| Return From Keyword    ${1:${optional return value}}
 | |
| endsnippet
 | |
| 
 | |
| snippet rfki "Return From Keyword If"
 | |
| Return From Keyword If    '\${${1:rc}}' != '${2:abc}'    ${3:${optional return value}}
 | |
| endsnippet
 | |
| 
 | |
| snippet rk "Run Keyword"
 | |
| Run Keyword    ${1:${kw}}    ${2:${args}}
 | |
| endsnippet
 | |
| 
 | |
| snippet rkacof "Run Keyword And Continue On Failure"
 | |
| Run Keyword And Continue On Failure    ${1:${kw}}    ${2:${args}}
 | |
| endsnippet
 | |
| 
 | |
| snippet rkaee "Run Keyword And Expect Error"
 | |
| Run Keyword And Expect Error    ${1:My error}    ${2:${kw}}    ${3:${args}}
 | |
| endsnippet
 | |
| 
 | |
| snippet rkaie "Run Keyword And Ignore Error"
 | |
| Run Keyword And Ignore Error    ${1:${kw}}    ${2:${args}}
 | |
| \${${3:result}}    \${${4:return_value}}=    Run Keyword And Ignore Error    ${1:${kw}}    ${2:${args}}
 | |
| endsnippet
 | |
| 
 | |
| snippet rkar "Run Keyword And Return"
 | |
| Run Keyword And Return    ${1:${kw}}    ${2:${args}}
 | |
| endsnippet
 | |
| 
 | |
| snippet rkari "Run Keyword And Return If"
 | |
| Run Keyword And Return If    '\${${1:rc}}' != '${2:abc}'    ${3:${kw}}    ${4:${args}}
 | |
| endsnippet
 | |
| 
 | |
| snippet rkars "Run Keyword And Return Status"
 | |
| \${${3:result}}=    Run Keyword And Return Status    ${1:${kw}}    ${2:${args}}
 | |
| endsnippet
 | |
| 
 | |
| snippet rki "Run Keyword If"
 | |
| Run Keyword If    '\${${1:rc}}' != '${2:abc}'
 | |
| ...               ${3:${VISUAL:Some keyword returning a value}}
 | |
| ...    ELSE IF    '\${${4:str}}' != '${5:def}'
 | |
| ...               ${6:Another keyword}
 | |
| ...    ELSE
 | |
| ...               ${7:Final keyword}
 | |
| endsnippet
 | |
| 
 | |
| snippet rkiactf "Run Keyword If Any Critical Tests Failed"
 | |
| Run Keyword If Any Critical Tests Failed    ${1:${kw}}    ${2:${args}}
 | |
| endsnippet
 | |
| 
 | |
| snippet rkiactp "Run Keyword If All Critical Tests Passed"
 | |
| Run Keyword If All Critical Tests Passed    ${1:${kw}}    ${2:${args}}
 | |
| endsnippet
 | |
| 
 | |
| snippet rkiatf "Run Keyword If Any Tests Failed"
 | |
| Run Keyword If Any Tests Failed    ${1:${kw}}    ${2:${args}}
 | |
| endsnippet
 | |
| 
 | |
| snippet rkiatp "Run Keyword If All Tests Passed"
 | |
| Run Keyword If All Tests Passed    ${1:${kw}}    ${2:${args}}
 | |
| endsnippet
 | |
| 
 | |
| snippet rkitf "Run Keyword If Test Failed"
 | |
| Run Keyword If Test Failed    ${1:${kw}}    ${2:${args}}
 | |
| endsnippet
 | |
| 
 | |
| snippet rkitp "Run Keyword If Test Passed"
 | |
| Run Keyword If Test Passed    ${1:${kw}}    ${2:${args}}
 | |
| endsnippet
 | |
| 
 | |
| snippet rkito "Run Keyword If Timeout Occurred"
 | |
| Run Keyword If Timeout Occurred    ${1:${kw}}    ${2:${args}}
 | |
| endsnippet
 | |
| 
 | |
| snippet rks "Run Keywords"
 | |
| Run Keywords
 | |
| ...    ${1:${VISUAL:Initialize database    $\{DB NAME\}}}    AND
 | |
| ...    ${2:Clear logs}
 | |
| endsnippet
 | |
| 
 | |
| snippet rku "Run Keyword Unless"
 | |
| Run Keyword Unless    '\${${1:rc}}' != '${2:abc}'    ${3:${kw}}    ${4:${args}}
 | |
| endsnippet
 | |
| 
 | |
| snippet sgv "Set Global Variable"
 | |
| Set Global Variable    \${${1:name}}    ${2:${value}}
 | |
| endsnippet
 | |
| 
 | |
| snippet sbe "Should Be Equal"
 | |
| Should Be Equal    "\${${1:var}}"    "${2:expected value}"    ${3:"optional error msg"}	${4:ignore_case=True}
 | |
| endsnippet
 | |
| 
 | |
| snippet sleep "Sleep"
 | |
| Sleep    ${1:2 minutes 10 seconds}
 | |
| endsnippet
 | |
| 
 | |
| snippet ssv "Set Suite Variable"
 | |
| Set Suite Variable    \${${1:name}}    ${2:${value}}
 | |
| endsnippet
 | |
| 
 | |
| snippet stv "Set Test Variable"
 | |
| Set Test Variable    \${${1:name}}    ${2:${value}}
 | |
| endsnippet
 | |
| 
 | |
| snippet sv "Set Variable"
 | |
| \${${1:name}}=    Set Variable    ${2:${value}}
 | |
| endsnippet
 | |
| 
 | |
| snippet svi "Set Variable If"
 | |
| \${${1:var}}=    Set Variable If    '\${${2:rc}}' != '${3:abc}'
 | |
| `!p snip.rv = '...' + ' ' * (len(t[1]) + 23)` ${4:${value true}}
 | |
| `!p snip.rv = '...' + ' ' * (len(t[1]) + 23)` ${5:${value false}}
 | |
| endsnippet
 | |
| 
 | |
| snippet wuks "Wait Until Keyword Succeeds"
 | |
| Wait Until Keyword Succeeds    ${1:10x}    ${2:2s}    ${3:${VISUAL:Some Keyword}}
 | |
| endsnippet
 | |
| 
 | |
| 
 | |
| #####################
 | |
| #  Dialogs library  #
 | |
| #####################
 | |
| snippet pause "Pause test execution"
 | |
| Import library    Dialogs
 | |
| Pause execution
 | |
| endsnippet
 | |
| 
 | |
| snippet tpause "Teardown Pause - pause test execution only on failure"
 | |
| [Teardown]    Run Keyword If Test Failed    Run Keywords
 | |
| ...    Import library    Dialogs    AND
 | |
| ...    Pause execution
 | |
| endsnippet
 | |
| 
 | |
| 
 | |
| ##############################
 | |
| #  Selenium2Library library  #
 | |
| ##############################
 | |
| snippet cps "Capture Page Screenshot"
 | |
| Capture Page Screenshot    ${1:${optional filename}}
 | |
| endsnippet
 | |
| 
 | |
| snippet esbd "Element Should Be Disabled"
 | |
| Element Should Be Disabled    \${${1:locator}}
 | |
| endsnippet
 | |
| 
 | |
| snippet esbe "Element Should Be Enabled"
 | |
| Element Should Be Enabled    ${${1:locator}}
 | |
| endsnippet
 | |
| 
 | |
| snippet esbf "Element Should Be Focused"
 | |
| Element Should Be Focused    ${${1:locator}}
 | |
| endsnippet
 | |
| 
 | |
| snippet esbv "Element Should Be Visible"
 | |
| Element Should Be Visible    ${${1:locator}}    ${2:${optional message}}
 | |
| endsnippet
 | |
| 
 | |
| snippet esc "Element Should Contain"
 | |
| Element Should Contain    ${${1:locator}}    ${2:${expected}}    ${3:${optional message}}
 | |
| endsnippet
 | |
| 
 | |
| snippet esnbv "Element Should Not Be Visible"
 | |
| Element Should Not Be Visible    ${${1:locator}}    ${2:${optional message}}
 | |
| endsnippet
 | |
| 
 | |
| snippet esnc "Element Should Not Contain"
 | |
| Element Should Not Contain    ${${1:locator}}    ${2:${expected}}    ${3:${optional message}}
 | |
| endsnippet
 | |
| 
 | |
| snippet etsb "Element Text Should Be"
 | |
| Element Text Should Be    ${${1:locator}}    ${2:${expected}}    ${3:${optional message}}
 | |
| endsnippet
 | |
| 
 | |
| snippet eaj "Execute Async Javascript"
 | |
| Execute Async Javascript    ${1:${code line 1}}    ${2:${code line 2}}
 | |
| endsnippet
 | |
| 
 | |
| snippet ej "Execute Javascript"
 | |
| Execute Javascript    ${1:${code line 1}}    ${2:${code line 2}}
 | |
| endsnippet
 | |
| 
 | |
| snippet gwp "Get Window Position"
 | |
| \${${1:x}}    \${${2:y}}=    Get Window Position
 | |
| endsnippet
 | |
| 
 | |
| snippet gws "Get Window Size"
 | |
| \${${1:width}}    \${${2:height}}=    Get Window Size
 | |
| endsnippet
 | |
| 
 | |
| snippet mbw "Maximize Browser Window"
 | |
| Maximize Browser Window
 | |
| endsnippet
 | |
| 
 | |
| snippet md "Mouse Down"
 | |
| Mouse Down    ${${1:locator}}
 | |
| endsnippet
 | |
| 
 | |
| snippet mdoi "Mouse Down On Image"
 | |
| Mouse Down On Image    ${1:${locator}}
 | |
| endsnippet
 | |
| 
 | |
| snippet mdol "Mouse Down On Link"
 | |
| Mouse Down On Link    ${1:${locator}}
 | |
| endsnippet
 | |
| 
 | |
| snippet mout "Mouse Out"
 | |
| Mouse Out    ${1:${locator}}
 | |
| endsnippet
 | |
| 
 | |
| snippet mover "Mouse Over"
 | |
| Mouse Over    ${1:${locator}}
 | |
| endsnippet
 | |
| 
 | |
| snippet mu "Mouse Up"
 | |
| Mouse Up    ${1:${locator}}
 | |
| endsnippet
 | |
| 
 | |
| snippet ob "Open Browser"
 | |
| Open Browser    ${1:${url}}    ${2:${browser=firefox}}    ${3:${alias=None}}    ${4:${remote_url=False}}    ${5:${desired_capabilities=None}}    ${6:${ff_profile_dir=None}}
 | |
| endsnippet
 | |
| 
 | |
| snippet ocm "Open Context Menu"
 | |
| Open Context Menu    ${1:${locator}}
 | |
| endsnippet
 | |
| 
 | |
| snippet psc "Page Should Contain"
 | |
| Page Should Contain    ${1:${text}}    ${2:loglevel=INFO}
 | |
| endsnippet
 | |
| 
 | |
| snippet pscb "Page Should Contain Button"
 | |
| Page Should Contain Button    ${1:${locator}}    ${2:${message=}}    ${3:loglevel=INFO}
 | |
| endsnippet
 | |
| 
 | |
| snippet pscc "Page Should Contain Checkbox"
 | |
| Page Should Contain Checkbox    ${1:${locator}}    ${2:${message=}}    ${3:loglevel=INFO}
 | |
| endsnippet
 | |
| 
 | |
| snippet psce "Page Should Contain Element"
 | |
| Page Should Contain Element    ${1:${locator}}    ${2:${message=}}    ${3:loglevel=INFO}
 | |
| endsnippet
 | |
| 
 | |
| snippet psci "Page Should Contain Image"
 | |
| Page Should Contain Image    ${1:${locator}}    ${2:${message=}}    ${3:loglevel=INFO}
 | |
| endsnippet
 | |
| 
 | |
| snippet pscl "Page Should Contain Link"
 | |
| Page Should Contain Link    ${1:${locator}}    ${2:${message=}}    ${3:loglevel=INFO}
 | |
| endsnippet
 | |
| 
 | |
| snippet pscrb "Page Should Contain Radio Button"
 | |
| Page Should Contain Radio Button    ${1:${locator}}    ${2:${message=}}    ${3:loglevel=INFO}
 | |
| endsnippet
 | |
| 
 | |
| snippet psct "Page Should Contain Textfield"
 | |
| Page Should Contain Textfield    ${1:${locator}}    ${2:${message=}}    ${3:loglevel=INFO}
 | |
| endsnippet
 | |
| 
 | |
| snippet psnc "Page Should Not Contain"
 | |
| Page Should Not Contain    ${1:${text}}    ${2:loglevel=INFO}
 | |
| endsnippet
 | |
| 
 | |
| snippet psncb "Page Should Not Contain Button"
 | |
| Page Should Not Contain Button    ${1:${locator}}    ${2:${message=}}    ${3:loglevel=INFO}
 | |
| endsnippet
 | |
| 
 | |
| snippet psncc "Page Should Not Contain Checkbox"
 | |
| Page Should Not Contain Checkbox    ${1:${locator}}    ${2:${message=}}    ${3:loglevel=INFO}
 | |
| endsnippet
 | |
| 
 | |
| snippet psnce "Page Should Not Contain Element"
 | |
| Page Should Not Contain Element    ${1:${locator}}    ${2:${message=}}    ${3:loglevel=INFO}
 | |
| endsnippet
 | |
| 
 | |
| snippet psnci "Page Should Not Contain Image"
 | |
| Page Should Not Contain Image    ${1:${locator}}    ${2:${message=}}    ${3:loglevel=INFO}
 | |
| endsnippet
 | |
| 
 | |
| snippet psncl "Page Should Not Contain Link"
 | |
| Page Should Not Contain Link    ${1:${locator}}    ${2:${message=}}    ${3:loglevel=INFO}
 | |
| endsnippet
 | |
| 
 | |
| snippet psncrb "Page Should Not Contain Radio Button"
 | |
| Page Should Not Contain Radio Button    ${1:${locator}}    ${2:${message=}}    ${3:loglevel=INFO}
 | |
| endsnippet
 | |
| 
 | |
| snippet psnct "Page Should Not Contain Textfield"
 | |
| Page Should Not Contain Textfield    ${1:${locator}}    ${2:${message=}}    ${3:loglevel=INFO}
 | |
| endsnippet
 | |
| 
 | |
| snippet rktrof "Register Keyword To Run On Failure"
 | |
| Register Keyword To Run On Failure    ${1:${kw}}
 | |
| endsnippet
 | |
| 
 | |
| snippet wuec "Wait Until Element Contains"
 | |
| Wait Until Element Contains    ${1:${locator}}    ${2:${text}}    ${3:${timeout=None}}    ${4:${error=None}}
 | |
| endsnippet
 | |
| 
 | |
| snippet wuednc "Wait Until Element Does Not Contain"
 | |
| Wait Until Element Does Not Contain    ${1:${locator}}    ${2:${text}}    ${3:${timeout=None}}    ${4:${error=None}}
 | |
| endsnippet
 | |
| 
 | |
| snippet wueie "Wait Until Element Is Enabled"
 | |
| Wait Until Element Is Enabled    ${1:${locator}}    ${2:${timeout=None}}    ${3:${error=None}}
 | |
| endsnippet
 | |
| 
 | |
| snippet wueinv "Wait Until Element Is Not Visible"
 | |
| Wait Until Element Is Not Visible    ${1:${locator}}    ${2:${timeout=None}}    ${3:${error=None}}
 | |
| endsnippet
 | |
| 
 | |
| snippet wueiv "Wait Until Element Is Visible"
 | |
| Wait Until Element Is Visible    ${1:${locator}}    ${2:${timeout=None}}    ${3:${error=None}}
 | |
| endsnippet
 | |
| 
 | |
| snippet wupc "Wait Until Page Contains"
 | |
| Wait Until Page Contains    ${1:${text}}    ${2:${timeout=None}}    ${3:${error=None}}
 | |
| endsnippet
 | |
| 
 | |
| snippet wupce "Wait Until Page Contains Element"
 | |
| Wait Until Page Contains Element    ${1:${locator}}    ${2:${timeout=None}}    ${3:${error=None}}
 | |
| endsnippet
 | |
| 
 | |
| snippet wupdnc "Wait Until Page Does Not Contain"
 | |
| Wait Until Page Does Not Contain    ${1:${text}}    ${2:${timeout=None}}    ${3:${error=None}}
 | |
| endsnippet
 | |
| 
 | |
| snippet wupdnce "Wait Until Page Does Not Contain Element"
 | |
| Wait Until Page Does Not Contain Element    ${1:${locator}}    ${2:${timeout=None}}    ${3:${error=None}}
 | |
| endsnippet
 | |
| 
 | 
