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/plugin/auth.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const { isAsyncFunction } = require('../utils')
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import path from 'path'
|
|
3
|
+
import { fileExists, isAsyncFunction } from '../utils.js'
|
|
4
|
+
import CommentStep from '../step/comment.js'
|
|
5
|
+
import Section from '../step/section.js'
|
|
6
|
+
import container from '../container.js'
|
|
7
|
+
import store from '../store.js'
|
|
8
|
+
import event from '../event.js'
|
|
9
|
+
import recorder from '../recorder.js'
|
|
10
|
+
import output from '../output.js'
|
|
12
11
|
|
|
13
12
|
const defaultUser = {
|
|
14
13
|
fetch: I => I.grabCookie(),
|
|
@@ -253,7 +252,7 @@ const defaultConfig = {
|
|
|
253
252
|
*
|
|
254
253
|
*
|
|
255
254
|
*/
|
|
256
|
-
|
|
255
|
+
export default function (config) {
|
|
257
256
|
config = Object.assign(defaultConfig, config)
|
|
258
257
|
Object.keys(config.users).map(
|
|
259
258
|
u =>
|
|
@@ -292,12 +291,12 @@ module.exports = function (config) {
|
|
|
292
291
|
|
|
293
292
|
if (isPlaywrightSession() && test?.opts?.cookies) {
|
|
294
293
|
if (test.opts.user == name) {
|
|
295
|
-
debug(`Cookies already loaded for ${name}`)
|
|
294
|
+
output.debug(`Cookies already loaded for ${name}`)
|
|
296
295
|
|
|
297
296
|
alreadyLoggedIn(name)
|
|
298
297
|
return
|
|
299
298
|
} else {
|
|
300
|
-
debug(`Cookies already loaded for ${test.opts.user}, but not for ${name}`)
|
|
299
|
+
output.debug(`Cookies already loaded for ${test.opts.user}, but not for ${name}`)
|
|
301
300
|
await I.deleteCookie()
|
|
302
301
|
}
|
|
303
302
|
}
|
|
@@ -317,11 +316,11 @@ module.exports = function (config) {
|
|
|
317
316
|
section.end()
|
|
318
317
|
const cookies = await userSession.fetch(I)
|
|
319
318
|
if (!cookies) {
|
|
320
|
-
debug("Cannot save user session with empty cookies from auto login's fetch method")
|
|
319
|
+
output.debug("Cannot save user session with empty cookies from auto login's fetch method")
|
|
321
320
|
return
|
|
322
321
|
}
|
|
323
322
|
if (config.saveToFile) {
|
|
324
|
-
debug(`Saved user session into file for ${name}`)
|
|
323
|
+
output.debug(`Saved user session into file for ${name}`)
|
|
325
324
|
fs.writeFileSync(path.join(global.output_dir, `${name}_session.json`), JSON.stringify(cookies))
|
|
326
325
|
}
|
|
327
326
|
store[`${name}_session`] = cookies
|
|
@@ -339,13 +338,13 @@ module.exports = function (config) {
|
|
|
339
338
|
}
|
|
340
339
|
section.end()
|
|
341
340
|
recorder.session.catch(err => {
|
|
342
|
-
debug(`Failed auto login for ${name} due to ${err}`)
|
|
343
|
-
debug('Logging in again')
|
|
341
|
+
output.debug(`Failed auto login for ${name} due to ${err}`)
|
|
342
|
+
output.debug('Logging in again')
|
|
344
343
|
recorder.session.start('auto login')
|
|
345
344
|
return loginAndSave()
|
|
346
345
|
.then(() => {
|
|
347
346
|
recorder.add(() => recorder.session.restore('auto login'))
|
|
348
|
-
recorder.catch(() => debug('continue'))
|
|
347
|
+
recorder.catch(() => output.debug('continue'))
|
|
349
348
|
})
|
|
350
349
|
.catch(err => {
|
|
351
350
|
recorder.session.restore('auto login')
|
|
@@ -365,7 +364,7 @@ module.exports = function (config) {
|
|
|
365
364
|
const suite = store.currentSuite
|
|
366
365
|
if (!suite) return
|
|
367
366
|
|
|
368
|
-
debug(`enabling auth as ${name} for each test of suite ${suite.title}`)
|
|
367
|
+
output.debug(`enabling auth as ${name} for each test of suite ${suite.title}`)
|
|
369
368
|
|
|
370
369
|
// we are setting test opts so they can be picked up by Playwright if it starts browser for this test
|
|
371
370
|
suite.eachTest(test => {
|
|
@@ -420,7 +419,7 @@ function loadCookiesFromFile(config) {
|
|
|
420
419
|
} catch (err) {
|
|
421
420
|
throw new Error(`Could not load session from ${fileName}\n${err}`)
|
|
422
421
|
}
|
|
423
|
-
debug(`Loaded user session for ${name}`)
|
|
422
|
+
output.debug(`Loaded user session for ${name}`)
|
|
424
423
|
}
|
|
425
424
|
}
|
|
426
425
|
|
package/lib/plugin/autoDelay.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import Container from '../container.js'
|
|
2
|
+
|
|
3
|
+
import store from '../store.js'
|
|
4
|
+
|
|
5
|
+
import recorder from '../recorder.js'
|
|
6
|
+
|
|
7
|
+
import event from '../event.js'
|
|
8
|
+
|
|
9
|
+
import output from '../output.js'
|
|
6
10
|
const standardActingHelpers = Container.STANDARD_ACTING_HELPERS
|
|
7
11
|
|
|
8
12
|
const methodsToDelay = ['click', 'fillField', 'checkOption', 'pressKey', 'doubleClick', 'rightClick']
|
|
@@ -51,7 +55,7 @@ const defaultConfig = {
|
|
|
51
55
|
* * `delayAfter`: put a delay after a command. 200ms by default
|
|
52
56
|
*
|
|
53
57
|
*/
|
|
54
|
-
|
|
58
|
+
export default function (config) {
|
|
55
59
|
const affectedHelpers = [...standardActingHelpers, 'REST']
|
|
56
60
|
const helpers = Container.helpers()
|
|
57
61
|
let helper
|
|
@@ -71,7 +75,7 @@ module.exports = function (config) {
|
|
|
71
75
|
|
|
72
76
|
recorder.add('auto-delay', async () => {
|
|
73
77
|
if (store.debugMode) return // no need to delay in debug
|
|
74
|
-
log(`Delaying for ${config.delayBefore}ms`)
|
|
78
|
+
output.log(`Delaying for ${config.delayBefore}ms`)
|
|
75
79
|
return new Promise(resolve => {
|
|
76
80
|
setTimeout(resolve, config.delayBefore)
|
|
77
81
|
})
|
|
@@ -83,7 +87,7 @@ module.exports = function (config) {
|
|
|
83
87
|
|
|
84
88
|
recorder.add('auto-delay', async () => {
|
|
85
89
|
if (store.debugMode) return // no need to delay in debug
|
|
86
|
-
log(`Delaying for ${config.delayAfter}ms`)
|
|
90
|
+
output.log(`Delaying for ${config.delayAfter}ms`)
|
|
87
91
|
return new Promise(resolve => {
|
|
88
92
|
setTimeout(resolve, config.delayAfter)
|
|
89
93
|
})
|
package/lib/plugin/coverage.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import debugModule from 'debug'
|
|
2
|
+
import { CoverageReport } from 'monocart-coverage-reports'
|
|
3
|
+
import Container from '../container.js'
|
|
4
|
+
|
|
5
|
+
import recorder from '../recorder.js'
|
|
6
|
+
|
|
7
|
+
import event from '../event.js'
|
|
8
|
+
|
|
9
|
+
import output from '../output.js'
|
|
10
|
+
|
|
11
|
+
import { deepMerge } from '../utils.js'
|
|
8
12
|
|
|
9
13
|
const defaultConfig = {
|
|
10
14
|
name: 'CodeceptJS Coverage Report',
|
|
@@ -113,7 +117,7 @@ const v8CoverageHelpers = {
|
|
|
113
117
|
* * `sourcePath`: option to resolve a custom path.
|
|
114
118
|
*
|
|
115
119
|
*/
|
|
116
|
-
|
|
120
|
+
export default function (config) {
|
|
117
121
|
config = deepMerge(defaultConfig, config)
|
|
118
122
|
|
|
119
123
|
if (config.debug) config.logging = 'debug'
|
|
@@ -145,9 +149,22 @@ module.exports = function (config) {
|
|
|
145
149
|
const coverageReport = new CoverageReport(coverageOptions)
|
|
146
150
|
coverageReport.cleanCache()
|
|
147
151
|
|
|
148
|
-
event.dispatcher.on(event.all.after,
|
|
149
|
-
|
|
150
|
-
|
|
152
|
+
event.dispatcher.on(event.all.after, () => {
|
|
153
|
+
// Add coverage generation to recorder to ensure it completes before process exit
|
|
154
|
+
recorder.add(
|
|
155
|
+
'generate coverage report',
|
|
156
|
+
async () => {
|
|
157
|
+
try {
|
|
158
|
+
output.print(`writing ${coverageOptions.outputDir}`)
|
|
159
|
+
await coverageReport.generate()
|
|
160
|
+
} catch (error) {
|
|
161
|
+
output.print(`Failed to generate coverage report: ${error.message}`)
|
|
162
|
+
// Don't throw - coverage failure shouldn't fail tests
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
true,
|
|
166
|
+
false,
|
|
167
|
+
)
|
|
151
168
|
})
|
|
152
169
|
|
|
153
170
|
// we're going to try to "start" coverage before each step because this is
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import Locator from '../locator.js'
|
|
2
|
+
import { xpathLocator } from '../utils.js'
|
|
3
3
|
|
|
4
4
|
const defaultConfig = {
|
|
5
5
|
prefix: '$',
|
|
@@ -111,7 +111,7 @@ const defaultConfig = {
|
|
|
111
111
|
* I.click('=sign-up'); // matches => [data-qa=sign-up],[data-test=sign-up]
|
|
112
112
|
* ```
|
|
113
113
|
*/
|
|
114
|
-
|
|
114
|
+
export default function (config) {
|
|
115
115
|
config = { ...defaultConfig, ...config }
|
|
116
116
|
|
|
117
117
|
Locator.addFilter((value, locatorObj) => {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import event from '../event.js'
|
|
2
|
+
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Sample custom reporter for CodeceptJS.
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
+
export default function (config) {
|
|
7
8
|
event.dispatcher.on(event.hook.finished, hook => {
|
|
8
9
|
if (config.onHookFinished) {
|
|
9
10
|
config.onHookFinished(hook)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import event from '../event.js'
|
|
2
|
+
import recorder from '../recorder.js'
|
|
3
|
+
import store from '../store.js'
|
|
4
|
+
import output from '../output.js'
|
|
5
|
+
import { RETRY_PRIORITIES } from '../retryCoordinator.js'
|
|
6
6
|
|
|
7
7
|
const defaultConfig = {
|
|
8
8
|
retries: 3,
|
|
@@ -17,7 +17,7 @@ const defaultConfig = {
|
|
|
17
17
|
* This plugin provides step-level retries and coordinates with global retry settings
|
|
18
18
|
* to avoid conflicts and provide predictable behavior.
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
export default config => {
|
|
21
21
|
config = Object.assign({}, defaultConfig, config)
|
|
22
22
|
config.ignoredSteps = config.ignoredSteps.concat(config.defaultIgnoredSteps)
|
|
23
23
|
const customWhen = config.when
|
package/lib/plugin/heal.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import debugFactory from 'debug'
|
|
2
|
+
const debug = debugFactory('codeceptjs:heal')
|
|
3
|
+
import colors from 'chalk'
|
|
4
|
+
import recorder from '../recorder.js'
|
|
5
|
+
|
|
6
|
+
import event from '../event.js'
|
|
7
|
+
|
|
8
|
+
import output from '../output.js'
|
|
9
|
+
|
|
10
|
+
import healModule from '../heal.js'
|
|
11
|
+
const heal = healModule.default || healModule
|
|
12
|
+
import store from '../store.js'
|
|
13
|
+
|
|
9
14
|
|
|
10
15
|
const defaultConfig = {
|
|
11
16
|
healLimit: 2,
|
|
@@ -29,7 +34,7 @@ const defaultConfig = {
|
|
|
29
34
|
* * `healLimit` - how many steps can be healed in a single test (default: 2)
|
|
30
35
|
*
|
|
31
36
|
*/
|
|
32
|
-
|
|
37
|
+
export default function (config = {}) {
|
|
33
38
|
if (store.debugMode && !process.env.DEBUG) {
|
|
34
39
|
event.dispatcher.on(event.test.failed, () => {
|
|
35
40
|
output.plugin('heal', 'Healing is disabled in --debug mode, use DEBUG="codeceptjs:heal" to enable it in debug mode')
|