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,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import Helper from '@codeceptjs/helper'
|
|
2
|
+
import assert from 'assert'
|
|
3
|
+
import joi from 'joi'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* This helper allows performing assertions on JSON responses paired with following helpers:
|
|
@@ -69,12 +69,17 @@ class JSONResponse extends Helper {
|
|
|
69
69
|
|
|
70
70
|
_beforeSuite() {
|
|
71
71
|
this.response = null
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
this.
|
|
72
|
+
try {
|
|
73
|
+
if (!this.helpers[this.options.requestHelper]) {
|
|
74
|
+
throw new Error(`Error setting JSONResponse, helper ${this.options.requestHelper} is not enabled in config, helpers: ${Object.keys(this.helpers)}`)
|
|
75
|
+
}
|
|
76
|
+
// connect to REST helper
|
|
77
|
+
this.helpers[this.options.requestHelper].config.onResponse = response => {
|
|
78
|
+
this.response = response
|
|
79
|
+
}
|
|
80
|
+
} catch (e) {
|
|
81
|
+
// Temporary workaround for ESM transition - helpers access issue
|
|
82
|
+
console.log('[JSONResponse] Warning: Could not connect to REST helper during ESM transition:', e.message)
|
|
78
83
|
}
|
|
79
84
|
}
|
|
80
85
|
|
|
@@ -84,7 +89,9 @@ class JSONResponse extends Helper {
|
|
|
84
89
|
|
|
85
90
|
static _checkRequirements() {
|
|
86
91
|
try {
|
|
87
|
-
|
|
92
|
+
// In ESM, joi is already imported at the top
|
|
93
|
+
// The import will fail at module load time if joi is missing
|
|
94
|
+
return null
|
|
88
95
|
} catch (e) {
|
|
89
96
|
return ['joi']
|
|
90
97
|
}
|
|
@@ -349,25 +356,7 @@ class JSONResponse extends Helper {
|
|
|
349
356
|
for (const key in expected) {
|
|
350
357
|
assert(key in actual, `Key "${key}" not found in ${JSON.stringify(actual)}`)
|
|
351
358
|
if (typeof expected[key] === 'object' && expected[key] !== null) {
|
|
352
|
-
|
|
353
|
-
// Handle array comparison: each expected element should have a match in actual array
|
|
354
|
-
assert(Array.isArray(actual[key]), `Expected array for key "${key}", but got ${typeof actual[key]}`)
|
|
355
|
-
for (const expectedItem of expected[key]) {
|
|
356
|
-
let found = false
|
|
357
|
-
for (const actualItem of actual[key]) {
|
|
358
|
-
try {
|
|
359
|
-
this._assertContains(actualItem, expectedItem)
|
|
360
|
-
found = true
|
|
361
|
-
break
|
|
362
|
-
} catch (err) {
|
|
363
|
-
continue
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
assert(found, `No matching element found in array for ${JSON.stringify(expectedItem)}`)
|
|
367
|
-
}
|
|
368
|
-
} else {
|
|
369
|
-
this._assertContains(actual[key], expected[key])
|
|
370
|
-
}
|
|
359
|
+
this._assertContains(actual[key], expected[key])
|
|
371
360
|
} else {
|
|
372
361
|
assert.deepStrictEqual(actual[key], expected[key], `Values for key "${key}" don't match`)
|
|
373
362
|
}
|
|
@@ -375,4 +364,4 @@ class JSONResponse extends Helper {
|
|
|
375
364
|
}
|
|
376
365
|
}
|
|
377
366
|
|
|
378
|
-
|
|
367
|
+
export { JSONResponse as default }
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
let currentTest
|
|
2
2
|
let currentSuite
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import Helper from '@codeceptjs/helper'
|
|
5
|
+
import { createRequire } from 'module'
|
|
6
|
+
import { clearString } from '../utils.js'
|
|
7
|
+
import { testToFileName } from '../mocha/test.js'
|
|
7
8
|
|
|
8
9
|
class Mochawesome extends Helper {
|
|
9
10
|
constructor(config) {
|
|
@@ -15,6 +16,8 @@ class Mochawesome extends Helper {
|
|
|
15
16
|
disableScreenshots: false,
|
|
16
17
|
}
|
|
17
18
|
|
|
19
|
+
// ESM-compatible require for CommonJS module
|
|
20
|
+
const require = createRequire(import.meta.url)
|
|
18
21
|
this._addContext = require('mochawesome/addContext')
|
|
19
22
|
|
|
20
23
|
this._createConfig(config)
|
|
@@ -37,20 +40,7 @@ class Mochawesome extends Helper {
|
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
_test(test) {
|
|
40
|
-
|
|
41
|
-
// but also potentially preserve context from the original test
|
|
42
|
-
const originalTest = test.retriedTest && test.retriedTest()
|
|
43
|
-
if (originalTest) {
|
|
44
|
-
// This is a retried test - use the retried test for context
|
|
45
|
-
currentTest = { test }
|
|
46
|
-
|
|
47
|
-
// Optionally copy context from original test if it exists
|
|
48
|
-
// Note: mochawesome context is stored in test.ctx, but we need to be careful
|
|
49
|
-
// not to break the mocha context structure
|
|
50
|
-
} else {
|
|
51
|
-
// Normal test (not a retry)
|
|
52
|
-
currentTest = { test }
|
|
53
|
-
}
|
|
43
|
+
currentTest = { test }
|
|
54
44
|
}
|
|
55
45
|
|
|
56
46
|
_failed(test) {
|
|
@@ -77,17 +67,8 @@ class Mochawesome extends Helper {
|
|
|
77
67
|
|
|
78
68
|
addMochawesomeContext(context) {
|
|
79
69
|
if (currentTest === '') currentTest = { test: currentSuite.ctx.test }
|
|
80
|
-
|
|
81
|
-
// For retried tests, make sure we're adding context to the current (retried) test
|
|
82
|
-
// not the original test
|
|
83
|
-
let targetTest = currentTest
|
|
84
|
-
if (currentTest.test && currentTest.test.retriedTest && currentTest.test.retriedTest()) {
|
|
85
|
-
// This test has been retried, make sure we're using the current test for context
|
|
86
|
-
targetTest = { test: currentTest.test }
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return this._addContext(targetTest, context)
|
|
70
|
+
return this._addContext(currentTest, context)
|
|
90
71
|
}
|
|
91
72
|
}
|
|
92
73
|
|
|
93
|
-
|
|
74
|
+
export default Mochawesome
|