codeceptjs 3.7.6-beta.4 → 4.0.0-beta.10.esm-aria
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 +1 -3
- package/bin/codecept.js +51 -53
- package/bin/test-server.js +14 -3
- package/docs/webapi/click.mustache +5 -1
- package/lib/actor.js +15 -11
- package/lib/ai.js +72 -107
- package/lib/assert/empty.js +9 -8
- package/lib/assert/equal.js +15 -17
- package/lib/assert/error.js +2 -2
- package/lib/assert/include.js +9 -11
- package/lib/assert/throws.js +1 -1
- package/lib/assert/truth.js +8 -5
- package/lib/assert.js +18 -18
- package/lib/codecept.js +102 -75
- package/lib/colorUtils.js +48 -50
- package/lib/command/check.js +32 -27
- package/lib/command/configMigrate.js +11 -10
- package/lib/command/definitions.js +16 -10
- package/lib/command/dryRun.js +16 -16
- package/lib/command/generate.js +62 -27
- package/lib/command/gherkin/init.js +36 -38
- package/lib/command/gherkin/snippets.js +14 -14
- package/lib/command/gherkin/steps.js +21 -18
- package/lib/command/info.js +8 -8
- package/lib/command/init.js +36 -29
- package/lib/command/interactive.js +11 -10
- package/lib/command/list.js +10 -9
- package/lib/command/run-multiple/chunk.js +5 -5
- package/lib/command/run-multiple/collection.js +5 -5
- package/lib/command/run-multiple/run.js +3 -3
- package/lib/command/run-multiple.js +16 -13
- package/lib/command/run-rerun.js +6 -7
- package/lib/command/run-workers.js +24 -9
- package/lib/command/run.js +23 -8
- package/lib/command/utils.js +20 -18
- package/lib/command/workers/runTests.js +197 -114
- package/lib/config.js +124 -51
- package/lib/container.js +438 -87
- package/lib/data/context.js +6 -5
- package/lib/data/dataScenarioConfig.js +1 -1
- package/lib/data/dataTableArgument.js +1 -1
- package/lib/data/table.js +1 -1
- package/lib/effects.js +94 -10
- package/lib/element/WebElement.js +2 -2
- package/lib/els.js +11 -9
- package/lib/event.js +11 -10
- package/lib/globals.js +141 -0
- package/lib/heal.js +12 -12
- package/lib/helper/AI.js +11 -11
- package/lib/helper/ApiDataFactory.js +50 -19
- package/lib/helper/Appium.js +19 -27
- package/lib/helper/FileSystem.js +32 -12
- package/lib/helper/GraphQL.js +3 -3
- package/lib/helper/GraphQLDataFactory.js +4 -4
- package/lib/helper/JSONResponse.js +25 -29
- package/lib/helper/Mochawesome.js +7 -4
- package/lib/helper/Playwright.js +902 -164
- package/lib/helper/Puppeteer.js +383 -76
- package/lib/helper/REST.js +29 -12
- package/lib/helper/WebDriver.js +268 -61
- package/lib/helper/clientscripts/PollyWebDriverExt.js +1 -1
- package/lib/helper/errors/ConnectionRefused.js +6 -6
- package/lib/helper/errors/ElementAssertion.js +11 -16
- package/lib/helper/errors/ElementNotFound.js +5 -9
- package/lib/helper/errors/RemoteBrowserConnectionRefused.js +5 -5
- package/lib/helper/extras/Console.js +11 -11
- package/lib/helper/extras/PlaywrightLocator.js +110 -0
- package/lib/helper/extras/PlaywrightPropEngine.js +18 -18
- package/lib/helper/extras/PlaywrightReactVueLocator.js +18 -9
- package/lib/helper/extras/PlaywrightRestartOpts.js +34 -23
- package/lib/helper/extras/Popup.js +1 -1
- package/lib/helper/extras/React.js +29 -30
- package/lib/helper/network/actions.js +29 -44
- package/lib/helper/network/utils.js +76 -83
- package/lib/helper/scripts/blurElement.js +6 -6
- package/lib/helper/scripts/focusElement.js +6 -6
- package/lib/helper/scripts/highlightElement.js +9 -9
- package/lib/helper/scripts/isElementClickable.js +34 -34
- package/lib/helper.js +2 -1
- package/lib/history.js +23 -20
- package/lib/hooks.js +10 -10
- package/lib/html.js +90 -100
- package/lib/index.js +48 -21
- package/lib/listener/config.js +19 -12
- package/lib/listener/emptyRun.js +6 -7
- package/lib/listener/enhancedGlobalRetry.js +6 -6
- package/lib/listener/exit.js +4 -3
- package/lib/listener/globalRetry.js +5 -5
- package/lib/listener/globalTimeout.js +30 -14
- package/lib/listener/helpers.js +39 -14
- package/lib/listener/mocha.js +3 -4
- package/lib/listener/result.js +4 -5
- package/lib/listener/retryEnhancer.js +3 -3
- package/lib/listener/steps.js +8 -7
- package/lib/listener/store.js +3 -3
- package/lib/locator.js +213 -192
- package/lib/mocha/asyncWrapper.js +105 -62
- package/lib/mocha/bdd.js +99 -13
- package/lib/mocha/cli.js +59 -26
- package/lib/mocha/factory.js +78 -19
- package/lib/mocha/featureConfig.js +1 -1
- package/lib/mocha/gherkin.js +56 -24
- package/lib/mocha/hooks.js +12 -3
- package/lib/mocha/index.js +13 -4
- package/lib/mocha/inject.js +22 -5
- package/lib/mocha/scenarioConfig.js +2 -2
- package/lib/mocha/suite.js +9 -2
- package/lib/mocha/test.js +10 -7
- package/lib/mocha/ui.js +28 -18
- package/lib/output.js +10 -8
- package/lib/parser.js +44 -44
- package/lib/pause.js +15 -16
- package/lib/plugin/analyze.js +19 -12
- package/lib/plugin/auth.js +20 -21
- package/lib/plugin/autoDelay.js +12 -8
- package/lib/plugin/coverage.js +28 -11
- package/lib/plugin/customLocator.js +3 -3
- package/lib/plugin/customReporter.js +3 -2
- package/lib/plugin/enhancedRetryFailedStep.js +6 -6
- package/lib/plugin/heal.js +14 -9
- package/lib/plugin/htmlReporter.js +724 -99
- package/lib/plugin/pageInfo.js +10 -10
- package/lib/plugin/pauseOnFail.js +4 -3
- package/lib/plugin/retryFailedStep.js +48 -5
- package/lib/plugin/screenshotOnFail.js +75 -37
- package/lib/plugin/stepByStepReport.js +14 -14
- package/lib/plugin/stepTimeout.js +4 -3
- package/lib/plugin/subtitles.js +6 -5
- package/lib/recorder.js +33 -14
- package/lib/rerun.js +69 -26
- package/lib/result.js +4 -4
- package/lib/retryCoordinator.js +2 -2
- package/lib/secret.js +18 -17
- package/lib/session.js +95 -89
- package/lib/step/base.js +7 -7
- package/lib/step/comment.js +2 -2
- package/lib/step/config.js +1 -1
- package/lib/step/func.js +3 -3
- package/lib/step/helper.js +3 -3
- package/lib/step/meta.js +5 -5
- package/lib/step/record.js +11 -11
- package/lib/step/retry.js +3 -3
- package/lib/step/section.js +3 -3
- package/lib/step.js +7 -10
- package/lib/steps.js +9 -5
- package/lib/store.js +1 -1
- package/lib/template/heal.js +1 -1
- package/lib/template/prompts/generatePageObject.js +31 -0
- package/lib/template/prompts/healStep.js +13 -0
- package/lib/template/prompts/writeStep.js +9 -0
- package/lib/test-server.js +17 -6
- package/lib/timeout.js +1 -7
- package/lib/transform.js +8 -8
- package/lib/translation.js +32 -18
- package/lib/utils/mask_data.js +4 -10
- package/lib/utils.js +66 -64
- package/lib/workerStorage.js +17 -17
- package/lib/workers.js +214 -84
- package/package.json +41 -37
- package/translations/de-DE.js +2 -2
- package/translations/fr-FR.js +2 -2
- package/translations/index.js +23 -10
- package/translations/it-IT.js +2 -2
- package/translations/ja-JP.js +2 -2
- package/translations/nl-NL.js +2 -2
- package/translations/pl-PL.js +2 -2
- package/translations/pt-BR.js +2 -2
- package/translations/ru-RU.js +2 -2
- package/translations/utils.js +4 -3
- package/translations/zh-CN.js +2 -2
- package/translations/zh-TW.js +2 -2
- package/typings/index.d.ts +5 -3
- package/typings/promiseBasedTypes.d.ts +4 -0
- package/typings/types.d.ts +4 -0
- package/lib/helper/Nightmare.js +0 -1486
- package/lib/helper/Protractor.js +0 -1840
- package/lib/helper/TestCafe.js +0 -1391
- package/lib/helper/clientscripts/nightmare.js +0 -213
- package/lib/helper/testcafe/testControllerHolder.js +0 -42
- package/lib/helper/testcafe/testcafe-utils.js +0 -61
- package/lib/plugin/allure.js +0 -15
- package/lib/plugin/autoLogin.js +0 -5
- package/lib/plugin/commentStep.js +0 -141
- package/lib/plugin/eachElement.js +0 -127
- package/lib/plugin/fakerTransform.js +0 -49
- package/lib/plugin/retryTo.js +0 -16
- package/lib/plugin/selenoid.js +0 -364
- package/lib/plugin/standardActingHelpers.js +0 -6
- package/lib/plugin/tryTo.js +0 -16
- package/lib/plugin/wdio.js +0 -247
- package/lib/within.js +0 -90
package/lib/listener/helpers.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const { error } = require('../output')
|
|
1
|
+
import path from 'path'
|
|
2
|
+
import event from '../event.js'
|
|
3
|
+
import recorder from '../recorder.js'
|
|
4
|
+
import store from '../store.js'
|
|
5
|
+
import output from '../output.js'
|
|
7
6
|
/**
|
|
8
7
|
* Enable Helpers to listen to test events
|
|
9
8
|
*/
|
|
10
|
-
|
|
11
|
-
const helpers = container.helpers()
|
|
9
|
+
export default function () {
|
|
10
|
+
const helpers = global.container.helpers()
|
|
12
11
|
|
|
13
12
|
const runHelpersHook = (hook, param) => {
|
|
14
13
|
if (store.dryRun) return
|
|
@@ -39,30 +38,30 @@ module.exports = function () {
|
|
|
39
38
|
|
|
40
39
|
event.dispatcher.on(event.test.started, test => {
|
|
41
40
|
runHelpersHook('_test', test)
|
|
42
|
-
recorder.catch(e => error(e))
|
|
41
|
+
recorder.catch(e => output.error(e))
|
|
43
42
|
})
|
|
44
43
|
|
|
45
44
|
event.dispatcher.on(event.test.before, test => {
|
|
46
45
|
// schedule config to revert changes
|
|
47
46
|
runAsyncHelpersHook('_before', test, true)
|
|
48
|
-
recorder.catchWithoutStop(e => error(e))
|
|
47
|
+
recorder.catchWithoutStop(e => output.error(e))
|
|
49
48
|
})
|
|
50
49
|
|
|
51
50
|
event.dispatcher.on(event.test.passed, test => {
|
|
52
51
|
runAsyncHelpersHook('_passed', test, true)
|
|
53
52
|
// should not fail test execution, so errors should be caught
|
|
54
|
-
recorder.catchWithoutStop(e => error(e))
|
|
53
|
+
recorder.catchWithoutStop(e => output.error(e))
|
|
55
54
|
})
|
|
56
55
|
|
|
57
56
|
event.dispatcher.on(event.test.failed, test => {
|
|
58
57
|
runAsyncHelpersHook('_failed', test, true)
|
|
59
58
|
// should not fail test execution, so errors should be caught
|
|
60
|
-
recorder.catchWithoutStop(e => error(e))
|
|
59
|
+
recorder.catchWithoutStop(e => output.error(e))
|
|
61
60
|
})
|
|
62
61
|
|
|
63
62
|
event.dispatcher.on(event.test.after, () => {
|
|
64
63
|
runAsyncHelpersHook('_after', {}, true)
|
|
65
|
-
recorder.catchWithoutStop(e => error(e))
|
|
64
|
+
recorder.catchWithoutStop(e => output.error(e))
|
|
66
65
|
})
|
|
67
66
|
|
|
68
67
|
event.dispatcher.on(event.step.before, step => {
|
|
@@ -74,6 +73,32 @@ module.exports = function () {
|
|
|
74
73
|
})
|
|
75
74
|
|
|
76
75
|
event.dispatcher.on(event.all.result, () => {
|
|
77
|
-
|
|
76
|
+
// Skip _finishTest for all helpers if any browser helper restarts to avoid double cleanup
|
|
77
|
+
const hasBrowserRestart = Object.values(helpers).some(helper =>
|
|
78
|
+
(helper.config && (helper.config.restart === 'browser' || helper.config.restart === 'context' || helper.config.restart === true)) ||
|
|
79
|
+
(helper.options && (helper.options.restart === 'browser' || helper.options.restart === 'context' || helper.options.restart === true))
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
Object.keys(helpers).forEach(key => {
|
|
83
|
+
const helper = helpers[key]
|
|
84
|
+
if (helper._finishTest && !hasBrowserRestart) {
|
|
85
|
+
recorder.add(`hook ${key}._finishTest()`, () => helper._finishTest(), true, false)
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
event.dispatcher.on(event.all.after, () => {
|
|
91
|
+
// Skip _cleanup for all helpers if any browser helper restarts to avoid double cleanup
|
|
92
|
+
const hasBrowserRestart = Object.values(helpers).some(helper =>
|
|
93
|
+
(helper.config && (helper.config.restart === 'browser' || helper.config.restart === 'context' || helper.config.restart === true)) ||
|
|
94
|
+
(helper.options && (helper.options.restart === 'browser' || helper.options.restart === 'context' || helper.options.restart === true))
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
Object.keys(helpers).forEach(key => {
|
|
98
|
+
const helper = helpers[key]
|
|
99
|
+
if (helper._cleanup && !hasBrowserRestart) {
|
|
100
|
+
recorder.add(`hook ${key}._cleanup()`, () => helper._cleanup(), true, false)
|
|
101
|
+
}
|
|
102
|
+
})
|
|
78
103
|
})
|
|
79
104
|
}
|
package/lib/listener/mocha.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
const container = require('../container')
|
|
1
|
+
import event from '../event.js'
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
export default function () {
|
|
5
4
|
let mocha
|
|
6
5
|
|
|
7
6
|
event.dispatcher.on(event.all.before, () => {
|
|
8
|
-
mocha = container.mocha()
|
|
7
|
+
mocha = global.container.mocha()
|
|
9
8
|
})
|
|
10
9
|
|
|
11
10
|
event.dispatcher.on(event.test.passed, test => {
|
package/lib/listener/result.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
const container = require('../container')
|
|
1
|
+
import event from '../event.js'
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
export default function () {
|
|
5
4
|
event.dispatcher.on(event.hook.failed, err => {
|
|
6
|
-
container.result().addStats({ failedHooks: 1 })
|
|
5
|
+
global.container.result().addStats({ failedHooks: 1 })
|
|
7
6
|
})
|
|
8
7
|
|
|
9
8
|
event.dispatcher.on(event.test.before, test => {
|
|
10
|
-
container.result().addTest(test)
|
|
9
|
+
global.container.result().addTest(test)
|
|
11
10
|
})
|
|
12
11
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import event from '../event.js'
|
|
2
|
+
import { enhanceMochaTest } from '../mocha/test.js'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Enhance retried tests by copying CodeceptJS-specific properties from the original test
|
|
6
6
|
* This fixes the issue where Mocha's shallow clone during retries loses CodeceptJS properties
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
export default function () {
|
|
9
9
|
event.dispatcher.on(event.test.before, test => {
|
|
10
10
|
// Check if this test is a retry (has a reference to the original test)
|
|
11
11
|
const originalTest = test.retriedTest && test.retriedTest()
|
package/lib/listener/steps.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import debugModule from 'debug'
|
|
2
|
+
const debug = debugModule('codeceptjs:steps')
|
|
3
|
+
import event from '../event.js'
|
|
4
|
+
import store from '../store.js'
|
|
5
|
+
import output from '../output.js'
|
|
6
|
+
import { BeforeHook, AfterHook, BeforeSuiteHook, AfterSuiteHook } from '../mocha/hooks.js'
|
|
7
|
+
import recorder from '../recorder.js'
|
|
7
8
|
|
|
8
9
|
let currentTest
|
|
9
10
|
let currentHook
|
|
@@ -14,7 +15,7 @@ const EXCLUDED_SESSIONS = ['tryTo', 'hopeThat']
|
|
|
14
15
|
/**
|
|
15
16
|
* Register steps inside tests
|
|
16
17
|
*/
|
|
17
|
-
|
|
18
|
+
export default function () {
|
|
18
19
|
event.dispatcher.on(event.test.before, test => {
|
|
19
20
|
test.startedAt = +new Date()
|
|
20
21
|
})
|
package/lib/listener/store.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import event from '../event.js'
|
|
2
|
+
import store from '../store.js'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export default function () {
|
|
5
5
|
event.dispatcher.on(event.suite.before, suite => {
|
|
6
6
|
store.currentSuite = suite
|
|
7
7
|
})
|