codeceptjs 3.3.0 → 3.3.3

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/CHANGELOG.md +50 -1
  2. package/README.md +6 -1
  3. package/docs/api.md +1 -1
  4. package/docs/bdd.md +1 -0
  5. package/docs/best.md +1 -1
  6. package/docs/build/ApiDataFactory.js +4 -3
  7. package/docs/build/Appium.js +21 -16
  8. package/docs/build/GraphQL.js +4 -2
  9. package/docs/build/GraphQLDataFactory.js +3 -3
  10. package/docs/build/JSONResponse.js +1 -1
  11. package/docs/build/Nightmare.js +54 -25
  12. package/docs/build/Playwright.js +105 -52
  13. package/docs/build/Protractor.js +72 -34
  14. package/docs/build/Puppeteer.js +80 -37
  15. package/docs/build/REST.js +5 -2
  16. package/docs/build/TestCafe.js +54 -23
  17. package/docs/build/WebDriver.js +115 -67
  18. package/docs/changelog.md +50 -1
  19. package/docs/custom-helpers.md +1 -1
  20. package/docs/data.md +2 -2
  21. package/docs/helpers/ApiDataFactory.md +7 -3
  22. package/docs/helpers/Appium.md +217 -175
  23. package/docs/helpers/GraphQL.md +6 -0
  24. package/docs/helpers/GraphQLDataFactory.md +3 -3
  25. package/docs/helpers/JSONResponse.md +1 -1
  26. package/docs/helpers/Nightmare.md +98 -45
  27. package/docs/helpers/Playwright.md +151 -59
  28. package/docs/helpers/Puppeteer.md +103 -26
  29. package/docs/helpers/REST.md +1 -1
  30. package/docs/helpers/TestCafe.md +77 -22
  31. package/docs/helpers/WebDriver.md +150 -62
  32. package/docs/index.md +1 -1
  33. package/docs/locators.md +1 -1
  34. package/docs/webapi/amOnPage.mustache +2 -1
  35. package/docs/webapi/appendField.mustache +2 -1
  36. package/docs/webapi/attachFile.mustache +2 -1
  37. package/docs/webapi/checkOption.mustache +2 -1
  38. package/docs/webapi/clearCookie.mustache +2 -1
  39. package/docs/webapi/clearField.mustache +1 -0
  40. package/docs/webapi/click.mustache +2 -1
  41. package/docs/webapi/clickLink.mustache +2 -1
  42. package/docs/webapi/closeCurrentTab.mustache +6 -4
  43. package/docs/webapi/closeOtherTabs.mustache +6 -4
  44. package/docs/webapi/dontSee.mustache +1 -0
  45. package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -0
  46. package/docs/webapi/dontSeeCookie.mustache +2 -1
  47. package/docs/webapi/dontSeeCurrentUrlEquals.mustache +2 -1
  48. package/docs/webapi/dontSeeElement.mustache +2 -1
  49. package/docs/webapi/dontSeeElementInDOM.mustache +2 -1
  50. package/docs/webapi/dontSeeInCurrentUrl.mustache +2 -1
  51. package/docs/webapi/dontSeeInField.mustache +2 -1
  52. package/docs/webapi/dontSeeInSource.mustache +1 -0
  53. package/docs/webapi/dontSeeInTitle.mustache +2 -1
  54. package/docs/webapi/doubleClick.mustache +1 -0
  55. package/docs/webapi/downloadFile.mustache +2 -1
  56. package/docs/webapi/dragAndDrop.mustache +1 -0
  57. package/docs/webapi/dragSlider.mustache +2 -1
  58. package/docs/webapi/executeAsyncScript.mustache +1 -1
  59. package/docs/webapi/executeScript.mustache +1 -1
  60. package/docs/webapi/fillField.mustache +1 -0
  61. package/docs/webapi/forceClick.mustache +1 -0
  62. package/docs/webapi/forceRightClick.mustache +1 -0
  63. package/docs/webapi/grabDataFromPerformanceTiming.mustache +2 -1
  64. package/docs/webapi/moveCursorTo.mustache +1 -0
  65. package/docs/webapi/openNewTab.mustache +6 -4
  66. package/docs/webapi/pressKey.mustache +2 -1
  67. package/docs/webapi/pressKeyDown.mustache +1 -0
  68. package/docs/webapi/pressKeyUp.mustache +1 -0
  69. package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -0
  70. package/docs/webapi/refreshPage.mustache +1 -0
  71. package/docs/webapi/resizeWindow.mustache +2 -1
  72. package/docs/webapi/rightClick.mustache +1 -0
  73. package/docs/webapi/saveElementScreenshot.mustache +1 -0
  74. package/docs/webapi/saveScreenshot.mustache +2 -1
  75. package/docs/webapi/say.mustache +2 -1
  76. package/docs/webapi/scrollIntoView.mustache +1 -0
  77. package/docs/webapi/scrollPageToBottom.mustache +1 -0
  78. package/docs/webapi/scrollPageToTop.mustache +1 -0
  79. package/docs/webapi/scrollTo.mustache +2 -1
  80. package/docs/webapi/see.mustache +2 -1
  81. package/docs/webapi/seeAttributesOnElements.mustache +2 -1
  82. package/docs/webapi/seeCheckboxIsChecked.mustache +1 -0
  83. package/docs/webapi/seeCookie.mustache +1 -0
  84. package/docs/webapi/seeCssPropertiesOnElements.mustache +2 -1
  85. package/docs/webapi/seeCurrentUrlEquals.mustache +2 -1
  86. package/docs/webapi/seeElement.mustache +2 -1
  87. package/docs/webapi/seeElementInDOM.mustache +1 -0
  88. package/docs/webapi/seeInCurrentUrl.mustache +2 -1
  89. package/docs/webapi/seeInField.mustache +1 -0
  90. package/docs/webapi/seeInPopup.mustache +1 -0
  91. package/docs/webapi/seeInSource.mustache +2 -1
  92. package/docs/webapi/seeInTitle.mustache +2 -1
  93. package/docs/webapi/seeNumberOfElements.mustache +1 -0
  94. package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -0
  95. package/docs/webapi/seeTextEquals.mustache +2 -1
  96. package/docs/webapi/seeTitleEquals.mustache +6 -5
  97. package/docs/webapi/selectOption.mustache +1 -0
  98. package/docs/webapi/setCookie.mustache +1 -0
  99. package/docs/webapi/setGeoLocation.mustache +1 -0
  100. package/docs/webapi/switchTo.mustache +2 -1
  101. package/docs/webapi/switchToNextTab.mustache +8 -7
  102. package/docs/webapi/switchToPreviousTab.mustache +8 -7
  103. package/docs/webapi/type.mustache +1 -0
  104. package/docs/webapi/uncheckOption.mustache +2 -1
  105. package/docs/webapi/wait.mustache +2 -1
  106. package/docs/webapi/waitForClickable.mustache +2 -1
  107. package/docs/webapi/waitForDetached.mustache +2 -1
  108. package/docs/webapi/waitForElement.mustache +2 -1
  109. package/docs/webapi/waitForEnabled.mustache +2 -1
  110. package/docs/webapi/waitForFunction.mustache +1 -0
  111. package/docs/webapi/waitForInvisible.mustache +2 -1
  112. package/docs/webapi/waitForText.mustache +2 -1
  113. package/docs/webapi/waitForValue.mustache +1 -0
  114. package/docs/webapi/waitForVisible.mustache +1 -0
  115. package/docs/webapi/waitInUrl.mustache +2 -1
  116. package/docs/webapi/waitNumberOfVisibleElements.mustache +2 -1
  117. package/docs/webapi/waitToHide.mustache +2 -1
  118. package/docs/webapi/waitUrlEquals.mustache +2 -1
  119. package/lib/cli.js +1 -1
  120. package/lib/command/definitions.js +9 -0
  121. package/lib/command/run-workers.js +1 -1
  122. package/lib/command/run.js +2 -2
  123. package/lib/command/workers/runTests.js +55 -0
  124. package/lib/helper/ApiDataFactory.js +4 -3
  125. package/lib/helper/Appium.js +2 -7
  126. package/lib/helper/GraphQL.js +4 -2
  127. package/lib/helper/GraphQLDataFactory.js +3 -3
  128. package/lib/helper/JSONResponse.js +1 -1
  129. package/lib/helper/Playwright.js +28 -17
  130. package/lib/helper/REST.js +5 -2
  131. package/lib/helper/WebDriver.js +4 -0
  132. package/lib/interfaces/bdd.js +5 -0
  133. package/lib/listener/steps.js +1 -0
  134. package/lib/output.js +4 -0
  135. package/lib/plugin/fakerTransform.js +1 -1
  136. package/lib/plugin/stepByStepReport.js +8 -6
  137. package/lib/workers.js +12 -0
  138. package/package.json +3 -3
  139. package/typings/types.d.ts +534 -112
@@ -92,6 +92,7 @@ const { createValueEngine, createDisabledEngine } = require('./extras/Playwright
92
92
  * * `waitForTimeout`: (optional) default wait* timeout in ms. Default: 1000.
93
93
  * * `basicAuth`: (optional) the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
94
94
  * * `windowSize`: (optional) default window size. Set a dimension like `640x480`.
95
+ * * `colorScheme`: (optional) default color scheme. Possible values: `dark` | `light` | `no-preference`.
95
96
  * * `userAgent`: (optional) user-agent string.
96
97
  * * `locale`: (optional) locale string. Example: 'en-GB', 'de-DE', 'fr-FR', ...
97
98
  * * `manualStart`: (optional, default: false) - do not start browser before a test, start it manually inside a helper with `this.helpers["Playwright"]._startBrowser()`.
@@ -212,7 +213,7 @@ const { createValueEngine, createDisabledEngine } = require('./extras/Playwright
212
213
  * }
213
214
  * ```
214
215
  *
215
- * #### Example #7: Launch test with a specifc user locale
216
+ * #### Example #7: Launch test with a specific user locale
216
217
  *
217
218
  * ```js
218
219
  * {
@@ -225,6 +226,19 @@ const { createValueEngine, createDisabledEngine } = require('./extras/Playwright
225
226
  * }
226
227
  * ```
227
228
  *
229
+ * * #### Example #8: Launch test with a specific color scheme
230
+ *
231
+ * ```js
232
+ * {
233
+ * helpers: {
234
+ * Playwright : {
235
+ * url: "http://localhost",
236
+ * colorScheme: "dark",
237
+ * }
238
+ * }
239
+ * }
240
+ * ```
241
+ *
228
242
  * Note: When connecting to remote browser `show` and specific `chrome` options (e.g. `headless` or `devtools`) are ignored.
229
243
  *
230
244
  * ## Access From Helpers
@@ -273,7 +287,7 @@ class Playwright extends Helper {
273
287
  waitForAction: 100,
274
288
  waitForTimeout: 1000,
275
289
  pressKeyDelay: 10,
276
- timeout: 1000,
290
+ timeout: 5000,
277
291
  fullPageScreenshots: false,
278
292
  disableScreenshots: false,
279
293
  ignoreLog: ['warning', 'log'],
@@ -411,6 +425,7 @@ class Playwright extends Helper {
411
425
  if (this.storageState) contextOptions.storageState = this.storageState;
412
426
  if (this.options.userAgent) contextOptions.userAgent = this.options.userAgent;
413
427
  if (this.options.locale) contextOptions.locale = this.options.locale;
428
+ if (this.options.colorScheme) contextOptions.colorScheme = this.options.colorScheme;
414
429
  if (!this.browserContext || !restartsSession()) {
415
430
  this.browserContext = await this.browser.newContext(contextOptions); // Adding the HTTPSError ignore in the context so that we can ignore those errors
416
431
  }
@@ -538,7 +553,7 @@ class Playwright extends Helper {
538
553
  * ```
539
554
  *
540
555
  * @param {string} description used to show in logs.
541
- * @param {function} fn async function that executed with Playwright helper as argument
556
+ * @param {function} fn async function that executed with Playwright helper as argumen
542
557
  */
543
558
  usePlaywrightTo(description, fn) {
544
559
  return this._useTo(...arguments);
@@ -596,7 +611,7 @@ class Playwright extends Helper {
596
611
  * I.seeInPopup('Popup text');
597
612
  * ```
598
613
  * @param {string} text value to check.
599
- *
614
+ * [!] returns a _promise_ which is synchronized internally by recorder
600
615
  */
601
616
  async seeInPopup(text) {
602
617
  popupStore.assertPopupVisible();
@@ -777,6 +792,7 @@ class Playwright extends Helper {
777
792
  * ```
778
793
  *
779
794
  * @param {string} url url path or global url.
795
+ * @return {void} automatically synchronized promise with recorder #!
780
796
  */
781
797
  async amOnPage(url) {
782
798
  if (this.isElectron) {
@@ -814,6 +830,7 @@ class Playwright extends Helper {
814
830
  *
815
831
  * @param {number} width width in pixels or `maximize`.
816
832
  * @param {number} height height in pixels.
833
+ * [!] returns a _promise_ which is synchronized internally by recorder
817
834
  *
818
835
  * Unlike other drivers Playwright changes the size of a viewport, not the window!
819
836
  * Playwright does not control the window of a browser so it can't adjust its real size.
@@ -866,7 +883,7 @@ class Playwright extends Helper {
866
883
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
867
884
  * @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
868
885
  * @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
869
- *
886
+ * [!] returns a _promise_ which is synchronized internally by recorder
870
887
  *
871
888
  */
872
889
  async moveCursorTo(locator, offsetX = 0, offsetY = 0) {
@@ -888,9 +905,9 @@ class Playwright extends Helper {
888
905
  *
889
906
  * @param {LocatorOrString} srcElement located by CSS|XPath|strict locator.
890
907
  * @param {LocatorOrString} destElement located by CSS|XPath|strict locator.
891
- *
908
+ * [!] returns a _promise_ which is synchronized internally by recorder
892
909
  *
893
- * [Additional options](https://playwright.dev/docs/api/class-page#page-drag-and-drop) can be passed as 3rd argument.
910
+ * @param {any} [options] [Additional options](https://playwright.dev/docs/api/class-page#page-drag-and-drop) can be passed as 3rd argument.
894
911
  *
895
912
  * ```js
896
913
  * // specify coordinates for source position
@@ -912,7 +929,7 @@ class Playwright extends Helper {
912
929
  * ```js
913
930
  * I.refreshPage();
914
931
  * ```
915
- *
932
+ * [!] returns a _promise_ which is synchronized internally by recorder
916
933
  */
917
934
  async refreshPage() {
918
935
  return this.page.reload({ timeout: this.options.getPageTimeout, waitUntil: this.options.waitForNavigation });
@@ -924,7 +941,7 @@ class Playwright extends Helper {
924
941
  * ```js
925
942
  * I.scrollPageToTop();
926
943
  * ```
927
- *
944
+ * [!] returns a _promise_ which is synchronized internally by recorder
928
945
  */
929
946
  scrollPageToTop() {
930
947
  return this.executeScript(() => {
@@ -938,9 +955,9 @@ class Playwright extends Helper {
938
955
  * ```js
939
956
  * I.scrollPageToBottom();
940
957
  * ```
941
- *
958
+ * [!] returns a _promise_ which is synchronized internally by recorder
942
959
  */
943
- scrollPageToBottom() {
960
+ async scrollPageToBottom() {
944
961
  return this.executeScript(() => {
945
962
  const body = document.body;
946
963
  const html = document.documentElement;
@@ -963,6 +980,7 @@ class Playwright extends Helper {
963
980
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
964
981
  * @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
965
982
  * @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
983
+ * [!] returns a _promise_ which is synchronized internally by recorder
966
984
  */
967
985
  async scrollTo(locator, offsetX = 0, offsetY = 0) {
968
986
  if (typeof locator === 'number' && typeof offsetX === 'number') {
@@ -991,6 +1009,7 @@ class Playwright extends Helper {
991
1009
  * ```
992
1010
  *
993
1011
  * @param {string} text text value to check.
1012
+ * [!] returns a _promise_ which is synchronized internally by recorder
994
1013
  */
995
1014
  async seeInTitle(text) {
996
1015
  const title = await this.page.title();
@@ -1021,14 +1040,14 @@ class Playwright extends Helper {
1021
1040
  }
1022
1041
 
1023
1042
  /**
1024
- * Checks that title is equal to provided one.
1025
- *
1026
- * ```js
1027
- * I.seeTitleEquals('Test title.');
1028
- * ```
1043
+ * Checks that title is equal to provided one.
1029
1044
  *
1030
- * @param {string} text value to check.
1045
+ * ```js
1046
+ * I.seeTitleEquals('Test title.');
1047
+ * ```
1031
1048
  *
1049
+ * @param {string} text value to check.
1050
+ * [!] returns a _promise_ which is synchronized internally by recorder
1032
1051
  */
1033
1052
  async seeTitleEquals(text) {
1034
1053
  const title = await this.page.title();
@@ -1043,6 +1062,7 @@ class Playwright extends Helper {
1043
1062
  * ```
1044
1063
  *
1045
1064
  * @param {string} text value to check.
1065
+ * [!] returns a _promise_ which is synchronized internally by recorder
1046
1066
  */
1047
1067
  async dontSeeInTitle(text) {
1048
1068
  const title = await this.page.title();
@@ -1070,8 +1090,6 @@ class Playwright extends Helper {
1070
1090
  * ```js
1071
1091
  * const elements = await this.helpers['Playwright']._locate({name: 'password'});
1072
1092
  * ```
1073
- *
1074
- *
1075
1093
  */
1076
1094
  async _locate(locator) {
1077
1095
  const context = await this.context || await this._getContext();
@@ -1249,6 +1267,7 @@ class Playwright extends Helper {
1249
1267
  * I.seeElement('#modal');
1250
1268
  * ```
1251
1269
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
1270
+ * [!] returns a _promise_ which is synchronized internally by recorder
1252
1271
  *
1253
1272
  */
1254
1273
  async seeElement(locator) {
@@ -1265,6 +1284,7 @@ class Playwright extends Helper {
1265
1284
  * ```
1266
1285
  *
1267
1286
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
1287
+ * [!] returns a _promise_ which is synchronized internally by recorder
1268
1288
  *
1269
1289
  */
1270
1290
  async dontSeeElement(locator) {
@@ -1281,7 +1301,7 @@ class Playwright extends Helper {
1281
1301
  * I.seeElementInDOM('#modal');
1282
1302
  * ```
1283
1303
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
1284
- *
1304
+ * [!] returns a _promise_ which is synchronized internally by recorder
1285
1305
  */
1286
1306
  async seeElementInDOM(locator) {
1287
1307
  const els = await this._locate(locator);
@@ -1296,6 +1316,7 @@ class Playwright extends Helper {
1296
1316
  * ```
1297
1317
  *
1298
1318
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
1319
+ * [!] returns a _promise_ which is synchronized internally by recorder
1299
1320
  */
1300
1321
  async dontSeeElementInDOM(locator) {
1301
1322
  const els = await this._locate(locator);
@@ -1317,6 +1338,7 @@ class Playwright extends Helper {
1317
1338
  * ```
1318
1339
  *
1319
1340
  * @param {string} [fileName] set filename for downloaded file
1341
+ * @return {Promise<void>}
1320
1342
  */
1321
1343
  async handleDownloads(fileName = 'downloads') {
1322
1344
  this.page.waitForEvent('download').then(async (download) => {
@@ -1356,10 +1378,11 @@ class Playwright extends Helper {
1356
1378
  * ```
1357
1379
  *
1358
1380
  * @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
1359
- * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
1381
+ * @param {?CodeceptJS.LocatorOrString | null} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
1382
+ * [!] returns a _promise_ which is synchronized internally by recorder
1360
1383
  *
1361
1384
  *
1362
- * [Additional options](https://playwright.dev/docs/api/class-page#page-click) for click available as 3rd argument.
1385
+ * @param {any} [opts] [Additional options](https://playwright.dev/docs/api/class-page#page-click) for click available as 3rd argument.
1363
1386
  *
1364
1387
  * Examples:
1365
1388
  *
@@ -1413,6 +1436,7 @@ class Playwright extends Helper {
1413
1436
  *
1414
1437
  * @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
1415
1438
  * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
1439
+ * [!] returns a _promise_ which is synchronized internally by recorder
1416
1440
  *
1417
1441
  */
1418
1442
  async forceClick(locator, context = null) {
@@ -1432,7 +1456,7 @@ class Playwright extends Helper {
1432
1456
  *
1433
1457
  * @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
1434
1458
  * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
1435
- *
1459
+ * [!] returns a _promise_ which is synchronized internally by recorder
1436
1460
  *
1437
1461
  *
1438
1462
  */
@@ -1454,7 +1478,7 @@ class Playwright extends Helper {
1454
1478
  *
1455
1479
  * @param {CodeceptJS.LocatorOrString} locator clickable element located by CSS|XPath|strict locator.
1456
1480
  * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
1457
- *
1481
+ * [!] returns a _promise_ which is synchronized internally by recorder
1458
1482
  *
1459
1483
  *
1460
1484
  */
@@ -1475,6 +1499,7 @@ class Playwright extends Helper {
1475
1499
  * ```
1476
1500
  * @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
1477
1501
  * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
1502
+ * [!] returns a _promise_ which is synchronized internally by recorder
1478
1503
  *
1479
1504
  * [Additional options](https://playwright.dev/docs/api/class-elementhandle#element-handle-check) for check available as 3rd argument.
1480
1505
  *
@@ -1505,6 +1530,7 @@ class Playwright extends Helper {
1505
1530
  * ```
1506
1531
  * @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
1507
1532
  * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
1533
+ * [!] returns a _promise_ which is synchronized internally by recorder
1508
1534
  *
1509
1535
  * [Additional options](https://playwright.dev/docs/api/class-elementhandle#element-handle-uncheck) for uncheck available as 3rd argument.
1510
1536
  *
@@ -1532,7 +1558,7 @@ class Playwright extends Helper {
1532
1558
  * ```
1533
1559
  *
1534
1560
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1535
- *
1561
+ * [!] returns a _promise_ which is synchronized internally by recorder
1536
1562
  */
1537
1563
  async seeCheckboxIsChecked(field) {
1538
1564
  return proceedIsChecked.call(this, 'assert', field);
@@ -1548,7 +1574,7 @@ class Playwright extends Helper {
1548
1574
  * ```
1549
1575
  *
1550
1576
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1551
- *
1577
+ * [!] returns a _promise_ which is synchronized internally by recorder
1552
1578
  */
1553
1579
  async dontSeeCheckboxIsChecked(field) {
1554
1580
  return proceedIsChecked.call(this, 'negate', field);
@@ -1566,7 +1592,7 @@ class Playwright extends Helper {
1566
1592
  * ```
1567
1593
  *
1568
1594
  * @param {string} key name of key to press down.
1569
- *
1595
+ * [!] returns a _promise_ which is synchronized internally by recorder
1570
1596
  */
1571
1597
  async pressKeyDown(key) {
1572
1598
  key = getNormalizedKey.call(this, key);
@@ -1586,7 +1612,7 @@ class Playwright extends Helper {
1586
1612
  * ```
1587
1613
  *
1588
1614
  * @param {string} key name of key to release.
1589
- *
1615
+ * [!] returns a _promise_ which is synchronized internally by recorder
1590
1616
  */
1591
1617
  async pressKeyUp(key) {
1592
1618
  key = getNormalizedKey.call(this, key);
@@ -1654,6 +1680,7 @@ class Playwright extends Helper {
1654
1680
  * - `'Tab'`
1655
1681
  *
1656
1682
  * @param {string|string[]} key key or array of keys to press.
1683
+ * [!] returns a _promise_ which is synchronized internally by recorder
1657
1684
  *
1658
1685
  *
1659
1686
  * _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313](https://github.com/GoogleChrome/puppeteer/issues/1313)).
@@ -1701,7 +1728,7 @@ class Playwright extends Helper {
1701
1728
  *
1702
1729
  * @param {string|string[]} key or array of keys to type.
1703
1730
  * @param {?number} [delay=null] (optional) delay in ms between key presses
1704
- *
1731
+ * [!] returns a _promise_ which is synchronized internally by recorder
1705
1732
  */
1706
1733
  async type(keys, delay = null) {
1707
1734
  if (!Array.isArray(keys)) {
@@ -1730,7 +1757,7 @@ class Playwright extends Helper {
1730
1757
  * ```
1731
1758
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1732
1759
  * @param {CodeceptJS.StringOrSecret} value text value to fill.
1733
- *
1760
+ * [!] returns a _promise_ which is synchronized internally by recorder
1734
1761
  *
1735
1762
  */
1736
1763
  async fillField(field, value) {
@@ -1757,7 +1784,7 @@ class Playwright extends Helper {
1757
1784
  * I.clearField('#email');
1758
1785
  * ```
1759
1786
  * @param {LocatorOrString} editable field located by label|name|CSS|XPath|strict locator.
1760
- *
1787
+ * [!] returns a _promise_ which is synchronized internally by recorder
1761
1788
  */
1762
1789
  async clearField(field) {
1763
1790
  return this.fillField(field, '');
@@ -1772,6 +1799,7 @@ class Playwright extends Helper {
1772
1799
  * ```
1773
1800
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
1774
1801
  * @param {string} value text value to append.
1802
+ * [!] returns a _promise_ which is synchronized internally by recorder
1775
1803
  *
1776
1804
  *
1777
1805
  */
@@ -1795,7 +1823,7 @@ class Playwright extends Helper {
1795
1823
  * ```
1796
1824
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1797
1825
  * @param {string} value value to check.
1798
- *
1826
+ * [!] returns a _promise_ which is synchronized internally by recorder
1799
1827
  */
1800
1828
  async seeInField(field, value) {
1801
1829
  return proceedSeeInField.call(this, 'assert', field, value);
@@ -1812,6 +1840,7 @@ class Playwright extends Helper {
1812
1840
  *
1813
1841
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1814
1842
  * @param {string} value value to check.
1843
+ * [!] returns a _promise_ which is synchronized internally by recorder
1815
1844
  */
1816
1845
  async dontSeeInField(field, value) {
1817
1846
  return proceedSeeInField.call(this, 'negate', field, value);
@@ -1829,6 +1858,7 @@ class Playwright extends Helper {
1829
1858
  *
1830
1859
  * @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
1831
1860
  * @param {string} pathToFile local file path relative to codecept.json config file.
1861
+ * [!] returns a _promise_ which is synchronized internally by recorder
1832
1862
  *
1833
1863
  */
1834
1864
  async attachFile(locator, pathToFile) {
@@ -1864,7 +1894,7 @@ class Playwright extends Helper {
1864
1894
  * ```
1865
1895
  * @param {LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
1866
1896
  * @param {string|Array<*>} option visible text or value of option.
1867
- *
1897
+ * [!] returns a _promise_ which is synchronized internally by recorder
1868
1898
  */
1869
1899
  async selectOption(select, option) {
1870
1900
  const els = await findFields.call(this, select);
@@ -1921,6 +1951,7 @@ class Playwright extends Helper {
1921
1951
  * ```
1922
1952
  *
1923
1953
  * @param {string} url a fragment to check
1954
+ * [!] returns a _promise_ which is synchronized internally by recorder
1924
1955
  */
1925
1956
  async seeInCurrentUrl(url) {
1926
1957
  stringIncludes('url').assert(url, await this._getPageUrl());
@@ -1930,6 +1961,7 @@ class Playwright extends Helper {
1930
1961
  * Checks that current url does not contain a provided fragment.
1931
1962
  *
1932
1963
  * @param {string} url value to check.
1964
+ * [!] returns a _promise_ which is synchronized internally by recorder
1933
1965
  */
1934
1966
  async dontSeeInCurrentUrl(url) {
1935
1967
  stringIncludes('url').negate(url, await this._getPageUrl());
@@ -1946,6 +1978,7 @@ class Playwright extends Helper {
1946
1978
  * ```
1947
1979
  *
1948
1980
  * @param {string} url value to check.
1981
+ * [!] returns a _promise_ which is synchronized internally by recorder
1949
1982
  */
1950
1983
  async seeCurrentUrlEquals(url) {
1951
1984
  urlEquals(this.options.url).assert(url, await this._getPageUrl());
@@ -1961,6 +1994,7 @@ class Playwright extends Helper {
1961
1994
  * ```
1962
1995
  *
1963
1996
  * @param {string} url value to check.
1997
+ * [!] returns a _promise_ which is synchronized internally by recorder
1964
1998
  */
1965
1999
  async dontSeeCurrentUrlEquals(url) {
1966
2000
  urlEquals(this.options.url).negate(url, await this._getPageUrl());
@@ -1977,6 +2011,7 @@ class Playwright extends Helper {
1977
2011
  * ```
1978
2012
  * @param {string} text expected on page.
1979
2013
  * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
2014
+ * [!] returns a _promise_ which is synchronized internally by recorder
1980
2015
  *
1981
2016
  *
1982
2017
  */
@@ -1993,6 +2028,7 @@ class Playwright extends Helper {
1993
2028
  *
1994
2029
  * @param {string} text element value to check.
1995
2030
  * @param {CodeceptJS.LocatorOrString?} [context=null] element located by CSS|XPath|strict locator.
2031
+ * [!] returns a _promise_ which is synchronized internally by recorder
1996
2032
  */
1997
2033
  async seeTextEquals(text, context = null) {
1998
2034
  return proceedSee.call(this, 'assert', text, context, true);
@@ -2009,7 +2045,7 @@ class Playwright extends Helper {
2009
2045
  *
2010
2046
  * @param {string} text which is not present.
2011
2047
  * @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
2012
- *
2048
+ * [!] returns a _promise_ which is synchronized internally by recorder
2013
2049
  *
2014
2050
  *
2015
2051
  */
@@ -2068,6 +2104,7 @@ class Playwright extends Helper {
2068
2104
  * I.seeInSource('<h1>Green eggs &amp; ham</h1>');
2069
2105
  * ```
2070
2106
  * @param {string} text value to check.
2107
+ * [!] returns a _promise_ which is synchronized internally by recorder
2071
2108
  */
2072
2109
  async seeInSource(text) {
2073
2110
  const source = await this.page.content();
@@ -2082,7 +2119,7 @@ class Playwright extends Helper {
2082
2119
  * ```
2083
2120
  *
2084
2121
  * @param {string} value to check.
2085
- *
2122
+ * [!] returns a _promise_ which is synchronized internally by recorder
2086
2123
  */
2087
2124
  async dontSeeInSource(text) {
2088
2125
  const source = await this.page.content();
@@ -2100,7 +2137,7 @@ class Playwright extends Helper {
2100
2137
  *
2101
2138
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2102
2139
  * @param {number} num number of elements.
2103
- *
2140
+ * [!] returns a _promise_ which is synchronized internally by recorder
2104
2141
  *
2105
2142
  *
2106
2143
  */
@@ -2119,7 +2156,7 @@ class Playwright extends Helper {
2119
2156
  *
2120
2157
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2121
2158
  * @param {number} num number of elements.
2122
- *
2159
+ * [!] returns a _promise_ which is synchronized internally by recorder
2123
2160
  *
2124
2161
  *
2125
2162
  */
@@ -2144,7 +2181,7 @@ class Playwright extends Helper {
2144
2181
  * ```
2145
2182
  *
2146
2183
  * @param {Cookie|Array<Cookie>} cookie a cookie object or array of cookie objects.
2147
- *
2184
+ * [!] returns a _promise_ which is synchronized internally by recorder
2148
2185
  */
2149
2186
  async setCookie(cookie) {
2150
2187
  if (Array.isArray(cookie)) {
@@ -2161,7 +2198,7 @@ class Playwright extends Helper {
2161
2198
  * ```
2162
2199
  *
2163
2200
  * @param {string} name cookie name.
2164
- *
2201
+ * [!] returns a _promise_ which is synchronized internally by recorder
2165
2202
  *
2166
2203
  */
2167
2204
  async seeCookie(name) {
@@ -2177,6 +2214,7 @@ class Playwright extends Helper {
2177
2214
  * ```
2178
2215
  *
2179
2216
  * @param {string} name cookie name.
2217
+ * [!] returns a _promise_ which is synchronized internally by recorder
2180
2218
  */
2181
2219
  async dontSeeCookie(name) {
2182
2220
  const cookies = await this.browserContext.cookies();
@@ -2216,6 +2254,7 @@ class Playwright extends Helper {
2216
2254
  * ```
2217
2255
  *
2218
2256
  * @param {?string} [cookie=null] (optional, `null` by default) cookie name
2257
+ * [!] returns a _promise_ which is synchronized internally by recorder
2219
2258
  */
2220
2259
  async clearCookie() {
2221
2260
  // Playwright currently doesn't support to delete a certain cookie
@@ -2246,7 +2285,6 @@ class Playwright extends Helper {
2246
2285
  *
2247
2286
  * @param {string|function} fn function to be executed in browser context.
2248
2287
  * @param {any} [arg] optional argument to pass to the function
2249
- * @return {Promise<any>}
2250
2288
  */
2251
2289
  async executeScript(fn, arg) {
2252
2290
  let context = this.page;
@@ -2444,6 +2482,7 @@ class Playwright extends Helper {
2444
2482
  *
2445
2483
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
2446
2484
  * @param {object} cssProperties object with CSS properties and their values to check.
2485
+ * [!] returns a _promise_ which is synchronized internally by recorder
2447
2486
  *
2448
2487
  */
2449
2488
  async seeCssPropertiesOnElements(locator, cssProperties) {
@@ -2489,6 +2528,7 @@ class Playwright extends Helper {
2489
2528
  *
2490
2529
  * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
2491
2530
  * @param {object} attributes attributes and their values to check.
2531
+ * [!] returns a _promise_ which is synchronized internally by recorder
2492
2532
  *
2493
2533
  */
2494
2534
  async seeAttributesOnElements(locator, attributes) {
@@ -2527,6 +2567,7 @@ class Playwright extends Helper {
2527
2567
  *
2528
2568
  * @param {CodeceptJS.LocatorOrString} locator located by label|name|CSS|XPath|strict locator.
2529
2569
  * @param {number} offsetX position to drag.
2570
+ * [!] returns a _promise_ which is synchronized internally by recorder
2530
2571
  *
2531
2572
  */
2532
2573
  async dragSlider(locator, offsetX = 0) {
@@ -2604,7 +2645,7 @@ class Playwright extends Helper {
2604
2645
  *
2605
2646
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2606
2647
  * @param {string} fileName file name to save.
2607
- *
2648
+ * [!] returns a _promise_ which is synchronized internally by recorder
2608
2649
  *
2609
2650
  */
2610
2651
  async saveElementScreenshot(locator, fileName) {
@@ -2630,6 +2671,7 @@ class Playwright extends Helper {
2630
2671
  *
2631
2672
  * @param {string} fileName file name to save.
2632
2673
  * @param {boolean} [fullPage=false] (optional, `false` by default) flag to enable fullscreen screenshot mode.
2674
+ * [!] returns a _promise_ which is synchronized internally by recorder
2633
2675
  */
2634
2676
  async saveScreenshot(fileName, fullPage) {
2635
2677
  const fullPageOption = fullPage || this.options.fullPageScreenshots;
@@ -2706,7 +2748,7 @@ class Playwright extends Helper {
2706
2748
  test.artifacts = {};
2707
2749
  }
2708
2750
 
2709
- if (this.options.recordVideo && this.page.video()) {
2751
+ if (this.options.recordVideo && this.page && this.page.video()) {
2710
2752
  test.artifacts.video = await this.page.video().path();
2711
2753
  }
2712
2754
 
@@ -2718,7 +2760,7 @@ class Playwright extends Helper {
2718
2760
  }
2719
2761
 
2720
2762
  async _passed(test) {
2721
- if (this.options.recordVideo && this.page.video()) {
2763
+ if (this.options.recordVideo && this.page && this.page.video()) {
2722
2764
  if (this.options.keepVideoForPassedTests) {
2723
2765
  test.artifacts.video = await this.page.video().path();
2724
2766
  } else {
@@ -2745,6 +2787,7 @@ class Playwright extends Helper {
2745
2787
  * ```
2746
2788
  *
2747
2789
  * @param {number} sec number of second to wait.
2790
+ * [!] returns a _promise_ which is synchronized internally by recorder
2748
2791
  */
2749
2792
  async wait(sec) {
2750
2793
  return new Promise(((done) => {
@@ -2758,6 +2801,7 @@ class Playwright extends Helper {
2758
2801
  *
2759
2802
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2760
2803
  * @param {number} [sec=1] (optional) time in seconds to wait, 1 by default.
2804
+ * [!] returns a _promise_ which is synchronized internally by recorder
2761
2805
  */
2762
2806
  async waitForEnabled(locator, sec) {
2763
2807
  const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
@@ -2792,7 +2836,7 @@ class Playwright extends Helper {
2792
2836
  * @param {LocatorOrString} field input field.
2793
2837
  * @param {string }value expected value.
2794
2838
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
2795
- *
2839
+ * [!] returns a _promise_ which is synchronized internally by recorder
2796
2840
  */
2797
2841
  async waitForValue(field, value, sec) {
2798
2842
  const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
@@ -2828,6 +2872,7 @@ class Playwright extends Helper {
2828
2872
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2829
2873
  * @param {number} num number of elements.
2830
2874
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
2875
+ * [!] returns a _promise_ which is synchronized internally by recorder
2831
2876
  *
2832
2877
  */
2833
2878
  async waitNumberOfVisibleElements(locator, num, sec) {
@@ -2868,6 +2913,7 @@ class Playwright extends Helper {
2868
2913
  *
2869
2914
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2870
2915
  * @param {number} [sec] (optional, `1` by default) time in seconds to wait
2916
+ * [!] returns a _promise_ which is synchronized internally by recorder
2871
2917
  */
2872
2918
  async waitForClickable(locator, waitTimeout) {
2873
2919
  console.log('I.waitForClickable is DEPRECATED: This is no longer needed, Playwright automatically waits for element to be clickable');
@@ -2885,6 +2931,7 @@ class Playwright extends Helper {
2885
2931
  *
2886
2932
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2887
2933
  * @param {number} [sec] (optional, `1` by default) time in seconds to wait
2934
+ * [!] returns a _promise_ which is synchronized internally by recorder
2888
2935
  *
2889
2936
  */
2890
2937
  async waitForElement(locator, sec) {
@@ -2908,7 +2955,7 @@ class Playwright extends Helper {
2908
2955
  *
2909
2956
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2910
2957
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
2911
- *
2958
+ * [!] returns a _promise_ which is synchronized internally by recorder
2912
2959
  *
2913
2960
  * This method accepts [React selectors](https://codecept.io/react).
2914
2961
  */
@@ -2932,6 +2979,7 @@ class Playwright extends Helper {
2932
2979
  *
2933
2980
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2934
2981
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
2982
+ * [!] returns a _promise_ which is synchronized internally by recorder
2935
2983
  */
2936
2984
  async waitForInvisible(locator, sec) {
2937
2985
  const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
@@ -2953,6 +3001,7 @@ class Playwright extends Helper {
2953
3001
  *
2954
3002
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
2955
3003
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
3004
+ * [!] returns a _promise_ which is synchronized internally by recorder
2956
3005
  */
2957
3006
  async waitToHide(locator, sec) {
2958
3007
  const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
@@ -2979,6 +3028,7 @@ class Playwright extends Helper {
2979
3028
  *
2980
3029
  * @param {string} urlPart value to check.
2981
3030
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
3031
+ * [!] returns a _promise_ which is synchronized internally by recorder
2982
3032
  */
2983
3033
  async waitInUrl(urlPart, sec = null) {
2984
3034
  const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
@@ -3006,6 +3056,7 @@ class Playwright extends Helper {
3006
3056
  *
3007
3057
  * @param {string} urlPart value to check.
3008
3058
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
3059
+ * [!] returns a _promise_ which is synchronized internally by recorder
3009
3060
  */
3010
3061
  async waitUrlEquals(urlPart, sec = null) {
3011
3062
  const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
@@ -3041,6 +3092,7 @@ class Playwright extends Helper {
3041
3092
  * @param {string }text to wait for.
3042
3093
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
3043
3094
  * @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator.
3095
+ * [!] returns a _promise_ which is synchronized internally by recorder
3044
3096
  */
3045
3097
  async waitForText(text, sec = null, context = null) {
3046
3098
  const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
@@ -3111,6 +3163,7 @@ class Playwright extends Helper {
3111
3163
  * ```
3112
3164
  *
3113
3165
  * @param {?CodeceptJS.LocatorOrString} [locator=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
3166
+ * [!] returns a _promise_ which is synchronized internally by recorder
3114
3167
  */
3115
3168
  async switchTo(locator) {
3116
3169
  if (Number.isInteger(locator)) {
@@ -3168,7 +3221,7 @@ class Playwright extends Helper {
3168
3221
  * @param {string|function} fn to be executed in browser context.
3169
3222
  * @param {any[]|number} [argsOrSec] (optional, `1` by default) arguments for function or seconds.
3170
3223
  * @param {number} [sec] (optional, `1` by default) time in seconds to wait
3171
- *
3224
+ * [!] returns a _promise_ which is synchronized internally by recorder
3172
3225
  */
3173
3226
  async waitForFunction(fn, argsOrSec = null, sec = null) {
3174
3227
  let args = [];
@@ -3217,6 +3270,7 @@ class Playwright extends Helper {
3217
3270
  *
3218
3271
  * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
3219
3272
  * @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
3273
+ * [!] returns a _promise_ which is synchronized internally by recorder
3220
3274
  */
3221
3275
  async waitForDetached(locator, sec) {
3222
3276
  const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
@@ -3262,6 +3316,7 @@ class Playwright extends Helper {
3262
3316
  * loadEventEnd: 241
3263
3317
  * }
3264
3318
  * ```
3319
+ * @return {Promise<any>} automatically synchronized promise through #recorder
3265
3320
  */
3266
3321
  async grabDataFromPerformanceTiming() {
3267
3322
  return perfTiming;
@@ -3306,9 +3361,8 @@ class Playwright extends Helper {
3306
3361
  * ```
3307
3362
  * This method allows intercepting and mocking requests & responses. [Learn more about it](https://playwright.dev/docs/network#handle-requests)
3308
3363
  *
3309
- * @param {string} [url] URL, regex or pattern for to match URL
3310
- * @param {function} [handler] a function to process request
3311
- *
3364
+ * @param {string|RegExp} [url] URL, regex or pattern for to match URL
3365
+ * @param {function} [handler] a function to process reques
3312
3366
  */
3313
3367
  async mockRoute(url, handler) {
3314
3368
  return this.browserContext.route(...arguments);
@@ -3323,9 +3377,8 @@ class Playwright extends Helper {
3323
3377
  * ```
3324
3378
  * If no handler is passed, all mock requests for the rote are disabled.
3325
3379
  *
3326
- * @param {string} [url] URL, regex or pattern for to match URL
3327
- * @param {function} [handler] a function to process request
3328
- *
3380
+ * @param {string|RegExp} [url] URL, regex or pattern for to match URL
3381
+ * @param {function} [handler] a function to process reques
3329
3382
  */
3330
3383
  async stopMockingRoute(url, handler) {
3331
3384
  return this.browserContext.unroute(...arguments);