codeceptjs 4.0.0-beta.1 → 4.0.0-beta.3
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/bin/codecept.js +84 -81
- package/lib/actor.js +13 -13
- package/lib/ai.js +10 -13
- package/lib/assert/empty.js +20 -21
- package/lib/assert/equal.js +37 -39
- package/lib/assert/error.js +14 -14
- package/lib/assert/include.js +46 -47
- package/lib/assert/throws.js +13 -11
- package/lib/assert/truth.js +19 -22
- package/lib/assert.js +4 -2
- package/lib/cli.js +57 -49
- package/lib/codecept.js +142 -155
- package/lib/colorUtils.js +3 -3
- package/lib/command/configMigrate.js +58 -52
- package/lib/command/definitions.js +88 -89
- package/lib/command/dryRun.js +71 -68
- package/lib/command/generate.js +197 -188
- package/lib/command/gherkin/init.js +27 -16
- package/lib/command/gherkin/snippets.js +20 -20
- package/lib/command/gherkin/steps.js +8 -8
- package/lib/command/info.js +40 -38
- package/lib/command/init.js +290 -288
- package/lib/command/interactive.js +32 -32
- package/lib/command/list.js +26 -26
- package/lib/command/run-multiple/chunk.js +5 -5
- package/lib/command/run-multiple/collection.js +3 -3
- package/lib/command/run-multiple/run.js +6 -2
- package/lib/command/run-multiple.js +113 -93
- package/lib/command/run-rerun.js +20 -25
- package/lib/command/run-workers.js +64 -66
- package/lib/command/run.js +26 -29
- package/lib/command/utils.js +80 -65
- package/lib/command/workers/runTests.js +10 -10
- package/lib/config.js +10 -9
- package/lib/container.js +40 -48
- package/lib/data/context.js +60 -59
- package/lib/data/dataScenarioConfig.js +47 -47
- package/lib/data/dataTableArgument.js +29 -29
- package/lib/data/table.js +26 -20
- package/lib/event.js +163 -167
- package/lib/heal.js +13 -17
- package/lib/helper/AI.js +130 -41
- package/lib/helper/ApiDataFactory.js +73 -69
- package/lib/helper/Appium.js +413 -382
- package/lib/helper/ExpectHelper.js +40 -48
- package/lib/helper/FileSystem.js +80 -79
- package/lib/helper/GraphQL.js +44 -43
- package/lib/helper/GraphQLDataFactory.js +50 -50
- package/lib/helper/JSONResponse.js +65 -62
- package/lib/helper/Mochawesome.js +28 -28
- package/lib/helper/MockServer.js +12 -14
- package/lib/helper/Nightmare.js +662 -566
- package/lib/helper/Playwright.js +1361 -1216
- package/lib/helper/Protractor.js +663 -627
- package/lib/helper/Puppeteer.js +1231 -1128
- package/lib/helper/REST.js +159 -68
- package/lib/helper/SoftExpectHelper.js +2 -2
- package/lib/helper/TestCafe.js +490 -484
- package/lib/helper/WebDriver.js +1297 -1156
- package/lib/helper/clientscripts/PollyWebDriverExt.js +1 -1
- package/lib/helper/errors/ConnectionRefused.js +1 -1
- package/lib/helper/errors/ElementAssertion.js +2 -2
- package/lib/helper/errors/ElementNotFound.js +2 -2
- package/lib/helper/errors/RemoteBrowserConnectionRefused.js +1 -1
- package/lib/helper/extras/Console.js +1 -1
- package/lib/helper/extras/PlaywrightPropEngine.js +2 -2
- package/lib/helper/extras/PlaywrightReactVueLocator.js +1 -1
- package/lib/helper/extras/PlaywrightRestartOpts.js +21 -18
- package/lib/helper/extras/Popup.js +1 -1
- package/lib/helper/extras/React.js +3 -3
- package/lib/helper/network/actions.js +14 -7
- package/lib/helper/network/utils.js +3 -2
- package/lib/helper/scripts/blurElement.js +1 -1
- package/lib/helper/scripts/focusElement.js +1 -1
- package/lib/helper/scripts/highlightElement.js +1 -1
- package/lib/helper/scripts/isElementClickable.js +1 -1
- package/lib/helper/testcafe/testControllerHolder.js +1 -1
- package/lib/helper/testcafe/testcafe-utils.js +6 -7
- package/lib/helper.js +1 -3
- package/lib/history.js +6 -5
- package/lib/hooks.js +6 -6
- package/lib/html.js +7 -7
- package/lib/index.js +25 -41
- package/lib/interfaces/bdd.js +47 -64
- package/lib/interfaces/featureConfig.js +19 -19
- package/lib/interfaces/gherkin.js +124 -118
- package/lib/interfaces/scenarioConfig.js +29 -29
- package/lib/listener/artifacts.js +9 -9
- package/lib/listener/config.js +24 -24
- package/lib/listener/exit.js +12 -12
- package/lib/listener/helpers.js +42 -42
- package/lib/listener/mocha.js +11 -11
- package/lib/listener/retry.js +32 -30
- package/lib/listener/steps.js +50 -53
- package/lib/listener/timeout.js +54 -54
- package/lib/locator.js +6 -10
- package/lib/mochaFactory.js +18 -15
- package/lib/output.js +6 -10
- package/lib/parser.js +15 -12
- package/lib/pause.js +40 -33
- package/lib/plugin/allure.js +15 -15
- package/lib/plugin/autoDelay.js +29 -37
- package/lib/plugin/autoLogin.js +70 -65
- package/lib/plugin/commentStep.js +18 -18
- package/lib/plugin/coverage.js +115 -67
- package/lib/plugin/customLocator.js +21 -20
- package/lib/plugin/debugErrors.js +24 -24
- package/lib/plugin/eachElement.js +38 -38
- package/lib/plugin/fakerTransform.js +6 -6
- package/lib/plugin/heal.js +67 -108
- package/lib/plugin/pauseOnFail.js +11 -11
- package/lib/plugin/retryFailedStep.js +32 -39
- package/lib/plugin/retryTo.js +46 -40
- package/lib/plugin/screenshotOnFail.js +109 -87
- package/lib/plugin/selenoid.js +131 -118
- package/lib/plugin/standardActingHelpers.js +2 -8
- package/lib/plugin/stepByStepReport.js +110 -91
- package/lib/plugin/stepTimeout.js +24 -23
- package/lib/plugin/subtitles.js +34 -35
- package/lib/plugin/tryTo.js +40 -30
- package/lib/plugin/wdio.js +78 -75
- package/lib/recorder.js +14 -17
- package/lib/rerun.js +11 -10
- package/lib/scenario.js +25 -23
- package/lib/secret.js +4 -2
- package/lib/session.js +10 -10
- package/lib/step.js +12 -9
- package/lib/store.js +2 -3
- package/lib/transform.js +1 -1
- package/lib/translation.js +7 -8
- package/lib/ui.js +12 -14
- package/lib/utils.js +70 -72
- package/lib/within.js +10 -10
- package/lib/workerStorage.js +27 -25
- package/lib/workers.js +29 -32
- package/package.json +56 -57
- package/translations/de-DE.js +1 -1
- package/translations/fr-FR.js +1 -1
- package/translations/index.js +9 -13
- package/translations/it-IT.js +1 -1
- package/translations/ja-JP.js +1 -1
- package/translations/pl-PL.js +1 -1
- package/translations/pt-BR.js +1 -1
- package/translations/ru-RU.js +1 -1
- package/translations/zh-CN.js +1 -1
- package/translations/zh-TW.js +1 -1
- package/typings/index.d.ts +415 -65
- package/typings/promiseBasedTypes.d.ts +32 -0
- package/typings/types.d.ts +32 -0
- package/lib/dirname.js +0 -5
- package/lib/helper/Expect.js +0 -425
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
let addMochawesomeContext
|
|
2
|
+
let currentTest
|
|
3
|
+
let currentSuite
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
let currentSuite;
|
|
5
|
+
const Helper = require('@codeceptjs/helper')
|
|
6
|
+
const { clearString } = require('../utils')
|
|
7
7
|
|
|
8
8
|
class Mochawesome extends Helper {
|
|
9
9
|
constructor(config) {
|
|
10
|
-
super(config)
|
|
10
|
+
super(config)
|
|
11
11
|
|
|
12
12
|
// set defaults
|
|
13
13
|
this.options = {
|
|
14
14
|
uniqueScreenshotNames: false,
|
|
15
15
|
disableScreenshots: false,
|
|
16
|
-
}
|
|
16
|
+
}
|
|
17
17
|
|
|
18
|
-
addMochawesomeContext = require('mochawesome/addContext')
|
|
19
|
-
this._createConfig(config)
|
|
18
|
+
addMochawesomeContext = require('mochawesome/addContext')
|
|
19
|
+
this._createConfig(config)
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
_createConfig(config) {
|
|
23
23
|
// override defaults with config
|
|
24
|
-
Object.assign(this.options, config)
|
|
24
|
+
Object.assign(this.options, config)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
_beforeSuite(suite) {
|
|
28
|
-
currentSuite = suite
|
|
29
|
-
currentTest = ''
|
|
28
|
+
currentSuite = suite
|
|
29
|
+
currentTest = ''
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
_before() {
|
|
33
33
|
if (currentSuite && currentSuite.ctx) {
|
|
34
|
-
currentTest = { test: currentSuite.ctx.currentTest }
|
|
34
|
+
currentTest = { test: currentSuite.ctx.currentTest }
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
_test(test) {
|
|
39
|
-
currentTest = { test }
|
|
39
|
+
currentTest = { test }
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
_failed(test) {
|
|
43
|
-
if (this.options.disableScreenshots) return
|
|
44
|
-
let fileName
|
|
43
|
+
if (this.options.disableScreenshots) return
|
|
44
|
+
let fileName
|
|
45
45
|
// Get proper name if we are fail on hook
|
|
46
46
|
if (test.ctx.test.type === 'hook') {
|
|
47
|
-
currentTest = { test: test.ctx.test }
|
|
47
|
+
currentTest = { test: test.ctx.test }
|
|
48
48
|
// ignore retries if we are in hook
|
|
49
|
-
test._retries = -1
|
|
50
|
-
fileName = clearString(`${test.title}_${currentTest.test.title}`)
|
|
49
|
+
test._retries = -1
|
|
50
|
+
fileName = clearString(`${test.title}_${currentTest.test.title}`)
|
|
51
51
|
} else {
|
|
52
|
-
currentTest = { test }
|
|
53
|
-
fileName = clearString(test.title)
|
|
52
|
+
currentTest = { test }
|
|
53
|
+
fileName = clearString(test.title)
|
|
54
54
|
}
|
|
55
55
|
if (this.options.uniqueScreenshotNames) {
|
|
56
|
-
const uuid = test.uuid || test.ctx.test.uuid
|
|
57
|
-
fileName = `${fileName.substring(0, 10)}_${uuid}
|
|
56
|
+
const uuid = test.uuid || test.ctx.test.uuid
|
|
57
|
+
fileName = `${fileName.substring(0, 10)}_${uuid}`
|
|
58
58
|
}
|
|
59
59
|
if (test._retries < 1 || test._retries === test.retryNum) {
|
|
60
|
-
fileName = `${fileName}.failed.png
|
|
61
|
-
return addMochawesomeContext(currentTest, fileName)
|
|
60
|
+
fileName = `${fileName}.failed.png`
|
|
61
|
+
return addMochawesomeContext(currentTest, fileName)
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
addMochawesomeContext(context) {
|
|
66
|
-
if (currentTest === '') currentTest = { test: currentSuite.ctx.test }
|
|
67
|
-
return addMochawesomeContext(currentTest, context)
|
|
66
|
+
if (currentTest === '') currentTest = { test: currentSuite.ctx.test }
|
|
67
|
+
return addMochawesomeContext(currentTest, context)
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
module.exports = Mochawesome
|
package/lib/helper/MockServer.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const { mock, settings } = pkg;
|
|
1
|
+
const { mock, settings } = require('pactum')
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
4
|
* ## Configuration
|
|
@@ -20,7 +18,7 @@ let config = {
|
|
|
20
18
|
key: '',
|
|
21
19
|
cert: '',
|
|
22
20
|
},
|
|
23
|
-
}
|
|
21
|
+
}
|
|
24
22
|
|
|
25
23
|
/**
|
|
26
24
|
* MockServer
|
|
@@ -143,10 +141,10 @@ let config = {
|
|
|
143
141
|
*/
|
|
144
142
|
class MockServer {
|
|
145
143
|
constructor(passedConfig) {
|
|
146
|
-
settings.setLogLevel('SILENT')
|
|
147
|
-
config = { ...passedConfig }
|
|
144
|
+
settings.setLogLevel('SILENT')
|
|
145
|
+
config = { ...passedConfig }
|
|
148
146
|
if (global.debugMode) {
|
|
149
|
-
settings.setLogLevel('VERBOSE')
|
|
147
|
+
settings.setLogLevel('VERBOSE')
|
|
150
148
|
}
|
|
151
149
|
}
|
|
152
150
|
|
|
@@ -157,10 +155,10 @@ class MockServer {
|
|
|
157
155
|
* @returns void
|
|
158
156
|
*/
|
|
159
157
|
async startMockServer(port) {
|
|
160
|
-
const _config = { ...config }
|
|
161
|
-
if (port) _config.port = port
|
|
162
|
-
await mock.setDefaults(_config)
|
|
163
|
-
await mock.start()
|
|
158
|
+
const _config = { ...config }
|
|
159
|
+
if (port) _config.port = port
|
|
160
|
+
await mock.setDefaults(_config)
|
|
161
|
+
await mock.start()
|
|
164
162
|
}
|
|
165
163
|
|
|
166
164
|
/**
|
|
@@ -170,7 +168,7 @@ class MockServer {
|
|
|
170
168
|
*
|
|
171
169
|
*/
|
|
172
170
|
async stopMockServer() {
|
|
173
|
-
await mock.stop()
|
|
171
|
+
await mock.stop()
|
|
174
172
|
}
|
|
175
173
|
|
|
176
174
|
/**
|
|
@@ -216,8 +214,8 @@ class MockServer {
|
|
|
216
214
|
*
|
|
217
215
|
*/
|
|
218
216
|
async addInteractionToMockServer(interaction) {
|
|
219
|
-
await mock.addInteraction(interaction)
|
|
217
|
+
await mock.addInteraction(interaction)
|
|
220
218
|
}
|
|
221
219
|
}
|
|
222
220
|
|
|
223
|
-
|
|
221
|
+
module.exports = MockServer
|