codeceptjs 3.5.3 → 3.5.4

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 (62) hide show
  1. package/README.md +0 -2
  2. package/docs/build/Appium.js +8 -6
  3. package/docs/build/GraphQL.js +25 -0
  4. package/docs/build/Nightmare.js +11 -6
  5. package/docs/build/Playwright.js +425 -193
  6. package/docs/build/Protractor.js +13 -8
  7. package/docs/build/Puppeteer.js +20 -14
  8. package/docs/build/TestCafe.js +17 -10
  9. package/docs/build/WebDriver.js +41 -37
  10. package/docs/changelog.md +170 -1
  11. package/docs/community-helpers.md +8 -4
  12. package/docs/examples.md +8 -2
  13. package/docs/helpers/Appium.md +2 -2
  14. package/docs/helpers/GraphQL.md +21 -0
  15. package/docs/helpers/Nightmare.md +2 -2
  16. package/docs/helpers/Playwright.md +239 -122
  17. package/docs/helpers/Protractor.md +2 -2
  18. package/docs/helpers/Puppeteer.md +3 -3
  19. package/docs/helpers/TestCafe.md +2 -2
  20. package/docs/helpers/WebDriver.md +3 -3
  21. package/docs/playwright.md +24 -1
  22. package/docs/webapi/dontSeeInField.mustache +1 -1
  23. package/docs/webapi/seeInField.mustache +1 -1
  24. package/docs/wiki/Books-&-Posts.md +0 -0
  25. package/docs/wiki/Community-Helpers-&-Plugins.md +8 -4
  26. package/docs/wiki/Converting-Playwright-to-Istanbul-Coverage.md +46 -14
  27. package/docs/wiki/Examples.md +8 -2
  28. package/docs/wiki/Google-Summer-of-Code-(GSoC)-2020.md +0 -0
  29. package/docs/wiki/Home.md +0 -0
  30. package/docs/wiki/Migration-to-Appium-v2---CodeceptJS.md +83 -0
  31. package/docs/wiki/Release-Process.md +0 -0
  32. package/docs/wiki/Roadmap.md +0 -0
  33. package/docs/wiki/Tests.md +0 -0
  34. package/docs/wiki/Upgrading-to-CodeceptJS-3.md +0 -0
  35. package/docs/wiki/Videos.md +0 -0
  36. package/lib/command/definitions.js +2 -7
  37. package/lib/command/run-multiple/collection.js +17 -5
  38. package/lib/helper/Appium.js +6 -4
  39. package/lib/helper/GraphQL.js +25 -0
  40. package/lib/helper/Nightmare.js +9 -4
  41. package/lib/helper/Playwright.js +422 -190
  42. package/lib/helper/Protractor.js +11 -6
  43. package/lib/helper/Puppeteer.js +18 -12
  44. package/lib/helper/TestCafe.js +15 -8
  45. package/lib/helper/WebDriver.js +39 -35
  46. package/lib/helper/errors/ElementNotFound.js +2 -1
  47. package/lib/helper/extras/PlaywrightReact.js +9 -0
  48. package/lib/helper/scripts/highlightElement.js +1 -1
  49. package/lib/interfaces/bdd.js +1 -1
  50. package/lib/mochaFactory.js +2 -1
  51. package/lib/pause.js +5 -4
  52. package/lib/plugin/heal.js +2 -3
  53. package/lib/plugin/selenoid.js +6 -1
  54. package/lib/step.js +27 -10
  55. package/lib/utils.js +4 -0
  56. package/lib/workers.js +3 -1
  57. package/package.json +14 -14
  58. package/typings/promiseBasedTypes.d.ts +145 -126
  59. package/typings/types.d.ts +152 -133
  60. package/CHANGELOG.md +0 -2563
  61. package/docs/build/Polly.js +0 -42
  62. package/docs/build/SeleniumWebdriver.js +0 -76
package/README.md CHANGED
@@ -304,9 +304,7 @@ Thanks all to those who are and will have contributing to this awesome project!
304
304
  <a href="https://github.com/pablopaul"><img src="https://avatars.githubusercontent.com/u/635526?v=4" title="pablopaul" width="80" height="80"></a>
305
305
  <a href="https://github.com/Georgegriff"><img src="https://avatars.githubusercontent.com/u/9056958?v=4" title="Georgegriff" width="80" height="80"></a>
306
306
  <a href="https://github.com/mirao"><img src="https://avatars.githubusercontent.com/u/12584138?v=4" title="mirao" width="80" height="80"></a>
307
- <a href="https://github.com/actions-user"><img src="https://avatars.githubusercontent.com/u/65916846?v=4" title="actions-user" width="80" height="80"></a>
308
307
  <a href="https://github.com/KMKoushik"><img src="https://avatars.githubusercontent.com/u/24666922?v=4" title="KMKoushik" width="80" height="80"></a>
309
- <a href="https://github.com/apps/dependabot"><img src="https://avatars.githubusercontent.com/in/29110?v=4" title="dependabot[bot]" width="80" height="80"></a>
310
308
  <a href="https://github.com/nikocanvacom"><img src="https://avatars.githubusercontent.com/u/83254493?v=4" title="nikocanvacom" width="80" height="80"></a>
311
309
  <a href="https://github.com/elukoyanov"><img src="https://avatars.githubusercontent.com/u/11647141?v=4" title="elukoyanov" width="80" height="80"></a>
312
310
  <a href="https://github.com/gkushang"><img src="https://avatars.githubusercontent.com/u/3663389?v=4" title="gkushang" width="80" height="80"></a>
@@ -1505,14 +1505,15 @@ class Appium extends Webdriver {
1505
1505
  * ```
1506
1506
  *
1507
1507
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1508
- * @param {string} value value to check.
1508
+ * @param {CodeceptJS.StringOrSecret} value value to check.
1509
1509
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
1510
1510
  *
1511
1511
  *
1512
1512
  */
1513
1513
  async dontSeeInField(field, value) {
1514
- if (this.isWeb) return super.dontSeeInField(field, value);
1515
- return super.dontSeeInField(parseLocator.call(this, field), value);
1514
+ const _value = (typeof value === 'boolean') ? value : value.toString();
1515
+ if (this.isWeb) return super.dontSeeInField(field, _value);
1516
+ return super.dontSeeInField(parseLocator.call(this, field), _value);
1516
1517
  }
1517
1518
 
1518
1519
  /**
@@ -1768,14 +1769,15 @@ class Appium extends Webdriver {
1768
1769
  * I.seeInField('#searchform input','Search');
1769
1770
  * ```
1770
1771
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1771
- * @param {string} value value to check.
1772
+ * @param {CodeceptJS.StringOrSecret} value value to check.
1772
1773
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
1773
1774
  *
1774
1775
  *
1775
1776
  */
1776
1777
  async seeInField(field, value) {
1777
- if (this.isWeb) return super.seeInField(field, value);
1778
- return super.seeInField(parseLocator.call(this, field), value);
1778
+ const _value = (typeof value === 'boolean') ? value : value.toString();
1779
+ if (this.isWeb) return super.seeInField(field, _value);
1780
+ return super.seeInField(parseLocator.call(this, field), _value);
1779
1781
  }
1780
1782
 
1781
1783
  /**
@@ -81,6 +81,8 @@ class GraphQL extends Helper {
81
81
  'Content-Type': 'application/json',
82
82
  });
83
83
 
84
+ request.headers = { ...this.headers, ...request.headers };
85
+
84
86
  if (this.config.onRequest) {
85
87
  await this.config.onRequest(request);
86
88
  }
@@ -200,5 +202,28 @@ class GraphQL extends Helper {
200
202
  _setRequestTimeout(newTimeout) {
201
203
  this.options.timeout = newTimeout;
202
204
  }
205
+
206
+ /**
207
+ * Sets request headers for all requests of this test
208
+ *
209
+ * @param {object} headers headers list
210
+ */
211
+ haveRequestHeaders(headers) {
212
+ this.headers = { ...this.headers, ...headers };
213
+ }
214
+
215
+ /**
216
+ * Adds a header for Bearer authentication
217
+ *
218
+ * ```js
219
+ * // we use secret function to hide token from logs
220
+ * I.amBearerAuthenticated(secret('heregoestoken'))
221
+ * ```
222
+ *
223
+ * @param {string | CodeceptJS.Secret} accessToken Bearer access token
224
+ */
225
+ amBearerAuthenticated(accessToken) {
226
+ this.haveRequestHeaders({ Authorization: `Bearer ${accessToken}` });
227
+ }
203
228
  }
204
229
  module.exports = GraphQL;
@@ -1063,12 +1063,13 @@ class Nightmare extends Helper {
1063
1063
  * I.seeInField('#searchform input','Search');
1064
1064
  * ```
1065
1065
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1066
- * @param {string} value value to check.
1066
+ * @param {CodeceptJS.StringOrSecret} value value to check.
1067
1067
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
1068
1068
  *
1069
1069
  */
1070
1070
  async seeInField(field, value) {
1071
- return proceedSeeInField.call(this, 'assert', field, value);
1071
+ const _value = (typeof value === 'boolean') ? value : value.toString();
1072
+ return proceedSeeInField.call(this, 'assert', field, _value);
1072
1073
  }
1073
1074
 
1074
1075
  /**
@@ -1081,12 +1082,13 @@ class Nightmare extends Helper {
1081
1082
  * ```
1082
1083
  *
1083
1084
  * @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
1084
- * @param {string} value value to check.
1085
+ * @param {CodeceptJS.StringOrSecret} value value to check.
1085
1086
  * ⚠️ returns a _promise_ which is synchronized internally by recorder
1086
1087
  *
1087
1088
  */
1088
1089
  async dontSeeInField(field, value) {
1089
- return proceedSeeInField.call(this, 'negate', field, value);
1090
+ const _value = (typeof value === 'boolean') ? value : value.toString();
1091
+ return proceedSeeInField.call(this, 'negate', field, _value);
1090
1092
  }
1091
1093
 
1092
1094
  /**
@@ -1990,8 +1992,11 @@ class Nightmare extends Helper {
1990
1992
  const body = document.body;
1991
1993
  const html = document.documentElement;
1992
1994
  window.scrollTo(0, Math.max(
1993
- body.scrollHeight, body.offsetHeight,
1994
- html.clientHeight, html.scrollHeight, html.offsetHeight
1995
+ body.scrollHeight,
1996
+ body.offsetHeight,
1997
+ html.clientHeight,
1998
+ html.scrollHeight,
1999
+ html.offsetHeight
1995
2000
  ));
1996
2001
  });
1997
2002
  /* eslint-enable */