codeceptjs 3.4.1 → 3.5.1

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.
Files changed (75) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/README.md +11 -9
  3. package/bin/codecept.js +1 -1
  4. package/docs/ai.md +248 -0
  5. package/docs/build/Appium.js +47 -7
  6. package/docs/build/JSONResponse.js +4 -4
  7. package/docs/build/Nightmare.js +3 -1
  8. package/docs/build/OpenAI.js +122 -0
  9. package/docs/build/Playwright.js +234 -54
  10. package/docs/build/Protractor.js +3 -1
  11. package/docs/build/Puppeteer.js +101 -12
  12. package/docs/build/REST.js +15 -5
  13. package/docs/build/TestCafe.js +61 -2
  14. package/docs/build/WebDriver.js +85 -5
  15. package/docs/changelog.md +85 -0
  16. package/docs/helpers/Appium.md +152 -147
  17. package/docs/helpers/JSONResponse.md +4 -4
  18. package/docs/helpers/Nightmare.md +2 -0
  19. package/docs/helpers/OpenAI.md +70 -0
  20. package/docs/helpers/Playwright.md +228 -151
  21. package/docs/helpers/Puppeteer.md +153 -101
  22. package/docs/helpers/REST.md +6 -5
  23. package/docs/helpers/TestCafe.md +97 -49
  24. package/docs/helpers/WebDriver.md +159 -107
  25. package/docs/mobile.md +49 -2
  26. package/docs/parallel.md +56 -0
  27. package/docs/plugins.md +87 -33
  28. package/docs/secrets.md +6 -0
  29. package/docs/tutorial.md +2 -2
  30. package/docs/webapi/appendField.mustache +2 -0
  31. package/docs/webapi/blur.mustache +17 -0
  32. package/docs/webapi/focus.mustache +12 -0
  33. package/docs/webapi/type.mustache +3 -0
  34. package/lib/ai.js +171 -0
  35. package/lib/cli.js +10 -2
  36. package/lib/codecept.js +4 -0
  37. package/lib/command/dryRun.js +9 -1
  38. package/lib/command/generate.js +46 -3
  39. package/lib/command/init.js +23 -1
  40. package/lib/command/interactive.js +15 -1
  41. package/lib/command/run-workers.js +2 -1
  42. package/lib/container.js +13 -3
  43. package/lib/event.js +2 -0
  44. package/lib/helper/Appium.js +45 -7
  45. package/lib/helper/JSONResponse.js +4 -4
  46. package/lib/helper/Nightmare.js +1 -1
  47. package/lib/helper/OpenAI.js +122 -0
  48. package/lib/helper/Playwright.js +200 -45
  49. package/lib/helper/Protractor.js +1 -1
  50. package/lib/helper/Puppeteer.js +67 -12
  51. package/lib/helper/REST.js +15 -5
  52. package/lib/helper/TestCafe.js +30 -2
  53. package/lib/helper/WebDriver.js +51 -5
  54. package/lib/helper/scripts/blurElement.js +17 -0
  55. package/lib/helper/scripts/focusElement.js +17 -0
  56. package/lib/helper/scripts/highlightElement.js +20 -0
  57. package/lib/html.js +258 -0
  58. package/lib/interfaces/gherkin.js +8 -0
  59. package/lib/listener/retry.js +2 -1
  60. package/lib/pause.js +73 -17
  61. package/lib/plugin/debugErrors.js +67 -0
  62. package/lib/plugin/fakerTransform.js +4 -6
  63. package/lib/plugin/heal.js +177 -0
  64. package/lib/plugin/screenshotOnFail.js +11 -2
  65. package/lib/recorder.js +11 -8
  66. package/lib/secret.js +5 -4
  67. package/lib/step.js +6 -1
  68. package/lib/ui.js +4 -3
  69. package/lib/utils.js +17 -0
  70. package/lib/workers.js +57 -9
  71. package/package.json +25 -16
  72. package/translations/ja-JP.js +9 -9
  73. package/typings/index.d.ts +43 -9
  74. package/typings/promiseBasedTypes.d.ts +242 -25
  75. package/typings/types.d.ts +260 -35
@@ -39,23 +39,24 @@ Type: [object][4]
39
39
 
40
40
  - `url` **[string][6]** base url of website to be tested
41
41
  - `basicAuth` **[object][4]?** (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
42
- - `show` **[boolean][17]?** show Google Chrome window for debug.
43
- - `restart` **[boolean][17]?** restart browser between tests.
44
- - `disableScreenshots` **[boolean][17]?** don't save screenshot on failure.
45
- - `fullPageScreenshots` **[boolean][17]?** make full page screenshots on failure.
46
- - `uniqueScreenshotNames` **[boolean][17]?** option to prevent screenshot override if you have scenarios with the same name in different suites.
47
- - `keepBrowserState` **[boolean][17]?** keep browser state between tests when `restart` is set to false.
48
- - `keepCookies` **[boolean][17]?** keep cookies between tests when `restart` is set to false.
49
- - `waitForAction` **[number][8]?** how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
50
- - `waitForNavigation` **[string][6]?** when to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API][20]. Array values are accepted as well.
51
- - `pressKeyDelay` **[number][8]?** delay between key presses in ms. Used when calling Puppeteers page.type(...) in fillField/appendField
52
- - `getPageTimeout` **[number][8]?** config option to set maximum navigation time in milliseconds. If the timeout is set to 0, then timeout will be disabled.
53
- - `waitForTimeout` **[number][8]?** default wait* timeout in ms.
42
+ - `show` **[boolean][20]?** show Google Chrome window for debug.
43
+ - `restart` **[boolean][20]?** restart browser between tests.
44
+ - `disableScreenshots` **[boolean][20]?** don't save screenshot on failure.
45
+ - `fullPageScreenshots` **[boolean][20]?** make full page screenshots on failure.
46
+ - `uniqueScreenshotNames` **[boolean][20]?** option to prevent screenshot override if you have scenarios with the same name in different suites.
47
+ - `keepBrowserState` **[boolean][20]?** keep browser state between tests when `restart` is set to false.
48
+ - `keepCookies` **[boolean][20]?** keep cookies between tests when `restart` is set to false.
49
+ - `waitForAction` **[number][10]?** how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
50
+ - `waitForNavigation` **[string][6]?** when to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API][23]. Array values are accepted as well.
51
+ - `pressKeyDelay` **[number][10]?** delay between key presses in ms. Used when calling Puppeteers page.type(...) in fillField/appendField
52
+ - `getPageTimeout` **[number][10]?** config option to set maximum navigation time in milliseconds. If the timeout is set to 0, then timeout will be disabled.
53
+ - `waitForTimeout` **[number][10]?** default wait* timeout in ms.
54
54
  - `windowSize` **[string][6]?** default window size. Set a dimension in format WIDTHxHEIGHT like `640x480`.
55
55
  - `userAgent` **[string][6]?** user-agent string.
56
- - `manualStart` **[boolean][17]?** do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
56
+ - `manualStart` **[boolean][20]?** do not start browser before a test, start it manually inside a helper with `this.helpers["Puppeteer"]._startBrowser()`.
57
57
  - `browser` **[string][6]?** can be changed to `firefox` when using [puppeteer-firefox][2].
58
- - `chrome` **[object][4]?** pass additional [Puppeteer run options][22].
58
+ - `chrome` **[object][4]?** pass additional [Puppeteer run options][25].
59
+ - `highlightElement` **[boolean][20]?** highlight the interacting elements
59
60
 
60
61
 
61
62
 
@@ -296,6 +297,8 @@ Field is located by name, label, CSS or XPath
296
297
 
297
298
  ```js
298
299
  I.appendField('#myTextField', 'appended');
300
+ // typing secret
301
+ I.appendField('password', secret('123456'));
299
302
  ```
300
303
 
301
304
  #### Parameters
@@ -325,6 +328,29 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
325
328
  - `pathToFile` **[string][6]** local file path relative to codecept.conf.ts or codecept.conf.js config file.
326
329
  ⚠️ returns a _promise_ which is synchronized internally by recorder> ⚠ There is an [issue with file upload in Puppeteer 2.1.0 & 2.1.1][7], downgrade to 2.0.0 if you face it.
327
330
 
331
+ ### blur
332
+
333
+ Remove focus from a text input, button, etc.
334
+ Calls [blur][8] on the element.
335
+
336
+ Examples:
337
+
338
+ ```js
339
+ I.blur('.text-area')
340
+ ```
341
+
342
+ ```js
343
+ //element `#product-tile` is focused
344
+ I.see('#add-to-cart-btn');
345
+ I.blur('#product-tile')
346
+ I.dontSee('#add-to-cart-btn');
347
+ ```
348
+
349
+ #### Parameters
350
+
351
+ - `locator` **([string][6] | [object][4])** field located by label|name|CSS|XPath|strict locator.
352
+ - `options` **any?** Playwright only: [Additional options][9] for available options object as 2nd argument.
353
+
328
354
  ### cancelPopup
329
355
 
330
356
  Dismisses the active JavaScript popup, as created by window.alert|window.confirm|window.prompt.
@@ -653,7 +679,7 @@ I.dragSlider('#slider', -70);
653
679
  #### Parameters
654
680
 
655
681
  - `locator` **([string][6] | [object][4])** located by label|name|CSS|XPath|strict locator.
656
- - `offsetX` **[number][8]** position to drag.
682
+ - `offsetX` **[number][10]** position to drag.
657
683
  ⚠️ returns a _promise_ which is synchronized internally by recorder
658
684
 
659
685
 
@@ -665,7 +691,7 @@ This action supports [React locators](https://codecept.io/react#locators)
665
691
  Executes async script on page.
666
692
  Provided function should execute a passed callback (as first argument) to signal it is finished.
667
693
 
668
- Example: In Vue.js to make components completely rendered we are waiting for [nextTick][9].
694
+ Example: In Vue.js to make components completely rendered we are waiting for [nextTick][11].
669
695
 
670
696
  ```js
671
697
  I.executeAsyncScript(function(done) {
@@ -687,7 +713,7 @@ let val = await I.executeAsyncScript(function(url, done) {
687
713
 
688
714
  - `args` **...any** to be passed to function.
689
715
  ⚠️ returns a _promise_ which is synchronized internally by recorderAsynchronous scripts can also be executed with `executeScript` if a function returns a Promise.
690
- - `fn` **([string][6] | [function][10])** function to be executed in browser context.
716
+ - `fn` **([string][6] | [function][12])** function to be executed in browser context.
691
717
 
692
718
  ### executeScript
693
719
 
@@ -719,7 +745,7 @@ let date = await I.executeScript(function(el) {
719
745
 
720
746
  - `args` **...any** to be passed to function.
721
747
  ⚠️ returns a _promise_ which is synchronized internally by recorderIf a function returns a Promise It will wait for it resolution.
722
- - `fn` **([string][6] | [function][10])** function to be executed in browser context.
748
+ - `fn` **([string][6] | [function][12])** function to be executed in browser context.
723
749
 
724
750
  ### fillField
725
751
 
@@ -747,6 +773,23 @@ I.fillField({css: 'form#login input[name=username]'}, 'John');
747
773
  This action supports [React locators](https://codecept.io/react#locators)
748
774
 
749
775
 
776
+ ### focus
777
+
778
+ Calls [focus][8] on the matching element.
779
+
780
+ Examples:
781
+
782
+ ```js
783
+ I.dontSee('#add-to-cart-btn');
784
+ I.focus('#product-tile')
785
+ I.see('#add-to-cart-bnt');
786
+ ```
787
+
788
+ #### Parameters
789
+
790
+ - `locator` **([string][6] | [object][4])** field located by label|name|CSS|XPath|strict locator.
791
+ - `options` **any?** Playwright only: [Additional options][13] for available options object as 2nd argument.
792
+
750
793
  ### forceClick
751
794
 
752
795
  Perform an emulated click on a link or a button, given by a locator.
@@ -799,7 +842,7 @@ let hint = await I.grabAttributeFrom('#tooltip', 'title');
799
842
  - `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
800
843
  - `attr` **[string][6]** attribute name.
801
844
 
802
- Returns **[Promise][11]<[string][6]>** attribute value
845
+ Returns **[Promise][14]<[string][6]>** attribute value
803
846
 
804
847
 
805
848
  This action supports [React locators](https://codecept.io/react#locators)
@@ -819,7 +862,7 @@ let hints = await I.grabAttributeFromAll('.tooltip', 'title');
819
862
  - `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
820
863
  - `attr` **[string][6]** attribute name.
821
864
 
822
- Returns **[Promise][11]<[Array][12]<[string][6]>>** attribute value
865
+ Returns **[Promise][14]<[Array][15]<[string][6]>>** attribute value
823
866
 
824
867
 
825
868
  This action supports [React locators](https://codecept.io/react#locators)
@@ -834,7 +877,7 @@ let logs = await I.grabBrowserLogs();
834
877
  console.log(JSON.stringify(logs))
835
878
  ```
836
879
 
837
- Returns **[Promise][11]<[Array][12]<any>>**
880
+ Returns **[Promise][14]<[Array][15]<any>>**
838
881
 
839
882
  ### grabCookie
840
883
 
@@ -851,7 +894,7 @@ assert(cookie.value, '123456');
851
894
 
852
895
  - `name` **[string][6]?** cookie name.
853
896
 
854
- Returns **([Promise][11]<[string][6]> | [Promise][11]<[Array][12]<[string][6]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
897
+ Returns **([Promise][14]<[string][6]> | [Promise][14]<[Array][15]<[string][6]>>)** attribute valueReturns cookie in JSON format. If name not passed returns all cookies for this domain.
855
898
 
856
899
  ### grabCssPropertyFrom
857
900
 
@@ -868,7 +911,7 @@ const value = await I.grabCssPropertyFrom('h3', 'font-weight');
868
911
  - `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
869
912
  - `cssProperty` **[string][6]** CSS property name.
870
913
 
871
- Returns **[Promise][11]<[string][6]>** CSS value
914
+ Returns **[Promise][14]<[string][6]>** CSS value
872
915
 
873
916
 
874
917
  This action supports [React locators](https://codecept.io/react#locators)
@@ -888,7 +931,7 @@ const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
888
931
  - `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
889
932
  - `cssProperty` **[string][6]** CSS property name.
890
933
 
891
- Returns **[Promise][11]<[Array][12]<[string][6]>>** CSS value
934
+ Returns **[Promise][14]<[Array][15]<[string][6]>>** CSS value
892
935
 
893
936
 
894
937
  This action supports [React locators](https://codecept.io/react#locators)
@@ -904,7 +947,7 @@ let url = await I.grabCurrentUrl();
904
947
  console.log(`Current URL is [${url}]`);
905
948
  ```
906
949
 
907
- Returns **[Promise][11]<[string][6]>** current URL
950
+ Returns **[Promise][14]<[string][6]>** current URL
908
951
 
909
952
  ### grabDataFromPerformanceTiming
910
953
 
@@ -929,7 +972,7 @@ let data = await I.grabDataFromPerformanceTiming();
929
972
  }
930
973
  ```
931
974
 
932
- Returns **[Promise][11]<any>** automatically synchronized promise through #recorder
975
+ Returns **[Promise][14]<any>** automatically synchronized promise through #recorder
933
976
 
934
977
  ### grabElementBoundingRect
935
978
 
@@ -957,7 +1000,7 @@ const width = await I.grabElementBoundingRect('h3', 'width');
957
1000
  - `prop`
958
1001
  - `elementSize` **[string][6]?** x, y, width or height of the given element.
959
1002
 
960
- Returns **([Promise][11]<DOMRect> | [Promise][11]<[number][8]>)** Element bounding rectangle
1003
+ Returns **([Promise][14]<DOMRect> | [Promise][14]<[number][10]>)** Element bounding rectangle
961
1004
 
962
1005
  ### grabHTMLFrom
963
1006
 
@@ -974,7 +1017,7 @@ let postHTML = await I.grabHTMLFrom('#post');
974
1017
  - `locator`
975
1018
  - `element` **([string][6] | [object][4])** located by CSS|XPath|strict locator.
976
1019
 
977
- Returns **[Promise][11]<[string][6]>** HTML code for an element
1020
+ Returns **[Promise][14]<[string][6]>** HTML code for an element
978
1021
 
979
1022
  ### grabHTMLFromAll
980
1023
 
@@ -990,7 +1033,7 @@ let postHTMLs = await I.grabHTMLFromAll('.post');
990
1033
  - `locator`
991
1034
  - `element` **([string][6] | [object][4])** located by CSS|XPath|strict locator.
992
1035
 
993
- Returns **[Promise][11]<[Array][12]<[string][6]>>** HTML code for an element
1036
+ Returns **[Promise][14]<[Array][15]<[string][6]>>** HTML code for an element
994
1037
 
995
1038
  ### grabNumberOfOpenTabs
996
1039
 
@@ -1001,7 +1044,7 @@ Resumes test execution, so **should be used inside async function with `await`**
1001
1044
  let tabs = await I.grabNumberOfOpenTabs();
1002
1045
  ```
1003
1046
 
1004
- Returns **[Promise][11]<[number][8]>** number of open tabs
1047
+ Returns **[Promise][14]<[number][10]>** number of open tabs
1005
1048
 
1006
1049
  ### grabNumberOfVisibleElements
1007
1050
 
@@ -1016,7 +1059,7 @@ let numOfElements = await I.grabNumberOfVisibleElements('p');
1016
1059
 
1017
1060
  - `locator` **([string][6] | [object][4])** located by CSS|XPath|strict locator.
1018
1061
 
1019
- Returns **[Promise][11]<[number][8]>** number of visible elements
1062
+ Returns **[Promise][14]<[number][10]>** number of visible elements
1020
1063
 
1021
1064
 
1022
1065
 
@@ -1032,7 +1075,7 @@ Resumes test execution, so **should be used inside an async function with `await
1032
1075
  let { x, y } = await I.grabPageScrollPosition();
1033
1076
  ```
1034
1077
 
1035
- Returns **[Promise][11]<PageScrollPosition>** scroll position
1078
+ Returns **[Promise][14]<PageScrollPosition>** scroll position
1036
1079
 
1037
1080
  ### grabPopupText
1038
1081
 
@@ -1042,7 +1085,7 @@ Grab the text within the popup. If no popup is visible then it will return null
1042
1085
  await I.grabPopupText();
1043
1086
  ```
1044
1087
 
1045
- Returns **[Promise][11]<([string][6] | null)>**
1088
+ Returns **[Promise][14]<([string][6] | null)>**
1046
1089
 
1047
1090
  ### grabSource
1048
1091
 
@@ -1053,7 +1096,7 @@ Resumes test execution, so **should be used inside async function with `await`**
1053
1096
  let pageSource = await I.grabSource();
1054
1097
  ```
1055
1098
 
1056
- Returns **[Promise][11]<[string][6]>** source code
1099
+ Returns **[Promise][14]<[string][6]>** source code
1057
1100
 
1058
1101
  ### grabTextFrom
1059
1102
 
@@ -1070,7 +1113,7 @@ If multiple elements found returns first element.
1070
1113
 
1071
1114
  - `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
1072
1115
 
1073
- Returns **[Promise][11]<[string][6]>** attribute value
1116
+ Returns **[Promise][14]<[string][6]>** attribute value
1074
1117
 
1075
1118
 
1076
1119
  This action supports [React locators](https://codecept.io/react#locators)
@@ -1089,7 +1132,7 @@ let pins = await I.grabTextFromAll('#pin li');
1089
1132
 
1090
1133
  - `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
1091
1134
 
1092
- Returns **[Promise][11]<[Array][12]<[string][6]>>** attribute value
1135
+ Returns **[Promise][14]<[Array][15]<[string][6]>>** attribute value
1093
1136
 
1094
1137
 
1095
1138
  This action supports [React locators](https://codecept.io/react#locators)
@@ -1104,7 +1147,7 @@ Resumes test execution, so **should be used inside async with `await`** operator
1104
1147
  let title = await I.grabTitle();
1105
1148
  ```
1106
1149
 
1107
- Returns **[Promise][11]<[string][6]>** title
1150
+ Returns **[Promise][14]<[string][6]>** title
1108
1151
 
1109
1152
  ### grabValueFrom
1110
1153
 
@@ -1120,7 +1163,7 @@ let email = await I.grabValueFrom('input[name=email]');
1120
1163
 
1121
1164
  - `locator` **([string][6] | [object][4])** field located by label|name|CSS|XPath|strict locator.
1122
1165
 
1123
- Returns **[Promise][11]<[string][6]>** attribute value
1166
+ Returns **[Promise][14]<[string][6]>** attribute value
1124
1167
 
1125
1168
  ### grabValueFromAll
1126
1169
 
@@ -1135,12 +1178,12 @@ let inputs = await I.grabValueFromAll('//form/input');
1135
1178
 
1136
1179
  - `locator` **([string][6] | [object][4])** field located by label|name|CSS|XPath|strict locator.
1137
1180
 
1138
- Returns **[Promise][11]<[Array][12]<[string][6]>>** attribute value
1181
+ Returns **[Promise][14]<[Array][15]<[string][6]>>** attribute value
1139
1182
 
1140
1183
  ### handleDownloads
1141
1184
 
1142
1185
  Sets a directory to where save files. Allows to test file downloads.
1143
- Should be used with [FileSystem helper][13] to check that file were downloaded correctly.
1186
+ Should be used with [FileSystem helper][16] to check that file were downloaded correctly.
1144
1187
 
1145
1188
  By default files are saved to `output/downloads`.
1146
1189
  This directory is cleaned on every `handleDownloads` call, to ensure no old files are kept.
@@ -1183,8 +1226,8 @@ I.moveCursorTo('#submit', 5,5);
1183
1226
  #### Parameters
1184
1227
 
1185
1228
  - `locator` **([string][6] | [object][4])** located by CSS|XPath|strict locator.
1186
- - `offsetX` **[number][8]** (optional, `0` by default) X-axis offset.
1187
- - `offsetY` **[number][8]** (optional, `0` by default) Y-axis offset.
1229
+ - `offsetX` **[number][10]** (optional, `0` by default) X-axis offset.
1230
+ - `offsetY` **[number][10]** (optional, `0` by default) Y-axis offset.
1188
1231
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1189
1232
 
1190
1233
 
@@ -1203,7 +1246,7 @@ I.openNewTab();
1203
1246
 
1204
1247
  Presses a key in the browser (on a focused element).
1205
1248
 
1206
- _Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][14].
1249
+ _Hint:_ For populating text field or textarea, it is recommended to use [`fillField`][17].
1207
1250
 
1208
1251
  ```js
1209
1252
  I.pressKey('Backspace');
@@ -1262,14 +1305,14 @@ Some of the supported key names are:
1262
1305
 
1263
1306
  #### Parameters
1264
1307
 
1265
- - `key` **([string][6] | [Array][12]<[string][6]>)** key or array of keys to press.
1266
- ⚠️ returns a _promise_ which is synchronized internally by recorder_Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/puppeteer#1313][15]).
1308
+ - `key` **([string][6] | [Array][15]<[string][6]>)** key or array of keys to press.
1309
+ ⚠️ returns a _promise_ which is synchronized internally by recorder_Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/puppeteer#1313][18]).
1267
1310
 
1268
1311
  ### pressKeyDown
1269
1312
 
1270
1313
  Presses a key in the browser and leaves it in a down state.
1271
1314
 
1272
- To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][16]).
1315
+ To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][19]).
1273
1316
 
1274
1317
  ```js
1275
1318
  I.pressKeyDown('Control');
@@ -1286,7 +1329,7 @@ I.pressKeyUp('Control');
1286
1329
 
1287
1330
  Releases a key in the browser which was previously set to a down state.
1288
1331
 
1289
- To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][16]).
1332
+ To make combinations with modifier key and user operation (e.g. `'Control'` + [`click`][19]).
1290
1333
 
1291
1334
  ```js
1292
1335
  I.pressKeyDown('Control');
@@ -1316,8 +1359,8 @@ First parameter can be set to `maximize`.
1316
1359
 
1317
1360
  #### Parameters
1318
1361
 
1319
- - `width` **[number][8]** width in pixels or `maximize`.
1320
- - `height` **[number][8]** height in pixels.
1362
+ - `width` **[number][10]** width in pixels or `maximize`.
1363
+ - `height` **[number][10]** height in pixels.
1321
1364
  ⚠️ returns a _promise_ which is synchronized internally by recorderUnlike other drivers Puppeteer changes the size of a viewport, not the window!
1322
1365
  Puppeteer does not control the window of a browser so it can't adjust its real size.
1323
1366
  It also can't maximize a window.
@@ -1374,7 +1417,7 @@ I.saveScreenshot('debug.png', true) //resizes to available scrollHeight and scro
1374
1417
  #### Parameters
1375
1418
 
1376
1419
  - `fileName` **[string][6]** file name to save.
1377
- - `fullPage` **[boolean][17]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
1420
+ - `fullPage` **[boolean][20]** (optional, `false` by default) flag to enable fullscreen screenshot mode.
1378
1421
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1379
1422
 
1380
1423
  ### scrollPageToBottom
@@ -1410,8 +1453,8 @@ I.scrollTo('#submit', 5, 5);
1410
1453
  #### Parameters
1411
1454
 
1412
1455
  - `locator` **([string][6] | [object][4])** located by CSS|XPath|strict locator.
1413
- - `offsetX` **[number][8]** (optional, `0` by default) X-axis offset.
1414
- - `offsetY` **[number][8]** (optional, `0` by default) Y-axis offset.
1456
+ - `offsetX` **[number][10]** (optional, `0` by default) X-axis offset.
1457
+ - `offsetY` **[number][10]** (optional, `0` by default) Y-axis offset.
1415
1458
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1416
1459
 
1417
1460
  ### see
@@ -1630,7 +1673,7 @@ I.seeNumberOfElements('#submitBtn', 1);
1630
1673
  #### Parameters
1631
1674
 
1632
1675
  - `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
1633
- - `num` **[number][8]** number of elements.
1676
+ - `num` **[number][10]** number of elements.
1634
1677
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1635
1678
 
1636
1679
 
@@ -1649,7 +1692,7 @@ I.seeNumberOfVisibleElements('.buttons', 3);
1649
1692
  #### Parameters
1650
1693
 
1651
1694
  - `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
1652
- - `num` **[number][8]** number of elements.
1695
+ - `num` **[number][10]** number of elements.
1653
1696
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1654
1697
 
1655
1698
 
@@ -1707,7 +1750,7 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
1707
1750
  #### Parameters
1708
1751
 
1709
1752
  - `select` **([string][6] | [object][4])** field located by label|name|CSS|XPath|strict locator.
1710
- - `option` **([string][6] | [Array][12]<any>)** visible text or value of option.
1753
+ - `option` **([string][6] | [Array][15]<any>)** visible text or value of option.
1711
1754
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1712
1755
 
1713
1756
  ### setCookie
@@ -1728,7 +1771,7 @@ I.setCookie([
1728
1771
 
1729
1772
  #### Parameters
1730
1773
 
1731
- - `cookie` **(Cookie | [Array][12]<Cookie>)** a cookie object or array of cookie objects.
1774
+ - `cookie` **(Cookie | [Array][15]<Cookie>)** a cookie object or array of cookie objects.
1732
1775
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1733
1776
 
1734
1777
  ### switchTo
@@ -1756,7 +1799,7 @@ I.switchToNextTab(2);
1756
1799
 
1757
1800
  #### Parameters
1758
1801
 
1759
- - `num` **[number][8]**
1802
+ - `num` **[number][10]**
1760
1803
 
1761
1804
  ### switchToPreviousTab
1762
1805
 
@@ -1769,13 +1812,13 @@ I.switchToPreviousTab(2);
1769
1812
 
1770
1813
  #### Parameters
1771
1814
 
1772
- - `num` **[number][8]**
1815
+ - `num` **[number][10]**
1773
1816
 
1774
1817
  ### type
1775
1818
 
1776
1819
  Types out the given text into an active field.
1777
1820
  To slow down typing use a second parameter, to set interval between key presses.
1778
- _Note:_ Should be used when [`fillField`][14] is not an option.
1821
+ _Note:_ Should be used when [`fillField`][17] is not an option.
1779
1822
 
1780
1823
  ```js
1781
1824
  // passing in a string
@@ -1786,14 +1829,17 @@ I.type('4141555311111111', 100);
1786
1829
 
1787
1830
  // passing in an array
1788
1831
  I.type(['T', 'E', 'X', 'T']);
1832
+
1833
+ // passing a secret
1834
+ I.type(secret('123456'));
1789
1835
  ```
1790
1836
 
1791
1837
  #### Parameters
1792
1838
 
1793
1839
  - `keys`
1794
- - `delay` **[number][8]?** (optional) delay in ms between key presses
1840
+ - `delay` **[number][10]?** (optional) delay in ms between key presses
1795
1841
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1796
- - `key` **([string][6] | [Array][12]<[string][6]>)** or array of keys to type.
1842
+ - `key` **([string][6] | [Array][15]<[string][6]>)** or array of keys to type.
1797
1843
 
1798
1844
  ### uncheckOption
1799
1845
 
@@ -1821,7 +1867,7 @@ Use Puppeteer API inside a test.
1821
1867
  First argument is a description of an action.
1822
1868
  Second argument is async function that gets this helper as parameter.
1823
1869
 
1824
- { [`page`][18], [`browser`][19] } from Puppeteer API are available.
1870
+ { [`page`][21], [`browser`][22] } from Puppeteer API are available.
1825
1871
 
1826
1872
  ```js
1827
1873
  I.usePuppeteerTo('emulate offline mode', async ({ page }) {
@@ -1832,7 +1878,7 @@ I.usePuppeteerTo('emulate offline mode', async ({ page }) {
1832
1878
  #### Parameters
1833
1879
 
1834
1880
  - `description` **[string][6]** used to show in logs.
1835
- - `fn` **[function][10]** async function that is executed with Puppeteer as argument
1881
+ - `fn` **[function][12]** async function that is executed with Puppeteer as argument
1836
1882
 
1837
1883
  ### wait
1838
1884
 
@@ -1844,7 +1890,7 @@ I.wait(2); // wait 2 secs
1844
1890
 
1845
1891
  #### Parameters
1846
1892
 
1847
- - `sec` **[number][8]** number of second to wait.
1893
+ - `sec` **[number][10]** number of second to wait.
1848
1894
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1849
1895
 
1850
1896
  ### waitForClickable
@@ -1861,7 +1907,7 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
1861
1907
 
1862
1908
  - `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
1863
1909
  - `waitTimeout`
1864
- - `sec` **[number][8]?** (optional, `1` by default) time in seconds to wait
1910
+ - `sec` **[number][10]?** (optional, `1` by default) time in seconds to wait
1865
1911
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1866
1912
 
1867
1913
  ### waitForDetached
@@ -1876,7 +1922,7 @@ I.waitForDetached('#popup');
1876
1922
  #### Parameters
1877
1923
 
1878
1924
  - `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
1879
- - `sec` **[number][8]** (optional, `1` by default) time in seconds to wait
1925
+ - `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
1880
1926
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1881
1927
 
1882
1928
  ### waitForElement
@@ -1892,7 +1938,7 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
1892
1938
  #### Parameters
1893
1939
 
1894
1940
  - `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
1895
- - `sec` **[number][8]?** (optional, `1` by default) time in seconds to wait
1941
+ - `sec` **[number][10]?** (optional, `1` by default) time in seconds to wait
1896
1942
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1897
1943
 
1898
1944
 
@@ -1907,7 +1953,7 @@ Element can be located by CSS or XPath.
1907
1953
  #### Parameters
1908
1954
 
1909
1955
  - `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
1910
- - `sec` **[number][8]** (optional) time in seconds to wait, 1 by default.
1956
+ - `sec` **[number][10]** (optional) time in seconds to wait, 1 by default.
1911
1957
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1912
1958
 
1913
1959
  ### waitForFunction
@@ -1927,9 +1973,9 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
1927
1973
 
1928
1974
  #### Parameters
1929
1975
 
1930
- - `fn` **([string][6] | [function][10])** to be executed in browser context.
1931
- - `argsOrSec` **([Array][12]<any> | [number][8])?** (optional, `1` by default) arguments for function or seconds.
1932
- - `sec` **[number][8]?** (optional, `1` by default) time in seconds to wait
1976
+ - `fn` **([string][6] | [function][12])** to be executed in browser context.
1977
+ - `argsOrSec` **([Array][15]<any> | [number][10])?** (optional, `1` by default) arguments for function or seconds.
1978
+ - `sec` **[number][10]?** (optional, `1` by default) time in seconds to wait
1933
1979
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1934
1980
 
1935
1981
  ### waitForInvisible
@@ -1944,14 +1990,14 @@ I.waitForInvisible('#popup');
1944
1990
  #### Parameters
1945
1991
 
1946
1992
  - `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
1947
- - `sec` **[number][8]** (optional, `1` by default) time in seconds to wait
1993
+ - `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
1948
1994
  ⚠️ returns a _promise_ which is synchronized internally by recorder
1949
1995
 
1950
1996
  ### waitForNavigation
1951
1997
 
1952
1998
  Waits for navigation to finish. By default takes configured `waitForNavigation` option.
1953
1999
 
1954
- See [Pupeteer's reference][20]
2000
+ See [Pupeteer's reference][23]
1955
2001
 
1956
2002
  #### Parameters
1957
2003
 
@@ -1968,8 +2014,8 @@ I.waitForRequest(request => request.url() === 'http://example.com' && request.me
1968
2014
 
1969
2015
  #### Parameters
1970
2016
 
1971
- - `urlOrPredicate` **([string][6] | [function][10])**
1972
- - `sec` **[number][8]?** seconds to wait
2017
+ - `urlOrPredicate` **([string][6] | [function][12])**
2018
+ - `sec` **[number][10]?** seconds to wait
1973
2019
 
1974
2020
  ### waitForResponse
1975
2021
 
@@ -1982,8 +2028,8 @@ I.waitForResponse(response => response.url() === 'http://example.com' && respons
1982
2028
 
1983
2029
  #### Parameters
1984
2030
 
1985
- - `urlOrPredicate` **([string][6] | [function][10])**
1986
- - `sec` **[number][8]?** number of seconds to wait
2031
+ - `urlOrPredicate` **([string][6] | [function][12])**
2032
+ - `sec` **[number][10]?** number of seconds to wait
1987
2033
 
1988
2034
  ### waitForText
1989
2035
 
@@ -1999,7 +2045,7 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
1999
2045
  #### Parameters
2000
2046
 
2001
2047
  - `text` **[string][6]** to wait for.
2002
- - `sec` **[number][8]** (optional, `1` by default) time in seconds to wait
2048
+ - `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
2003
2049
  - `context` **([string][6] | [object][4])?** (optional) element located by CSS|XPath|strict locator.
2004
2050
  ⚠️ returns a _promise_ which is synchronized internally by recorder
2005
2051
 
@@ -2015,7 +2061,7 @@ I.waitForValue('//input', "GoodValue");
2015
2061
 
2016
2062
  - `field` **([string][6] | [object][4])** input field.
2017
2063
  - `value` **[string][6]** expected value.
2018
- - `sec` **[number][8]** (optional, `1` by default) time in seconds to wait
2064
+ - `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
2019
2065
  ⚠️ returns a _promise_ which is synchronized internally by recorder
2020
2066
 
2021
2067
  ### waitForVisible
@@ -2030,8 +2076,8 @@ I.waitForVisible('#popup');
2030
2076
  #### Parameters
2031
2077
 
2032
2078
  - `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
2033
- - `sec` **[number][8]** (optional, `1` by default) time in seconds to wait
2034
- ⚠️ returns a _promise_ which is synchronized internally by recorderThis method accepts [React selectors][21].
2079
+ - `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
2080
+ ⚠️ returns a _promise_ which is synchronized internally by recorderThis method accepts [React selectors][24].
2035
2081
 
2036
2082
  ### waitInUrl
2037
2083
 
@@ -2044,7 +2090,7 @@ I.waitInUrl('/info', 2);
2044
2090
  #### Parameters
2045
2091
 
2046
2092
  - `urlPart` **[string][6]** value to check.
2047
- - `sec` **[number][8]** (optional, `1` by default) time in seconds to wait
2093
+ - `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
2048
2094
  ⚠️ returns a _promise_ which is synchronized internally by recorder
2049
2095
 
2050
2096
  ### waitNumberOfVisibleElements
@@ -2058,8 +2104,8 @@ I.waitNumberOfVisibleElements('a', 3);
2058
2104
  #### Parameters
2059
2105
 
2060
2106
  - `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
2061
- - `num` **[number][8]** number of elements.
2062
- - `sec` **[number][8]** (optional, `1` by default) time in seconds to wait
2107
+ - `num` **[number][10]** number of elements.
2108
+ - `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
2063
2109
  ⚠️ returns a _promise_ which is synchronized internally by recorder
2064
2110
 
2065
2111
 
@@ -2078,7 +2124,7 @@ I.waitToHide('#popup');
2078
2124
  #### Parameters
2079
2125
 
2080
2126
  - `locator` **([string][6] | [object][4])** element located by CSS|XPath|strict locator.
2081
- - `sec` **[number][8]** (optional, `1` by default) time in seconds to wait
2127
+ - `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
2082
2128
  ⚠️ returns a _promise_ which is synchronized internally by recorder
2083
2129
 
2084
2130
  ### waitUrlEquals
@@ -2093,7 +2139,7 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
2093
2139
  #### Parameters
2094
2140
 
2095
2141
  - `urlPart` **[string][6]** value to check.
2096
- - `sec` **[number][8]** (optional, `1` by default) time in seconds to wait
2142
+ - `sec` **[number][10]** (optional, `1` by default) time in seconds to wait
2097
2143
  ⚠️ returns a _promise_ which is synchronized internally by recorder
2098
2144
 
2099
2145
  [1]: https://github.com/GoogleChrome/puppeteer
@@ -2110,32 +2156,38 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
2110
2156
 
2111
2157
  [7]: https://github.com/puppeteer/puppeteer/issues/5420
2112
2158
 
2113
- [8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
2159
+ [8]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
2160
+
2161
+ [9]: https://playwright.dev/docs/api/class-locator#locator-blur
2162
+
2163
+ [10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
2164
+
2165
+ [11]: https://vuejs.org/v2/api/#Vue-nextTick
2114
2166
 
2115
- [9]: https://vuejs.org/v2/api/#Vue-nextTick
2167
+ [12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
2116
2168
 
2117
- [10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
2169
+ [13]: https://playwright.dev/docs/api/class-locator#locator-focus
2118
2170
 
2119
- [11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
2171
+ [14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise
2120
2172
 
2121
- [12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
2173
+ [15]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
2122
2174
 
2123
- [13]: https://codecept.io/helpers/FileSystem
2175
+ [16]: https://codecept.io/helpers/FileSystem
2124
2176
 
2125
- [14]: #fillfield
2177
+ [17]: #fillfield
2126
2178
 
2127
- [15]: https://github.com/GoogleChrome/puppeteer/issues/1313
2179
+ [18]: https://github.com/GoogleChrome/puppeteer/issues/1313
2128
2180
 
2129
- [16]: #click
2181
+ [19]: #click
2130
2182
 
2131
- [17]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
2183
+ [20]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
2132
2184
 
2133
- [18]: https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#class-page
2185
+ [21]: https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#class-page
2134
2186
 
2135
- [19]: https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#class-browser
2187
+ [22]: https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#class-browser
2136
2188
 
2137
- [20]: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagewaitfornavigationoptions
2189
+ [23]: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagewaitfornavigationoptions
2138
2190
 
2139
- [21]: https://codecept.io/react
2191
+ [24]: https://codecept.io/react
2140
2192
 
2141
- [22]: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions
2193
+ [25]: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions