codeceptjs 3.7.0-beta.1 → 3.7.0-beta.10

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 (73) hide show
  1. package/README.md +9 -10
  2. package/bin/codecept.js +7 -0
  3. package/lib/actor.js +46 -92
  4. package/lib/ai.js +130 -121
  5. package/lib/codecept.js +2 -2
  6. package/lib/command/check.js +186 -0
  7. package/lib/command/definitions.js +3 -1
  8. package/lib/command/interactive.js +1 -1
  9. package/lib/command/run-workers.js +2 -54
  10. package/lib/command/workers/runTests.js +64 -225
  11. package/lib/container.js +27 -0
  12. package/lib/effects.js +218 -0
  13. package/lib/els.js +87 -106
  14. package/lib/event.js +18 -17
  15. package/lib/heal.js +10 -0
  16. package/lib/helper/AI.js +2 -1
  17. package/lib/helper/Appium.js +31 -22
  18. package/lib/helper/Playwright.js +22 -1
  19. package/lib/helper/Puppeteer.js +5 -0
  20. package/lib/helper/WebDriver.js +29 -8
  21. package/lib/listener/emptyRun.js +2 -5
  22. package/lib/listener/exit.js +5 -8
  23. package/lib/listener/globalTimeout.js +66 -10
  24. package/lib/listener/result.js +12 -0
  25. package/lib/listener/steps.js +3 -6
  26. package/lib/listener/store.js +9 -1
  27. package/lib/mocha/asyncWrapper.js +15 -3
  28. package/lib/mocha/cli.js +79 -28
  29. package/lib/mocha/featureConfig.js +13 -0
  30. package/lib/mocha/hooks.js +32 -3
  31. package/lib/mocha/inject.js +5 -0
  32. package/lib/mocha/scenarioConfig.js +11 -0
  33. package/lib/mocha/suite.js +27 -1
  34. package/lib/mocha/test.js +102 -3
  35. package/lib/mocha/types.d.ts +11 -0
  36. package/lib/output.js +75 -73
  37. package/lib/pause.js +3 -10
  38. package/lib/plugin/analyze.js +349 -0
  39. package/lib/plugin/autoDelay.js +2 -2
  40. package/lib/plugin/commentStep.js +5 -0
  41. package/lib/plugin/customReporter.js +52 -0
  42. package/lib/plugin/heal.js +30 -0
  43. package/lib/plugin/pageInfo.js +140 -0
  44. package/lib/plugin/retryTo.js +18 -118
  45. package/lib/plugin/screenshotOnFail.js +12 -17
  46. package/lib/plugin/standardActingHelpers.js +4 -1
  47. package/lib/plugin/stepByStepReport.js +6 -5
  48. package/lib/plugin/stepTimeout.js +1 -1
  49. package/lib/plugin/tryTo.js +17 -107
  50. package/lib/recorder.js +5 -5
  51. package/lib/rerun.js +43 -42
  52. package/lib/result.js +161 -0
  53. package/lib/step/base.js +228 -0
  54. package/lib/step/config.js +50 -0
  55. package/lib/step/func.js +46 -0
  56. package/lib/step/helper.js +50 -0
  57. package/lib/step/meta.js +99 -0
  58. package/lib/step/record.js +74 -0
  59. package/lib/step/retry.js +11 -0
  60. package/lib/step/section.js +55 -0
  61. package/lib/step.js +20 -347
  62. package/lib/steps.js +50 -0
  63. package/lib/store.js +4 -0
  64. package/lib/timeout.js +66 -0
  65. package/lib/utils.js +93 -0
  66. package/lib/within.js +2 -2
  67. package/lib/workers.js +29 -49
  68. package/package.json +23 -20
  69. package/typings/index.d.ts +5 -4
  70. package/typings/promiseBasedTypes.d.ts +617 -7
  71. package/typings/types.d.ts +663 -34
  72. package/lib/listener/artifacts.js +0 -19
  73. package/lib/plugin/debugErrors.js +0 -67
@@ -1,19 +0,0 @@
1
- const event = require('../event')
2
- const recorder = require('../recorder')
3
-
4
- /**
5
- * Create and clean up empty artifacts
6
- */
7
- module.exports = function () {
8
- event.dispatcher.on(event.test.before, test => {
9
- test.artifacts = {}
10
- })
11
-
12
- event.dispatcher.on(event.test.after, test => {
13
- recorder.add('clean up empty artifacts', () => {
14
- for (const key in test.artifacts || {}) {
15
- if (!test.artifacts[key]) delete test.artifacts[key]
16
- }
17
- })
18
- })
19
- }
@@ -1,67 +0,0 @@
1
- const Container = require('../container')
2
- const recorder = require('../recorder')
3
- const event = require('../event')
4
- const supportedHelpers = require('./standardActingHelpers')
5
- const { scanForErrorMessages } = require('../html')
6
- const { output } = require('..')
7
-
8
- const defaultConfig = {
9
- errorClasses: ['error', 'warning', 'alert', 'danger'],
10
- }
11
-
12
- /**
13
- * Prints errors found in HTML code after each failed test.
14
- *
15
- * It scans HTML and searches for elements with error classes.
16
- * If an element found prints a text from it to console and adds as artifact to the test.
17
- *
18
- * Enable this plugin in config:
19
- *
20
- * ```js
21
- * plugins: {
22
- * debugErrors: {
23
- * enabled: true,
24
- * }
25
- * ```
26
- *
27
- * Additional config options:
28
- *
29
- * * `errorClasses` - list of classes to search for errors (default: `['error', 'warning', 'alert', 'danger']`)
30
- *
31
- */
32
- module.exports = function (config = {}) {
33
- const helpers = Container.helpers()
34
- let helper
35
-
36
- config = Object.assign(defaultConfig, config)
37
-
38
- for (const helperName of supportedHelpers) {
39
- if (Object.keys(helpers).indexOf(helperName) > -1) {
40
- helper = helpers[helperName]
41
- }
42
- }
43
-
44
- if (!helper) return // no helpers for screenshot
45
-
46
- event.dispatcher.on(event.test.failed, test => {
47
- recorder.add('HTML snapshot failed test', async () => {
48
- try {
49
- const currentOutputLevel = output.level()
50
- output.level(0)
51
- const html = await helper.grabHTMLFrom('body')
52
- output.level(currentOutputLevel)
53
-
54
- if (!html) return
55
-
56
- const errors = scanForErrorMessages(html, config.errorClasses)
57
- if (errors.length) {
58
- output.debug('Detected errors in HTML code')
59
- errors.forEach(error => output.debug(error))
60
- test.artifacts.errors = errors
61
- }
62
- } catch (err) {
63
- // not really needed
64
- }
65
- })
66
- })
67
- }