codeceptjs 3.7.0-beta.1 → 3.7.0-beta.11
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.
- package/README.md +9 -10
- package/bin/codecept.js +7 -0
- package/lib/actor.js +46 -92
- package/lib/ai.js +130 -121
- package/lib/codecept.js +2 -2
- package/lib/command/check.js +186 -0
- package/lib/command/definitions.js +3 -1
- package/lib/command/interactive.js +1 -1
- package/lib/command/run-workers.js +2 -54
- package/lib/command/workers/runTests.js +64 -225
- package/lib/container.js +32 -0
- package/lib/effects.js +218 -0
- package/lib/els.js +87 -106
- package/lib/event.js +18 -17
- package/lib/heal.js +10 -0
- package/lib/helper/AI.js +2 -1
- package/lib/helper/Appium.js +31 -22
- package/lib/helper/Playwright.js +22 -1
- package/lib/helper/Puppeteer.js +5 -0
- package/lib/helper/WebDriver.js +29 -8
- package/lib/listener/emptyRun.js +2 -5
- package/lib/listener/exit.js +5 -8
- package/lib/listener/globalTimeout.js +66 -10
- package/lib/listener/result.js +12 -0
- package/lib/listener/steps.js +3 -6
- package/lib/listener/store.js +9 -1
- package/lib/mocha/asyncWrapper.js +15 -3
- package/lib/mocha/cli.js +79 -28
- package/lib/mocha/featureConfig.js +13 -0
- package/lib/mocha/hooks.js +32 -3
- package/lib/mocha/inject.js +5 -0
- package/lib/mocha/scenarioConfig.js +11 -0
- package/lib/mocha/suite.js +27 -1
- package/lib/mocha/test.js +102 -3
- package/lib/mocha/types.d.ts +11 -0
- package/lib/output.js +75 -73
- package/lib/pause.js +3 -10
- package/lib/plugin/analyze.js +349 -0
- package/lib/plugin/autoDelay.js +2 -2
- package/lib/plugin/commentStep.js +5 -0
- package/lib/plugin/customReporter.js +52 -0
- package/lib/plugin/heal.js +30 -0
- package/lib/plugin/pageInfo.js +140 -0
- package/lib/plugin/retryTo.js +18 -118
- package/lib/plugin/screenshotOnFail.js +12 -17
- package/lib/plugin/standardActingHelpers.js +4 -1
- package/lib/plugin/stepByStepReport.js +6 -5
- package/lib/plugin/stepTimeout.js +1 -1
- package/lib/plugin/tryTo.js +17 -107
- package/lib/recorder.js +5 -5
- package/lib/rerun.js +43 -42
- package/lib/result.js +161 -0
- package/lib/step/base.js +228 -0
- package/lib/step/config.js +50 -0
- package/lib/step/func.js +46 -0
- package/lib/step/helper.js +50 -0
- package/lib/step/meta.js +99 -0
- package/lib/step/record.js +74 -0
- package/lib/step/retry.js +11 -0
- package/lib/step/section.js +55 -0
- package/lib/step.js +20 -347
- package/lib/steps.js +50 -0
- package/lib/store.js +4 -0
- package/lib/timeout.js +66 -0
- package/lib/utils.js +93 -0
- package/lib/within.js +2 -2
- package/lib/workers.js +29 -49
- package/package.json +23 -20
- package/typings/index.d.ts +5 -4
- package/typings/promiseBasedTypes.d.ts +507 -49
- package/typings/types.d.ts +623 -73
- package/lib/listener/artifacts.js +0 -19
- 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
|
-
}
|