codeceptjs 3.5.6 → 3.5.7

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 (139) hide show
  1. package/README.md +5 -1
  2. package/docs/advanced.md +1 -1
  3. package/docs/bdd.md +11 -7
  4. package/docs/build/ApiDataFactory.js +2 -1
  5. package/docs/build/Appium.js +26 -23
  6. package/docs/build/Expect.js +422 -0
  7. package/docs/build/Nightmare.js +53 -56
  8. package/docs/build/Playwright.js +202 -103
  9. package/docs/build/Protractor.js +66 -69
  10. package/docs/build/Puppeteer.js +124 -81
  11. package/docs/build/TestCafe.js +56 -55
  12. package/docs/build/WebDriver.js +81 -82
  13. package/docs/changelog.md +562 -1
  14. package/docs/commands.md +12 -0
  15. package/docs/community-helpers.md +8 -4
  16. package/docs/examples.md +8 -2
  17. package/docs/helpers/Appium.md +50 -32
  18. package/docs/helpers/Expect.md +275 -0
  19. package/docs/helpers/Nightmare.md +141 -94
  20. package/docs/helpers/Playwright.md +360 -261
  21. package/docs/helpers/Protractor.md +229 -169
  22. package/docs/helpers/Puppeteer.md +270 -187
  23. package/docs/helpers/TestCafe.md +201 -149
  24. package/docs/helpers/WebDriver.md +252 -178
  25. package/docs/mobile.md +17 -21
  26. package/docs/plugins.md +35 -1
  27. package/docs/webapi/amOnPage.mustache +1 -1
  28. package/docs/webapi/appendField.mustache +1 -1
  29. package/docs/webapi/attachFile.mustache +1 -1
  30. package/docs/webapi/blur.mustache +1 -0
  31. package/docs/webapi/checkOption.mustache +1 -1
  32. package/docs/webapi/clearCookie.mustache +1 -1
  33. package/docs/webapi/clearField.mustache +1 -1
  34. package/docs/webapi/click.mustache +1 -1
  35. package/docs/webapi/clickLink.mustache +1 -1
  36. package/docs/webapi/closeCurrentTab.mustache +1 -1
  37. package/docs/webapi/closeOtherTabs.mustache +1 -1
  38. package/docs/webapi/dontSee.mustache +1 -1
  39. package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -1
  40. package/docs/webapi/dontSeeCookie.mustache +1 -1
  41. package/docs/webapi/dontSeeCurrentUrlEquals.mustache +1 -1
  42. package/docs/webapi/dontSeeElement.mustache +1 -1
  43. package/docs/webapi/dontSeeElementInDOM.mustache +1 -1
  44. package/docs/webapi/dontSeeInCurrentUrl.mustache +1 -1
  45. package/docs/webapi/dontSeeInField.mustache +1 -1
  46. package/docs/webapi/dontSeeInSource.mustache +1 -1
  47. package/docs/webapi/dontSeeInTitle.mustache +1 -1
  48. package/docs/webapi/doubleClick.mustache +1 -1
  49. package/docs/webapi/downloadFile.mustache +1 -1
  50. package/docs/webapi/dragAndDrop.mustache +1 -1
  51. package/docs/webapi/dragSlider.mustache +1 -1
  52. package/docs/webapi/executeAsyncScript.mustache +0 -2
  53. package/docs/webapi/executeScript.mustache +0 -2
  54. package/docs/webapi/fillField.mustache +1 -1
  55. package/docs/webapi/focus.mustache +1 -0
  56. package/docs/webapi/forceClick.mustache +1 -1
  57. package/docs/webapi/forceRightClick.mustache +1 -1
  58. package/docs/webapi/grabCookie.mustache +1 -1
  59. package/docs/webapi/grabDataFromPerformanceTiming.mustache +1 -1
  60. package/docs/webapi/moveCursorTo.mustache +1 -1
  61. package/docs/webapi/openNewTab.mustache +1 -1
  62. package/docs/webapi/pressKey.mustache +1 -1
  63. package/docs/webapi/pressKeyDown.mustache +1 -1
  64. package/docs/webapi/pressKeyUp.mustache +1 -1
  65. package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -1
  66. package/docs/webapi/refreshPage.mustache +1 -1
  67. package/docs/webapi/resizeWindow.mustache +1 -1
  68. package/docs/webapi/rightClick.mustache +1 -1
  69. package/docs/webapi/saveElementScreenshot.mustache +1 -1
  70. package/docs/webapi/saveScreenshot.mustache +1 -1
  71. package/docs/webapi/say.mustache +1 -1
  72. package/docs/webapi/scrollIntoView.mustache +1 -1
  73. package/docs/webapi/scrollPageToBottom.mustache +1 -1
  74. package/docs/webapi/scrollPageToTop.mustache +1 -1
  75. package/docs/webapi/scrollTo.mustache +1 -1
  76. package/docs/webapi/see.mustache +1 -1
  77. package/docs/webapi/seeAttributesOnElements.mustache +1 -1
  78. package/docs/webapi/seeCheckboxIsChecked.mustache +1 -1
  79. package/docs/webapi/seeCookie.mustache +1 -1
  80. package/docs/webapi/seeCssPropertiesOnElements.mustache +1 -1
  81. package/docs/webapi/seeCurrentUrlEquals.mustache +1 -1
  82. package/docs/webapi/seeElement.mustache +1 -1
  83. package/docs/webapi/seeElementInDOM.mustache +1 -1
  84. package/docs/webapi/seeInCurrentUrl.mustache +1 -1
  85. package/docs/webapi/seeInField.mustache +1 -1
  86. package/docs/webapi/seeInPopup.mustache +1 -1
  87. package/docs/webapi/seeInSource.mustache +1 -1
  88. package/docs/webapi/seeInTitle.mustache +1 -1
  89. package/docs/webapi/seeNumberOfElements.mustache +1 -1
  90. package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -1
  91. package/docs/webapi/seeTextEquals.mustache +1 -1
  92. package/docs/webapi/seeTitleEquals.mustache +1 -1
  93. package/docs/webapi/selectOption.mustache +1 -1
  94. package/docs/webapi/setCookie.mustache +1 -1
  95. package/docs/webapi/setGeoLocation.mustache +1 -1
  96. package/docs/webapi/switchTo.mustache +1 -1
  97. package/docs/webapi/switchToNextTab.mustache +1 -1
  98. package/docs/webapi/switchToPreviousTab.mustache +1 -1
  99. package/docs/webapi/type.mustache +1 -1
  100. package/docs/webapi/uncheckOption.mustache +1 -1
  101. package/docs/webapi/wait.mustache +1 -1
  102. package/docs/webapi/waitForClickable.mustache +1 -1
  103. package/docs/webapi/waitForDetached.mustache +1 -1
  104. package/docs/webapi/waitForElement.mustache +1 -1
  105. package/docs/webapi/waitForEnabled.mustache +1 -1
  106. package/docs/webapi/waitForFunction.mustache +1 -1
  107. package/docs/webapi/waitForInvisible.mustache +1 -1
  108. package/docs/webapi/waitForText.mustache +1 -1
  109. package/docs/webapi/waitForValue.mustache +1 -1
  110. package/docs/webapi/waitForVisible.mustache +1 -1
  111. package/docs/webapi/waitInUrl.mustache +1 -1
  112. package/docs/webapi/waitNumberOfVisibleElements.mustache +1 -1
  113. package/docs/webapi/waitToHide.mustache +1 -1
  114. package/docs/webapi/waitUrlEquals.mustache +1 -1
  115. package/docs/webdriver.md +1 -1
  116. package/lib/cli.js +3 -1
  117. package/lib/command/dryRun.js +2 -1
  118. package/lib/helper/ApiDataFactory.js +2 -1
  119. package/lib/helper/Appium.js +8 -5
  120. package/lib/helper/Expect.js +422 -0
  121. package/lib/helper/Playwright.js +127 -32
  122. package/lib/helper/Puppeteer.js +47 -4
  123. package/lib/interfaces/gherkin.js +21 -2
  124. package/lib/output.js +1 -1
  125. package/lib/plugin/autoLogin.js +41 -3
  126. package/lib/utils.js +1 -1
  127. package/lib/workers.js +23 -2
  128. package/package.json +25 -16
  129. package/translations/de-DE.js +5 -0
  130. package/translations/fr-FR.js +1 -0
  131. package/translations/it-IT.js +1 -0
  132. package/translations/ja-JP.js +5 -0
  133. package/translations/pl-PL.js +5 -0
  134. package/translations/pt-BR.js +1 -0
  135. package/translations/ru-RU.js +1 -0
  136. package/translations/zh-CN.js +5 -0
  137. package/translations/zh-TW.js +5 -0
  138. package/typings/promiseBasedTypes.d.ts +928 -862
  139. package/typings/types.d.ts +932 -845
@@ -116,6 +116,10 @@ const config = {};
116
116
  * npm i playwright-core@^1.18 --save
117
117
  * ```
118
118
  *
119
+ * Breaking Changes: if you use Playwright v1.38 and later, it will no longer download browsers automatically.
120
+ *
121
+ * Run `npx playwright install` to download browsers after `npm install`.
122
+ *
119
123
  * Using playwright-core package, will prevent the download of browser binaries and allow connecting to an existing browser installation or for connecting to a remote one.
120
124
  *
121
125
  *
@@ -694,7 +698,7 @@ class Playwright extends Helper {
694
698
  * I.seeInPopup('Popup text');
695
699
  * ```
696
700
  * @param {string} text value to check.
697
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
701
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
698
702
  *
699
703
  */
700
704
  async seeInPopup(text) {
@@ -900,7 +904,8 @@ class Playwright extends Helper {
900
904
  * ```
901
905
  *
902
906
  * @param {string} url url path or global url.
903
- * @return {void} automatically synchronized promise with recorder #!
907
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
908
+ *
904
909
  */
905
910
  async amOnPage(url) {
906
911
  if (this.isElectron) {
@@ -938,7 +943,7 @@ class Playwright extends Helper {
938
943
  *
939
944
  * @param {number} width width in pixels or `maximize`.
940
945
  * @param {number} height height in pixels.
941
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
946
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
942
947
  *
943
948
  *
944
949
  * Unlike other drivers Playwright changes the size of a viewport, not the window!
@@ -966,14 +971,14 @@ class Playwright extends Helper {
966
971
  * Set headers for all next requests
967
972
  *
968
973
  * ```js
969
- * I.haveRequestHeaders({
974
+ * I.setPlaywrightRequestHeaders({
970
975
  * 'X-Sent-By': 'CodeceptJS',
971
976
  * });
972
977
  * ```
973
978
  *
974
979
  * @param {object} customHeaders headers to set
975
980
  */
976
- async haveRequestHeaders(customHeaders) {
981
+ async setPlaywrightRequestHeaders(customHeaders) {
977
982
  if (!customHeaders) {
978
983
  throw new Error('Cannot send empty headers.');
979
984
  }
@@ -992,7 +997,7 @@ class Playwright extends Helper {
992
997
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
993
998
  * @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
994
999
  * @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
995
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1000
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
996
1001
  *
997
1002
  *
998
1003
  */
@@ -1019,6 +1024,7 @@ class Playwright extends Helper {
1019
1024
  *
1020
1025
  * @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
1021
1026
  * @param {any} [options] Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-focus) for available options object as 2nd argument.
1027
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1022
1028
  *
1023
1029
  *
1024
1030
  */
@@ -1048,6 +1054,7 @@ class Playwright extends Helper {
1048
1054
  *
1049
1055
  * @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
1050
1056
  * @param {any} [options] Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-blur) for available options object as 2nd argument.
1057
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1051
1058
  *
1052
1059
  *
1053
1060
  */
@@ -1058,6 +1065,38 @@ class Playwright extends Helper {
1058
1065
  await el.blur(options);
1059
1066
  return this._waitForAction();
1060
1067
  }
1068
+ /**
1069
+ * Return the checked status of given element.
1070
+ *
1071
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1072
+ * @param {object} [options] See https://playwright.dev/docs/api/class-locator#locator-is-checked
1073
+ * @return {Promise<boolean>}
1074
+ *
1075
+ */
1076
+
1077
+ async grabCheckedElementStatus(locator, options = {}) {
1078
+ const supportedTypes = ['checkbox', 'radio'];
1079
+ const el = await this._locateElement(locator);
1080
+ const type = await el.getAttribute('type');
1081
+
1082
+ if (supportedTypes.includes(type)) {
1083
+ return el.isChecked(options);
1084
+ }
1085
+ throw new Error(`Element is not a ${supportedTypes.join(' or ')} input`);
1086
+ }
1087
+ /**
1088
+ * Return the disabled status of given element.
1089
+ *
1090
+ * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1091
+ * @param {object} [options] See https://playwright.dev/docs/api/class-locator#locator-is-disabled
1092
+ * @return {Promise<boolean>}
1093
+ *
1094
+ */
1095
+
1096
+ async grabDisabledElementStatus(locator, options = {}) {
1097
+ const el = await this._locateElement(locator);
1098
+ return el.isDisabled(options);
1099
+ }
1061
1100
 
1062
1101
  /**
1063
1102
  * Drag an item to a destination element.
@@ -1068,7 +1107,7 @@ class Playwright extends Helper {
1068
1107
  *
1069
1108
  * @param {LocatorOrString} srcElement located by CSS|XPath|strict locator.
1070
1109
  * @param {LocatorOrString} destElement located by CSS|XPath|strict locator.
1071
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1110
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1072
1111
  *
1073
1112
  * @param {any} [options] [Additional options](https://playwright.dev/docs/api/class-page#page-drag-and-drop) can be passed as 3rd argument.
1074
1113
  *
@@ -1126,7 +1165,7 @@ class Playwright extends Helper {
1126
1165
  * ```js
1127
1166
  * I.refreshPage();
1128
1167
  * ```
1129
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1168
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1130
1169
  *
1131
1170
  */
1132
1171
  async refreshPage() {
@@ -1139,7 +1178,7 @@ class Playwright extends Helper {
1139
1178
  * ```js
1140
1179
  * I.scrollPageToTop();
1141
1180
  * ```
1142
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1181
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1143
1182
  *
1144
1183
  */
1145
1184
  scrollPageToTop() {
@@ -1154,7 +1193,7 @@ class Playwright extends Helper {
1154
1193
  * ```js
1155
1194
  * I.scrollPageToBottom();
1156
1195
  * ```
1157
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1196
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1158
1197
  *
1159
1198
  */
1160
1199
  async scrollPageToBottom() {
@@ -1183,7 +1222,7 @@ class Playwright extends Helper {
1183
1222
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
1184
1223
  * @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
1185
1224
  * @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
1186
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1225
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1187
1226
  *
1188
1227
  */
1189
1228
  async scrollTo(locator, offsetX = 0, offsetY = 0) {
@@ -1213,7 +1252,7 @@ class Playwright extends Helper {
1213
1252
  * ```
1214
1253
  *
1215
1254
  * @param {string} text text value to check.
1216
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1255
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1217
1256
  *
1218
1257
  */
1219
1258
  async seeInTitle(text) {
@@ -1252,7 +1291,7 @@ class Playwright extends Helper {
1252
1291
  * ```
1253
1292
  *
1254
1293
  * @param {string} text value to check.
1255
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1294
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1256
1295
  *
1257
1296
  */
1258
1297
  async seeTitleEquals(text) {
@@ -1268,7 +1307,7 @@ class Playwright extends Helper {
1268
1307
  * ```
1269
1308
  *
1270
1309
  * @param {string} text value to check.
1271
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1310
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1272
1311
  *
1273
1312
  */
1274
1313
  async dontSeeInTitle(text) {
@@ -1493,7 +1532,7 @@ class Playwright extends Helper {
1493
1532
  * I.seeElement('#modal');
1494
1533
  * ```
1495
1534
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
1496
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1535
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1497
1536
  *
1498
1537
  *
1499
1538
  */
@@ -1511,7 +1550,7 @@ class Playwright extends Helper {
1511
1550
  * ```
1512
1551
  *
1513
1552
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
1514
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1553
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1515
1554
  *
1516
1555
  *
1517
1556
  */
@@ -1529,7 +1568,7 @@ class Playwright extends Helper {
1529
1568
  * I.seeElementInDOM('#modal');
1530
1569
  * ```
1531
1570
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1532
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1571
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1533
1572
  *
1534
1573
  */
1535
1574
  async seeElementInDOM(locator) {
@@ -1545,7 +1584,7 @@ class Playwright extends Helper {
1545
1584
  * ```
1546
1585
  *
1547
1586
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
1548
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1587
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1549
1588
  *
1550
1589
  */
1551
1590
  async dontSeeElementInDOM(locator) {
@@ -1611,7 +1650,7 @@ class Playwright extends Helper {
1611
1650
  *
1612
1651
  * @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
1613
1652
  * @param {?CodeceptJS.LocatorOrString | null} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
1614
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1653
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1615
1654
  *
1616
1655
  *
1617
1656
  * @param {any} [options] [Additional options](https://playwright.dev/docs/api/class-page#page-click) for click available as 3rd argument.
@@ -1668,7 +1707,7 @@ class Playwright extends Helper {
1668
1707
  *
1669
1708
  * @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
1670
1709
  * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
1671
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1710
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1672
1711
  *
1673
1712
  */
1674
1713
  async forceClick(locator, context = null) {
@@ -1688,7 +1727,7 @@ class Playwright extends Helper {
1688
1727
  *
1689
1728
  * @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
1690
1729
  * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
1691
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1730
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1692
1731
  *
1693
1732
  *
1694
1733
  *
@@ -1711,7 +1750,7 @@ class Playwright extends Helper {
1711
1750
  *
1712
1751
  * @param {CodeceptJS.LocatorOrString} locator clickable element located by CSS|XPath|strict locator.
1713
1752
  * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
1714
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1753
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1715
1754
  *
1716
1755
  *
1717
1756
  *
@@ -1733,7 +1772,7 @@ class Playwright extends Helper {
1733
1772
  * ```
1734
1773
  * @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
1735
1774
  * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
1736
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1775
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1737
1776
  *
1738
1777
  *
1739
1778
  * [Additional options](https://playwright.dev/docs/api/class-elementhandle#element-handle-check) for check available as 3rd argument.
@@ -1765,7 +1804,7 @@ class Playwright extends Helper {
1765
1804
  * ```
1766
1805
  * @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
1767
1806
  * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
1768
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1807
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1769
1808
  *
1770
1809
  *
1771
1810
  * [Additional options](https://playwright.dev/docs/api/class-elementhandle#element-handle-uncheck) for uncheck available as 3rd argument.
@@ -1794,7 +1833,7 @@ class Playwright extends Helper {
1794
1833
  * ```
1795
1834
  *
1796
1835
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1797
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1836
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1798
1837
  *
1799
1838
  */
1800
1839
  async seeCheckboxIsChecked(field) {
@@ -1811,7 +1850,7 @@ class Playwright extends Helper {
1811
1850
  * ```
1812
1851
  *
1813
1852
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1814
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1853
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1815
1854
  *
1816
1855
  */
1817
1856
  async dontSeeCheckboxIsChecked(field) {
@@ -1830,7 +1869,7 @@ class Playwright extends Helper {
1830
1869
  * ```
1831
1870
  *
1832
1871
  * @param {string} key name of key to press down.
1833
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1872
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1834
1873
  *
1835
1874
  */
1836
1875
  async pressKeyDown(key) {
@@ -1851,7 +1890,7 @@ class Playwright extends Helper {
1851
1890
  * ```
1852
1891
  *
1853
1892
  * @param {string} key name of key to release.
1854
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1893
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1855
1894
  *
1856
1895
  */
1857
1896
  async pressKeyUp(key) {
@@ -1920,7 +1959,7 @@ class Playwright extends Helper {
1920
1959
  * - `'Tab'`
1921
1960
  *
1922
1961
  * @param {string|string[]} key key or array of keys to press.
1923
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
1962
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1924
1963
  *
1925
1964
  *
1926
1965
  * _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313](https://github.com/GoogleChrome/puppeteer/issues/1313)).
@@ -1971,7 +2010,7 @@ class Playwright extends Helper {
1971
2010
  *
1972
2011
  * @param {string|string[]} key or array of keys to type.
1973
2012
  * @param {?number} [delay=null] (optional) delay in ms between key presses
1974
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2013
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
1975
2014
  *
1976
2015
  */
1977
2016
  async type(keys, delay = null) {
@@ -2002,7 +2041,7 @@ class Playwright extends Helper {
2002
2041
  * ```
2003
2042
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
2004
2043
  * @param {CodeceptJS.StringOrSecret} value text value to fill.
2005
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2044
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2006
2045
  *
2007
2046
  *
2008
2047
  */
@@ -2061,7 +2100,7 @@ class Playwright extends Helper {
2061
2100
  * ```
2062
2101
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
2063
2102
  * @param {string} value text value to append.
2064
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2103
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2065
2104
  *
2066
2105
  *
2067
2106
  *
@@ -2087,7 +2126,7 @@ class Playwright extends Helper {
2087
2126
  * ```
2088
2127
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
2089
2128
  * @param {CodeceptJS.StringOrSecret} value value to check.
2090
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2129
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2091
2130
  *
2092
2131
  */
2093
2132
  async seeInField(field, value) {
@@ -2106,7 +2145,7 @@ class Playwright extends Helper {
2106
2145
  *
2107
2146
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
2108
2147
  * @param {CodeceptJS.StringOrSecret} value value to check.
2109
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2148
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2110
2149
  *
2111
2150
  */
2112
2151
  async dontSeeInField(field, value) {
@@ -2126,7 +2165,7 @@ class Playwright extends Helper {
2126
2165
  *
2127
2166
  * @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
2128
2167
  * @param {string} pathToFile local file path relative to codecept.conf.ts or codecept.conf.js config file.
2129
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2168
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2130
2169
  *
2131
2170
  *
2132
2171
  */
@@ -2163,7 +2202,7 @@ class Playwright extends Helper {
2163
2202
  * ```
2164
2203
  * @param {LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
2165
2204
  * @param {string|Array<*>} option visible text or value of option.
2166
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2205
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2167
2206
  *
2168
2207
  */
2169
2208
  async selectOption(select, option) {
@@ -2205,7 +2244,7 @@ class Playwright extends Helper {
2205
2244
  * ```
2206
2245
  *
2207
2246
  * @param {string} url a fragment to check
2208
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2247
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2209
2248
  *
2210
2249
  */
2211
2250
  async seeInCurrentUrl(url) {
@@ -2216,7 +2255,7 @@ class Playwright extends Helper {
2216
2255
  * Checks that current url does not contain a provided fragment.
2217
2256
  *
2218
2257
  * @param {string} url value to check.
2219
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2258
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2220
2259
  *
2221
2260
  */
2222
2261
  async dontSeeInCurrentUrl(url) {
@@ -2234,7 +2273,7 @@ class Playwright extends Helper {
2234
2273
  * ```
2235
2274
  *
2236
2275
  * @param {string} url value to check.
2237
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2276
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2238
2277
  *
2239
2278
  */
2240
2279
  async seeCurrentUrlEquals(url) {
@@ -2251,7 +2290,7 @@ class Playwright extends Helper {
2251
2290
  * ```
2252
2291
  *
2253
2292
  * @param {string} url value to check.
2254
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2293
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2255
2294
  *
2256
2295
  */
2257
2296
  async dontSeeCurrentUrlEquals(url) {
@@ -2269,7 +2308,7 @@ class Playwright extends Helper {
2269
2308
  * ```
2270
2309
  * @param {string} text expected on page.
2271
2310
  * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
2272
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2311
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2273
2312
  *
2274
2313
  *
2275
2314
  *
@@ -2287,7 +2326,7 @@ class Playwright extends Helper {
2287
2326
  *
2288
2327
  * @param {string} text element value to check.
2289
2328
  * @param {CodeceptJS.LocatorOrString?} [context=null] element located by CSS|XPath|strict locator.
2290
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2329
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2291
2330
  *
2292
2331
  */
2293
2332
  async seeTextEquals(text, context = null) {
@@ -2305,7 +2344,7 @@ class Playwright extends Helper {
2305
2344
  *
2306
2345
  * @param {string} text which is not present.
2307
2346
  * @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
2308
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2347
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2309
2348
  *
2310
2349
  *
2311
2350
  *
@@ -2367,7 +2406,7 @@ class Playwright extends Helper {
2367
2406
  * I.seeInSource('<h1>Green eggs &amp; ham</h1>');
2368
2407
  * ```
2369
2408
  * @param {string} text value to check.
2370
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2409
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2371
2410
  *
2372
2411
  */
2373
2412
  async seeInSource(text) {
@@ -2383,7 +2422,7 @@ class Playwright extends Helper {
2383
2422
  * ```
2384
2423
  *
2385
2424
  * @param {string} value to check.
2386
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2425
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2387
2426
  *
2388
2427
  */
2389
2428
  async dontSeeInSource(text) {
@@ -2402,7 +2441,7 @@ class Playwright extends Helper {
2402
2441
  *
2403
2442
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2404
2443
  * @param {number} num number of elements.
2405
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2444
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2406
2445
  *
2407
2446
  *
2408
2447
  *
@@ -2422,7 +2461,7 @@ class Playwright extends Helper {
2422
2461
  *
2423
2462
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2424
2463
  * @param {number} num number of elements.
2425
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2464
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2426
2465
  *
2427
2466
  *
2428
2467
  *
@@ -2448,7 +2487,7 @@ class Playwright extends Helper {
2448
2487
  * ```
2449
2488
  *
2450
2489
  * @param {Cookie|Array<Cookie>} cookie a cookie object or array of cookie objects.
2451
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2490
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2452
2491
  *
2453
2492
  */
2454
2493
  async setCookie(cookie) {
@@ -2466,7 +2505,7 @@ class Playwright extends Helper {
2466
2505
  * ```
2467
2506
  *
2468
2507
  * @param {string} name cookie name.
2469
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2508
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2470
2509
  *
2471
2510
  *
2472
2511
  */
@@ -2483,7 +2522,7 @@ class Playwright extends Helper {
2483
2522
  * ```
2484
2523
  *
2485
2524
  * @param {string} name cookie name.
2486
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2525
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2487
2526
  *
2488
2527
  */
2489
2528
  async dontSeeCookie(name) {
@@ -2502,7 +2541,7 @@ class Playwright extends Helper {
2502
2541
  * ```
2503
2542
  *
2504
2543
  * @param {?string} [name=null] cookie name.
2505
- * @returns {Promise<string>|Promise<string[]>} attribute value
2544
+ * @returns {any} attribute value
2506
2545
  *
2507
2546
  *
2508
2547
  * Returns cookie in JSON format. If name not passed returns all cookies for this domain.
@@ -2524,7 +2563,7 @@ class Playwright extends Helper {
2524
2563
  * ```
2525
2564
  *
2526
2565
  * @param {?string} [cookie=null] (optional, `null` by default) cookie name
2527
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2566
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2528
2567
  *
2529
2568
  */
2530
2569
  async clearCookie() {
@@ -2754,7 +2793,7 @@ class Playwright extends Helper {
2754
2793
  *
2755
2794
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
2756
2795
  * @param {object} cssProperties object with CSS properties and their values to check.
2757
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2796
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2758
2797
  *
2759
2798
  *
2760
2799
  */
@@ -2800,7 +2839,7 @@ class Playwright extends Helper {
2800
2839
  *
2801
2840
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
2802
2841
  * @param {object} attributes attributes and their values to check.
2803
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2842
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2804
2843
  *
2805
2844
  *
2806
2845
  */
@@ -2840,7 +2879,7 @@ class Playwright extends Helper {
2840
2879
  *
2841
2880
  * @param {CodeceptJS.LocatorOrString} locator located by label|name|CSS|XPath|strict locator.
2842
2881
  * @param {number} offsetX position to drag.
2843
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2882
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2844
2883
  *
2845
2884
  *
2846
2885
  */
@@ -2918,7 +2957,7 @@ class Playwright extends Helper {
2918
2957
  *
2919
2958
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2920
2959
  * @param {string} fileName file name to save.
2921
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2960
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2922
2961
  *
2923
2962
  *
2924
2963
  */
@@ -2944,7 +2983,7 @@ class Playwright extends Helper {
2944
2983
  *
2945
2984
  * @param {string} fileName file name to save.
2946
2985
  * @param {boolean} [fullPage=false] (optional, `false` by default) flag to enable fullscreen screenshot mode.
2947
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
2986
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
2948
2987
  *
2949
2988
  */
2950
2989
  async saveScreenshot(fileName, fullPage) {
@@ -3082,7 +3121,7 @@ class Playwright extends Helper {
3082
3121
  * ```
3083
3122
  *
3084
3123
  * @param {number} sec number of second to wait.
3085
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
3124
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
3086
3125
  *
3087
3126
  */
3088
3127
  async wait(sec) {
@@ -3097,7 +3136,7 @@ class Playwright extends Helper {
3097
3136
  *
3098
3137
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
3099
3138
  * @param {number} [sec=1] (optional) time in seconds to wait, 1 by default.
3100
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
3139
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
3101
3140
  *
3102
3141
  */
3103
3142
  async waitForEnabled(locator, sec) {
@@ -3133,7 +3172,7 @@ class Playwright extends Helper {
3133
3172
  * @param {LocatorOrString} field input field.
3134
3173
  * @param {string }value expected value.
3135
3174
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
3136
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
3175
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
3137
3176
  *
3138
3177
  */
3139
3178
  async waitForValue(field, value, sec) {
@@ -3170,7 +3209,7 @@ class Playwright extends Helper {
3170
3209
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
3171
3210
  * @param {number} num number of elements.
3172
3211
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
3173
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
3212
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
3174
3213
  *
3175
3214
  *
3176
3215
  */
@@ -3212,7 +3251,7 @@ class Playwright extends Helper {
3212
3251
  *
3213
3252
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
3214
3253
  * @param {number} [sec] (optional, `1` by default) time in seconds to wait
3215
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
3254
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
3216
3255
  *
3217
3256
  */
3218
3257
  async waitForClickable(locator, waitTimeout) {
@@ -3231,7 +3270,7 @@ class Playwright extends Helper {
3231
3270
  *
3232
3271
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
3233
3272
  * @param {number} [sec] (optional, `1` by default) time in seconds to wait
3234
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
3273
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
3235
3274
  *
3236
3275
  *
3237
3276
  */
@@ -3240,10 +3279,11 @@ class Playwright extends Helper {
3240
3279
  locator = new Locator(locator, 'css');
3241
3280
 
3242
3281
  const context = await this._getContext();
3243
- const waiter = context.waitForSelector(buildLocatorString(locator), { timeout: waitTimeout, state: 'attached' });
3244
- return waiter.catch((err) => {
3245
- throw new Error(`element (${locator.toString()}) still not present on page after ${waitTimeout / 1000} sec\n${err.message}`);
3246
- });
3282
+ try {
3283
+ await context.locator(buildLocatorString(locator)).first().waitFor({ timeout: waitTimeout, state: 'attached' });
3284
+ } catch (e) {
3285
+ throw new Error(`element (${locator.toString()}) still not present on page after ${waitTimeout / 1000} sec\n${e.message}`);
3286
+ }
3247
3287
  }
3248
3288
 
3249
3289
  /**
@@ -3256,7 +3296,7 @@ class Playwright extends Helper {
3256
3296
  *
3257
3297
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
3258
3298
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
3259
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
3299
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
3260
3300
  *
3261
3301
  *
3262
3302
  * This method accepts [React selectors](https://codecept.io/react).
@@ -3265,10 +3305,26 @@ class Playwright extends Helper {
3265
3305
  const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
3266
3306
  locator = new Locator(locator, 'css');
3267
3307
  const context = await this._getContext();
3268
- const waiter = context.waitForSelector(buildLocatorString(locator), { timeout: waitTimeout, state: 'visible' });
3269
- return waiter.catch((err) => {
3270
- throw new Error(`element (${locator.toString()}) still not visible after ${waitTimeout / 1000} sec\n${err.message}`);
3271
- });
3308
+ let count = 0;
3309
+
3310
+ // we have this as https://github.com/microsoft/playwright/issues/26829 is not yet implemented
3311
+ let waiter;
3312
+ if (this.frame) {
3313
+ do {
3314
+ waiter = await this.frame.locator(buildLocatorString(locator)).first().isVisible();
3315
+ await this.wait(1);
3316
+ count += 1000;
3317
+ if (waiter) break;
3318
+ } while (count <= waitTimeout);
3319
+
3320
+ if (!waiter) throw new Error(`element (${locator.toString()}) still not visible after ${waitTimeout / 1000} sec.`);
3321
+ }
3322
+
3323
+ try {
3324
+ await context.locator(buildLocatorString(locator)).first().waitFor({ timeout: waitTimeout, state: 'visible' });
3325
+ } catch (e) {
3326
+ throw new Error(`element (${locator.toString()}) still not visible after ${waitTimeout / 1000} sec\n${e.message}`);
3327
+ }
3272
3328
  }
3273
3329
 
3274
3330
  /**
@@ -3281,17 +3337,34 @@ class Playwright extends Helper {
3281
3337
  *
3282
3338
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
3283
3339
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
3284
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
3340
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
3285
3341
  *
3286
3342
  */
3287
3343
  async waitForInvisible(locator, sec) {
3288
3344
  const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
3289
3345
  locator = new Locator(locator, 'css');
3290
3346
  const context = await this._getContext();
3291
- const waiter = context.waitForSelector(buildLocatorString(locator), { timeout: waitTimeout, state: 'hidden' });
3292
- return waiter.catch((err) => {
3293
- throw new Error(`element (${locator.toString()}) still visible after ${waitTimeout / 1000} sec\n${err.message}`);
3294
- });
3347
+ let waiter;
3348
+ let count = 0;
3349
+
3350
+ // we have this as https://github.com/microsoft/playwright/issues/26829 is not yet implemented
3351
+ if (this.frame) {
3352
+ do {
3353
+ waiter = await this.frame.locator(buildLocatorString(locator)).first().isHidden();
3354
+ await this.wait(1);
3355
+ count += 1000;
3356
+ if (waiter) break;
3357
+ } while (count <= waitTimeout);
3358
+
3359
+ if (!waiter) throw new Error(`element (${locator.toString()}) still visible after ${waitTimeout / 1000} sec.`);
3360
+ return;
3361
+ }
3362
+
3363
+ try {
3364
+ await context.locator(buildLocatorString(locator)).first().waitFor({ timeout: waitTimeout, state: 'hidden' });
3365
+ } catch (e) {
3366
+ throw new Error(`element (${locator.toString()}) still visible after ${waitTimeout / 1000} sec\n${e.message}`);
3367
+ }
3295
3368
  }
3296
3369
 
3297
3370
  /**
@@ -3304,14 +3377,30 @@ class Playwright extends Helper {
3304
3377
  *
3305
3378
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
3306
3379
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
3307
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
3380
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
3308
3381
  *
3309
3382
  */
3310
3383
  async waitToHide(locator, sec) {
3311
3384
  const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
3312
3385
  locator = new Locator(locator, 'css');
3313
3386
  const context = await this._getContext();
3314
- return context.waitForSelector(buildLocatorString(locator), { timeout: waitTimeout, state: 'hidden' }).catch((err) => {
3387
+ let waiter;
3388
+ let count = 0;
3389
+
3390
+ // we have this as https://github.com/microsoft/playwright/issues/26829 is not yet implemented
3391
+ if (this.frame) {
3392
+ do {
3393
+ waiter = await this.frame.locator(buildLocatorString(locator)).first().isHidden();
3394
+ await this.wait(1);
3395
+ count += 1000;
3396
+ if (waiter) break;
3397
+ } while (count <= waitTimeout);
3398
+
3399
+ if (!waiter) throw new Error(`element (${locator.toString()}) still not hidden after ${waitTimeout / 1000} sec.`);
3400
+ return;
3401
+ }
3402
+
3403
+ return context.locator(buildLocatorString(locator)).first().waitFor({ timeout: waitTimeout, state: 'hidden' }).catch((err) => {
3315
3404
  throw new Error(`element (${locator.toString()}) still not hidden after ${waitTimeout / 1000} sec\n${err.message}`);
3316
3405
  });
3317
3406
  }
@@ -3332,7 +3421,7 @@ class Playwright extends Helper {
3332
3421
  *
3333
3422
  * @param {string} urlPart value to check.
3334
3423
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
3335
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
3424
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
3336
3425
  *
3337
3426
  */
3338
3427
  async waitInUrl(urlPart, sec = null) {
@@ -3361,7 +3450,7 @@ class Playwright extends Helper {
3361
3450
  *
3362
3451
  * @param {string} urlPart value to check.
3363
3452
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
3364
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
3453
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
3365
3454
  *
3366
3455
  */
3367
3456
  async waitUrlEquals(urlPart, sec = null) {
@@ -3398,7 +3487,7 @@ class Playwright extends Helper {
3398
3487
  * @param {string }text to wait for.
3399
3488
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
3400
3489
  * @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator.
3401
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
3490
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
3402
3491
  *
3403
3492
  */
3404
3493
  async waitForText(text, sec = null, context = null) {
@@ -3410,7 +3499,12 @@ class Playwright extends Helper {
3410
3499
  if (context) {
3411
3500
  const locator = new Locator(context, 'css');
3412
3501
  if (!locator.isXPath()) {
3413
- waiter = contextObject.waitForSelector(`${locator.isCustom() ? `${locator.type}=${locator.value}` : locator.simplify()} >> text=${text}`, { timeout: waitTimeout, state: 'visible' });
3502
+ try {
3503
+ await contextObject.locator(`${locator.isCustom() ? `${locator.type}=${locator.value}` : locator.simplify()} >> text=${text}`).first().waitFor({ timeout: waitTimeout, state: 'visible' });
3504
+ } catch (e) {
3505
+ console.log(e);
3506
+ throw new Error(`Text "${text}" was not found on page after ${waitTimeout / 1000} sec\n${e.message}`);
3507
+ }
3414
3508
  }
3415
3509
 
3416
3510
  if (locator.isXPath()) {
@@ -3423,18 +3517,17 @@ class Playwright extends Helper {
3423
3517
  }
3424
3518
  } else {
3425
3519
  // we have this as https://github.com/microsoft/playwright/issues/26829 is not yet implemented
3426
- if (this.frame) {
3427
- const { setTimeout } = require('timers/promises');
3428
- await setTimeout(waitTimeout);
3429
- waiter = await this.frame.locator(`:has-text('${text}')`).first().isVisible();
3430
- if (!waiter) throw new Error(`Text "${text}" was not found on page after ${waitTimeout / 1000} sec`);
3431
- return;
3432
- }
3433
- waiter = contextObject.waitForFunction(text => document.body && document.body.innerText.indexOf(text) > -1, text, { timeout: waitTimeout });
3520
+ // eslint-disable-next-line no-lonely-if
3521
+ const _contextObject = this.frame ? this.frame : contextObject;
3522
+ let count = 0;
3523
+ do {
3524
+ waiter = await _contextObject.locator(`:has-text('${text}')`).first().isVisible();
3525
+ await this.wait(1);
3526
+ count += 1000;
3527
+ } while (count <= waitTimeout);
3528
+
3529
+ if (!waiter) throw new Error(`Text "${text}" was not found on page after ${waitTimeout / 1000} sec`);
3434
3530
  }
3435
- return waiter.catch((err) => {
3436
- throw new Error(`Text "${text}" was not found on page after ${waitTimeout / 1000} sec\n${err.message}`);
3437
- });
3438
3531
  }
3439
3532
 
3440
3533
  /**
@@ -3478,7 +3571,7 @@ class Playwright extends Helper {
3478
3571
  * ```
3479
3572
  *
3480
3573
  * @param {?CodeceptJS.LocatorOrString} [locator=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
3481
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
3574
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
3482
3575
  *
3483
3576
  */
3484
3577
  async switchTo(locator) {
@@ -3550,7 +3643,7 @@ class Playwright extends Helper {
3550
3643
  * @param {string|function} fn to be executed in browser context.
3551
3644
  * @param {any[]|number} [argsOrSec] (optional, `1` by default) arguments for function or seconds.
3552
3645
  * @param {number} [sec] (optional, `1` by default) time in seconds to wait
3553
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
3646
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
3554
3647
  *
3555
3648
  */
3556
3649
  async waitForFunction(fn, argsOrSec = null, sec = null) {
@@ -3619,7 +3712,7 @@ class Playwright extends Helper {
3619
3712
  *
3620
3713
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
3621
3714
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
3622
- * ⚠️ returns a _promise_ which is synchronized internally by recorder
3715
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
3623
3716
  *
3624
3717
  */
3625
3718
  async waitForDetached(locator, sec) {
@@ -3629,17 +3722,21 @@ class Playwright extends Helper {
3629
3722
  let waiter;
3630
3723
  const context = await this._getContext();
3631
3724
  if (!locator.isXPath()) {
3632
- waiter = context.waitForSelector(`${locator.isCustom() ? `${locator.type}=${locator.value}` : locator.simplify()}`, { timeout: waitTimeout, state: 'detached' });
3725
+ try {
3726
+ await context.locator(`${locator.isCustom() ? `${locator.type}=${locator.value}` : locator.simplify()}`).first().waitFor({ timeout: waitTimeout, state: 'detached' });
3727
+ } catch (e) {
3728
+ throw new Error(`element (${locator.toString()}) still on page after ${waitTimeout / 1000} sec\n${e.message}`);
3729
+ }
3633
3730
  } else {
3634
3731
  const visibleFn = function ([locator, $XPath]) {
3635
3732
  eval($XPath); // eslint-disable-line no-eval
3636
3733
  return $XPath(null, locator).length === 0;
3637
3734
  };
3638
3735
  waiter = context.waitForFunction(visibleFn, [locator.value, $XPath.toString()], { timeout: waitTimeout });
3736
+ return waiter.catch((err) => {
3737
+ throw new Error(`element (${locator.toString()}) still on page after ${waitTimeout / 1000} sec\n${err.message}`);
3738
+ });
3639
3739
  }
3640
- return waiter.catch((err) => {
3641
- throw new Error(`element (${locator.toString()}) still on page after ${waitTimeout / 1000} sec\n${err.message}`);
3642
- });
3643
3740
  }
3644
3741
 
3645
3742
  async _waitForAction() {
@@ -3666,7 +3763,8 @@ class Playwright extends Helper {
3666
3763
  * loadEventEnd: 241
3667
3764
  * }
3668
3765
  * ```
3669
- * @return {Promise<any>} automatically synchronized promise through #recorder
3766
+ * @returns {Promise<void>} automatically synchronized promise through #recorder
3767
+ *
3670
3768
  */
3671
3769
  async grabDataFromPerformanceTiming() {
3672
3770
  return perfTiming;
@@ -4366,7 +4464,8 @@ async function proceedSee(assertType, text, context, strict = false) {
4366
4464
  if (!context) {
4367
4465
  const el = await this.context;
4368
4466
 
4369
- allText = [await el.locator('body').innerText()];
4467
+ allText = el.constructor.name ? [await el.locator('body').innerText()] : [await el.innerText()];
4468
+
4370
4469
  description = 'web application';
4371
4470
  } else {
4372
4471
  const locator = new Locator(context, 'css');