codeceptjs 3.5.5 → 3.5.7-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/docs/bdd.md +11 -7
  3. package/docs/build/ApiDataFactory.js +2 -1
  4. package/docs/build/Appium.js +25 -23
  5. package/docs/build/Expect.js +422 -0
  6. package/docs/build/FileSystem.js +1 -1
  7. package/docs/build/Nightmare.js +53 -56
  8. package/docs/build/Playwright.js +209 -135
  9. package/docs/build/Protractor.js +66 -69
  10. package/docs/build/Puppeteer.js +83 -83
  11. package/docs/build/TestCafe.js +56 -55
  12. package/docs/build/WebDriver.js +85 -86
  13. package/docs/changelog.md +63 -0
  14. package/docs/commands.md +12 -0
  15. package/docs/helpers/Appium.md +50 -32
  16. package/docs/helpers/Expect.md +275 -0
  17. package/docs/helpers/FileSystem.md +1 -1
  18. package/docs/helpers/Nightmare.md +141 -94
  19. package/docs/helpers/Playwright.md +281 -212
  20. package/docs/helpers/Protractor.md +229 -169
  21. package/docs/helpers/Puppeteer.md +257 -186
  22. package/docs/helpers/TestCafe.md +201 -149
  23. package/docs/helpers/WebDriver.md +253 -179
  24. package/docs/mobile.md +17 -21
  25. package/docs/plugins.md +35 -1
  26. package/docs/webapi/amOnPage.mustache +1 -1
  27. package/docs/webapi/appendField.mustache +1 -1
  28. package/docs/webapi/attachFile.mustache +1 -1
  29. package/docs/webapi/blur.mustache +1 -0
  30. package/docs/webapi/checkOption.mustache +1 -1
  31. package/docs/webapi/clearCookie.mustache +1 -1
  32. package/docs/webapi/clearField.mustache +1 -1
  33. package/docs/webapi/click.mustache +1 -1
  34. package/docs/webapi/clickLink.mustache +1 -1
  35. package/docs/webapi/closeCurrentTab.mustache +1 -1
  36. package/docs/webapi/closeOtherTabs.mustache +1 -1
  37. package/docs/webapi/dontSee.mustache +1 -1
  38. package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -1
  39. package/docs/webapi/dontSeeCookie.mustache +1 -1
  40. package/docs/webapi/dontSeeCurrentUrlEquals.mustache +1 -1
  41. package/docs/webapi/dontSeeElement.mustache +1 -1
  42. package/docs/webapi/dontSeeElementInDOM.mustache +1 -1
  43. package/docs/webapi/dontSeeInCurrentUrl.mustache +1 -1
  44. package/docs/webapi/dontSeeInField.mustache +1 -1
  45. package/docs/webapi/dontSeeInSource.mustache +1 -1
  46. package/docs/webapi/dontSeeInTitle.mustache +1 -1
  47. package/docs/webapi/doubleClick.mustache +1 -1
  48. package/docs/webapi/downloadFile.mustache +1 -1
  49. package/docs/webapi/dragAndDrop.mustache +1 -1
  50. package/docs/webapi/dragSlider.mustache +1 -1
  51. package/docs/webapi/executeAsyncScript.mustache +0 -2
  52. package/docs/webapi/executeScript.mustache +0 -2
  53. package/docs/webapi/fillField.mustache +1 -1
  54. package/docs/webapi/focus.mustache +1 -0
  55. package/docs/webapi/forceClick.mustache +1 -1
  56. package/docs/webapi/forceRightClick.mustache +1 -1
  57. package/docs/webapi/grabCookie.mustache +1 -1
  58. package/docs/webapi/grabDataFromPerformanceTiming.mustache +1 -1
  59. package/docs/webapi/moveCursorTo.mustache +1 -1
  60. package/docs/webapi/openNewTab.mustache +1 -1
  61. package/docs/webapi/pressKey.mustache +1 -1
  62. package/docs/webapi/pressKeyDown.mustache +1 -1
  63. package/docs/webapi/pressKeyUp.mustache +1 -1
  64. package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -1
  65. package/docs/webapi/refreshPage.mustache +1 -1
  66. package/docs/webapi/resizeWindow.mustache +1 -1
  67. package/docs/webapi/rightClick.mustache +1 -1
  68. package/docs/webapi/saveElementScreenshot.mustache +1 -1
  69. package/docs/webapi/saveScreenshot.mustache +1 -1
  70. package/docs/webapi/say.mustache +1 -1
  71. package/docs/webapi/scrollIntoView.mustache +1 -1
  72. package/docs/webapi/scrollPageToBottom.mustache +1 -1
  73. package/docs/webapi/scrollPageToTop.mustache +1 -1
  74. package/docs/webapi/scrollTo.mustache +1 -1
  75. package/docs/webapi/see.mustache +1 -1
  76. package/docs/webapi/seeAttributesOnElements.mustache +1 -1
  77. package/docs/webapi/seeCheckboxIsChecked.mustache +1 -1
  78. package/docs/webapi/seeCookie.mustache +1 -1
  79. package/docs/webapi/seeCssPropertiesOnElements.mustache +1 -1
  80. package/docs/webapi/seeCurrentUrlEquals.mustache +1 -1
  81. package/docs/webapi/seeElement.mustache +1 -1
  82. package/docs/webapi/seeElementInDOM.mustache +1 -1
  83. package/docs/webapi/seeInCurrentUrl.mustache +1 -1
  84. package/docs/webapi/seeInField.mustache +1 -1
  85. package/docs/webapi/seeInPopup.mustache +1 -1
  86. package/docs/webapi/seeInSource.mustache +1 -1
  87. package/docs/webapi/seeInTitle.mustache +1 -1
  88. package/docs/webapi/seeNumberOfElements.mustache +1 -1
  89. package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -1
  90. package/docs/webapi/seeTextEquals.mustache +1 -1
  91. package/docs/webapi/seeTitleEquals.mustache +1 -1
  92. package/docs/webapi/selectOption.mustache +1 -1
  93. package/docs/webapi/setCookie.mustache +1 -1
  94. package/docs/webapi/setGeoLocation.mustache +1 -1
  95. package/docs/webapi/switchTo.mustache +1 -1
  96. package/docs/webapi/switchToNextTab.mustache +1 -1
  97. package/docs/webapi/switchToPreviousTab.mustache +1 -1
  98. package/docs/webapi/type.mustache +1 -1
  99. package/docs/webapi/uncheckOption.mustache +1 -1
  100. package/docs/webapi/wait.mustache +1 -1
  101. package/docs/webapi/waitForClickable.mustache +1 -1
  102. package/docs/webapi/waitForDetached.mustache +1 -1
  103. package/docs/webapi/waitForElement.mustache +1 -1
  104. package/docs/webapi/waitForEnabled.mustache +1 -1
  105. package/docs/webapi/waitForFunction.mustache +1 -1
  106. package/docs/webapi/waitForInvisible.mustache +1 -1
  107. package/docs/webapi/waitForText.mustache +1 -1
  108. package/docs/webapi/waitForValue.mustache +1 -1
  109. package/docs/webapi/waitForVisible.mustache +1 -1
  110. package/docs/webapi/waitInUrl.mustache +1 -1
  111. package/docs/webapi/waitNumberOfVisibleElements.mustache +1 -1
  112. package/docs/webapi/waitToHide.mustache +1 -1
  113. package/docs/webapi/waitUrlEquals.mustache +1 -1
  114. package/lib/ai.js +12 -3
  115. package/lib/cli.js +3 -1
  116. package/lib/codecept.js +3 -0
  117. package/lib/command/dryRun.js +2 -1
  118. package/lib/command/info.js +24 -0
  119. package/lib/command/run-workers.js +3 -2
  120. package/lib/command/run.js +3 -2
  121. package/lib/data/context.js +14 -6
  122. package/lib/helper/ApiDataFactory.js +2 -1
  123. package/lib/helper/Appium.js +7 -5
  124. package/lib/helper/Expect.js +422 -0
  125. package/lib/helper/FileSystem.js +1 -1
  126. package/lib/helper/Playwright.js +134 -64
  127. package/lib/helper/Puppeteer.js +6 -6
  128. package/lib/helper/WebDriver.js +4 -4
  129. package/lib/helper/scripts/highlightElement.js +1 -1
  130. package/lib/html.js +3 -3
  131. package/lib/interfaces/gherkin.js +21 -2
  132. package/lib/output.js +1 -1
  133. package/lib/pause.js +6 -5
  134. package/lib/plugin/autoLogin.js +35 -8
  135. package/lib/plugin/heal.js +40 -7
  136. package/lib/plugin/retryTo.js +0 -2
  137. package/lib/plugin/tryTo.js +0 -3
  138. package/lib/recorder.js +12 -5
  139. package/lib/session.js +1 -1
  140. package/package.json +24 -17
  141. package/translations/de-DE.js +5 -0
  142. package/translations/fr-FR.js +14 -1
  143. package/translations/it-IT.js +1 -0
  144. package/translations/ja-JP.js +5 -0
  145. package/translations/pl-PL.js +5 -0
  146. package/translations/pt-BR.js +1 -0
  147. package/translations/ru-RU.js +1 -0
  148. package/translations/zh-CN.js +5 -0
  149. package/translations/zh-TW.js +5 -0
  150. package/typings/promiseBasedTypes.d.ts +905 -863
  151. package/typings/types.d.ts +909 -850
@@ -5,4 +5,4 @@ given string.
5
5
  I.seeInPopup('Popup text');
6
6
  ```
7
7
  @param {string} text value to check.
8
- ⚠️ returns a _promise_ which is synchronized internally by recorder
8
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -4,4 +4,4 @@ Checks that the current page contains the given string in its raw source code.
4
4
  I.seeInSource('<h1>Green eggs &amp; ham</h1>');
5
5
  ```
6
6
  @param {string} text value to check.
7
- ⚠️ returns a _promise_ which is synchronized internally by recorder
7
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -5,4 +5,4 @@ I.seeInTitle('Home Page');
5
5
  ```
6
6
 
7
7
  @param {string} text text value to check.
8
- ⚠️ returns a _promise_ which is synchronized internally by recorder
8
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -8,4 +8,4 @@ I.seeNumberOfElements('#submitBtn', 1);
8
8
 
9
9
  @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
10
10
  @param {number} num number of elements.
11
- ⚠️ returns a _promise_ which is synchronized internally by recorder
11
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -7,4 +7,4 @@ I.seeNumberOfVisibleElements('.buttons', 3);
7
7
 
8
8
  @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
9
9
  @param {number} num number of elements.
10
- ⚠️ returns a _promise_ which is synchronized internally by recorder
10
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -6,4 +6,4 @@ I.seeTextEquals('text', 'h1');
6
6
 
7
7
  @param {string} text element value to check.
8
8
  @param {CodeceptJS.LocatorOrString?} [context=null] element located by CSS|XPath|strict locator.
9
- ⚠️ returns a _promise_ which is synchronized internally by recorder
9
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -5,4 +5,4 @@ I.seeTitleEquals('Test title.');
5
5
  ```
6
6
 
7
7
  @param {string} text value to check.
8
- ⚠️ returns a _promise_ which is synchronized internally by recorder
8
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -18,4 +18,4 @@ I.selectOption('Which OS do you use?', ['Android', 'iOS']);
18
18
  ```
19
19
  @param {LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
20
20
  @param {string|Array<*>} option visible text or value of option.
21
- ⚠️ returns a _promise_ which is synchronized internally by recorder
21
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -13,4 +13,4 @@ I.setCookie([
13
13
  ```
14
14
 
15
15
  @param {Cookie|Array<Cookie>} cookie a cookie object or array of cookie objects.
16
- ⚠️ returns a _promise_ which is synchronized internally by recorder
16
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -9,4 +9,4 @@ I.setGeoLocation(121.21, 11.56, 10);
9
9
  @param {number} latitude to set.
10
10
  @param {number} longitude to set
11
11
  @param {number=} altitude (optional, null by default) to set
12
- ⚠️ returns a _promise_ which is synchronized internally by recorder
12
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -6,4 +6,4 @@ I.switchTo(); // switch back to main page
6
6
  ```
7
7
 
8
8
  @param {?CodeceptJS.LocatorOrString} [locator=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
9
- ⚠️ returns a _promise_ which is synchronized internally by recorder
9
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -7,4 +7,4 @@ I.switchToNextTab(2);
7
7
 
8
8
  @param {number} [num] (optional) number of tabs to switch forward, default: 1.
9
9
  @param {number | null} [sec] (optional) time in seconds to wait.
10
- ⚠️ returns a _promise_ which is synchronized internally by recorder
10
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -7,4 +7,4 @@ I.switchToPreviousTab(2);
7
7
 
8
8
  @param {number} [num] (optional) number of tabs to switch backward, default: 1.
9
9
  @param {number?} [sec] (optional) time in seconds to wait.
10
- ⚠️ returns a _promise_ which is synchronized internally by recorder
10
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -18,4 +18,4 @@ I.type(secret('123456'));
18
18
 
19
19
  @param {string|string[]} key or array of keys to type.
20
20
  @param {?number} [delay=null] (optional) delay in ms between key presses
21
- ⚠️ returns a _promise_ which is synchronized internally by recorder
21
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -10,4 +10,4 @@ I.uncheckOption('agree', '//form');
10
10
  ```
11
11
  @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
12
12
  @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
13
- ⚠️ returns a _promise_ which is synchronized internally by recorder
13
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -5,4 +5,4 @@ I.wait(2); // wait 2 secs
5
5
  ```
6
6
 
7
7
  @param {number} sec number of second to wait.
8
- ⚠️ returns a _promise_ which is synchronized internally by recorder
8
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -8,4 +8,4 @@ I.waitForClickable('.btn.continue', 5); // wait for 5 secs
8
8
 
9
9
  @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
10
10
  @param {number} [sec] (optional, `1` by default) time in seconds to wait
11
- ⚠️ returns a _promise_ which is synchronized internally by recorder
11
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -7,4 +7,4 @@ I.waitForDetached('#popup');
7
7
 
8
8
  @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
9
9
  @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
10
- ⚠️ returns a _promise_ which is synchronized internally by recorder
10
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -8,4 +8,4 @@ I.waitForElement('.btn.continue', 5); // wait for 5 secs
8
8
 
9
9
  @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
10
10
  @param {number} [sec] (optional, `1` by default) time in seconds to wait
11
- ⚠️ returns a _promise_ which is synchronized internally by recorder
11
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -3,4 +3,4 @@ Element can be located by CSS or XPath.
3
3
 
4
4
  @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
5
5
  @param {number} [sec=1] (optional) time in seconds to wait, 1 by default.
6
- ⚠️ returns a _promise_ which is synchronized internally by recorder
6
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -14,4 +14,4 @@ I.waitForFunction((count) => window.requests == count, [3], 5) // pass args and
14
14
  @param {string|function} fn to be executed in browser context.
15
15
  @param {any[]|number} [argsOrSec] (optional, `1` by default) arguments for function or seconds.
16
16
  @param {number} [sec] (optional, `1` by default) time in seconds to wait
17
- ⚠️ returns a _promise_ which is synchronized internally by recorder
17
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -7,4 +7,4 @@ I.waitForInvisible('#popup');
7
7
 
8
8
  @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
9
9
  @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
10
- ⚠️ returns a _promise_ which is synchronized internally by recorder
10
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -10,4 +10,4 @@ I.waitForText('Thank you, form has been submitted', 5, '#modal');
10
10
  @param {string }text to wait for.
11
11
  @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
12
12
  @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator.
13
- ⚠️ returns a _promise_ which is synchronized internally by recorder
13
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -7,4 +7,4 @@ I.waitForValue('//input', "GoodValue");
7
7
  @param {LocatorOrString} field input field.
8
8
  @param {string }value expected value.
9
9
  @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
10
- ⚠️ returns a _promise_ which is synchronized internally by recorder
10
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -7,4 +7,4 @@ I.waitForVisible('#popup');
7
7
 
8
8
  @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
9
9
  @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
10
- ⚠️ returns a _promise_ which is synchronized internally by recorder
10
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -6,4 +6,4 @@ I.waitInUrl('/info', 2);
6
6
 
7
7
  @param {string} urlPart value to check.
8
8
  @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
9
- ⚠️ returns a _promise_ which is synchronized internally by recorder
9
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -7,4 +7,4 @@ I.waitNumberOfVisibleElements('a', 3);
7
7
  @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
8
8
  @param {number} num number of elements.
9
9
  @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
10
- ⚠️ returns a _promise_ which is synchronized internally by recorder
10
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -7,4 +7,4 @@ I.waitToHide('#popup');
7
7
 
8
8
  @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
9
9
  @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
10
- ⚠️ returns a _promise_ which is synchronized internally by recorder
10
+ @returns {Promise<void>} automatically synchronized promise through #recorder
@@ -7,4 +7,4 @@ I.waitUrlEquals('http://127.0.0.1:8000/info');
7
7
 
8
8
  @param {string} urlPart value to check.
9
9
  @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
10
- ⚠️ returns a _promise_ which is synchronized internally by recorder
10
+ @returns {Promise<void>} automatically synchronized promise through #recorder
package/lib/ai.js CHANGED
@@ -16,6 +16,8 @@ const htmlConfig = {
16
16
  html: {},
17
17
  };
18
18
 
19
+ const aiInstance = null;
20
+
19
21
  class AiAssistant {
20
22
  constructor() {
21
23
  this.config = config.get('ai', defaultConfig);
@@ -26,7 +28,10 @@ class AiAssistant {
26
28
 
27
29
  this.isEnabled = !!process.env.OPENAI_API_KEY;
28
30
 
29
- if (!this.isEnabled) return;
31
+ if (!this.isEnabled) {
32
+ debug('No OpenAI API key provided. AI assistant is disabled.');
33
+ return;
34
+ }
30
35
 
31
36
  const configuration = new Configuration({
32
37
  apiKey: process.env.OPENAI_API_KEY,
@@ -35,13 +40,17 @@ class AiAssistant {
35
40
  this.openai = new OpenAIApi(configuration);
36
41
  }
37
42
 
38
- setHtmlContext(html) {
43
+ static getInstance() {
44
+ return aiInstance || new AiAssistant();
45
+ }
46
+
47
+ async setHtmlContext(html) {
39
48
  let processedHTML = html;
40
49
 
41
50
  if (this.htmlConfig.simplify) {
42
51
  processedHTML = removeNonInteractiveElements(processedHTML, this.htmlConfig);
43
52
  }
44
- if (this.htmlConfig.minify) processedHTML = minifyHtml(processedHTML);
53
+ if (this.htmlConfig.minify) processedHTML = await minifyHtml(processedHTML);
45
54
  if (this.htmlConfig.maxLength) processedHTML = splitByChunks(processedHTML, this.htmlConfig.maxLength)[0];
46
55
 
47
56
  debug(processedHTML);
package/lib/cli.js CHANGED
@@ -106,7 +106,9 @@ class Cli extends Base {
106
106
  }
107
107
  currentMetaStep = metaSteps;
108
108
  output.stepShift = 3 + 2 * shift;
109
- output.step(step);
109
+ if (step.helper.constructor.name !== 'ExpectHelper') {
110
+ output.step(step);
111
+ }
110
112
  });
111
113
 
112
114
  event.dispatcher.on(event.step.finished, () => {
package/lib/codecept.js CHANGED
@@ -89,6 +89,9 @@ class Codecept {
89
89
  global.When = stepDefinitions.When;
90
90
  global.Then = stepDefinitions.Then;
91
91
  global.DefineParameterType = stepDefinitions.defineParameterType;
92
+
93
+ // debug mode
94
+ global.debugMode = false;
92
95
  }
93
96
  }
94
97
 
@@ -20,7 +20,8 @@ module.exports = async function (test, options) {
20
20
  if (config.plugins) {
21
21
  // disable all plugins by default, they can be enabled with -p option
22
22
  for (const plugin in config.plugins) {
23
- config.plugins[plugin].enabled = false;
23
+ // if `-p all` is passed, then enabling all plugins, otherwise plugins could be enabled by `-p customLocator,commentStep,tryTo`
24
+ config.plugins[plugin].enabled = options.plugins === 'all';
24
25
  }
25
26
  }
26
27
 
@@ -37,3 +37,27 @@ module.exports = async function (path) {
37
37
  output.print('Please copy environment info when you report issues on GitHub: https://github.com/Codeception/CodeceptJS/issues');
38
38
  output.print('***************************************');
39
39
  };
40
+
41
+ module.exports.getMachineInfo = async () => {
42
+ const info = {
43
+ nodeInfo: await envinfo.helpers.getNodeInfo(),
44
+ osInfo: await envinfo.helpers.getOSInfo(),
45
+ cpuInfo: await envinfo.helpers.getCPUInfo(),
46
+ chromeInfo: await envinfo.helpers.getChromeInfo(),
47
+ edgeInfo: await envinfo.helpers.getEdgeInfo(),
48
+ firefoxInfo: await envinfo.helpers.getFirefoxInfo(),
49
+ safariInfo: await envinfo.helpers.getSafariInfo(),
50
+ };
51
+
52
+ output.print('***************************************');
53
+ for (const [key, value] of Object.entries(info)) {
54
+ if (Array.isArray(value)) {
55
+ output.print(`${key}: ${value[1]}`);
56
+ } else {
57
+ output.print(`${key}: ${JSON.stringify(value, null, ' ')}`);
58
+ }
59
+ }
60
+ output.print('If you need more detailed info, just run this: npx codeceptjs info');
61
+ output.print('***************************************');
62
+ return info;
63
+ };
@@ -40,8 +40,9 @@ module.exports = async function (workerCount, selectedRuns, options) {
40
40
 
41
41
  try {
42
42
  if (options.verbose) {
43
- const getInfo = require('./info');
44
- await getInfo();
43
+ global.debugMode = true;
44
+ const { getMachineInfo } = require('./info');
45
+ await getMachineInfo();
45
46
  }
46
47
  await workers.bootstrapAll();
47
48
  await workers.run();
@@ -30,8 +30,9 @@ module.exports = async function (test, options) {
30
30
  codecept.loadTests(test);
31
31
 
32
32
  if (options.verbose) {
33
- const getInfo = require('./info');
34
- await getInfo();
33
+ global.debugMode = true;
34
+ const { getMachineInfo } = require('./info');
35
+ await getMachineInfo();
35
36
  }
36
37
 
37
38
  await codecept.run();
@@ -23,6 +23,7 @@ module.exports = function (context) {
23
23
  .inject({ current: dataRow.data }));
24
24
  }
25
25
  });
26
+ maskSecretInTitle(scenarios);
26
27
  return new DataScenarioConfig(scenarios);
27
28
  },
28
29
  only: {
@@ -42,6 +43,7 @@ module.exports = function (context) {
42
43
  .inject({ current: dataRow.data }));
43
44
  }
44
45
  });
46
+ maskSecretInTitle(scenarios);
45
47
  return new DataScenarioConfig(scenarios);
46
48
  },
47
49
  },
@@ -71,12 +73,6 @@ function replaceTitle(title, dataRow) {
71
73
  // it should be printed
72
74
  if (Object.prototype.toString.call(dataRow.data) === (Object()).toString()
73
75
  && dataRow.data.toString() !== (Object()).toString()) {
74
- Object.entries(dataRow.data).forEach(entry => {
75
- const [key, value] = entry;
76
- if (value instanceof Secret) {
77
- dataRow.data[key] = value.getMasked();
78
- }
79
- });
80
76
  return `${title} | ${dataRow.data}`;
81
77
  }
82
78
 
@@ -119,3 +115,15 @@ function detectDataType(dataTable) {
119
115
 
120
116
  throw new Error('Invalid data type. Data accepts either: DataTable || generator || Array || function');
121
117
  }
118
+
119
+ function maskSecretInTitle(scenarios) {
120
+ scenarios.forEach(scenario => {
121
+ const res = [];
122
+
123
+ scenario.test.title.split(',').forEach(item => {
124
+ res.push(item.replace(/{"_secret":"(.*)"}/, '"*****"'));
125
+ });
126
+
127
+ scenario.test.title = res.join(',');
128
+ });
129
+ }
@@ -309,7 +309,8 @@ class ApiDataFactory extends Helper {
309
309
  } catch (e) {
310
310
  modulePath = path.join(global.codecept_dir, modulePath);
311
311
  }
312
- const builder = require(modulePath);
312
+ // check if the new syntax `export default new Factory()` is used and loads the builder, otherwise loads the module that used old syntax `module.exports = new Factory()`.
313
+ const builder = require(modulePath).default || require(modulePath);
313
314
  return builder.build(data, options);
314
315
  } catch (err) {
315
316
  throw new Error(`Couldn't load factory file from ${modulePath}, check that
@@ -22,7 +22,7 @@ const vendorPrefix = {
22
22
  };
23
23
 
24
24
  /**
25
- * Appium helper extends [Webriver](http://codecept.io/helpers/WebDriver/) helper.
25
+ * Appium helper extends [Webdriver](http://codecept.io/helpers/WebDriver/) helper.
26
26
  * It supports all browser methods and also includes special methods for mobile apps testing.
27
27
  * You can use this helper to test Web on desktop and mobile devices and mobile apps.
28
28
  *
@@ -31,7 +31,7 @@ const vendorPrefix = {
31
31
  * Appium is an open source test automation framework for use with native, hybrid and mobile web apps that implements the WebDriver protocol.
32
32
  * It allows you to run Selenium tests on mobile devices and also test native, hybrid and mobile web apps.
33
33
  *
34
- * Download and install [Appium](http://appium.io/)
34
+ * Download and install [Appium](https://appium.io/docs/en/2.1/)
35
35
  *
36
36
  * ```sh
37
37
  * npm install -g appium
@@ -43,7 +43,7 @@ const vendorPrefix = {
43
43
  *
44
44
  * This helper should be configured in codecept.conf.ts or codecept.conf.js
45
45
  *
46
- * * `appiumV2`: set this to true if you want to run tests with Appiumv2. See more how to setup [here](https://codecept.io/mobile/#setting-up)
46
+ * * `appiumV2`: set this to true if you want to run tests with AppiumV2. See more how to setup [here](https://codecept.io/mobile/#setting-up)
47
47
  * * `app`: Application path. Local path or remote URL to an .ipa or .apk file, or a .zip containing one of these. Alias to desiredCapabilities.appPackage
48
48
  * * `host`: (default: 'localhost') Appium host
49
49
  * * `port`: (default: '4723') Appium port
@@ -117,7 +117,7 @@ const vendorPrefix = {
117
117
  * }
118
118
  * ```
119
119
  *
120
- * Example Android App using Appiumv2 on BrowserStack:
120
+ * Example Android App using AppiumV2 on BrowserStack:
121
121
  *
122
122
  * ```js
123
123
  * {
@@ -154,7 +154,7 @@ const vendorPrefix = {
154
154
  * }
155
155
  * ```
156
156
  *
157
- * Additional configuration params can be used from <https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md>
157
+ * Additional configuration params can be used from <https://github.com/appium/appium/blob/master/packages/appium/docs/en/guides/caps.md>
158
158
  *
159
159
  * ## Access From Helpers
160
160
  *
@@ -273,6 +273,8 @@ class Appium extends Webdriver {
273
273
  if (!key.startsWith(vendorPrefix.appium)) {
274
274
  if (key !== 'platformName') {
275
275
  _convertedCaps[`${vendorPrefix.appium}:${key}`] = value;
276
+ } else {
277
+ _convertedCaps[`${key}`] = value;
276
278
  }
277
279
  } else {
278
280
  _convertedCaps[`${key}`] = value;