Skip to content

Commit cf8fcec

Browse files
committed
add snippets
1 parent 1943df6 commit cf8fcec

File tree

1 file changed

+342
-0
lines changed

1 file changed

+342
-0
lines changed

snippets/webdriverio_snippets.json

Lines changed: 342 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,342 @@
1+
{
2+
"$$": {
3+
"prefix": "wd$$",
4+
"body": "browser.$$(${1:selector})",
5+
"description": "Short way to call the findElements command"
6+
},
7+
"$": {
8+
"prefix": "wd$",
9+
"body": "browser.$(${1:selector})",
10+
"description": "Short way to call the findElement command"
11+
},
12+
"call": {
13+
"prefix": "wdcall",
14+
"body": "browser.call(${1:callback})",
15+
"description": "Short way to call the findElement command"
16+
},
17+
"custom$$": {
18+
"prefix": "wdcustom$$",
19+
"body": "browser.custom$$(${1:strategyName}, ${2:strategyArguments})",
20+
"description": "Allows you to use a custom strategy declared by using browser.addLocatorStrategy"
21+
},
22+
"custom$": {
23+
"prefix": "wdcustom$",
24+
"body": "browser.custom$(${1:strategyName}, ${2:strategyArguments})",
25+
"description": "Allows you to use a custom strategy declared by using browser.addLocatorStrategy"
26+
},
27+
"debug": {
28+
"prefix": "wddebug",
29+
"body": "browser.debug()",
30+
"description": "Helps you to debug your integration tests"
31+
},
32+
"deleteCookies": {
33+
"prefix": "wddeleteCookies",
34+
"body": "browser.deleteCookies(${1:names})",
35+
"description": "Delete cookies visible to the current page"
36+
},
37+
"execute": {
38+
"prefix": "wdexecute",
39+
"body": "browser.execute(${1:script}, ${2:arguments})",
40+
"description": "Inject a snippet of JavaScript into the page for execution (synchronous) in the context of the currently selected frame"
41+
},
42+
"executeAsync": {
43+
"prefix": "wdexecuteAsync",
44+
"body": "browser.executeAsync(${1:script}, ${2:arguments})",
45+
"description": "Inject a snippet of JavaScript into the page for execution (asynchronous) in the context of the currently selected frame"
46+
},
47+
"getCookies": {
48+
"prefix": "wdgetCookies",
49+
"body": "browser.getCookies(${1:names})",
50+
"description": "Retrieve a cookie visible to the current page"
51+
},
52+
"getWindowSize": {
53+
"prefix": "wdgetWindowSize",
54+
"body": "browser.getWindowSize()",
55+
"description": "Returns browser window size"
56+
},
57+
"keys": {
58+
"prefix": "wdkeys",
59+
"body": "browser.keys(${1:value})",
60+
"description": "Send a sequence of key strokes to the active element"
61+
},
62+
"newWindow": {
63+
"prefix": "wdnewWindow",
64+
"body": "browser.newWindow(${1:url}, ${2:windowName}, ${3:windowFeatures})",
65+
"description": "Open new window in browser."
66+
},
67+
"pause": {
68+
"prefix": "wdpause",
69+
"body": "browser.pause(${1:milliseconds})",
70+
"description": "Pauses execution for a specific amount of time"
71+
},
72+
"react$$": {
73+
"prefix": "wdreact$$",
74+
"body": "browser.react$$(${1:selector}, ${2:props}, ${3:state})",
75+
"description": "Command is a useful command to query multiple React Components by their actual name"
76+
},
77+
"react$": {
78+
"prefix": "wdreact$",
79+
"body": "browser.react$$(${1:selector}, ${2:props}, ${3:state})",
80+
"description": "Command is a useful command to query React Components by their actual name"
81+
},
82+
"reloadSession": {
83+
"prefix": "wdreloadSession",
84+
"body": "browser.reloadSession()",
85+
"description": "Creates a new Selenium session with your current capabilities"
86+
},
87+
"saveRecordingScreen": {
88+
"prefix": "wdsaveRecordingScreen",
89+
"body": "browser.saveRecordingScreen(${1:filepath})",
90+
"description": "**Appium only. Save a video started by startRecordingScreen command to file."
91+
},
92+
"saveScreenshot": {
93+
"prefix": "wdsaveScreenshot",
94+
"body": "browser.saveScreenshot(${1:filepath})",
95+
"description": "Save a screenshot of the current browsing context to a PNG file on your OS."
96+
},
97+
"setCookies": {
98+
"prefix": "wdsetCookies",
99+
"body": "browser.setCookies(${1:cookie})",
100+
"description": "Sets one or more cookies for the current page"
101+
},
102+
"setTimeout": {
103+
"prefix": "wdsetTimeout",
104+
"body": "browser.setTimeout(${1:timeouts}, ${2:timeouts.implicit}, ${3:timeouts.pageLoad}, ${4:timeouts.script})",
105+
"description": "Sets the timeouts associated with the current session"
106+
},
107+
"setWindowSize": {
108+
"prefix": "wdsetWindowSize",
109+
"body": "browser.setWindowSize(${1:width}, ${2:height})",
110+
"description": "Resizes browser window outer size according to provided width and height."
111+
},
112+
"switchWindow": {
113+
"prefix": "wdswitchWindow",
114+
"body": "browser.switchWindow(${1:urlOrTitleToMatch})",
115+
"description": "Switch focus to a particular tab / window."
116+
},
117+
"touchAction": {
118+
"prefix": "wdtouchAction",
119+
"body": "browser.touchAction(${1:action})",
120+
"description": "Touch Action API provides the basis of all gestures that can be automated in Appium"
121+
},
122+
"uploadFile": {
123+
"prefix": "wduploadFile",
124+
"body": "browser.uploadFile(${1:localPath})",
125+
"description": "Uploads a file to the Selenium Standalone server or other browser driver"
126+
},
127+
"url": {
128+
"prefix": "wdurl",
129+
"body": "browser.url(${1:url})",
130+
"description": "Protocol binding to load the URL of the browser."
131+
},
132+
"waitUntil": {
133+
"prefix": "wdwaitUntil",
134+
"body": "browser.waitUntil(${1:condition}, ${2:timeout}, ${3:timeoutMsg}, ${4:interval})",
135+
"description": "This wait command is your universal weapon if you want to wait on something"
136+
},
137+
"element$$": {
138+
"prefix": "wdelement$$",
139+
"body": "$$(${1:selector})",
140+
"description": "When calling it from an element scope, the driver will look within the children of that element"
141+
},
142+
"element$": {
143+
"prefix": "wdelement$",
144+
"body": "$(${1:selector})",
145+
"description": "When calling it from an element scope, the driver will look within the children of that element"
146+
},
147+
"addValue": {
148+
"prefix": "wdaddValue",
149+
"body": "addValue(${1:value})",
150+
"description": "Add a value to an object found by given selector"
151+
},
152+
"clearValue": {
153+
"prefix": "wdclearValue",
154+
"body": "clearValue()",
155+
"description": "Clear a <textarea> or text <input> element’s value"
156+
},
157+
"click": {
158+
"prefix": "wdclick",
159+
"body": "click(${1:options}, ${2:options.button}, ${3:options.x}, ${4:options.y})",
160+
"description": "Click on an element."
161+
},
162+
"elementcustom$$": {
163+
"prefix": "wdelementcustom$$",
164+
"body": "custom$$(${1:strategyName}, ${2:strategyArguments})",
165+
"description": "allows you to use a custom strategy declared by using browser.addLocatorStrategy"
166+
},
167+
"elementcustom$": {
168+
"prefix": "wdelementcustom$",
169+
"body": "custom$(${1:strategyName}, ${2:strategyArguments})",
170+
"description": "allows you to use a custom strategy declared by using browser.addLocatorStrategy"
171+
},
172+
"doubleClick": {
173+
"prefix": "wddoubleClick",
174+
"body": "doubleClick()",
175+
"description": "Double-click on an element"
176+
},
177+
"dragAndDrop": {
178+
"prefix": "wddragAndDrop",
179+
"body": "dragAndDrop(${1:target}, ${2:duration})",
180+
"description": "Drag an item to a destination element."
181+
},
182+
"getAttribute": {
183+
"prefix": "wdgetAttribute",
184+
"body": "getAttribute(${1:attributeName})",
185+
"description": "Get an attribute from a DOM-element based on the attribute name."
186+
},
187+
"getCSSProperty": {
188+
"prefix": "wdgetCSSProperty",
189+
"body": "getCSSProperty(${1:cssProperty})",
190+
"description": "Get a css property from a DOM-element selected by given selector"
191+
},
192+
"getHTML": {
193+
"prefix": "wdgetHTML",
194+
"body": "getHTML(${1:includeSelectorTag})",
195+
"description": "Get source code of specified DOM element by selector."
196+
},
197+
"getLocation": {
198+
"prefix": "wdgetLocation",
199+
"body": "getLocation(${1:prop})",
200+
"description": "Determine an element’s location on the page."
201+
},
202+
"getProperty": {
203+
"prefix": "wdgetProperty",
204+
"body": "getProperty(${1:property})",
205+
"description": "The Get Element Property command will return the result of getting a property of an element."
206+
},
207+
"getSize": {
208+
"prefix": "wdgetSize",
209+
"body": "getSize(${1:prop})",
210+
"description": "Get the width and height for an DOM-element."
211+
},
212+
"getTagName": {
213+
"prefix": "wdgetTagName",
214+
"body": "getTagName()",
215+
"description": "Get tag name of a DOM-element."
216+
},
217+
"getText": {
218+
"prefix": "wdgetText",
219+
"body": "getText()",
220+
"description": "Get the text content from a DOM-element."
221+
},
222+
"getValue": {
223+
"prefix": "wdgetValue",
224+
"body": "getValue()",
225+
"description": "Get the value of a <textarea>, <select> or text <input> found by given selector."
226+
},
227+
"isClickable": {
228+
"prefix": "wdisClickable",
229+
"body": "isClickable()",
230+
"description": "Return true if the selected DOM-element exists, is visible, is within viewport, is not disabled"
231+
},
232+
"isDisplayed": {
233+
"prefix": "wdisDisplayed",
234+
"body": "isDisplayed()",
235+
"description": "Return true if the selected DOM-element is displayed."
236+
},
237+
"isDisplayedInViewport": {
238+
"prefix": "wdisDisplayedInViewport",
239+
"body": "isDisplayedInViewport()",
240+
"description": "Return true if the selected DOM-element found by given selector is partially visible and within the viewport."
241+
},
242+
"isEnabled": {
243+
"prefix": "wdisEnabled",
244+
"body": "isEnabled()",
245+
"description": "Return true or false if the selected DOM-element is enabled."
246+
},
247+
"isExisting": {
248+
"prefix": "wdisExisting",
249+
"body": "isExisting()",
250+
"description": "Returns true if element exists in the DOM"
251+
},
252+
"isFocused": {
253+
"prefix": "wdisFocused",
254+
"body": "isFocused()",
255+
"description": "Return true or false if the selected DOM-element currently has focus."
256+
},
257+
"isSelected": {
258+
"prefix": "wdisSelected",
259+
"body": "isSelected()",
260+
"description": "Will return true or false whether or not an <option> or <input> element of type checkbox or radio is currently selected."
261+
},
262+
"moveTo": {
263+
"prefix": "wdmoveTo",
264+
"body": "moveTo(${1:xoffset}, ${2:yoffset})",
265+
"description": "Move the mouse by an offset of the specified element."
266+
},
267+
"elementReact$$": {
268+
"prefix": "wdelementreact$$",
269+
"body": "react$$(${1:selector}, ${2:props}, ${3:state})",
270+
"description": "Command is a useful command to query multiple React Components by their actual name "
271+
},
272+
"elementReact$": {
273+
"prefix": "wdelementreact$",
274+
"body": "react$(${1:selector}, ${2:props}, ${3:state})",
275+
"description": "Command is a useful command to query multiple React Components by their actual name "
276+
},
277+
"elementSaveScreenshot": {
278+
"prefix": "wdelementsaveScreenshot",
279+
"body": "saveScreenshot(${1:filename})",
280+
"description": "Save a screenshot of an element to a PNG file on your OS."
281+
},
282+
"scrollIntoView": {
283+
"prefix": "wdscrollIntoView",
284+
"body": "scrollIntoView(${1:scrollIntoViewOptions})",
285+
"description": "Scroll element into viewport."
286+
},
287+
"selectByAttribute": {
288+
"prefix": "wdselectByAttribute",
289+
"body": "selectByAttribute(${1:attribute}, ${2:value})",
290+
"description": "Select option with a specific value."
291+
},
292+
"selectByIndex": {
293+
"prefix": "wdselectByIndex",
294+
"body": "selectByIndex(${1:index})",
295+
"description": "Select option with a specific index."
296+
},
297+
"selectByVisibleText": {
298+
"prefix": "wdselectByVisibleText",
299+
"body": "selectByVisibleText(${1:text})",
300+
"description": "Select option with displayed text matching the argument."
301+
},
302+
"setValue": {
303+
"prefix": "wdsetValue",
304+
"body": "setValue(${1:value})",
305+
"description": "Send a sequence of key strokes to an element (clears value before)"
306+
},
307+
"shadow$$": {
308+
"prefix": "wdshadow$$",
309+
"body": "shadow$$(${1:selector})",
310+
"description": "Access elements inside a given element's shadowRoot"
311+
},
312+
"shadow$": {
313+
"prefix": "wdshadow$",
314+
"body": "shadow$(${1:selector})",
315+
"description": "Access element inside a given element's shadowRoot"
316+
},
317+
"elementTouchAction": {
318+
"prefix": "wdelementtouchAction",
319+
"body": "touchAction(${1:action})",
320+
"description": "The Touch Action API provides the basis of all gestures that can be automated in Appium"
321+
},
322+
"waitForClickable": {
323+
"prefix": "wdwaitForClickable",
324+
"body": "waitForClickable(${1:options}, ${2:options.timeout}, ${3:options.reverse}, ${4:options.timeoutMsg}, ${5:options.interval})",
325+
"description": "Wait for an element for the provided amount of milliseconds to be clickable or not clickable."
326+
},
327+
"waitForDisplayed": {
328+
"prefix": "wdwaitForDisplayed",
329+
"body": "waitForDisplayed(${1:ms}, ${2:reverse}, ${3:error})",
330+
"description": "Wait for an element for the provided amount of milliseconds to be displayed or not displayed."
331+
},
332+
"waitForEnabled": {
333+
"prefix": "wdwaitForEnabled",
334+
"body": "waitForEnabled(${1:ms}, ${2:reverse}, ${3:error})",
335+
"description": "Wait for an element (selected by css selector) for the provided amount of milliseconds to be (dis/en)abled."
336+
},
337+
"waitForExist": {
338+
"prefix": "wdwaitForExist",
339+
"body": "waitForExist(${1:ms}, ${2:reverse}, ${3:error})",
340+
"description": "WWait for an element for the provided amount of milliseconds to be present within the DOM."
341+
}
342+
}

0 commit comments

Comments
 (0)