codeceptjs 4.0.0-beta.5 → 4.0.0-beta.6.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 +0 -45
- package/bin/codecept.js +46 -57
- package/lib/actor.js +15 -11
- package/lib/ai.js +6 -5
- 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 +66 -107
- 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 +29 -26
- 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 +34 -31
- 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 +10 -24
- package/lib/command/run.js +8 -8
- package/lib/command/utils.js +20 -18
- package/lib/command/workers/runTests.js +117 -269
- package/lib/config.js +111 -49
- package/lib/container.js +299 -102
- 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/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 +1 -1
- package/lib/helper/ApiDataFactory.js +16 -13
- package/lib/helper/FileSystem.js +32 -12
- package/lib/helper/GraphQL.js +1 -1
- package/lib/helper/GraphQLDataFactory.js +1 -1
- package/lib/helper/JSONResponse.js +19 -30
- package/lib/helper/Mochawesome.js +9 -28
- package/lib/helper/Playwright.js +668 -265
- package/lib/helper/Puppeteer.js +284 -169
- package/lib/helper/REST.js +29 -12
- package/lib/helper/WebDriver.js +191 -71
- 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/PlaywrightRestartOpts.js +23 -23
- package/lib/helper/extras/Popup.js +1 -1
- package/lib/helper/extras/React.js +29 -30
- package/lib/helper/network/actions.js +33 -48
- 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 +8 -9
- package/lib/listener/emptyRun.js +6 -7
- package/lib/listener/exit.js +4 -3
- package/lib/listener/globalRetry.js +5 -5
- package/lib/listener/globalTimeout.js +11 -10
- package/lib/listener/helpers.js +33 -14
- package/lib/listener/mocha.js +3 -4
- package/lib/listener/result.js +4 -5
- package/lib/listener/steps.js +7 -18
- package/lib/listener/store.js +3 -3
- package/lib/locator.js +213 -192
- package/lib/mocha/asyncWrapper.js +108 -75
- package/lib/mocha/bdd.js +99 -13
- package/lib/mocha/cli.js +60 -27
- package/lib/mocha/factory.js +75 -19
- package/lib/mocha/featureConfig.js +1 -1
- package/lib/mocha/gherkin.js +57 -25
- 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 -13
- package/lib/mocha/ui.js +28 -31
- package/lib/output.js +11 -9
- 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 +12 -8
- package/lib/plugin/customLocator.js +3 -3
- package/lib/plugin/customReporter.js +3 -2
- package/lib/plugin/heal.js +14 -9
- package/lib/plugin/pageInfo.js +10 -10
- package/lib/plugin/pauseOnFail.js +4 -3
- package/lib/plugin/retryFailedStep.js +47 -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 -23
- package/lib/rerun.js +69 -26
- package/lib/result.js +4 -4
- package/lib/secret.js +18 -17
- package/lib/session.js +95 -89
- package/lib/step/base.js +6 -6
- 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 +4 -4
- 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/timeout.js +1 -7
- package/lib/transform.js +8 -8
- package/lib/translation.js +32 -18
- package/lib/utils.js +68 -97
- package/lib/workerStorage.js +16 -17
- package/lib/workers.js +145 -171
- package/package.json +63 -57
- 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 +11 -2
- package/translations/zh-CN.js +2 -2
- package/translations/zh-TW.js +2 -2
- package/typings/index.d.ts +7 -18
- package/typings/promiseBasedTypes.d.ts +3769 -5450
- package/typings/types.d.ts +3953 -5778
- package/bin/test-server.js +0 -53
- package/lib/element/WebElement.js +0 -327
- 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/extras/PlaywrightReactVueLocator.js +0 -43
- package/lib/helper/testcafe/testControllerHolder.js +0 -42
- package/lib/helper/testcafe/testcafe-utils.js +0 -61
- package/lib/listener/retryEnhancer.js +0 -85
- 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/htmlReporter.js +0 -1947
- 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/test-server.js +0 -323
- package/lib/within.js +0 -90
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { fork } from 'child_process'
|
|
2
|
+
import path from 'path'
|
|
3
|
+
import crypto from 'crypto'
|
|
4
|
+
import { fileURLToPath } from 'url'
|
|
5
|
+
|
|
6
|
+
import runHook from '../hooks.js'
|
|
7
|
+
import event from '../event.js'
|
|
8
|
+
import { createRuns } from './run-multiple/collection.js'
|
|
9
|
+
import { clearString, replaceValueDeep } from '../utils.js'
|
|
10
|
+
import { getConfig, getTestRoot, fail } from './utils.js'
|
|
11
|
+
|
|
12
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
13
|
+
const __dirname = path.dirname(__filename)
|
|
11
14
|
const runner = path.join(__dirname, '/../../bin/codecept')
|
|
12
15
|
let config
|
|
13
16
|
const childOpts = {}
|
|
@@ -24,7 +27,7 @@ let subprocessCount = 0
|
|
|
24
27
|
let totalSubprocessCount = 0
|
|
25
28
|
let processesDone
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
export default async function (selectedRuns, options) {
|
|
28
31
|
// registering options globally to use in config
|
|
29
32
|
if (options.profile) {
|
|
30
33
|
process.env.profile = options.profile
|
|
@@ -49,7 +52,7 @@ module.exports = async function (selectedRuns, options) {
|
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
config = {
|
|
52
|
-
...getConfig(configFile),
|
|
55
|
+
...(await getConfig(configFile)),
|
|
53
56
|
...overrides,
|
|
54
57
|
}
|
|
55
58
|
|
|
@@ -88,7 +91,7 @@ module.exports = async function (selectedRuns, options) {
|
|
|
88
91
|
})
|
|
89
92
|
|
|
90
93
|
const runsToExecute = []
|
|
91
|
-
|
|
94
|
+
createRuns(selectedRuns, config).forEach(run => {
|
|
92
95
|
const runName = run.getOriginalName() || run.getName()
|
|
93
96
|
const runConfig = run.getConfig()
|
|
94
97
|
runsToExecute.push(executeRun(runName, runConfig))
|
package/lib/command/run-rerun.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const Codecept = require('../rerun')
|
|
1
|
+
import { getConfig, getTestRoot, printError, createOutputDir } from './utils.js'
|
|
2
|
+
import Config from '../config.js'
|
|
3
|
+
import Codecept from '../rerun.js'
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
export default async function (test, options) {
|
|
7
6
|
// registering options globally to use in config
|
|
8
7
|
// Backward compatibility for --profile
|
|
9
8
|
process.profile = options.profile
|
|
10
9
|
process.env.profile = options.profile
|
|
11
10
|
const configFile = options.config
|
|
12
11
|
|
|
13
|
-
let config = getConfig(configFile)
|
|
12
|
+
let config = await getConfig(configFile)
|
|
14
13
|
if (options.override) {
|
|
15
14
|
config = Config.append(JSON.parse(options.override))
|
|
16
15
|
}
|
|
@@ -20,7 +19,7 @@ module.exports = async function (test, options) {
|
|
|
20
19
|
const codecept = new Codecept(config, options)
|
|
21
20
|
|
|
22
21
|
try {
|
|
23
|
-
codecept.init(testRoot)
|
|
22
|
+
await codecept.init(testRoot)
|
|
24
23
|
|
|
25
24
|
await codecept.bootstrap()
|
|
26
25
|
codecept.loadTests(test)
|
|
@@ -1,31 +1,18 @@
|
|
|
1
1
|
// For Node version >=10.5.0, have to use experimental flag
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { tryOrDefault } from '../utils.js'
|
|
3
|
+
import output from '../output.js'
|
|
4
|
+
import store from '../store.js'
|
|
5
|
+
import event from '../event.js'
|
|
6
|
+
import Workers from '../workers.js'
|
|
7
|
+
import Codecept from '../codecept.js'
|
|
8
|
+
import { getMachineInfo } from './info.js'
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
export default async function (workerCount, selectedRuns, options) {
|
|
9
11
|
process.env.profile = options.profile
|
|
10
12
|
|
|
11
13
|
const { config: testConfig, override = '' } = options
|
|
12
14
|
const overrideConfigs = tryOrDefault(() => JSON.parse(override), {})
|
|
13
|
-
|
|
14
|
-
// Determine test split strategy
|
|
15
|
-
let by = 'test' // default
|
|
16
|
-
if (options.by) {
|
|
17
|
-
// Explicit --by option takes precedence
|
|
18
|
-
by = options.by
|
|
19
|
-
} else if (options.suites) {
|
|
20
|
-
// Legacy --suites option
|
|
21
|
-
by = 'suite'
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Validate the by option
|
|
25
|
-
const validStrategies = ['test', 'suite', 'pool']
|
|
26
|
-
if (!validStrategies.includes(by)) {
|
|
27
|
-
throw new Error(`Invalid --by strategy: ${by}. Valid options are: ${validStrategies.join(', ')}`)
|
|
28
|
-
}
|
|
15
|
+
const by = options.suites ? 'suite' : 'test'
|
|
29
16
|
delete options.parent
|
|
30
17
|
const config = {
|
|
31
18
|
by,
|
|
@@ -36,7 +23,7 @@ module.exports = async function (workerCount, selectedRuns, options) {
|
|
|
36
23
|
|
|
37
24
|
const numberOfWorkers = parseInt(workerCount, 10)
|
|
38
25
|
|
|
39
|
-
output.print(`CodeceptJS v${
|
|
26
|
+
output.print(`CodeceptJS v${Codecept.version()} ${output.standWithUkraine()}`)
|
|
40
27
|
output.print(`Running tests in ${output.styles.bold(numberOfWorkers)} workers...`)
|
|
41
28
|
output.print()
|
|
42
29
|
store.hasWorkers = true
|
|
@@ -64,7 +51,6 @@ module.exports = async function (workerCount, selectedRuns, options) {
|
|
|
64
51
|
if (options.verbose || options.debug) store.debugMode = true
|
|
65
52
|
|
|
66
53
|
if (options.verbose) {
|
|
67
|
-
const { getMachineInfo } = require('./info')
|
|
68
54
|
await getMachineInfo()
|
|
69
55
|
}
|
|
70
56
|
await workers.bootstrapAll()
|
package/lib/command/run.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { getConfig, printError, getTestRoot, createOutputDir } from './utils.js'
|
|
2
|
+
import Config from '../config.js'
|
|
3
|
+
import store from '../store.js'
|
|
4
|
+
import Codecept from '../codecept.js'
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
export default async function (test, options) {
|
|
7
7
|
// registering options globally to use in config
|
|
8
8
|
// Backward compatibility for --profile
|
|
9
9
|
// TODO: remove in CodeceptJS 4
|
|
@@ -16,7 +16,7 @@ module.exports = async function (test, options) {
|
|
|
16
16
|
|
|
17
17
|
const configFile = options.config
|
|
18
18
|
|
|
19
|
-
let config = getConfig(configFile)
|
|
19
|
+
let config = await getConfig(configFile)
|
|
20
20
|
if (options.override) {
|
|
21
21
|
config = Config.append(JSON.parse(options.override))
|
|
22
22
|
}
|
|
@@ -26,13 +26,13 @@ module.exports = async function (test, options) {
|
|
|
26
26
|
const codecept = new Codecept(config, options)
|
|
27
27
|
|
|
28
28
|
try {
|
|
29
|
-
codecept.init(testRoot)
|
|
29
|
+
await codecept.init(testRoot)
|
|
30
30
|
await codecept.bootstrap()
|
|
31
31
|
codecept.loadTests(test)
|
|
32
32
|
|
|
33
33
|
if (options.verbose) {
|
|
34
34
|
global.debugMode = true
|
|
35
|
-
const { getMachineInfo } =
|
|
35
|
+
const { getMachineInfo } = await import('./info.js')
|
|
36
36
|
await getMachineInfo()
|
|
37
37
|
}
|
|
38
38
|
|
package/lib/command/utils.js
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import path from 'path'
|
|
3
|
+
import util from 'util'
|
|
4
|
+
import { mkdirp } from 'mkdirp'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import output from '../output.js'
|
|
7
|
+
import { fileExists, beautify, deepMerge } from '../utils.js'
|
|
8
8
|
|
|
9
9
|
// alias to deep merge
|
|
10
|
-
|
|
10
|
+
export { deepMerge }
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
export async function getConfig(configFile) {
|
|
13
13
|
try {
|
|
14
|
-
|
|
14
|
+
const configModule = await import('../config.js')
|
|
15
|
+
const config = configModule.default || configModule
|
|
16
|
+
return await config.load(configFile)
|
|
15
17
|
} catch (err) {
|
|
16
18
|
fail(err.stack)
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
export function readConfig(configFile) {
|
|
21
23
|
try {
|
|
22
24
|
const data = fs.readFileSync(configFile, 'utf8')
|
|
23
25
|
return data
|
|
@@ -32,14 +34,14 @@ function getTestRoot(currentPath) {
|
|
|
32
34
|
currentPath = fs.lstatSync(currentPath).isDirectory() || !path.extname(currentPath) ? currentPath : path.dirname(currentPath)
|
|
33
35
|
return currentPath
|
|
34
36
|
}
|
|
35
|
-
|
|
37
|
+
export { getTestRoot }
|
|
36
38
|
|
|
37
39
|
function fail(msg) {
|
|
38
40
|
output.error(msg)
|
|
39
41
|
process.exit(1)
|
|
40
42
|
}
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
export { fail }
|
|
43
45
|
|
|
44
46
|
function updateConfig(testsPath, config, extension) {
|
|
45
47
|
const configFile = path.join(testsPath, `codecept.conf.${extension}`)
|
|
@@ -57,7 +59,7 @@ function updateConfig(testsPath, config, extension) {
|
|
|
57
59
|
return fs.writeFileSync(configFile, beautify(`exports.config = ${util.inspect(config, false, 4, false)}`), 'utf-8')
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
|
|
62
|
+
export { updateConfig }
|
|
61
63
|
|
|
62
64
|
function safeFileWrite(file, contents) {
|
|
63
65
|
if (fileExists(file)) {
|
|
@@ -68,9 +70,9 @@ function safeFileWrite(file, contents) {
|
|
|
68
70
|
return true
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
export { safeFileWrite }
|
|
72
74
|
|
|
73
|
-
|
|
75
|
+
export const captureStream = stream => {
|
|
74
76
|
let oldStream
|
|
75
77
|
let buffer = ''
|
|
76
78
|
|
|
@@ -87,14 +89,14 @@ module.exports.captureStream = stream => {
|
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
91
|
|
|
90
|
-
|
|
92
|
+
export const printError = err => {
|
|
91
93
|
output.print('')
|
|
92
94
|
output.error(err.message)
|
|
93
95
|
output.print('')
|
|
94
96
|
output.print(output.colors.grey(err.stack.replace(err.message, '')))
|
|
95
97
|
}
|
|
96
98
|
|
|
97
|
-
|
|
99
|
+
export const createOutputDir = (config, testRoot) => {
|
|
98
100
|
let outputDir
|
|
99
101
|
if (path.isAbsolute(config.output)) outputDir = config.output
|
|
100
102
|
else outputDir = path.join(testRoot, config.output)
|
|
@@ -105,7 +107,7 @@ module.exports.createOutputDir = (config, testRoot) => {
|
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
|
|
108
|
-
|
|
110
|
+
export const findConfigFile = testsPath => {
|
|
109
111
|
const extensions = ['js', 'ts']
|
|
110
112
|
for (const ext of extensions) {
|
|
111
113
|
const configFile = path.join(testsPath, `codecept.conf.${ext}`)
|