codeceptjs 3.1.0 → 3.2.0

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 (71) hide show
  1. package/CHANGELOG.md +129 -3
  2. package/README.md +2 -3
  3. package/bin/codecept.js +1 -0
  4. package/docs/advanced.md +94 -60
  5. package/docs/basics.md +1 -1
  6. package/docs/bdd.md +55 -1
  7. package/docs/build/Appium.js +106 -34
  8. package/docs/build/FileSystem.js +1 -0
  9. package/docs/build/Nightmare.js +48 -48
  10. package/docs/build/Playwright.js +97 -94
  11. package/docs/build/Protractor.js +68 -81
  12. package/docs/build/Puppeteer.js +91 -93
  13. package/docs/build/REST.js +1 -0
  14. package/docs/build/TestCafe.js +44 -44
  15. package/docs/build/WebDriver.js +71 -95
  16. package/docs/changelog.md +144 -2
  17. package/docs/commands.md +21 -7
  18. package/docs/configuration.md +15 -2
  19. package/docs/custom-helpers.md +1 -36
  20. package/docs/helpers/Appium.md +97 -95
  21. package/docs/helpers/FileSystem.md +1 -1
  22. package/docs/helpers/Playwright.md +16 -18
  23. package/docs/helpers/Puppeteer.md +18 -18
  24. package/docs/helpers/REST.md +3 -1
  25. package/docs/helpers/WebDriver.md +3 -19
  26. package/docs/mobile-react-native-locators.md +3 -0
  27. package/docs/playwright.md +40 -0
  28. package/docs/plugins.md +185 -68
  29. package/docs/reports.md +23 -5
  30. package/lib/actor.js +20 -2
  31. package/lib/codecept.js +15 -2
  32. package/lib/command/info.js +1 -1
  33. package/lib/config.js +13 -1
  34. package/lib/container.js +3 -1
  35. package/lib/data/dataTableArgument.js +35 -0
  36. package/lib/helper/Appium.js +49 -4
  37. package/lib/helper/FileSystem.js +1 -0
  38. package/lib/helper/Playwright.js +35 -22
  39. package/lib/helper/Protractor.js +2 -14
  40. package/lib/helper/Puppeteer.js +20 -19
  41. package/lib/helper/REST.js +1 -0
  42. package/lib/helper/WebDriver.js +2 -16
  43. package/lib/index.js +2 -0
  44. package/lib/interfaces/featureConfig.js +3 -0
  45. package/lib/interfaces/gherkin.js +7 -1
  46. package/lib/interfaces/scenarioConfig.js +4 -0
  47. package/lib/listener/helpers.js +1 -0
  48. package/lib/listener/steps.js +21 -3
  49. package/lib/listener/timeout.js +71 -0
  50. package/lib/locator.js +3 -0
  51. package/lib/mochaFactory.js +13 -9
  52. package/lib/plugin/allure.js +6 -1
  53. package/lib/plugin/{puppeteerCoverage.js → coverage.js} +10 -22
  54. package/lib/plugin/customLocator.js +2 -2
  55. package/lib/plugin/retryTo.js +130 -0
  56. package/lib/plugin/screenshotOnFail.js +1 -0
  57. package/lib/plugin/stepByStepReport.js +7 -0
  58. package/lib/plugin/stepTimeout.js +90 -0
  59. package/lib/plugin/subtitles.js +88 -0
  60. package/lib/plugin/tryTo.js +1 -1
  61. package/lib/recorder.js +21 -8
  62. package/lib/step.js +7 -2
  63. package/lib/store.js +2 -0
  64. package/lib/ui.js +2 -2
  65. package/package.json +6 -7
  66. package/typings/index.d.ts +8 -1
  67. package/typings/types.d.ts +198 -82
  68. package/docs/angular.md +0 -325
  69. package/docs/helpers/Protractor.md +0 -1658
  70. package/docs/webapi/waitUntil.mustache +0 -11
  71. package/typings/Protractor.d.ts +0 -16
@@ -129,8 +129,9 @@ const consoleLogStore = new Console();
129
129
  * }
130
130
  * }
131
131
  * ```
132
+ * > Note: When connecting to remote browser `show` and specific `chrome` options (e.g. `headless` or `devtools`) are ignored.
132
133
  *
133
- * #### Example #5: Target URL with provided basic authentication
134
+ * #### Example #5: Target URL with provided basic authentication
134
135
  *
135
136
  * ```js
136
137
  * {
@@ -143,10 +144,25 @@ const consoleLogStore = new Console();
143
144
  * }
144
145
  * }
145
146
  * ```
147
+ * #### Troubleshooting
146
148
  *
149
+ * Error Message: `No usable sandbox!`
150
+ *
151
+ * When running Puppeteer on CI try to disable sandbox if you see that message
152
+ *
153
+ * ```
154
+ * helpers: {
155
+ * Puppeteer: {
156
+ * url: 'http://localhost',
157
+ * show: false,
158
+ * chrome: {
159
+ * args: ['--no-sandbox', '--disable-setuid-sandbox']
160
+ * }
161
+ * },
162
+ * }
163
+ * ```
147
164
  *
148
165
  *
149
- * Note: When connecting to remote browser `show` and specific `chrome` options (e.g. `headless` or `devtools`) are ignored.
150
166
  *
151
167
  * ## Access From Helpers
152
168
  *
@@ -545,10 +561,9 @@ class Puppeteer extends Helper {
545
561
  this.context = null;
546
562
  popupStore.clear();
547
563
  this.isAuthenticated = false;
564
+ await this.browser.close();
548
565
  if (this.isRemoteBrowser) {
549
566
  await this.browser.disconnect();
550
- } else {
551
- await this.browser.close();
552
567
  }
553
568
  }
554
569
 
@@ -690,7 +705,7 @@ class Puppeteer extends Helper {
690
705
  * I.moveCursorTo('#submit', 5,5);
691
706
  * ```
692
707
  *
693
- * @param {string | object} locator located by CSS|XPath|strict locator.
708
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
694
709
  * @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
695
710
  * @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
696
711
  *
@@ -713,8 +728,8 @@ class Puppeteer extends Helper {
713
728
  * I.dragAndDrop('#dragHandle', '#container');
714
729
  * ```
715
730
  *
716
- * @param {string | object} srcElement located by CSS|XPath|strict locator.
717
- * @param {string | object} destElement located by CSS|XPath|strict locator.
731
+ * @param {LocatorOrString} srcElement located by CSS|XPath|strict locator.
732
+ * @param {LocatorOrString} destElement located by CSS|XPath|strict locator.
718
733
  *
719
734
  */
720
735
  async dragAndDrop(srcElement, destElement) {
@@ -775,7 +790,7 @@ class Puppeteer extends Helper {
775
790
  * I.scrollTo('#submit', 5, 5);
776
791
  * ```
777
792
  *
778
- * @param {string | object} locator located by CSS|XPath|strict locator.
793
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
779
794
  * @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
780
795
  * @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
781
796
  */
@@ -836,11 +851,14 @@ class Puppeteer extends Helper {
836
851
  }
837
852
 
838
853
  /**
839
- * Checks that title is equal to provided one.
840
- *
841
- * ```js
842
- * I.seeTitleEquals('Test title.');
843
- * ```
854
+ * Checks that title is equal to provided one.
855
+ *
856
+ * ```js
857
+ * I.seeTitleEquals('Test title.');
858
+ * ```
859
+ *
860
+ * @param {string} text value to check.
861
+ *
844
862
  */
845
863
  async seeTitleEquals(text) {
846
864
  const title = await this.page.title();
@@ -1042,7 +1060,7 @@ class Puppeteer extends Helper {
1042
1060
  * ```js
1043
1061
  * I.seeElement('#modal');
1044
1062
  * ```
1045
- * @param {string | object} locator located by CSS|XPath|strict locator.
1063
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
1046
1064
  * {{ react }}
1047
1065
  */
1048
1066
  async seeElement(locator) {
@@ -1061,7 +1079,7 @@ class Puppeteer extends Helper {
1061
1079
  * I.dontSeeElement('.modal'); // modal is not shown
1062
1080
  * ```
1063
1081
  *
1064
- * @param {string | object} locator located by CSS|XPath|Strict locator.
1082
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
1065
1083
  * {{ react }}
1066
1084
  */
1067
1085
  async dontSeeElement(locator) {
@@ -1080,7 +1098,7 @@ class Puppeteer extends Helper {
1080
1098
  * ```js
1081
1099
  * I.seeElementInDOM('#modal');
1082
1100
  * ```
1083
- * @param {string | object} locator element located by CSS|XPath|strict locator.
1101
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1084
1102
  *
1085
1103
  */
1086
1104
  async seeElementInDOM(locator) {
@@ -1095,7 +1113,7 @@ class Puppeteer extends Helper {
1095
1113
  * I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
1096
1114
  * ```
1097
1115
  *
1098
- * @param {string | object} locator located by CSS|XPath|Strict locator.
1116
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
1099
1117
  */
1100
1118
  async dontSeeElementInDOM(locator) {
1101
1119
  const els = await this._locate(locator);
@@ -1125,8 +1143,8 @@ class Puppeteer extends Helper {
1125
1143
  * I.click({css: 'nav a.login'});
1126
1144
  * ```
1127
1145
  *
1128
- * @param {string | object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
1129
- * @param {?string | object} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
1146
+ * @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
1147
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
1130
1148
  *
1131
1149
  *
1132
1150
  * {{ react }}
@@ -1161,8 +1179,8 @@ class Puppeteer extends Helper {
1161
1179
  * I.forceClick({css: 'nav a.login'});
1162
1180
  * ```
1163
1181
  *
1164
- * @param {string | object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
1165
- * @param {?string | object} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
1182
+ * @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
1183
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
1166
1184
  *
1167
1185
  *
1168
1186
  * {{ react }}
@@ -1198,8 +1216,8 @@ class Puppeteer extends Helper {
1198
1216
  * ```js
1199
1217
  * I.clickLink('Logout', '#nav');
1200
1218
  * ```
1201
- * @param {string | object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator
1202
- * @param {?string | object} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator
1219
+ * @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator
1220
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator
1203
1221
  *
1204
1222
  * {{ react }}
1205
1223
  */
@@ -1310,8 +1328,8 @@ class Puppeteer extends Helper {
1310
1328
  * I.doubleClick('.btn.edit');
1311
1329
  * ```
1312
1330
  *
1313
- * @param {string | object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
1314
- * @param {?string | object} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
1331
+ * @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
1332
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
1315
1333
  *
1316
1334
  *
1317
1335
  * {{ react }}
@@ -1332,8 +1350,8 @@ class Puppeteer extends Helper {
1332
1350
  * I.rightClick('Click me', '.context');
1333
1351
  * ```
1334
1352
  *
1335
- * @param {string | object} locator clickable element located by CSS|XPath|strict locator.
1336
- * @param {?string | object} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
1353
+ * @param {CodeceptJS.LocatorOrString} locator clickable element located by CSS|XPath|strict locator.
1354
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
1337
1355
  *
1338
1356
  *
1339
1357
  * {{ react }}
@@ -1353,8 +1371,8 @@ class Puppeteer extends Helper {
1353
1371
  * I.checkOption('I Agree to Terms and Conditions');
1354
1372
  * I.checkOption('agree', '//form');
1355
1373
  * ```
1356
- * @param {string | object} field checkbox located by label | name | CSS | XPath | strict locator.
1357
- * @param {?string | object} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
1374
+ * @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
1375
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
1358
1376
  */
1359
1377
  async checkOption(field, context = null) {
1360
1378
  const elm = await this._locateCheckable(field, context);
@@ -1378,8 +1396,8 @@ class Puppeteer extends Helper {
1378
1396
  * I.uncheckOption('I Agree to Terms and Conditions');
1379
1397
  * I.uncheckOption('agree', '//form');
1380
1398
  * ```
1381
- * @param {string | object} field checkbox located by label | name | CSS | XPath | strict locator.
1382
- * @param {?string | object} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
1399
+ * @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
1400
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
1383
1401
  */
1384
1402
  async uncheckOption(field, context = null) {
1385
1403
  const elm = await this._locateCheckable(field, context);
@@ -1401,7 +1419,7 @@ class Puppeteer extends Helper {
1401
1419
  * I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
1402
1420
  * ```
1403
1421
  *
1404
- * @param {string | object} field located by label|name|CSS|XPath|strict locator.
1422
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1405
1423
  *
1406
1424
  */
1407
1425
  async seeCheckboxIsChecked(field) {
@@ -1417,7 +1435,7 @@ class Puppeteer extends Helper {
1417
1435
  * I.dontSeeCheckboxIsChecked('agree'); // located by name
1418
1436
  * ```
1419
1437
  *
1420
- * @param {string | object} field located by label|name|CSS|XPath|strict locator.
1438
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1421
1439
  *
1422
1440
  */
1423
1441
  async dontSeeCheckboxIsChecked(field) {
@@ -1598,8 +1616,8 @@ class Puppeteer extends Helper {
1598
1616
  * // or by strict locator
1599
1617
  * I.fillField({css: 'form#login input[name=username]'}, 'John');
1600
1618
  * ```
1601
- * @param {string | object} field located by label|name|CSS|XPath|strict locator.
1602
- * @param {string | object} value text value to fill.
1619
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1620
+ * @param {CodeceptJS.StringOrSecret} value text value to fill.
1603
1621
  *
1604
1622
  * {{ react }}
1605
1623
  */
@@ -1626,7 +1644,7 @@ class Puppeteer extends Helper {
1626
1644
  * I.clearField('user[email]');
1627
1645
  * I.clearField('#email');
1628
1646
  * ```
1629
- * @param {string | object} editable field located by label|name|CSS|XPath|strict locator.
1647
+ * @param {LocatorOrString} editable field located by label|name|CSS|XPath|strict locator.
1630
1648
  *
1631
1649
  */
1632
1650
  async clearField(field) {
@@ -1640,7 +1658,7 @@ class Puppeteer extends Helper {
1640
1658
  * ```js
1641
1659
  * I.appendField('#myTextField', 'appended');
1642
1660
  * ```
1643
- * @param {string | object} field located by label|name|CSS|XPath|strict locator
1661
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
1644
1662
  * @param {string} value text value to append.
1645
1663
  *
1646
1664
  * {{ react }}
@@ -1663,7 +1681,7 @@ class Puppeteer extends Helper {
1663
1681
  * I.seeInField('form input[type=hidden]','hidden_value');
1664
1682
  * I.seeInField('#searchform input','Search');
1665
1683
  * ```
1666
- * @param {string | object} field located by label|name|CSS|XPath|strict locator.
1684
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1667
1685
  * @param {string} value value to check.
1668
1686
  *
1669
1687
  */
@@ -1680,7 +1698,7 @@ class Puppeteer extends Helper {
1680
1698
  * I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
1681
1699
  * ```
1682
1700
  *
1683
- * @param {string | object} field located by label|name|CSS|XPath|strict locator.
1701
+ * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1684
1702
  * @param {string} value value to check.
1685
1703
  */
1686
1704
  async dontSeeInField(field, value) {
@@ -1697,7 +1715,7 @@ class Puppeteer extends Helper {
1697
1715
  * I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
1698
1716
  * ```
1699
1717
  *
1700
- * @param {string | object} locator field located by label|name|CSS|XPath|strict locator.
1718
+ * @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
1701
1719
  * @param {string} pathToFile local file path relative to codecept.json config file.
1702
1720
  *
1703
1721
  * > ⚠ There is an [issue with file upload in Puppeteer 2.1.0 & 2.1.1](https://github.com/puppeteer/puppeteer/issues/5420), downgrade to 2.0.0 if you face it.
@@ -1733,7 +1751,7 @@ class Puppeteer extends Helper {
1733
1751
  * ```js
1734
1752
  * I.selectOption('Which OS do you use?', ['Android', 'iOS']);
1735
1753
  * ```
1736
- * @param {string | object} select field located by label|name|CSS|XPath|strict locator.
1754
+ * @param {LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
1737
1755
  * @param {string|Array<*>} option visible text or value of option.
1738
1756
  *
1739
1757
  */
@@ -1774,7 +1792,7 @@ class Puppeteer extends Helper {
1774
1792
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
1775
1793
  * ```
1776
1794
  *
1777
- * @param {string | object} locator located by CSS|XPath|strict locator.
1795
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
1778
1796
  * @returns {Promise<number>} number of visible elements
1779
1797
  * {{ react }}
1780
1798
  */
@@ -1850,7 +1868,7 @@ class Puppeteer extends Helper {
1850
1868
  * I.see('Register', {css: 'form.register'}); // use strict locator
1851
1869
  * ```
1852
1870
  * @param {string} text expected on page.
1853
- * @param {?string | object} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
1871
+ * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
1854
1872
  *
1855
1873
  * {{ react }}
1856
1874
  */
@@ -1866,7 +1884,7 @@ class Puppeteer extends Helper {
1866
1884
  * ```
1867
1885
  *
1868
1886
  * @param {string} text element value to check.
1869
- * @param {(string | object)?} [context=null] element located by CSS|XPath|strict locator.
1887
+ * @param {CodeceptJS.LocatorOrString?} [context=null] element located by CSS|XPath|strict locator.
1870
1888
  */
1871
1889
  async seeTextEquals(text, context = null) {
1872
1890
  return proceedSee.call(this, 'assert', text, context, true);
@@ -1882,7 +1900,7 @@ class Puppeteer extends Helper {
1882
1900
  * ```
1883
1901
  *
1884
1902
  * @param {string} text which is not present.
1885
- * @param {string | object} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
1903
+ * @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
1886
1904
  *
1887
1905
  *
1888
1906
  * {{ react }}
@@ -1972,7 +1990,7 @@ class Puppeteer extends Helper {
1972
1990
  * I.seeNumberOfElements('#submitBtn', 1);
1973
1991
  * ```
1974
1992
  *
1975
- * @param {string | object} locator element located by CSS|XPath|strict locator.
1993
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1976
1994
  * @param {number} num number of elements.
1977
1995
  *
1978
1996
  *
@@ -1991,7 +2009,7 @@ class Puppeteer extends Helper {
1991
2009
  * I.seeNumberOfVisibleElements('.buttons', 3);
1992
2010
  * ```
1993
2011
  *
1994
- * @param {string | object} locator element located by CSS|XPath|strict locator.
2012
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1995
2013
  * @param {number} num number of elements.
1996
2014
  *
1997
2015
  *
@@ -2191,7 +2209,7 @@ class Puppeteer extends Helper {
2191
2209
  * let pins = await I.grabTextFromAll('#pin li');
2192
2210
  * ```
2193
2211
  *
2194
- * @param {string | object} locator element located by CSS|XPath|strict locator.
2212
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2195
2213
  * @returns {Promise<string[]>} attribute value
2196
2214
  *
2197
2215
  * {{ react }}
@@ -2214,7 +2232,7 @@ class Puppeteer extends Helper {
2214
2232
  * ```
2215
2233
  * If multiple elements found returns first element.
2216
2234
  *
2217
- * @param {string | object} locator element located by CSS|XPath|strict locator.
2235
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2218
2236
  * @returns {Promise<string>} attribute value
2219
2237
  *
2220
2238
  * {{ react }}
@@ -2236,7 +2254,7 @@ class Puppeteer extends Helper {
2236
2254
  * ```js
2237
2255
  * let inputs = await I.grabValueFromAll('//form/input');
2238
2256
  * ```
2239
- * @param {string | object} locator field located by label|name|CSS|XPath|strict locator.
2257
+ * @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
2240
2258
  * @returns {Promise<string[]>} attribute value
2241
2259
  *
2242
2260
  */
@@ -2257,7 +2275,7 @@ class Puppeteer extends Helper {
2257
2275
  * ```js
2258
2276
  * let email = await I.grabValueFrom('input[name=email]');
2259
2277
  * ```
2260
- * @param {string | object} locator field located by label|name|CSS|XPath|strict locator.
2278
+ * @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
2261
2279
  * @returns {Promise<string>} attribute value
2262
2280
  *
2263
2281
  */
@@ -2279,7 +2297,7 @@ class Puppeteer extends Helper {
2279
2297
  * let postHTMLs = await I.grabHTMLFromAll('.post');
2280
2298
  * ```
2281
2299
  *
2282
- * @param {string | object} element located by CSS|XPath|strict locator.
2300
+ * @param {CodeceptJS.LocatorOrString} element located by CSS|XPath|strict locator.
2283
2301
  * @returns {Promise<string[]>} HTML code for an element
2284
2302
  *
2285
2303
  */
@@ -2298,7 +2316,7 @@ class Puppeteer extends Helper {
2298
2316
  * let postHTML = await I.grabHTMLFrom('#post');
2299
2317
  * ```
2300
2318
  *
2301
- * @param {string | object} element located by CSS|XPath|strict locator.
2319
+ * @param {CodeceptJS.LocatorOrString} element located by CSS|XPath|strict locator.
2302
2320
  * @returns {Promise<string>} HTML code for an element
2303
2321
  *
2304
2322
  */
@@ -2320,7 +2338,7 @@ class Puppeteer extends Helper {
2320
2338
  * const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
2321
2339
  * ```
2322
2340
  *
2323
- * @param {string | object} locator element located by CSS|XPath|strict locator.
2341
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2324
2342
  * @param {string} cssProperty CSS property name.
2325
2343
  * @returns {Promise<string[]>} CSS value
2326
2344
  *
@@ -2343,7 +2361,7 @@ class Puppeteer extends Helper {
2343
2361
  * const value = await I.grabCssPropertyFrom('h3', 'font-weight');
2344
2362
  * ```
2345
2363
  *
2346
- * @param {string | object} locator element located by CSS|XPath|strict locator.
2364
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2347
2365
  * @param {string} cssProperty CSS property name.
2348
2366
  * @returns {Promise<string>} CSS value
2349
2367
  *
@@ -2367,7 +2385,7 @@ class Puppeteer extends Helper {
2367
2385
  * I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
2368
2386
  * ```
2369
2387
  *
2370
- * @param {string | object} locator located by CSS|XPath|strict locator.
2388
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
2371
2389
  * @param {object} cssProperties object with CSS properties and their values to check.
2372
2390
  * {{ react }}
2373
2391
  */
@@ -2413,7 +2431,7 @@ class Puppeteer extends Helper {
2413
2431
  * I.seeAttributesOnElements('//form', { method: "post"});
2414
2432
  * ```
2415
2433
  *
2416
- * @param {string | object} locator located by CSS|XPath|strict locator.
2434
+ * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
2417
2435
  * @param {object} attributes attributes and their values to check.
2418
2436
  * {{ react }}
2419
2437
  */
@@ -2453,7 +2471,7 @@ class Puppeteer extends Helper {
2453
2471
  * I.dragSlider('#slider', -70);
2454
2472
  * ```
2455
2473
  *
2456
- * @param {string | object} locator located by label|name|CSS|XPath|strict locator.
2474
+ * @param {CodeceptJS.LocatorOrString} locator located by label|name|CSS|XPath|strict locator.
2457
2475
  * @param {number} offsetX position to drag.
2458
2476
  * {{ react }}
2459
2477
  */
@@ -2482,7 +2500,7 @@ class Puppeteer extends Helper {
2482
2500
  * ```js
2483
2501
  * let hints = await I.grabAttributeFromAll('.tooltip', 'title');
2484
2502
  * ```
2485
- * @param {string | object} locator element located by CSS|XPath|strict locator.
2503
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2486
2504
  * @param {string} attr attribute name.
2487
2505
  * @returns {Promise<string[]>} attribute value
2488
2506
  *
@@ -2506,7 +2524,7 @@ class Puppeteer extends Helper {
2506
2524
  * ```js
2507
2525
  * let hint = await I.grabAttributeFrom('#tooltip', 'title');
2508
2526
  * ```
2509
- * @param {string | object} locator element located by CSS|XPath|strict locator.
2527
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2510
2528
  * @param {string} attr attribute name.
2511
2529
  * @returns {Promise<string>} attribute value
2512
2530
  *
@@ -2530,7 +2548,7 @@ class Puppeteer extends Helper {
2530
2548
  * I.saveElementScreenshot(`#submit`,'debug.png');
2531
2549
  * ```
2532
2550
  *
2533
- * @param {string | object} locator element located by CSS|XPath|strict locator.
2551
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2534
2552
  * @param {string} fileName file name to save.
2535
2553
  *
2536
2554
  */
@@ -2602,7 +2620,7 @@ class Puppeteer extends Helper {
2602
2620
  * Waits for element to become enabled (by default waits for 1sec).
2603
2621
  * Element can be located by CSS or XPath.
2604
2622
  *
2605
- * @param {string | object} locator element located by CSS|XPath|strict locator.
2623
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2606
2624
  * @param {number} [sec=1] (optional) time in seconds to wait, 1 by default.
2607
2625
  */
2608
2626
  async waitForEnabled(locator, sec) {
@@ -2639,7 +2657,7 @@ class Puppeteer extends Helper {
2639
2657
  * I.waitForValue('//input', "GoodValue");
2640
2658
  * ```
2641
2659
  *
2642
- * @param {string | object} field input field.
2660
+ * @param {LocatorOrString} field input field.
2643
2661
  * @param {string }value expected value.
2644
2662
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
2645
2663
  *
@@ -2679,7 +2697,7 @@ class Puppeteer extends Helper {
2679
2697
  * I.waitNumberOfVisibleElements('a', 3);
2680
2698
  * ```
2681
2699
  *
2682
- * @param {string | object} locator element located by CSS|XPath|strict locator.
2700
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2683
2701
  * @param {number} num number of elements.
2684
2702
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
2685
2703
  * {{ react }}
@@ -2720,7 +2738,7 @@ class Puppeteer extends Helper {
2720
2738
  * I.waitForClickable('.btn.continue', 5); // wait for 5 secs
2721
2739
  * ```
2722
2740
  *
2723
- * @param {string | object} locator element located by CSS|XPath|strict locator.
2741
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2724
2742
  * @param {number} [sec] (optional, `1` by default) time in seconds to wait
2725
2743
  */
2726
2744
  async waitForClickable(locator, waitTimeout) {
@@ -2745,7 +2763,7 @@ class Puppeteer extends Helper {
2745
2763
  * I.waitForElement('.btn.continue', 5); // wait for 5 secs
2746
2764
  * ```
2747
2765
  *
2748
- * @param {string | object} locator element located by CSS|XPath|strict locator.
2766
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2749
2767
  * @param {number} [sec] (optional, `1` by default) time in seconds to wait
2750
2768
  * {{ react }}
2751
2769
  */
@@ -2773,7 +2791,7 @@ class Puppeteer extends Helper {
2773
2791
  * I.waitForVisible('#popup');
2774
2792
  * ```
2775
2793
  *
2776
- * @param {string | object} locator element located by CSS|XPath|strict locator.
2794
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2777
2795
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
2778
2796
  *
2779
2797
  *
@@ -2803,7 +2821,7 @@ class Puppeteer extends Helper {
2803
2821
  * I.waitForInvisible('#popup');
2804
2822
  * ```
2805
2823
  *
2806
- * @param {string | object} locator element located by CSS|XPath|strict locator.
2824
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2807
2825
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
2808
2826
  */
2809
2827
  async waitForInvisible(locator, sec) {
@@ -2830,7 +2848,7 @@ class Puppeteer extends Helper {
2830
2848
  * I.waitToHide('#popup');
2831
2849
  * ```
2832
2850
  *
2833
- * @param {string | object} locator element located by CSS|XPath|strict locator.
2851
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2834
2852
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
2835
2853
  */
2836
2854
  async waitToHide(locator, sec) {
@@ -2925,7 +2943,7 @@ class Puppeteer extends Helper {
2925
2943
  *
2926
2944
  * @param {string }text to wait for.
2927
2945
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
2928
- * @param {string | object} [context] (optional) element located by CSS|XPath|strict locator.
2946
+ * @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator.
2929
2947
  */
2930
2948
  async waitForText(text, sec = null, context = null) {
2931
2949
  const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
@@ -3000,7 +3018,7 @@ class Puppeteer extends Helper {
3000
3018
  * I.switchTo(); // switch back to main page
3001
3019
  * ```
3002
3020
  *
3003
- * @param {?string | object} [locator=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
3021
+ * @param {?CodeceptJS.LocatorOrString} [locator=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
3004
3022
  */
3005
3023
  async switchTo(locator) {
3006
3024
  if (Number.isInteger(locator)) {
@@ -3086,26 +3104,6 @@ class Puppeteer extends Helper {
3086
3104
  return this.page.waitForNavigation(opts);
3087
3105
  }
3088
3106
 
3089
- /**
3090
- * Waits for a function to return true (waits for 1sec by default).
3091
- *
3092
- * ```js
3093
- * I.waitUntil(() => window.requests == 0);
3094
- * I.waitUntil(() => window.requests == 0, 5);
3095
- * ```
3096
- *
3097
- * @param {function|string} fn function which is executed in browser context.
3098
- * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
3099
- * @param {string} [timeoutMsg=''] message to show in case of timeout fail.
3100
- * @param {?number} [interval=null]
3101
- */
3102
- async waitUntil(fn, sec = null) {
3103
- console.log('This method will remove in CodeceptJS 1.4; use `waitForFunction` instead!');
3104
- const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
3105
- const context = await this._getContext();
3106
- return context.waitForFunction(fn, { timeout: waitTimeout });
3107
- }
3108
-
3109
3107
  async waitUntilExists(locator, sec) {
3110
3108
  console.log(`waitUntilExists deprecated:
3111
3109
  * use 'waitForElement' to wait for element to be attached
@@ -3121,7 +3119,7 @@ class Puppeteer extends Helper {
3121
3119
  * I.waitForDetached('#popup');
3122
3120
  * ```
3123
3121
  *
3124
- * @param {string | object} locator element located by CSS|XPath|strict locator.
3122
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
3125
3123
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
3126
3124
  */
3127
3125
  async waitForDetached(locator, sec) {
@@ -3194,7 +3192,7 @@ class Puppeteer extends Helper {
3194
3192
  * const width = await I.grabElementBoundingRect('h3', 'width');
3195
3193
  * // width == 527
3196
3194
  * ```
3197
- * @param {string | object} locator element located by CSS|XPath|strict locator.
3195
+ * @param {LocatorOrString} locator element located by CSS|XPath|strict locator.
3198
3196
  * @param {string=} elementSize x, y, width or height of the given element.
3199
3197
  * @returns {Promise<DOMRect>|Promise<number>} Element bounding rectangle
3200
3198
  *
@@ -131,6 +131,7 @@ class REST extends Helper {
131
131
  * I.setRequestTimeout(10000); // In milliseconds
132
132
  * ```
133
133
  *
134
+ * @param {number} newTimeout - timeout in milliseconds
134
135
  */
135
136
  setRequestTimeout(newTimeout) {
136
137
  this.options.timeout = newTimeout;