codeceptjs 4.0.0-beta.1 → 4.0.0-beta.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 (151) hide show
  1. package/bin/codecept.js +84 -81
  2. package/lib/actor.js +13 -13
  3. package/lib/ai.js +10 -13
  4. package/lib/assert/empty.js +20 -21
  5. package/lib/assert/equal.js +37 -39
  6. package/lib/assert/error.js +14 -14
  7. package/lib/assert/include.js +46 -47
  8. package/lib/assert/throws.js +13 -11
  9. package/lib/assert/truth.js +19 -22
  10. package/lib/assert.js +4 -2
  11. package/lib/cli.js +57 -49
  12. package/lib/codecept.js +142 -155
  13. package/lib/colorUtils.js +3 -3
  14. package/lib/command/configMigrate.js +58 -52
  15. package/lib/command/definitions.js +88 -89
  16. package/lib/command/dryRun.js +71 -68
  17. package/lib/command/generate.js +197 -188
  18. package/lib/command/gherkin/init.js +27 -16
  19. package/lib/command/gherkin/snippets.js +20 -20
  20. package/lib/command/gherkin/steps.js +8 -8
  21. package/lib/command/info.js +40 -38
  22. package/lib/command/init.js +290 -288
  23. package/lib/command/interactive.js +32 -32
  24. package/lib/command/list.js +26 -26
  25. package/lib/command/run-multiple/chunk.js +5 -5
  26. package/lib/command/run-multiple/collection.js +3 -3
  27. package/lib/command/run-multiple/run.js +6 -2
  28. package/lib/command/run-multiple.js +113 -93
  29. package/lib/command/run-rerun.js +20 -25
  30. package/lib/command/run-workers.js +64 -66
  31. package/lib/command/run.js +26 -29
  32. package/lib/command/utils.js +80 -65
  33. package/lib/command/workers/runTests.js +10 -10
  34. package/lib/config.js +10 -9
  35. package/lib/container.js +40 -48
  36. package/lib/data/context.js +60 -59
  37. package/lib/data/dataScenarioConfig.js +47 -47
  38. package/lib/data/dataTableArgument.js +29 -29
  39. package/lib/data/table.js +26 -20
  40. package/lib/event.js +163 -167
  41. package/lib/heal.js +13 -17
  42. package/lib/helper/AI.js +130 -41
  43. package/lib/helper/ApiDataFactory.js +73 -69
  44. package/lib/helper/Appium.js +413 -382
  45. package/lib/helper/ExpectHelper.js +40 -48
  46. package/lib/helper/FileSystem.js +80 -79
  47. package/lib/helper/GraphQL.js +44 -43
  48. package/lib/helper/GraphQLDataFactory.js +50 -50
  49. package/lib/helper/JSONResponse.js +65 -62
  50. package/lib/helper/Mochawesome.js +28 -28
  51. package/lib/helper/MockServer.js +12 -14
  52. package/lib/helper/Nightmare.js +662 -566
  53. package/lib/helper/Playwright.js +1361 -1216
  54. package/lib/helper/Protractor.js +663 -627
  55. package/lib/helper/Puppeteer.js +1231 -1128
  56. package/lib/helper/REST.js +159 -68
  57. package/lib/helper/SoftExpectHelper.js +2 -2
  58. package/lib/helper/TestCafe.js +490 -484
  59. package/lib/helper/WebDriver.js +1297 -1156
  60. package/lib/helper/clientscripts/PollyWebDriverExt.js +1 -1
  61. package/lib/helper/errors/ConnectionRefused.js +1 -1
  62. package/lib/helper/errors/ElementAssertion.js +2 -2
  63. package/lib/helper/errors/ElementNotFound.js +2 -2
  64. package/lib/helper/errors/RemoteBrowserConnectionRefused.js +1 -1
  65. package/lib/helper/extras/Console.js +1 -1
  66. package/lib/helper/extras/PlaywrightPropEngine.js +2 -2
  67. package/lib/helper/extras/PlaywrightReactVueLocator.js +1 -1
  68. package/lib/helper/extras/PlaywrightRestartOpts.js +21 -18
  69. package/lib/helper/extras/Popup.js +1 -1
  70. package/lib/helper/extras/React.js +3 -3
  71. package/lib/helper/network/actions.js +14 -7
  72. package/lib/helper/network/utils.js +3 -2
  73. package/lib/helper/scripts/blurElement.js +1 -1
  74. package/lib/helper/scripts/focusElement.js +1 -1
  75. package/lib/helper/scripts/highlightElement.js +1 -1
  76. package/lib/helper/scripts/isElementClickable.js +1 -1
  77. package/lib/helper/testcafe/testControllerHolder.js +1 -1
  78. package/lib/helper/testcafe/testcafe-utils.js +6 -7
  79. package/lib/helper.js +1 -3
  80. package/lib/history.js +6 -5
  81. package/lib/hooks.js +6 -6
  82. package/lib/html.js +7 -7
  83. package/lib/index.js +25 -41
  84. package/lib/interfaces/bdd.js +47 -64
  85. package/lib/interfaces/featureConfig.js +19 -19
  86. package/lib/interfaces/gherkin.js +124 -118
  87. package/lib/interfaces/scenarioConfig.js +29 -29
  88. package/lib/listener/artifacts.js +9 -9
  89. package/lib/listener/config.js +24 -24
  90. package/lib/listener/exit.js +12 -12
  91. package/lib/listener/helpers.js +42 -42
  92. package/lib/listener/mocha.js +11 -11
  93. package/lib/listener/retry.js +32 -30
  94. package/lib/listener/steps.js +50 -53
  95. package/lib/listener/timeout.js +54 -54
  96. package/lib/locator.js +6 -10
  97. package/lib/mochaFactory.js +18 -15
  98. package/lib/output.js +6 -10
  99. package/lib/parser.js +15 -12
  100. package/lib/pause.js +40 -33
  101. package/lib/plugin/allure.js +15 -15
  102. package/lib/plugin/autoDelay.js +29 -37
  103. package/lib/plugin/autoLogin.js +70 -65
  104. package/lib/plugin/commentStep.js +18 -18
  105. package/lib/plugin/coverage.js +115 -67
  106. package/lib/plugin/customLocator.js +21 -20
  107. package/lib/plugin/debugErrors.js +24 -24
  108. package/lib/plugin/eachElement.js +38 -38
  109. package/lib/plugin/fakerTransform.js +6 -6
  110. package/lib/plugin/heal.js +67 -108
  111. package/lib/plugin/pauseOnFail.js +11 -11
  112. package/lib/plugin/retryFailedStep.js +32 -39
  113. package/lib/plugin/retryTo.js +46 -40
  114. package/lib/plugin/screenshotOnFail.js +109 -87
  115. package/lib/plugin/selenoid.js +131 -118
  116. package/lib/plugin/standardActingHelpers.js +2 -8
  117. package/lib/plugin/stepByStepReport.js +110 -91
  118. package/lib/plugin/stepTimeout.js +24 -23
  119. package/lib/plugin/subtitles.js +34 -35
  120. package/lib/plugin/tryTo.js +40 -30
  121. package/lib/plugin/wdio.js +78 -75
  122. package/lib/recorder.js +14 -17
  123. package/lib/rerun.js +11 -10
  124. package/lib/scenario.js +25 -23
  125. package/lib/secret.js +4 -2
  126. package/lib/session.js +10 -10
  127. package/lib/step.js +12 -9
  128. package/lib/store.js +2 -3
  129. package/lib/transform.js +1 -1
  130. package/lib/translation.js +7 -8
  131. package/lib/ui.js +12 -14
  132. package/lib/utils.js +70 -72
  133. package/lib/within.js +10 -10
  134. package/lib/workerStorage.js +27 -25
  135. package/lib/workers.js +29 -32
  136. package/package.json +56 -57
  137. package/translations/de-DE.js +1 -1
  138. package/translations/fr-FR.js +1 -1
  139. package/translations/index.js +9 -13
  140. package/translations/it-IT.js +1 -1
  141. package/translations/ja-JP.js +1 -1
  142. package/translations/pl-PL.js +1 -1
  143. package/translations/pt-BR.js +1 -1
  144. package/translations/ru-RU.js +1 -1
  145. package/translations/zh-CN.js +1 -1
  146. package/translations/zh-TW.js +1 -1
  147. package/typings/index.d.ts +415 -65
  148. package/typings/promiseBasedTypes.d.ts +32 -0
  149. package/typings/types.d.ts +32 -0
  150. package/lib/dirname.js +0 -5
  151. package/lib/helper/Expect.js +0 -425
@@ -1,9 +1,9 @@
1
- import { getConfig, getTestRoot } from '../utils.js';
2
- import Codecept from '../../codecept.js';
3
- import * as output from '../../output.js';
4
- import { getSteps } from '../../interfaces/bdd.js';
1
+ const { getConfig, getTestRoot } = require('../utils');
2
+ const Codecept = require('../../codecept');
3
+ const output = require('../../output');
4
+ const { getSteps } = require('../../interfaces/bdd');
5
5
 
6
- export default function (genPath, options) {
6
+ module.exports = function (genPath, options) {
7
7
  const configFile = options.config || genPath;
8
8
  const testsPath = getTestRoot(configFile);
9
9
  const config = getConfig(configFile);
@@ -16,10 +16,10 @@ export default function (genPath, options) {
16
16
  output.print();
17
17
  const steps = getSteps();
18
18
  for (const step of Object.keys(steps)) {
19
- output.print(` ${output.output.colors.bold(step)} ${output.output.colors.green(steps[step].line || '')}`);
19
+ output.print(` ${output.colors.bold(step)} ${output.colors.green(steps[step].line || '')}`);
20
20
  }
21
21
  output.print();
22
22
  if (!Object.keys(steps).length) {
23
- output.output.error('No Gherkin steps defined');
23
+ output.error('No Gherkin steps defined');
24
24
  }
25
- }
25
+ };
@@ -1,44 +1,46 @@
1
- import envinfo from 'envinfo';
2
- import { getConfig, getTestRoot } from './utils.js';
3
- import Codecept from '../codecept.js';
4
- import * as codeceptInstance from '../codecept.js';
5
- import * as output from '../output.js';
1
+ const envinfo = require('envinfo')
6
2
 
7
- export default async function (path) {
8
- const testsPath = getTestRoot(path);
9
- const config = getConfig(testsPath);
10
- const codecept = new Codecept(config, {});
11
- codecept.init(testsPath);
3
+ const { getConfig, getTestRoot } = require('./utils')
4
+ const Codecept = require('../codecept')
5
+ const output = require('../output')
12
6
 
13
- output.print('\n Environment information:-\n');
14
- const info = {};
15
- info.codeceptVersion = codeceptInstance.version();
16
- info.nodeInfo = await envinfo.helpers.getNodeInfo();
17
- info.osInfo = await envinfo.helpers.getOSInfo();
18
- info.cpuInfo = await envinfo.helpers.getCPUInfo();
19
- info.chromeInfo = await envinfo.helpers.getChromeInfo();
20
- info.edgeInfo = await envinfo.helpers.getEdgeInfo();
21
- info.firefoxInfo = await envinfo.helpers.getFirefoxInfo();
22
- info.safariInfo = await envinfo.helpers.getSafariInfo();
23
- const { helpers, plugins } = config;
24
- info.helpers = helpers || "You don't use any helpers";
25
- info.plugins = plugins || "You don't have any enabled plugins";
7
+ module.exports = async function (path) {
8
+ const testsPath = getTestRoot(path)
9
+ const config = getConfig(testsPath)
10
+ const codecept = new Codecept(config, {})
11
+ codecept.init(testsPath)
12
+
13
+ output.print('\n Environment information:-\n')
14
+ const info = {}
15
+ info.codeceptVersion = Codecept.version()
16
+ info.nodeInfo = await envinfo.helpers.getNodeInfo()
17
+ info.osInfo = await envinfo.helpers.getOSInfo()
18
+ info.cpuInfo = await envinfo.helpers.getCPUInfo()
19
+ info.chromeInfo = await envinfo.helpers.getChromeInfo()
20
+ info.edgeInfo = await envinfo.helpers.getEdgeInfo()
21
+ info.firefoxInfo = await envinfo.helpers.getFirefoxInfo()
22
+ info.safariInfo = await envinfo.helpers.getSafariInfo()
23
+ const { helpers, plugins } = config
24
+ info.helpers = helpers || "You don't use any helpers"
25
+ info.plugins = plugins || "You don't have any enabled plugins"
26
26
 
27
27
  for (const [key, value] of Object.entries(info)) {
28
28
  if (Array.isArray(value)) {
29
- output.print(`${key}: ${value[1]}`);
29
+ output.print(`${key}: ${value[1]}`)
30
30
  } else {
31
- output.print(`${key}: ${JSON.stringify(value, null, ' ')}`);
31
+ output.print(`${key}: ${JSON.stringify(value, null, ' ')}`)
32
32
  }
33
33
  }
34
- output.print('***************************************');
35
- output.print('If you have questions ask them in our Slack: http://bit.ly/chat-codeceptjs');
36
- output.print('Or ask them on our discussion board: https://codecept.discourse.group/');
37
- output.print('Please copy environment info when you report issues on GitHub: https://github.com/Codeception/CodeceptJS/issues');
38
- output.print('***************************************');
34
+ output.print('***************************************')
35
+ output.print('If you have questions ask them in our Slack: http://bit.ly/chat-codeceptjs')
36
+ output.print('Or ask them on our discussion board: https://codecept.discourse.group/')
37
+ output.print(
38
+ 'Please copy environment info when you report issues on GitHub: https://github.com/Codeception/CodeceptJS/issues',
39
+ )
40
+ output.print('***************************************')
39
41
  }
40
42
 
41
- export async function getMachineInfo() {
43
+ module.exports.getMachineInfo = async () => {
42
44
  const info = {
43
45
  nodeInfo: await envinfo.helpers.getNodeInfo(),
44
46
  osInfo: await envinfo.helpers.getOSInfo(),
@@ -47,17 +49,17 @@ export async function getMachineInfo() {
47
49
  edgeInfo: await envinfo.helpers.getEdgeInfo(),
48
50
  firefoxInfo: await envinfo.helpers.getFirefoxInfo(),
49
51
  safariInfo: await envinfo.helpers.getSafariInfo(),
50
- };
52
+ }
51
53
 
52
- output.print('***************************************');
54
+ output.print('***************************************')
53
55
  for (const [key, value] of Object.entries(info)) {
54
56
  if (Array.isArray(value)) {
55
- output.print(`${key}: ${value[1]}`);
57
+ output.print(`${key}: ${value[1]}`)
56
58
  } else {
57
- output.print(`${key}: ${JSON.stringify(value, null, ' ')}`);
59
+ output.print(`${key}: ${JSON.stringify(value, null, ' ')}`)
58
60
  }
59
61
  }
60
- output.print('If you need more detailed info, just run this: npx codeceptjs info');
61
- output.print('***************************************');
62
- return info;
62
+ output.print('If you need more detailed info, just run this: npx codeceptjs info')
63
+ output.print('***************************************')
64
+ return info
63
65
  }