codeceptjs 3.5.0 → 3.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +3 -3
- package/docs/ai.md +11 -9
- package/docs/build/OpenAI.js +14 -10
- package/docs/build/Playwright.js +60 -28
- package/docs/build/Puppeteer.js +56 -0
- package/docs/build/TestCafe.js +58 -1
- package/docs/build/WebDriver.js +55 -0
- package/docs/changelog.md +27 -0
- package/docs/helpers/Playwright.md +201 -166
- package/docs/helpers/Puppeteer.md +148 -102
- package/docs/helpers/TestCafe.md +95 -49
- package/docs/helpers/WebDriver.md +150 -104
- package/docs/plugins.md +1 -1
- package/docs/webapi/blur.mustache +17 -0
- package/docs/webapi/focus.mustache +12 -0
- package/lib/cli.js +9 -1
- package/lib/command/init.js +10 -0
- package/lib/event.js +2 -0
- package/lib/helper/OpenAI.js +14 -10
- package/lib/helper/Playwright.js +48 -45
- package/lib/helper/Puppeteer.js +27 -0
- package/lib/helper/TestCafe.js +29 -1
- package/lib/helper/WebDriver.js +26 -0
- package/lib/helper/scripts/blurElement.js +17 -0
- package/lib/helper/scripts/focusElement.js +17 -0
- package/lib/interfaces/gherkin.js +8 -0
- package/lib/plugin/heal.js +5 -7
- package/lib/recorder.js +7 -4
- package/lib/utils.js +13 -0
- package/package.json +7 -10
- package/typings/promiseBasedTypes.d.ts +130 -13
- package/typings/types.d.ts +134 -17
|
@@ -30,22 +30,22 @@ Type: [object][16]
|
|
|
30
30
|
- `browser` **[string][17]** Browser in which to perform testing.
|
|
31
31
|
- `basicAuth` **[string][17]?** (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
|
|
32
32
|
- `host` **[string][17]?** WebDriver host to connect.
|
|
33
|
-
- `port` **[number][
|
|
33
|
+
- `port` **[number][22]?** WebDriver port to connect.
|
|
34
34
|
- `protocol` **[string][17]?** protocol for WebDriver server.
|
|
35
35
|
- `path` **[string][17]?** path to WebDriver server.
|
|
36
|
-
- `restart` **[boolean][
|
|
37
|
-
- `smartWait` **([boolean][
|
|
38
|
-
- `disableScreenshots` **[boolean][
|
|
39
|
-
- `fullPageScreenshots` **[boolean][
|
|
40
|
-
- `uniqueScreenshotNames` **[boolean][
|
|
41
|
-
- `keepBrowserState` **[boolean][
|
|
42
|
-
- `keepCookies` **[boolean][
|
|
36
|
+
- `restart` **[boolean][32]?** restart browser between tests.
|
|
37
|
+
- `smartWait` **([boolean][32] | [number][22])?** **enables [SmartWait][36]**; wait for additional milliseconds for element to appear. Enable for 5 secs: "smartWait": 5000.
|
|
38
|
+
- `disableScreenshots` **[boolean][32]?** don't save screenshots on failure.
|
|
39
|
+
- `fullPageScreenshots` **[boolean][32]?** (optional - make full page screenshots on failure.
|
|
40
|
+
- `uniqueScreenshotNames` **[boolean][32]?** option to prevent screenshot override if you have scenarios with the same name in different suites.
|
|
41
|
+
- `keepBrowserState` **[boolean][32]?** keep browser state between tests when `restart` is set to false.
|
|
42
|
+
- `keepCookies` **[boolean][32]?** keep cookies between tests when `restart` set to false.
|
|
43
43
|
- `windowSize` **[string][17]?** default window size. Set to `maximize` or a dimension in the format `640x480`.
|
|
44
|
-
- `waitForTimeout` **[number][
|
|
44
|
+
- `waitForTimeout` **[number][22]?** sets default wait time in _ms_ for all `wait*` functions.
|
|
45
45
|
- `desiredCapabilities` **[object][16]?** Selenium's [desired capabilities][6].
|
|
46
|
-
- `manualStart` **[boolean][
|
|
47
|
-
- `timeouts` **[object][16]?** [WebDriver timeouts][
|
|
48
|
-
- `highlightElement` **[boolean][
|
|
46
|
+
- `manualStart` **[boolean][32]?** do not start browser before a test, start it manually inside a helper with `this.helpers["WebDriver"]._startBrowser()`.
|
|
47
|
+
- `timeouts` **[object][16]?** [WebDriver timeouts][37] defined as hash.
|
|
48
|
+
- `highlightElement` **[boolean][32]?** highlight the interacting elements
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
|
|
@@ -496,6 +496,29 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
|
496
496
|
- `pathToFile` **[string][17]** local file path relative to codecept.conf.ts or codecept.conf.js config file.
|
|
497
497
|
⚠️ returns a _promise_ which is synchronized internally by recorderAppium: not tested
|
|
498
498
|
|
|
499
|
+
### blur
|
|
500
|
+
|
|
501
|
+
Remove focus from a text input, button, etc.
|
|
502
|
+
Calls [blur][19] on the element.
|
|
503
|
+
|
|
504
|
+
Examples:
|
|
505
|
+
|
|
506
|
+
```js
|
|
507
|
+
I.blur('.text-area')
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
```js
|
|
511
|
+
//element `#product-tile` is focused
|
|
512
|
+
I.see('#add-to-cart-btn');
|
|
513
|
+
I.blur('#product-tile')
|
|
514
|
+
I.dontSee('#add-to-cart-btn');
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
#### Parameters
|
|
518
|
+
|
|
519
|
+
- `locator` **([string][17] | [object][16])** field located by label|name|CSS|XPath|strict locator.
|
|
520
|
+
- `options` **any?** Playwright only: [Additional options][20] for available options object as 2nd argument.
|
|
521
|
+
|
|
499
522
|
### cancelPopup
|
|
500
523
|
|
|
501
524
|
Dismisses the active JavaScript popup, as created by window.alert|window.confirm|window.prompt.
|
|
@@ -606,7 +629,7 @@ I.closeOtherTabs();
|
|
|
606
629
|
|
|
607
630
|
### defineTimeout
|
|
608
631
|
|
|
609
|
-
Set [WebDriver timeouts][
|
|
632
|
+
Set [WebDriver timeouts][21] in realtime.
|
|
610
633
|
|
|
611
634
|
Timeouts are expected to be passed as object:
|
|
612
635
|
|
|
@@ -813,7 +836,7 @@ I.dragSlider('#slider', -70);
|
|
|
813
836
|
#### Parameters
|
|
814
837
|
|
|
815
838
|
- `locator` **([string][17] | [object][16])** located by label|name|CSS|XPath|strict locator.
|
|
816
|
-
- `offsetX` **[number][
|
|
839
|
+
- `offsetX` **[number][22]** position to drag.
|
|
817
840
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
818
841
|
|
|
819
842
|
### executeAsyncScript
|
|
@@ -821,7 +844,7 @@ I.dragSlider('#slider', -70);
|
|
|
821
844
|
Executes async script on page.
|
|
822
845
|
Provided function should execute a passed callback (as first argument) to signal it is finished.
|
|
823
846
|
|
|
824
|
-
Example: In Vue.js to make components completely rendered we are waiting for [nextTick][
|
|
847
|
+
Example: In Vue.js to make components completely rendered we are waiting for [nextTick][23].
|
|
825
848
|
|
|
826
849
|
```js
|
|
827
850
|
I.executeAsyncScript(function(done) {
|
|
@@ -843,7 +866,7 @@ let val = await I.executeAsyncScript(function(url, done) {
|
|
|
843
866
|
|
|
844
867
|
- `args` **...any** to be passed to function.
|
|
845
868
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
846
|
-
- `fn` **([string][17] | [function][
|
|
869
|
+
- `fn` **([string][17] | [function][24])** function to be executed in browser context.
|
|
847
870
|
|
|
848
871
|
### executeScript
|
|
849
872
|
|
|
@@ -874,8 +897,8 @@ let date = await I.executeScript(function(el) {
|
|
|
874
897
|
#### Parameters
|
|
875
898
|
|
|
876
899
|
- `args` **...any** to be passed to function.
|
|
877
|
-
⚠️ returns a _promise_ which is synchronized internally by recorderWraps [execute][
|
|
878
|
-
- `fn` **([string][17] | [function][
|
|
900
|
+
⚠️ returns a _promise_ which is synchronized internally by recorderWraps [execute][25] command.
|
|
901
|
+
- `fn` **([string][17] | [function][24])** function to be executed in browser context.
|
|
879
902
|
|
|
880
903
|
### fillField
|
|
881
904
|
|
|
@@ -904,6 +927,23 @@ This action supports [React locators](https://codecept.io/react#locators)
|
|
|
904
927
|
|
|
905
928
|
{{ custom }}
|
|
906
929
|
|
|
930
|
+
### focus
|
|
931
|
+
|
|
932
|
+
Calls [focus][19] on the matching element.
|
|
933
|
+
|
|
934
|
+
Examples:
|
|
935
|
+
|
|
936
|
+
```js
|
|
937
|
+
I.dontSee('#add-to-cart-btn');
|
|
938
|
+
I.focus('#product-tile')
|
|
939
|
+
I.see('#add-to-cart-bnt');
|
|
940
|
+
```
|
|
941
|
+
|
|
942
|
+
#### Parameters
|
|
943
|
+
|
|
944
|
+
- `locator` **([string][17] | [object][16])** field located by label|name|CSS|XPath|strict locator.
|
|
945
|
+
- `options` **any?** Playwright only: [Additional options][26] for available options object as 2nd argument.
|
|
946
|
+
|
|
907
947
|
### forceClick
|
|
908
948
|
|
|
909
949
|
Perform an emulated click on a link or a button, given by a locator.
|
|
@@ -977,7 +1017,7 @@ Useful for referencing a specific handle when calling `I.switchToWindow(handle)`
|
|
|
977
1017
|
const windows = await I.grabAllWindowHandles();
|
|
978
1018
|
```
|
|
979
1019
|
|
|
980
|
-
Returns **[Promise][
|
|
1020
|
+
Returns **[Promise][27]<[Array][28]<[string][17]>>**
|
|
981
1021
|
|
|
982
1022
|
### grabAttributeFrom
|
|
983
1023
|
|
|
@@ -994,7 +1034,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
|
994
1034
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
995
1035
|
- `attr` **[string][17]** attribute name.
|
|
996
1036
|
|
|
997
|
-
Returns **[Promise][
|
|
1037
|
+
Returns **[Promise][27]<[string][17]>** attribute value
|
|
998
1038
|
|
|
999
1039
|
### grabAttributeFromAll
|
|
1000
1040
|
|
|
@@ -1010,7 +1050,7 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
|
1010
1050
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
1011
1051
|
- `attr` **[string][17]** attribute name.
|
|
1012
1052
|
|
|
1013
|
-
Returns **[Promise][
|
|
1053
|
+
Returns **[Promise][27]<[Array][28]<[string][17]>>** attribute value
|
|
1014
1054
|
|
|
1015
1055
|
### grabBrowserLogs
|
|
1016
1056
|
|
|
@@ -1022,7 +1062,7 @@ let logs = await I.grabBrowserLogs();
|
|
|
1022
1062
|
console.log(JSON.stringify(logs))
|
|
1023
1063
|
```
|
|
1024
1064
|
|
|
1025
|
-
Returns **([Promise][
|
|
1065
|
+
Returns **([Promise][27]<[Array][28]<[object][16]>> | [undefined][29])** all browser logs
|
|
1026
1066
|
|
|
1027
1067
|
### grabCookie
|
|
1028
1068
|
|
|
@@ -1039,7 +1079,7 @@ assert(cookie.value, '123456');
|
|
|
1039
1079
|
|
|
1040
1080
|
- `name` **[string][17]?** cookie name.
|
|
1041
1081
|
|
|
1042
|
-
Returns **([Promise][
|
|
1082
|
+
Returns **([Promise][27]<[string][17]> | [Promise][27]<[Array][28]<[string][17]>>)** attribute value
|
|
1043
1083
|
|
|
1044
1084
|
### grabCssPropertyFrom
|
|
1045
1085
|
|
|
@@ -1056,7 +1096,7 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
|
1056
1096
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
1057
1097
|
- `cssProperty` **[string][17]** CSS property name.
|
|
1058
1098
|
|
|
1059
|
-
Returns **[Promise][
|
|
1099
|
+
Returns **[Promise][27]<[string][17]>** CSS value
|
|
1060
1100
|
|
|
1061
1101
|
### grabCssPropertyFromAll
|
|
1062
1102
|
|
|
@@ -1072,7 +1112,7 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
|
1072
1112
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
1073
1113
|
- `cssProperty` **[string][17]** CSS property name.
|
|
1074
1114
|
|
|
1075
|
-
Returns **[Promise][
|
|
1115
|
+
Returns **[Promise][27]<[Array][28]<[string][17]>>** CSS value
|
|
1076
1116
|
|
|
1077
1117
|
### grabCurrentUrl
|
|
1078
1118
|
|
|
@@ -1084,7 +1124,7 @@ let url = await I.grabCurrentUrl();
|
|
|
1084
1124
|
console.log(`Current URL is [${url}]`);
|
|
1085
1125
|
```
|
|
1086
1126
|
|
|
1087
|
-
Returns **[Promise][
|
|
1127
|
+
Returns **[Promise][27]<[string][17]>** current URL
|
|
1088
1128
|
|
|
1089
1129
|
### grabCurrentWindowHandle
|
|
1090
1130
|
|
|
@@ -1095,7 +1135,7 @@ Useful for referencing it when calling `I.switchToWindow(handle)`
|
|
|
1095
1135
|
const window = await I.grabCurrentWindowHandle();
|
|
1096
1136
|
```
|
|
1097
1137
|
|
|
1098
|
-
Returns **[Promise][
|
|
1138
|
+
Returns **[Promise][27]<[string][17]>**
|
|
1099
1139
|
|
|
1100
1140
|
### grabElementBoundingRect
|
|
1101
1141
|
|
|
@@ -1123,7 +1163,7 @@ const width = await I.grabElementBoundingRect('h3', 'width');
|
|
|
1123
1163
|
- `prop`
|
|
1124
1164
|
- `elementSize` **[string][17]?** x, y, width or height of the given element.
|
|
1125
1165
|
|
|
1126
|
-
Returns **([Promise][
|
|
1166
|
+
Returns **([Promise][27]<DOMRect> | [Promise][27]<[number][22]>)** Element bounding rectangle
|
|
1127
1167
|
|
|
1128
1168
|
### grabGeoLocation
|
|
1129
1169
|
|
|
@@ -1134,7 +1174,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1134
1174
|
let geoLocation = await I.grabGeoLocation();
|
|
1135
1175
|
```
|
|
1136
1176
|
|
|
1137
|
-
Returns **[Promise][
|
|
1177
|
+
Returns **[Promise][27]<{latitude: [number][22], longitude: [number][22], altitude: [number][22]}>**
|
|
1138
1178
|
|
|
1139
1179
|
### grabHTMLFrom
|
|
1140
1180
|
|
|
@@ -1151,7 +1191,7 @@ let postHTML = await I.grabHTMLFrom('#post');
|
|
|
1151
1191
|
- `locator`
|
|
1152
1192
|
- `element` **([string][17] | [object][16])** located by CSS|XPath|strict locator.
|
|
1153
1193
|
|
|
1154
|
-
Returns **[Promise][
|
|
1194
|
+
Returns **[Promise][27]<[string][17]>** HTML code for an element
|
|
1155
1195
|
|
|
1156
1196
|
### grabHTMLFromAll
|
|
1157
1197
|
|
|
@@ -1167,7 +1207,7 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
|
1167
1207
|
- `locator`
|
|
1168
1208
|
- `element` **([string][17] | [object][16])** located by CSS|XPath|strict locator.
|
|
1169
1209
|
|
|
1170
|
-
Returns **[Promise][
|
|
1210
|
+
Returns **[Promise][27]<[Array][28]<[string][17]>>** HTML code for an element
|
|
1171
1211
|
|
|
1172
1212
|
### grabNumberOfOpenTabs
|
|
1173
1213
|
|
|
@@ -1178,7 +1218,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1178
1218
|
let tabs = await I.grabNumberOfOpenTabs();
|
|
1179
1219
|
```
|
|
1180
1220
|
|
|
1181
|
-
Returns **[Promise][
|
|
1221
|
+
Returns **[Promise][27]<[number][22]>** number of open tabs
|
|
1182
1222
|
|
|
1183
1223
|
### grabNumberOfVisibleElements
|
|
1184
1224
|
|
|
@@ -1193,7 +1233,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
|
1193
1233
|
|
|
1194
1234
|
- `locator` **([string][17] | [object][16])** located by CSS|XPath|strict locator.
|
|
1195
1235
|
|
|
1196
|
-
Returns **[Promise][
|
|
1236
|
+
Returns **[Promise][27]<[number][22]>** number of visible elements
|
|
1197
1237
|
|
|
1198
1238
|
### grabPageScrollPosition
|
|
1199
1239
|
|
|
@@ -1204,7 +1244,7 @@ Resumes test execution, so **should be used inside an async function with `await
|
|
|
1204
1244
|
let { x, y } = await I.grabPageScrollPosition();
|
|
1205
1245
|
```
|
|
1206
1246
|
|
|
1207
|
-
Returns **[Promise][
|
|
1247
|
+
Returns **[Promise][27]<PageScrollPosition>** scroll position
|
|
1208
1248
|
|
|
1209
1249
|
### grabPopupText
|
|
1210
1250
|
|
|
@@ -1214,7 +1254,7 @@ Grab the text within the popup. If no popup is visible then it will return null.
|
|
|
1214
1254
|
await I.grabPopupText();
|
|
1215
1255
|
```
|
|
1216
1256
|
|
|
1217
|
-
Returns **[Promise][
|
|
1257
|
+
Returns **[Promise][27]<[string][17]>**
|
|
1218
1258
|
|
|
1219
1259
|
### grabSource
|
|
1220
1260
|
|
|
@@ -1225,7 +1265,7 @@ Resumes test execution, so **should be used inside async function with `await`**
|
|
|
1225
1265
|
let pageSource = await I.grabSource();
|
|
1226
1266
|
```
|
|
1227
1267
|
|
|
1228
|
-
Returns **[Promise][
|
|
1268
|
+
Returns **[Promise][27]<[string][17]>** source code
|
|
1229
1269
|
|
|
1230
1270
|
### grabTextFrom
|
|
1231
1271
|
|
|
@@ -1242,7 +1282,7 @@ If multiple elements found returns first element.
|
|
|
1242
1282
|
|
|
1243
1283
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
1244
1284
|
|
|
1245
|
-
Returns **[Promise][
|
|
1285
|
+
Returns **[Promise][27]<[string][17]>** attribute value
|
|
1246
1286
|
|
|
1247
1287
|
### grabTextFromAll
|
|
1248
1288
|
|
|
@@ -1257,7 +1297,7 @@ let pins = await I.grabTextFromAll('#pin li');
|
|
|
1257
1297
|
|
|
1258
1298
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
1259
1299
|
|
|
1260
|
-
Returns **[Promise][
|
|
1300
|
+
Returns **[Promise][27]<[Array][28]<[string][17]>>** attribute value
|
|
1261
1301
|
|
|
1262
1302
|
### grabTitle
|
|
1263
1303
|
|
|
@@ -1268,7 +1308,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
|
|
|
1268
1308
|
let title = await I.grabTitle();
|
|
1269
1309
|
```
|
|
1270
1310
|
|
|
1271
|
-
Returns **[Promise][
|
|
1311
|
+
Returns **[Promise][27]<[string][17]>** title
|
|
1272
1312
|
|
|
1273
1313
|
### grabValueFrom
|
|
1274
1314
|
|
|
@@ -1284,7 +1324,7 @@ let email = await I.grabValueFrom('input[name=email]');
|
|
|
1284
1324
|
|
|
1285
1325
|
- `locator` **([string][17] | [object][16])** field located by label|name|CSS|XPath|strict locator.
|
|
1286
1326
|
|
|
1287
|
-
Returns **[Promise][
|
|
1327
|
+
Returns **[Promise][27]<[string][17]>** attribute value
|
|
1288
1328
|
|
|
1289
1329
|
### grabValueFromAll
|
|
1290
1330
|
|
|
@@ -1299,7 +1339,7 @@ let inputs = await I.grabValueFromAll('//form/input');
|
|
|
1299
1339
|
|
|
1300
1340
|
- `locator` **([string][17] | [object][16])** field located by label|name|CSS|XPath|strict locator.
|
|
1301
1341
|
|
|
1302
|
-
Returns **[Promise][
|
|
1342
|
+
Returns **[Promise][27]<[Array][28]<[string][17]>>** attribute value
|
|
1303
1343
|
|
|
1304
1344
|
### moveCursorTo
|
|
1305
1345
|
|
|
@@ -1316,8 +1356,8 @@ I.moveCursorTo('#submit', 5,5);
|
|
|
1316
1356
|
- `locator` **([string][17] | [object][16])** located by CSS|XPath|strict locator.
|
|
1317
1357
|
- `xOffset`
|
|
1318
1358
|
- `yOffset`
|
|
1319
|
-
- `offsetX` **[number][
|
|
1320
|
-
- `offsetY` **[number][
|
|
1359
|
+
- `offsetX` **[number][22]** (optional, `0` by default) X-axis offset.
|
|
1360
|
+
- `offsetY` **[number][22]** (optional, `0` by default) Y-axis offset.
|
|
1321
1361
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1322
1362
|
|
|
1323
1363
|
### openNewTab
|
|
@@ -1339,7 +1379,7 @@ I.openNewTab();
|
|
|
1339
1379
|
|
|
1340
1380
|
Presses a key in the browser (on a focused element).
|
|
1341
1381
|
|
|
1342
|
-
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][
|
|
1382
|
+
_Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][30].
|
|
1343
1383
|
|
|
1344
1384
|
```js
|
|
1345
1385
|
I.pressKey('Backspace');
|
|
@@ -1398,14 +1438,14 @@ Some of the supported key names are:
|
|
|
1398
1438
|
|
|
1399
1439
|
#### Parameters
|
|
1400
1440
|
|
|
1401
|
-
- `key` **([string][17] | [Array][
|
|
1441
|
+
- `key` **([string][17] | [Array][28]<[string][17]>)** key or array of keys to press.
|
|
1402
1442
|
⚠️ returns a _promise_ which is synchronized internally by recorder_Note:_ In case a text field or textarea is focused be aware that some browsers do not respect active modifier when combining modifier keys with other keys.
|
|
1403
1443
|
|
|
1404
1444
|
### pressKeyDown
|
|
1405
1445
|
|
|
1406
1446
|
Presses a key in the browser and leaves it in a down state.
|
|
1407
1447
|
|
|
1408
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1448
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][31]).
|
|
1409
1449
|
|
|
1410
1450
|
```js
|
|
1411
1451
|
I.pressKeyDown('Control');
|
|
@@ -1422,7 +1462,7 @@ I.pressKeyUp('Control');
|
|
|
1422
1462
|
|
|
1423
1463
|
Releases a key in the browser which was previously set to a down state.
|
|
1424
1464
|
|
|
1425
|
-
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][
|
|
1465
|
+
To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][31]).
|
|
1426
1466
|
|
|
1427
1467
|
```js
|
|
1428
1468
|
I.pressKeyDown('Control');
|
|
@@ -1452,8 +1492,8 @@ First parameter can be set to `maximize`.
|
|
|
1452
1492
|
|
|
1453
1493
|
#### Parameters
|
|
1454
1494
|
|
|
1455
|
-
- `width` **[number][
|
|
1456
|
-
- `height` **[number][
|
|
1495
|
+
- `width` **[number][22]** width in pixels or `maximize`.
|
|
1496
|
+
- `height` **[number][22]** height in pixels.
|
|
1457
1497
|
⚠️ returns a _promise_ which is synchronized internally by recorderAppium: not tested in web, in apps doesn't work
|
|
1458
1498
|
|
|
1459
1499
|
### rightClick
|
|
@@ -1534,7 +1574,7 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
|
|
|
1534
1574
|
#### Parameters
|
|
1535
1575
|
|
|
1536
1576
|
- `fileName` **[string][17]** file name to save.
|
|
1537
|
-
- `fullPage` **[boolean][
|
|
1577
|
+
- `fullPage` **[boolean][32]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
1538
1578
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1539
1579
|
|
|
1540
1580
|
### scrollIntoView
|
|
@@ -1550,7 +1590,7 @@ I.scrollIntoView('#submit', { behavior: "smooth", block: "center", inline: "cent
|
|
|
1550
1590
|
#### Parameters
|
|
1551
1591
|
|
|
1552
1592
|
- `locator` **([string][17] | [object][16])** located by CSS|XPath|strict locator.
|
|
1553
|
-
- `scrollIntoViewOptions` **ScrollIntoViewOptions** see [https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView][
|
|
1593
|
+
- `scrollIntoViewOptions` **ScrollIntoViewOptions** see [https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView][33].
|
|
1554
1594
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1555
1595
|
|
|
1556
1596
|
### scrollPageToBottom
|
|
@@ -1586,8 +1626,8 @@ I.scrollTo('#submit', 5, 5);
|
|
|
1586
1626
|
#### Parameters
|
|
1587
1627
|
|
|
1588
1628
|
- `locator` **([string][17] | [object][16])** located by CSS|XPath|strict locator.
|
|
1589
|
-
- `offsetX` **[number][
|
|
1590
|
-
- `offsetY` **[number][
|
|
1629
|
+
- `offsetX` **[number][22]** (optional, `0` by default) X-axis offset.
|
|
1630
|
+
- `offsetY` **[number][22]** (optional, `0` by default) Y-axis offset.
|
|
1591
1631
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1592
1632
|
|
|
1593
1633
|
### see
|
|
@@ -1793,7 +1833,7 @@ I.seeNumberOfElements('#submitBtn', 1);
|
|
|
1793
1833
|
#### Parameters
|
|
1794
1834
|
|
|
1795
1835
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
1796
|
-
- `num` **[number][
|
|
1836
|
+
- `num` **[number][22]** number of elements.
|
|
1797
1837
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1798
1838
|
|
|
1799
1839
|
|
|
@@ -1812,7 +1852,7 @@ I.seeNumberOfVisibleElements('.buttons', 3);
|
|
|
1812
1852
|
#### Parameters
|
|
1813
1853
|
|
|
1814
1854
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
1815
|
-
- `num` **[number][
|
|
1855
|
+
- `num` **[number][22]** number of elements.
|
|
1816
1856
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1817
1857
|
|
|
1818
1858
|
|
|
@@ -1870,7 +1910,7 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
|
1870
1910
|
#### Parameters
|
|
1871
1911
|
|
|
1872
1912
|
- `select` **([string][17] | [object][16])** field located by label|name|CSS|XPath|strict locator.
|
|
1873
|
-
- `option` **([string][17] | [Array][
|
|
1913
|
+
- `option` **([string][17] | [Array][28]<any>)** visible text or value of option.
|
|
1874
1914
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1875
1915
|
|
|
1876
1916
|
### setCookie
|
|
@@ -1891,9 +1931,9 @@ I.setCookie([
|
|
|
1891
1931
|
|
|
1892
1932
|
#### Parameters
|
|
1893
1933
|
|
|
1894
|
-
- `cookie` **(Cookie | [Array][
|
|
1934
|
+
- `cookie` **(Cookie | [Array][28]<Cookie>)** a cookie object or array of cookie objects.
|
|
1895
1935
|
⚠️ returns a _promise_ which is synchronized internally by recorderUses Selenium's JSON [cookie
|
|
1896
|
-
format][
|
|
1936
|
+
format][34].
|
|
1897
1937
|
|
|
1898
1938
|
### setGeoLocation
|
|
1899
1939
|
|
|
@@ -1906,9 +1946,9 @@ I.setGeoLocation(121.21, 11.56, 10);
|
|
|
1906
1946
|
|
|
1907
1947
|
#### Parameters
|
|
1908
1948
|
|
|
1909
|
-
- `latitude` **[number][
|
|
1910
|
-
- `longitude` **[number][
|
|
1911
|
-
- `altitude` **[number][
|
|
1949
|
+
- `latitude` **[number][22]** to set.
|
|
1950
|
+
- `longitude` **[number][22]** to set
|
|
1951
|
+
- `altitude` **[number][22]?** (optional, null by default) to set
|
|
1912
1952
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1913
1953
|
|
|
1914
1954
|
### switchTo
|
|
@@ -1936,8 +1976,8 @@ I.switchToNextTab(2);
|
|
|
1936
1976
|
|
|
1937
1977
|
#### Parameters
|
|
1938
1978
|
|
|
1939
|
-
- `num` **[number][
|
|
1940
|
-
- `sec` **([number][
|
|
1979
|
+
- `num` **[number][22]?** (optional) number of tabs to switch forward, default: 1.
|
|
1980
|
+
- `sec` **([number][22] | null)?** (optional) time in seconds to wait.
|
|
1941
1981
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1942
1982
|
|
|
1943
1983
|
### switchToPreviousTab
|
|
@@ -1951,8 +1991,8 @@ I.switchToPreviousTab(2);
|
|
|
1951
1991
|
|
|
1952
1992
|
#### Parameters
|
|
1953
1993
|
|
|
1954
|
-
- `num` **[number][
|
|
1955
|
-
- `sec` **[number][
|
|
1994
|
+
- `num` **[number][22]?** (optional) number of tabs to switch backward, default: 1.
|
|
1995
|
+
- `sec` **[number][22]??** (optional) time in seconds to wait.
|
|
1956
1996
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
1957
1997
|
|
|
1958
1998
|
### switchToWindow
|
|
@@ -1977,7 +2017,7 @@ await I.switchToWindow( window );
|
|
|
1977
2017
|
|
|
1978
2018
|
Types out the given text into an active field.
|
|
1979
2019
|
To slow down typing use a second parameter, to set interval between key presses.
|
|
1980
|
-
_Note:_ Should be used when [`fillField`][
|
|
2020
|
+
_Note:_ Should be used when [`fillField`][30] is not an option.
|
|
1981
2021
|
|
|
1982
2022
|
```js
|
|
1983
2023
|
// passing in a string
|
|
@@ -1996,9 +2036,9 @@ I.type(secret('123456'));
|
|
|
1996
2036
|
#### Parameters
|
|
1997
2037
|
|
|
1998
2038
|
- `keys`
|
|
1999
|
-
- `delay` **[number][
|
|
2039
|
+
- `delay` **[number][22]?** (optional) delay in ms between key presses
|
|
2000
2040
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2001
|
-
- `key` **([string][17] | [Array][
|
|
2041
|
+
- `key` **([string][17] | [Array][28]<[string][17]>)** or array of keys to type.
|
|
2002
2042
|
|
|
2003
2043
|
### uncheckOption
|
|
2004
2044
|
|
|
@@ -2021,12 +2061,12 @@ I.uncheckOption('agree', '//form');
|
|
|
2021
2061
|
|
|
2022
2062
|
### useWebDriverTo
|
|
2023
2063
|
|
|
2024
|
-
Use [webdriverio][
|
|
2064
|
+
Use [webdriverio][35] API inside a test.
|
|
2025
2065
|
|
|
2026
2066
|
First argument is a description of an action.
|
|
2027
2067
|
Second argument is async function that gets this helper as parameter.
|
|
2028
2068
|
|
|
2029
|
-
{ [`browser`][
|
|
2069
|
+
{ [`browser`][35]) } object from WebDriver API is available.
|
|
2030
2070
|
|
|
2031
2071
|
```js
|
|
2032
2072
|
I.useWebDriverTo('open multiple windows', async ({ browser }) {
|
|
@@ -2038,7 +2078,7 @@ I.useWebDriverTo('open multiple windows', async ({ browser }) {
|
|
|
2038
2078
|
#### Parameters
|
|
2039
2079
|
|
|
2040
2080
|
- `description` **[string][17]** used to show in logs.
|
|
2041
|
-
- `fn` **[function][
|
|
2081
|
+
- `fn` **[function][24]** async functuion that executed with WebDriver helper as argument
|
|
2042
2082
|
|
|
2043
2083
|
### wait
|
|
2044
2084
|
|
|
@@ -2050,7 +2090,7 @@ I.wait(2); // wait 2 secs
|
|
|
2050
2090
|
|
|
2051
2091
|
#### Parameters
|
|
2052
2092
|
|
|
2053
|
-
- `sec` **[number][
|
|
2093
|
+
- `sec` **[number][22]** number of second to wait.
|
|
2054
2094
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2055
2095
|
|
|
2056
2096
|
### waitForClickable
|
|
@@ -2067,7 +2107,7 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
|
2067
2107
|
|
|
2068
2108
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
2069
2109
|
- `waitTimeout`
|
|
2070
|
-
- `sec` **[number][
|
|
2110
|
+
- `sec` **[number][22]?** (optional, `1` by default) time in seconds to wait
|
|
2071
2111
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2072
2112
|
|
|
2073
2113
|
### waitForDetached
|
|
@@ -2082,7 +2122,7 @@ I.waitForDetached('#popup');
|
|
|
2082
2122
|
#### Parameters
|
|
2083
2123
|
|
|
2084
2124
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
2085
|
-
- `sec` **[number][
|
|
2125
|
+
- `sec` **[number][22]** (optional, `1` by default) time in seconds to wait
|
|
2086
2126
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2087
2127
|
|
|
2088
2128
|
### waitForElement
|
|
@@ -2098,7 +2138,7 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
|
2098
2138
|
#### Parameters
|
|
2099
2139
|
|
|
2100
2140
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
2101
|
-
- `sec` **[number][
|
|
2141
|
+
- `sec` **[number][22]?** (optional, `1` by default) time in seconds to wait
|
|
2102
2142
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2103
2143
|
|
|
2104
2144
|
### waitForEnabled
|
|
@@ -2109,7 +2149,7 @@ Element can be located by CSS or XPath.
|
|
|
2109
2149
|
#### Parameters
|
|
2110
2150
|
|
|
2111
2151
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
2112
|
-
- `sec` **[number][
|
|
2152
|
+
- `sec` **[number][22]** (optional) time in seconds to wait, 1 by default.
|
|
2113
2153
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2114
2154
|
|
|
2115
2155
|
### waitForFunction
|
|
@@ -2129,9 +2169,9 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
|
|
|
2129
2169
|
|
|
2130
2170
|
#### Parameters
|
|
2131
2171
|
|
|
2132
|
-
- `fn` **([string][17] | [function][
|
|
2133
|
-
- `argsOrSec` **([Array][
|
|
2134
|
-
- `sec` **[number][
|
|
2172
|
+
- `fn` **([string][17] | [function][24])** to be executed in browser context.
|
|
2173
|
+
- `argsOrSec` **([Array][28]<any> | [number][22])?** (optional, `1` by default) arguments for function or seconds.
|
|
2174
|
+
- `sec` **[number][22]?** (optional, `1` by default) time in seconds to wait
|
|
2135
2175
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2136
2176
|
|
|
2137
2177
|
### waitForInvisible
|
|
@@ -2146,7 +2186,7 @@ I.waitForInvisible('#popup');
|
|
|
2146
2186
|
#### Parameters
|
|
2147
2187
|
|
|
2148
2188
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
2149
|
-
- `sec` **[number][
|
|
2189
|
+
- `sec` **[number][22]** (optional, `1` by default) time in seconds to wait
|
|
2150
2190
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2151
2191
|
|
|
2152
2192
|
### waitForText
|
|
@@ -2163,7 +2203,7 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
|
|
|
2163
2203
|
#### Parameters
|
|
2164
2204
|
|
|
2165
2205
|
- `text` **[string][17]** to wait for.
|
|
2166
|
-
- `sec` **[number][
|
|
2206
|
+
- `sec` **[number][22]** (optional, `1` by default) time in seconds to wait
|
|
2167
2207
|
- `context` **([string][17] | [object][16])?** (optional) element located by CSS|XPath|strict locator.
|
|
2168
2208
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2169
2209
|
|
|
@@ -2179,7 +2219,7 @@ I.waitForValue('//input', "GoodValue");
|
|
|
2179
2219
|
|
|
2180
2220
|
- `field` **([string][17] | [object][16])** input field.
|
|
2181
2221
|
- `value` **[string][17]** expected value.
|
|
2182
|
-
- `sec` **[number][
|
|
2222
|
+
- `sec` **[number][22]** (optional, `1` by default) time in seconds to wait
|
|
2183
2223
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2184
2224
|
|
|
2185
2225
|
### waitForVisible
|
|
@@ -2194,7 +2234,7 @@ I.waitForVisible('#popup');
|
|
|
2194
2234
|
#### Parameters
|
|
2195
2235
|
|
|
2196
2236
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
2197
|
-
- `sec` **[number][
|
|
2237
|
+
- `sec` **[number][22]** (optional, `1` by default) time in seconds to wait
|
|
2198
2238
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2199
2239
|
|
|
2200
2240
|
### waitInUrl
|
|
@@ -2208,7 +2248,7 @@ I.waitInUrl('/info', 2);
|
|
|
2208
2248
|
#### Parameters
|
|
2209
2249
|
|
|
2210
2250
|
- `urlPart` **[string][17]** value to check.
|
|
2211
|
-
- `sec` **[number][
|
|
2251
|
+
- `sec` **[number][22]** (optional, `1` by default) time in seconds to wait
|
|
2212
2252
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2213
2253
|
|
|
2214
2254
|
### waitNumberOfVisibleElements
|
|
@@ -2222,8 +2262,8 @@ I.waitNumberOfVisibleElements('a', 3);
|
|
|
2222
2262
|
#### Parameters
|
|
2223
2263
|
|
|
2224
2264
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
2225
|
-
- `num` **[number][
|
|
2226
|
-
- `sec` **[number][
|
|
2265
|
+
- `num` **[number][22]** number of elements.
|
|
2266
|
+
- `sec` **[number][22]** (optional, `1` by default) time in seconds to wait
|
|
2227
2267
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2228
2268
|
|
|
2229
2269
|
### waitToHide
|
|
@@ -2238,7 +2278,7 @@ I.waitToHide('#popup');
|
|
|
2238
2278
|
#### Parameters
|
|
2239
2279
|
|
|
2240
2280
|
- `locator` **([string][17] | [object][16])** element located by CSS|XPath|strict locator.
|
|
2241
|
-
- `sec` **[number][
|
|
2281
|
+
- `sec` **[number][22]** (optional, `1` by default) time in seconds to wait
|
|
2242
2282
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2243
2283
|
|
|
2244
2284
|
### waitUrlEquals
|
|
@@ -2253,7 +2293,7 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2253
2293
|
#### Parameters
|
|
2254
2294
|
|
|
2255
2295
|
- `urlPart` **[string][17]** value to check.
|
|
2256
|
-
- `sec` **[number][
|
|
2296
|
+
- `sec` **[number][22]** (optional, `1` by default) time in seconds to wait
|
|
2257
2297
|
⚠️ returns a _promise_ which is synchronized internally by recorder
|
|
2258
2298
|
|
|
2259
2299
|
[1]: http://webdriver.io/
|
|
@@ -2292,34 +2332,40 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
|
|
|
2292
2332
|
|
|
2293
2333
|
[18]: http://jster.net/category/windows-modals-popups
|
|
2294
2334
|
|
|
2295
|
-
[19]: https://
|
|
2335
|
+
[19]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
|
|
2336
|
+
|
|
2337
|
+
[20]: https://playwright.dev/docs/api/class-locator#locator-blur
|
|
2338
|
+
|
|
2339
|
+
[21]: https://webdriver.io/docs/timeouts.html
|
|
2340
|
+
|
|
2341
|
+
[22]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
2296
2342
|
|
|
2297
|
-
[
|
|
2343
|
+
[23]: https://vuejs.org/v2/api/#Vue-nextTick
|
|
2298
2344
|
|
|
2299
|
-
[
|
|
2345
|
+
[24]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
|
|
2300
2346
|
|
|
2301
|
-
[
|
|
2347
|
+
[25]: http://webdriver.io/api/protocol/execute.html
|
|
2302
2348
|
|
|
2303
|
-
[
|
|
2349
|
+
[26]: https://playwright.dev/docs/api/class-locator#locator-focus
|
|
2304
2350
|
|
|
2305
|
-
[
|
|
2351
|
+
[27]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
|
|
2306
2352
|
|
|
2307
|
-
[
|
|
2353
|
+
[28]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
2308
2354
|
|
|
2309
|
-
[
|
|
2355
|
+
[29]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined
|
|
2310
2356
|
|
|
2311
|
-
[
|
|
2357
|
+
[30]: #fillfield
|
|
2312
2358
|
|
|
2313
|
-
[
|
|
2359
|
+
[31]: #click
|
|
2314
2360
|
|
|
2315
|
-
[
|
|
2361
|
+
[32]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
2316
2362
|
|
|
2317
|
-
[
|
|
2363
|
+
[33]: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
|
|
2318
2364
|
|
|
2319
|
-
[
|
|
2365
|
+
[34]: https://code.google.com/p/selenium/wiki/JsonWireProtocol#Cookie_JSON_Object
|
|
2320
2366
|
|
|
2321
|
-
[
|
|
2367
|
+
[35]: https://webdriver.io/docs/api.html
|
|
2322
2368
|
|
|
2323
|
-
[
|
|
2369
|
+
[36]: http://codecept.io/acceptance/#smartwait
|
|
2324
2370
|
|
|
2325
|
-
[
|
|
2371
|
+
[37]: http://webdriver.io/docs/timeouts.html
|