-
Notifications
You must be signed in to change notification settings - Fork 2k
/
Copy pathrobot.snippets
355 lines (270 loc) · 10.7 KB
/
robot.snippets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
##############################################################################
# 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