codeceptjs 4.0.0-beta.5 → 4.0.0-beta.7.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 +192 -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 +58 -55
- 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 +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
package/README.md
CHANGED
|
@@ -64,8 +64,6 @@ You don't need to worry about asynchronous nature of NodeJS or about various API
|
|
|
64
64
|
- Also plays nice with TypeScript.
|
|
65
65
|
- </> Smart locators: use names, labels, matching text, CSS or XPath to locate elements.
|
|
66
66
|
- 🌐 Interactive debugging shell: pause test at any point and try different commands in a browser.
|
|
67
|
-
- ⚡ **Parallel testing** with dynamic test pooling for optimal load balancing and performance.
|
|
68
|
-
- 📊 **Built-in HTML Reporter** with interactive dashboard, step-by-step execution details, and comprehensive test analytics.
|
|
69
67
|
- Easily create tests, pageobjects, stepobjects with CLI generators.
|
|
70
68
|
|
|
71
69
|
## Installation
|
|
@@ -235,49 +233,6 @@ Scenario('test title', () => {
|
|
|
235
233
|
})
|
|
236
234
|
```
|
|
237
235
|
|
|
238
|
-
## HTML Reporter
|
|
239
|
-
|
|
240
|
-
CodeceptJS includes a powerful built-in HTML Reporter that generates comprehensive, interactive test reports with detailed information about your test runs. The HTML reporter is **enabled by default** for all new projects and provides:
|
|
241
|
-
|
|
242
|
-
### Features
|
|
243
|
-
|
|
244
|
-
- **Interactive Dashboard**: Visual statistics, pie charts, and expandable test details
|
|
245
|
-
- **Step-by-Step Execution**: Shows individual test steps with timing and status indicators
|
|
246
|
-
- **BDD/Gherkin Support**: Full support for feature files with proper scenario formatting
|
|
247
|
-
- **System Information**: Comprehensive environment details including browser versions
|
|
248
|
-
- **Advanced Filtering**: Real-time filtering by status, tags, features, and test types
|
|
249
|
-
- **History Tracking**: Multi-run history with trend visualization
|
|
250
|
-
- **Error Details**: Clean formatting of error messages and stack traces
|
|
251
|
-
- **Artifacts Support**: Display screenshots and other test artifacts
|
|
252
|
-
|
|
253
|
-
### Visual Examples
|
|
254
|
-
|
|
255
|
-
#### Interactive Test Dashboard
|
|
256
|
-
|
|
257
|
-
The main dashboard provides a complete overview with interactive statistics and pie charts:
|
|
258
|
-
|
|
259
|
-

|
|
260
|
-
|
|
261
|
-
#### Detailed Test Results
|
|
262
|
-
|
|
263
|
-
Each test shows comprehensive execution details with expandable step information:
|
|
264
|
-
|
|
265
|
-

|
|
266
|
-
|
|
267
|
-
#### Advanced Filtering Capabilities
|
|
268
|
-
|
|
269
|
-
Real-time filtering allows quick navigation through test results:
|
|
270
|
-
|
|
271
|
-

|
|
272
|
-
|
|
273
|
-
#### BDD/Gherkin Support
|
|
274
|
-
|
|
275
|
-
Full support for Gherkin scenarios with proper feature formatting:
|
|
276
|
-
|
|
277
|
-

|
|
278
|
-
|
|
279
|
-
The HTML reporter generates self-contained reports that can be easily shared with your team. Learn more about configuration and features in the [HTML Reporter documentation](https://codecept.io/plugins/#htmlreporter).
|
|
280
|
-
|
|
281
236
|
## PageObjects
|
|
282
237
|
|
|
283
238
|
CodeceptJS provides the most simple way to create and use page objects in your test.
|
package/bin/codecept.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { Command } from 'commander'
|
|
3
|
+
const program = new Command()
|
|
4
|
+
import Codecept from '../lib/codecept.js'
|
|
5
|
+
import output from '../lib/output.js'
|
|
6
|
+
const { print, error } = output
|
|
7
|
+
import { printError } from '../lib/command/utils.js'
|
|
6
8
|
|
|
7
9
|
const commandFlags = {
|
|
8
10
|
ai: {
|
|
@@ -42,6 +44,23 @@ const errorHandler =
|
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
|
|
47
|
+
const dynamicImport = async modulePath => {
|
|
48
|
+
const module = await import(modulePath)
|
|
49
|
+
return module.default || module
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const commandHandler = modulePath =>
|
|
53
|
+
errorHandler(async (...args) => {
|
|
54
|
+
const handler = await dynamicImport(modulePath)
|
|
55
|
+
return handler(...args)
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const commandHandlerWithProperty = (modulePath, property) =>
|
|
59
|
+
errorHandler(async (...args) => {
|
|
60
|
+
const module = await dynamicImport(modulePath)
|
|
61
|
+
return module[property](...args)
|
|
62
|
+
})
|
|
63
|
+
|
|
45
64
|
if (process.versions.node && process.versions.node.split('.') && process.versions.node.split('.')[0] < 12) {
|
|
46
65
|
error('NodeJS >= 12 is required to run.')
|
|
47
66
|
print()
|
|
@@ -53,22 +72,16 @@ if (process.versions.node && process.versions.node.split('.') && process.version
|
|
|
53
72
|
program.usage('<command> [options]')
|
|
54
73
|
program.version(Codecept.version())
|
|
55
74
|
|
|
56
|
-
program
|
|
57
|
-
.command('init [path]')
|
|
58
|
-
.description('Creates dummy config in current dir or [path]')
|
|
59
|
-
.action(errorHandler(require('../lib/command/init')))
|
|
75
|
+
program.command('init [path]').description('Creates dummy config in current dir or [path]').action(commandHandler('../lib/command/init.js'))
|
|
60
76
|
|
|
61
77
|
program
|
|
62
78
|
.command('check')
|
|
63
79
|
.option(commandFlags.config.flag, commandFlags.config.description)
|
|
64
80
|
.description('Checks configuration and environment before running tests')
|
|
65
81
|
.option('-t, --timeout [ms]', 'timeout for checks in ms, 50000 by default')
|
|
66
|
-
.action(
|
|
82
|
+
.action(commandHandler('../lib/command/check.js'))
|
|
67
83
|
|
|
68
|
-
program
|
|
69
|
-
.command('migrate [path]')
|
|
70
|
-
.description('Migrate json config to js config in current dir or [path]')
|
|
71
|
-
.action(errorHandler(require('../lib/command/configMigrate')))
|
|
84
|
+
program.command('migrate [path]').description('Migrate json config to js config in current dir or [path]').action(commandHandler('../lib/command/configMigrate.js'))
|
|
72
85
|
|
|
73
86
|
program
|
|
74
87
|
.command('shell [path]')
|
|
@@ -78,34 +91,30 @@ program
|
|
|
78
91
|
.option(commandFlags.profile.flag, commandFlags.profile.description)
|
|
79
92
|
.option(commandFlags.ai.flag, commandFlags.ai.description)
|
|
80
93
|
.option(commandFlags.config.flag, commandFlags.config.description)
|
|
81
|
-
.action(
|
|
94
|
+
.action(commandHandler('../lib/command/interactive.js'))
|
|
82
95
|
|
|
83
|
-
program
|
|
84
|
-
.command('list [path]')
|
|
85
|
-
.alias('l')
|
|
86
|
-
.description('List all actions for I.')
|
|
87
|
-
.action(errorHandler(require('../lib/command/list')))
|
|
96
|
+
program.command('list [path]').alias('l').description('List all actions for I.').action(commandHandler('../lib/command/list.js'))
|
|
88
97
|
|
|
89
98
|
program
|
|
90
99
|
.command('def [path]')
|
|
91
100
|
.description('Generates TypeScript definitions for all I actions.')
|
|
92
101
|
.option(commandFlags.config.flag, commandFlags.config.description)
|
|
93
102
|
.option('-o, --output [folder]', 'target folder to paste definitions')
|
|
94
|
-
.action(
|
|
103
|
+
.action(commandHandler('../lib/command/definitions.js'))
|
|
95
104
|
|
|
96
105
|
program
|
|
97
106
|
.command('gherkin:init [path]')
|
|
98
107
|
.alias('bdd:init')
|
|
99
108
|
.description('Prepare CodeceptJS to run feature files.')
|
|
100
109
|
.option(commandFlags.config.flag, commandFlags.config.description)
|
|
101
|
-
.action(
|
|
110
|
+
.action(commandHandler('../lib/command/gherkin/init.js'))
|
|
102
111
|
|
|
103
112
|
program
|
|
104
113
|
.command('gherkin:steps [path]')
|
|
105
114
|
.alias('bdd:steps')
|
|
106
115
|
.description('Prints all defined gherkin steps.')
|
|
107
116
|
.option(commandFlags.config.flag, commandFlags.config.description)
|
|
108
|
-
.action(
|
|
117
|
+
.action(commandHandler('../lib/command/gherkin/steps.js'))
|
|
109
118
|
|
|
110
119
|
program
|
|
111
120
|
.command('gherkin:snippets [path]')
|
|
@@ -115,38 +124,22 @@ program
|
|
|
115
124
|
.option(commandFlags.config.flag, commandFlags.config.description)
|
|
116
125
|
.option('--feature [file]', 'feature files(s) to scan')
|
|
117
126
|
.option('--path [file]', 'file in which to place the new snippets')
|
|
118
|
-
.action(
|
|
127
|
+
.action(commandHandler('../lib/command/gherkin/snippets.js'))
|
|
119
128
|
|
|
120
|
-
program
|
|
121
|
-
.command('generate:test [path]')
|
|
122
|
-
.alias('gt')
|
|
123
|
-
.description('Generates an empty test')
|
|
124
|
-
.action(errorHandler(require('../lib/command/generate').test))
|
|
129
|
+
program.command('generate:test [path]').alias('gt').description('Generates an empty test').action(commandHandlerWithProperty('../lib/command/generate.js', 'test'))
|
|
125
130
|
|
|
126
|
-
program
|
|
127
|
-
.command('generate:pageobject [path]')
|
|
128
|
-
.alias('gpo')
|
|
129
|
-
.description('Generates an empty page object')
|
|
130
|
-
.action(errorHandler(require('../lib/command/generate').pageObject))
|
|
131
|
+
program.command('generate:pageobject [path]').alias('gpo').description('Generates an empty page object').action(commandHandlerWithProperty('../lib/command/generate.js', 'pageObject'))
|
|
131
132
|
|
|
132
133
|
program
|
|
133
134
|
.command('generate:object [path]')
|
|
134
135
|
.alias('go')
|
|
135
136
|
.option('--type, -t [kind]', 'type of object to be created')
|
|
136
137
|
.description('Generates an empty support object (page/step/fragment)')
|
|
137
|
-
.action(
|
|
138
|
+
.action(commandHandlerWithProperty('../lib/command/generate.js', 'pageObject'))
|
|
138
139
|
|
|
139
|
-
program
|
|
140
|
-
.command('generate:helper [path]')
|
|
141
|
-
.alias('gh')
|
|
142
|
-
.description('Generates a new helper')
|
|
143
|
-
.action(errorHandler(require('../lib/command/generate').helper))
|
|
140
|
+
program.command('generate:helper [path]').alias('gh').description('Generates a new helper').action(commandHandlerWithProperty('../lib/command/generate.js', 'helper'))
|
|
144
141
|
|
|
145
|
-
program
|
|
146
|
-
.command('generate:heal [path]')
|
|
147
|
-
.alias('gr')
|
|
148
|
-
.description('Generates basic heal recipes')
|
|
149
|
-
.action(errorHandler(require('../lib/command/generate').heal))
|
|
142
|
+
program.command('generate:heal [path]').alias('gr').description('Generates basic heal recipes').action(commandHandlerWithProperty('../lib/command/generate.js', 'heal'))
|
|
150
143
|
|
|
151
144
|
program
|
|
152
145
|
.command('run [test]')
|
|
@@ -164,8 +157,6 @@ program
|
|
|
164
157
|
.option('--tests', 'run only JS test files and skip features')
|
|
165
158
|
.option('--no-timeouts', 'disable all timeouts')
|
|
166
159
|
.option('-p, --plugins <k=v,k2=v2,...>', 'enable plugins, comma-separated')
|
|
167
|
-
.option('--shuffle', 'Shuffle the order in which test files run')
|
|
168
|
-
.option('--shard <index/total>', 'run only a fraction of tests (e.g., --shard 1/4)')
|
|
169
160
|
|
|
170
161
|
// mocha options
|
|
171
162
|
.option('--colors', 'force enabling of colors')
|
|
@@ -187,7 +178,7 @@ program
|
|
|
187
178
|
.option('--recursive', 'include sub directories')
|
|
188
179
|
.option('--trace', 'trace function calls')
|
|
189
180
|
.option('--child <string>', 'option for child processes')
|
|
190
|
-
.action(
|
|
181
|
+
.action(commandHandler('../lib/command/run.js'))
|
|
191
182
|
|
|
192
183
|
program
|
|
193
184
|
.command('run-workers <workers> [selectedRuns...]')
|
|
@@ -197,7 +188,6 @@ program
|
|
|
197
188
|
.option('-i, --invert', 'inverts --grep matches')
|
|
198
189
|
.option('-o, --override [value]', 'override current config options')
|
|
199
190
|
.option('--suites', 'parallel execution of suites not single tests')
|
|
200
|
-
.option('--by <strategy>', 'test distribution strategy: "test" (pre-assign individual tests), "suite" (pre-assign test suites), or "pool" (dynamic distribution for optimal load balancing, recommended)')
|
|
201
191
|
.option(commandFlags.debug.flag, commandFlags.debug.description)
|
|
202
192
|
.option(commandFlags.verbose.flag, commandFlags.verbose.description)
|
|
203
193
|
.option('--features', 'run only *.feature files and skip tests')
|
|
@@ -207,7 +197,7 @@ program
|
|
|
207
197
|
.option('-p, --plugins <k=v,k2=v2,...>', 'enable plugins, comma-separated')
|
|
208
198
|
.option('-O, --reporter-options <k=v,k2=v2,...>', 'reporter-specific options')
|
|
209
199
|
.option('-R, --reporter <name>', 'specify the reporter to use')
|
|
210
|
-
.action(
|
|
200
|
+
.action(commandHandler('../lib/command/run-workers.js'))
|
|
211
201
|
|
|
212
202
|
program
|
|
213
203
|
.command('run-multiple [suites...]')
|
|
@@ -233,13 +223,9 @@ program
|
|
|
233
223
|
// mocha options
|
|
234
224
|
.option('--colors', 'force enabling of colors')
|
|
235
225
|
|
|
236
|
-
.action(
|
|
226
|
+
.action(commandHandler('../lib/command/run-multiple.js'))
|
|
237
227
|
|
|
238
|
-
program
|
|
239
|
-
.command('info [path]')
|
|
240
|
-
.description('Print debugging information concerning the local environment')
|
|
241
|
-
.option('-c, --config', 'your config file path')
|
|
242
|
-
.action(errorHandler(require('../lib/command/info')))
|
|
228
|
+
program.command('info [path]').description('Print debugging information concerning the local environment').option('-c, --config', 'your config file path').action(commandHandler('../lib/command/info.js'))
|
|
243
229
|
|
|
244
230
|
program
|
|
245
231
|
.command('dry-run [test]')
|
|
@@ -256,7 +242,7 @@ program
|
|
|
256
242
|
.option(commandFlags.steps.flag, commandFlags.steps.description)
|
|
257
243
|
.option(commandFlags.verbose.flag, commandFlags.verbose.description)
|
|
258
244
|
.option(commandFlags.debug.flag, commandFlags.debug.description)
|
|
259
|
-
.action(
|
|
245
|
+
.action(commandHandler('../lib/command/dryRun.js'))
|
|
260
246
|
|
|
261
247
|
program
|
|
262
248
|
.command('run-rerun [test]')
|
|
@@ -294,7 +280,10 @@ program
|
|
|
294
280
|
.option('--trace', 'trace function calls')
|
|
295
281
|
.option('--child <string>', 'option for child processes')
|
|
296
282
|
|
|
297
|
-
.action(
|
|
283
|
+
.action(async (...args) => {
|
|
284
|
+
const runRerun = await dynamicImport('../lib/command/run-rerun.js')
|
|
285
|
+
return runRerun(...args)
|
|
286
|
+
})
|
|
298
287
|
|
|
299
288
|
program.on('command:*', cmd => {
|
|
300
289
|
console.log(`\nUnknown command ${cmd}\n`)
|
package/lib/actor.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import Step, { MetaStep } from './step.js'
|
|
2
|
+
import recordStep from './step/record.js'
|
|
3
|
+
import retryStep from './step/retry.js'
|
|
4
|
+
import { methodsOfObject } from './utils.js'
|
|
5
|
+
import { TIMEOUT_ORDER } from './timeout.js'
|
|
6
|
+
import event from './event.js'
|
|
7
|
+
import store from './store.js'
|
|
8
|
+
import output from './output.js'
|
|
9
|
+
import Container from './container.js'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @interface
|
|
@@ -59,7 +59,6 @@ class Actor {
|
|
|
59
59
|
*/
|
|
60
60
|
retry(opts) {
|
|
61
61
|
console.log('I.retry() is deprecated, use step.retry() instead')
|
|
62
|
-
const retryStep = require('./step/retry')
|
|
63
62
|
retryStep(opts)
|
|
64
63
|
return this
|
|
65
64
|
}
|
|
@@ -71,7 +70,12 @@ class Actor {
|
|
|
71
70
|
* Wraps helper methods into promises.
|
|
72
71
|
* @ignore
|
|
73
72
|
*/
|
|
74
|
-
|
|
73
|
+
export default function (obj = {}, container) {
|
|
74
|
+
// Use global container if none provided
|
|
75
|
+
if (!container) {
|
|
76
|
+
container = Container
|
|
77
|
+
}
|
|
78
|
+
|
|
75
79
|
const actor = container.actor() || new Actor()
|
|
76
80
|
|
|
77
81
|
// load all helpers once container initialized
|
package/lib/ai.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import debugModule from 'debug'
|
|
2
|
+
const debug = debugModule('codeceptjs:ai')
|
|
3
|
+
import output from './output.js'
|
|
4
|
+
import event from './event.js'
|
|
5
|
+
import { removeNonInteractiveElements, minifyHtml, splitByChunks } from './html.js'
|
|
5
6
|
|
|
6
7
|
const defaultHtmlConfig = {
|
|
7
8
|
maxLength: 50000,
|
|
@@ -304,4 +305,4 @@ function parseCodeBlocks(response) {
|
|
|
304
305
|
return modifiedSnippets.filter(snippet => !!snippet)
|
|
305
306
|
}
|
|
306
307
|
|
|
307
|
-
|
|
308
|
+
export default new AiAssistant()
|
package/lib/assert/empty.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import assertionModule from '../assert.js'
|
|
2
|
+
const Assertion = assertionModule.default || assertionModule
|
|
3
|
+
import AssertionFailedError from './error.js'
|
|
4
|
+
import { template } from '../utils.js'
|
|
5
|
+
import outputModule from '../output.js'
|
|
6
|
+
const output = outputModule.default || outputModule
|
|
5
7
|
|
|
6
8
|
class EmptinessAssertion extends Assertion {
|
|
7
9
|
constructor(params) {
|
|
@@ -35,7 +37,6 @@ class EmptinessAssertion extends Assertion {
|
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
40
|
+
export { EmptinessAssertion as Assertion }
|
|
41
|
+
|
|
42
|
+
export const empty = subject => new EmptinessAssertion({ subject })
|
package/lib/assert/equal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import Assertion from '../assert.js'
|
|
2
|
+
import AssertionFailedError from './error.js'
|
|
3
|
+
import { template } from '../utils.js'
|
|
4
|
+
import output from '../output.js'
|
|
5
5
|
|
|
6
6
|
class EqualityAssertion extends Assertion {
|
|
7
7
|
constructor(params) {
|
|
@@ -37,18 +37,16 @@ class EqualityAssertion extends Assertion {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
actual = actual.slice(actual.indexOf(baseUrl) + baseUrl.length)
|
|
48
|
-
}
|
|
49
|
-
return actual === expected
|
|
40
|
+
export { EqualityAssertion as Assertion }
|
|
41
|
+
export const equals = jar => new EqualityAssertion({ jar })
|
|
42
|
+
export const urlEquals = baseUrl => {
|
|
43
|
+
const assert = new EqualityAssertion({ jar: 'url of current page' })
|
|
44
|
+
assert.comparator = function (expected, actual) {
|
|
45
|
+
if (expected.indexOf('http') !== 0) {
|
|
46
|
+
actual = actual.slice(actual.indexOf(baseUrl) + baseUrl.length)
|
|
50
47
|
}
|
|
51
|
-
return
|
|
52
|
-
}
|
|
53
|
-
|
|
48
|
+
return actual === expected
|
|
49
|
+
}
|
|
50
|
+
return assert
|
|
54
51
|
}
|
|
52
|
+
export const fileEquals = file => new EqualityAssertion({ file, jar: 'contents of {{file}}' })
|
package/lib/assert/error.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { template as subs } from '../utils.js'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Assertion errors, can provide a detailed error messages.
|
|
@@ -29,4 +29,4 @@ function AssertionFailedError(params, template) {
|
|
|
29
29
|
AssertionFailedError.prototype = Object.create(Error.prototype)
|
|
30
30
|
AssertionFailedError.constructor = AssertionFailedError
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
export default AssertionFailedError
|
package/lib/assert/include.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import Assertion from '../assert.js'
|
|
2
|
+
import AssertionFailedError from './error.js'
|
|
3
|
+
import { template } from '../utils.js'
|
|
4
|
+
import output from '../output.js'
|
|
5
5
|
|
|
6
6
|
const MAX_LINES = 10
|
|
7
7
|
|
|
@@ -62,14 +62,12 @@ class InclusionAssertion extends Assertion {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return new InclusionAssertion({ jar: needleType })
|
|
70
|
-
},
|
|
71
|
-
fileIncludes: file => new InclusionAssertion({ file, jar: 'file {{file}}' }),
|
|
65
|
+
export { InclusionAssertion as Assertion }
|
|
66
|
+
export const includes = needleType => {
|
|
67
|
+
needleType = needleType || 'string'
|
|
68
|
+
return new InclusionAssertion({ jar: needleType })
|
|
72
69
|
}
|
|
70
|
+
export const fileIncludes = file => new InclusionAssertion({ file, jar: 'file {{file}}' })
|
|
73
71
|
|
|
74
72
|
function escapeRegExp(str) {
|
|
75
73
|
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&')
|
package/lib/assert/throws.js
CHANGED
package/lib/assert/truth.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import Assertion from '../assert.js'
|
|
2
|
+
import AssertionFailedError from './error.js'
|
|
3
|
+
import { template } from '../utils.js'
|
|
4
|
+
import output from '../output.js'
|
|
5
5
|
|
|
6
6
|
class TruthAssertion extends Assertion {
|
|
7
7
|
constructor(params) {
|
|
@@ -30,7 +30,10 @@ class TruthAssertion extends Assertion {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
export { TruthAssertion as Assertion }
|
|
34
|
+
export const truth = (subject, type) => new TruthAssertion({ subject, type })
|
|
35
|
+
|
|
36
|
+
export default {
|
|
34
37
|
Assertion: TruthAssertion,
|
|
35
38
|
truth: (subject, type) => new TruthAssertion({ subject, type }),
|
|
36
39
|
}
|
package/lib/assert.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import AssertionFailedError from './assert/error.js'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Abstract assertion class introduced for more verbose and customizable messages.
|
|
@@ -22,9 +22,9 @@ const AssertionFailedError = require('./assert/error');
|
|
|
22
22
|
*/
|
|
23
23
|
class Assertion {
|
|
24
24
|
constructor(comparator, params) {
|
|
25
|
-
this.comparator = comparator
|
|
26
|
-
this.params = params || {}
|
|
27
|
-
this.params.customMessage = ''
|
|
25
|
+
this.comparator = comparator
|
|
26
|
+
this.params = params || {}
|
|
27
|
+
this.params.customMessage = ''
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -32,10 +32,10 @@ class Assertion {
|
|
|
32
32
|
* Fails if comparator function with provided arguments returns false
|
|
33
33
|
*/
|
|
34
34
|
assert() {
|
|
35
|
-
this.addAssertParams.apply(this, arguments)
|
|
36
|
-
const result = this.comparator.apply(this.params, arguments)
|
|
37
|
-
if (result) return
|
|
38
|
-
throw this.getFailedAssertion()
|
|
35
|
+
this.addAssertParams.apply(this, arguments)
|
|
36
|
+
const result = this.comparator.apply(this.params, arguments)
|
|
37
|
+
if (result) return // should increase global assertion counter
|
|
38
|
+
throw this.getFailedAssertion()
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -43,10 +43,10 @@ class Assertion {
|
|
|
43
43
|
* Fails if comparator function with provided arguments returns true
|
|
44
44
|
*/
|
|
45
45
|
negate() {
|
|
46
|
-
this.addAssertParams.apply(this, arguments)
|
|
47
|
-
const result = this.comparator.apply(this.params, arguments)
|
|
48
|
-
if (!result) return
|
|
49
|
-
throw this.getFailedNegation()
|
|
46
|
+
this.addAssertParams.apply(this, arguments)
|
|
47
|
+
const result = this.comparator.apply(this.params, arguments)
|
|
48
|
+
if (!result) return // should increase global assertion counter
|
|
49
|
+
throw this.getFailedNegation()
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
/**
|
|
@@ -55,18 +55,18 @@ class Assertion {
|
|
|
55
55
|
addAssertParams() {}
|
|
56
56
|
|
|
57
57
|
getException() {
|
|
58
|
-
return new AssertionFailedError(this.params, '')
|
|
58
|
+
return new AssertionFailedError(this.params, '')
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
getFailedNegation() {
|
|
62
|
-
const err = this.getException()
|
|
63
|
-
err.params.type = `not ${err.params.type}
|
|
64
|
-
return err
|
|
62
|
+
const err = this.getException()
|
|
63
|
+
err.params.type = `not ${err.params.type}`
|
|
64
|
+
return err
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
getFailedAssertion() {
|
|
68
|
-
return this.getException()
|
|
68
|
+
return this.getException()
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
export default Assertion
|