codeceptjs 3.7.0-rc.1 → 3.7.0
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 +1 -1
- package/lib/command/check.js +24 -9
- package/lib/effects.js +7 -2
- package/lib/event.js +2 -0
- package/lib/helper/Playwright.js +1 -1
- package/lib/helper/Puppeteer.js +1 -1
- package/lib/helper/extras/Popup.js +22 -22
- package/lib/mocha/test.js +5 -2
- package/lib/plugin/analyze.js +50 -3
- package/lib/plugin/retryFailedStep.js +13 -14
- package/lib/plugin/retryTo.js +1 -1
- package/lib/plugin/screenshotOnFail.js +3 -4
- package/lib/plugin/tryTo.js +1 -1
- package/lib/recorder.js +1 -0
- package/lib/store.js +29 -5
- package/lib/utils.js +1 -1
- package/lib/within.js +2 -0
- package/package.json +2 -2
- package/typings/promiseBasedTypes.d.ts +0 -24
- package/typings/types.d.ts +30 -31
package/bin/codecept.js
CHANGED
|
@@ -62,7 +62,7 @@ program
|
|
|
62
62
|
.command('check')
|
|
63
63
|
.option(commandFlags.config.flag, commandFlags.config.description)
|
|
64
64
|
.description('Checks configuration and environment before running tests')
|
|
65
|
-
.option('-t, --timeout [ms]', 'timeout for checks in ms,
|
|
65
|
+
.option('-t, --timeout [ms]', 'timeout for checks in ms, 50000 by default')
|
|
66
66
|
.action(errorHandler(require('../lib/command/check')))
|
|
67
67
|
|
|
68
68
|
program
|
package/lib/command/check.js
CHANGED
|
@@ -25,6 +25,7 @@ module.exports = async function (options) {
|
|
|
25
25
|
ai: true, // we don't need to check AI
|
|
26
26
|
helpers: false,
|
|
27
27
|
setup: false,
|
|
28
|
+
teardown: false,
|
|
28
29
|
tests: false,
|
|
29
30
|
def: false,
|
|
30
31
|
}
|
|
@@ -87,9 +88,9 @@ module.exports = async function (options) {
|
|
|
87
88
|
|
|
88
89
|
if (config?.ai?.request) {
|
|
89
90
|
checks.ai = true
|
|
90
|
-
printCheck('ai', checks['ai'], '
|
|
91
|
+
printCheck('ai', checks['ai'], 'Configuration is enabled, request function is set')
|
|
91
92
|
} else {
|
|
92
|
-
printCheck('ai', checks['ai'], '
|
|
93
|
+
printCheck('ai', checks['ai'], 'Disabled')
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
printCheck('tests', checks['tests'], `Total: ${numTests} tests`)
|
|
@@ -131,22 +132,36 @@ module.exports = async function (options) {
|
|
|
131
132
|
if (Object.keys(helpers).length) {
|
|
132
133
|
const suite = container.mocha().suite
|
|
133
134
|
const test = createTest('test', () => {})
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
checks.setup = true
|
|
136
|
+
for (const helper of Object.values(helpers)) {
|
|
137
|
+
try {
|
|
136
138
|
if (helper._beforeSuite) await helper._beforeSuite(suite)
|
|
137
139
|
if (helper._before) await helper._before(test)
|
|
140
|
+
} catch (err) {
|
|
141
|
+
err.message = `${helper.constructor.name} helper: ${err.message}`
|
|
142
|
+
if (checks.setup instanceof Error) err.message = `${err.message}\n\n${checks.setup?.message || ''}`.trim()
|
|
143
|
+
checks.setup = err
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
printCheck('Helpers Before', checks['setup'], standardActingHelpers.some(h => Object.keys(helpers).includes(h)) ? 'Initializing browser' : '')
|
|
148
|
+
|
|
149
|
+
checks.teardown = true
|
|
150
|
+
for (const helper of Object.values(helpers).reverse()) {
|
|
151
|
+
try {
|
|
138
152
|
if (helper._passed) await helper._passed(test)
|
|
139
153
|
if (helper._after) await helper._after(test)
|
|
140
154
|
if (helper._finishTest) await helper._finishTest(suite)
|
|
141
155
|
if (helper._afterSuite) await helper._afterSuite(suite)
|
|
156
|
+
} catch (err) {
|
|
157
|
+
err.message = `${helper.constructor.name} helper: ${err.message}`
|
|
158
|
+
if (checks.teardown instanceof Error) err.message = `${err.message}\n\n${checks.teardown?.message || ''}`.trim()
|
|
159
|
+
checks.teardown = err
|
|
142
160
|
}
|
|
143
|
-
checks.setup = true
|
|
144
|
-
} catch (err) {
|
|
145
|
-
checks.setup = err
|
|
146
161
|
}
|
|
147
|
-
}
|
|
148
162
|
|
|
149
|
-
|
|
163
|
+
printCheck('Helpers After', checks['teardown'], standardActingHelpers.some(h => Object.keys(helpers).includes(h)) ? 'Closing browser' : '')
|
|
164
|
+
}
|
|
150
165
|
|
|
151
166
|
try {
|
|
152
167
|
definitions(configFile, { dryRun: true })
|
package/lib/effects.js
CHANGED
|
@@ -2,6 +2,7 @@ const recorder = require('./recorder')
|
|
|
2
2
|
const { debug } = require('./output')
|
|
3
3
|
const store = require('./store')
|
|
4
4
|
const event = require('./event')
|
|
5
|
+
const within = require('./within')
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* A utility function for CodeceptJS tests that acts as a soft assertion.
|
|
@@ -178,11 +179,14 @@ async function tryTo(callback) {
|
|
|
178
179
|
const sessionName = 'tryTo'
|
|
179
180
|
|
|
180
181
|
let result = false
|
|
182
|
+
let isAutoRetriesEnabled = store.autoRetries
|
|
181
183
|
return recorder.add(
|
|
182
184
|
sessionName,
|
|
183
185
|
() => {
|
|
184
186
|
recorder.session.start(sessionName)
|
|
185
|
-
|
|
187
|
+
isAutoRetriesEnabled = store.autoRetries
|
|
188
|
+
if (isAutoRetriesEnabled) debug('Auto retries disabled inside tryTo effect')
|
|
189
|
+
store.autoRetries = false
|
|
186
190
|
callback()
|
|
187
191
|
recorder.add(() => {
|
|
188
192
|
result = true
|
|
@@ -199,7 +203,7 @@ async function tryTo(callback) {
|
|
|
199
203
|
return recorder.add(
|
|
200
204
|
'result',
|
|
201
205
|
() => {
|
|
202
|
-
store.
|
|
206
|
+
store.autoRetries = isAutoRetriesEnabled
|
|
203
207
|
return result
|
|
204
208
|
},
|
|
205
209
|
true,
|
|
@@ -215,4 +219,5 @@ module.exports = {
|
|
|
215
219
|
hopeThat,
|
|
216
220
|
retryTo,
|
|
217
221
|
tryTo,
|
|
222
|
+
within,
|
|
218
223
|
}
|
package/lib/event.js
CHANGED
package/lib/helper/Playwright.js
CHANGED
|
@@ -484,7 +484,7 @@ class Playwright extends Helper {
|
|
|
484
484
|
this.currentRunningTest = test
|
|
485
485
|
|
|
486
486
|
recorder.retry({
|
|
487
|
-
retries:
|
|
487
|
+
retries: test?.opts?.conditionalRetries || 3,
|
|
488
488
|
when: err => {
|
|
489
489
|
if (!err || typeof err.message !== 'string') {
|
|
490
490
|
return false
|
package/lib/helper/Puppeteer.js
CHANGED
|
@@ -312,7 +312,7 @@ class Puppeteer extends Helper {
|
|
|
312
312
|
this.sessionPages = {}
|
|
313
313
|
this.currentRunningTest = test
|
|
314
314
|
recorder.retry({
|
|
315
|
-
retries:
|
|
315
|
+
retries: test?.opts?.conditionalRetries || 3,
|
|
316
316
|
when: err => {
|
|
317
317
|
if (!err || typeof err.message !== 'string') {
|
|
318
318
|
return false
|
|
@@ -2,66 +2,66 @@
|
|
|
2
2
|
* Class to handle the interaction with the Dialog (Popup) Class from Puppeteer
|
|
3
3
|
*/
|
|
4
4
|
class Popup {
|
|
5
|
-
constructor(popup, defaultAction) {
|
|
6
|
-
this._popup = popup
|
|
7
|
-
this._actionType = ''
|
|
8
|
-
this._defaultAction = defaultAction
|
|
5
|
+
constructor(popup = null, defaultAction = '') {
|
|
6
|
+
this._popup = popup
|
|
7
|
+
this._actionType = ''
|
|
8
|
+
this._defaultAction = defaultAction
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
_assertValidActionType(action) {
|
|
12
12
|
if (['accept', 'cancel'].indexOf(action) === -1) {
|
|
13
|
-
throw new Error('Invalid Popup action type. Only "accept" or "cancel" actions are accepted')
|
|
13
|
+
throw new Error('Invalid Popup action type. Only "accept" or "cancel" actions are accepted')
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
set defaultAction(action) {
|
|
18
|
-
this._assertValidActionType(action)
|
|
19
|
-
this._defaultAction = action
|
|
18
|
+
this._assertValidActionType(action)
|
|
19
|
+
this._defaultAction = action
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
get defaultAction() {
|
|
23
|
-
return this._defaultAction
|
|
23
|
+
return this._defaultAction
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
get popup() {
|
|
27
|
-
return this._popup
|
|
27
|
+
return this._popup
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
set popup(popup) {
|
|
31
31
|
if (this._popup) {
|
|
32
|
-
|
|
32
|
+
return
|
|
33
33
|
}
|
|
34
|
-
this._popup = popup
|
|
34
|
+
this._popup = popup
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
get actionType() {
|
|
38
|
-
return this._actionType
|
|
38
|
+
return this._actionType
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
set actionType(action) {
|
|
42
|
-
this._assertValidActionType(action)
|
|
43
|
-
this._actionType = action
|
|
42
|
+
this._assertValidActionType(action)
|
|
43
|
+
this._actionType = action
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
clear() {
|
|
47
|
-
this._popup = null
|
|
48
|
-
this._actionType = ''
|
|
47
|
+
this._popup = null
|
|
48
|
+
this._actionType = ''
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
assertPopupVisible() {
|
|
52
52
|
if (!this._popup) {
|
|
53
|
-
throw new Error('There is no Popup visible')
|
|
53
|
+
throw new Error('There is no Popup visible')
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
assertPopupActionType(type) {
|
|
58
|
-
this.assertPopupVisible()
|
|
59
|
-
const expectedAction = this._actionType || this._defaultAction
|
|
58
|
+
this.assertPopupVisible()
|
|
59
|
+
const expectedAction = this._actionType || this._defaultAction
|
|
60
60
|
if (expectedAction !== type) {
|
|
61
|
-
throw new Error(`Popup action does not fit the expected action type. Expected popup action to be '${expectedAction}' not '${type}`)
|
|
61
|
+
throw new Error(`Popup action does not fit the expected action type. Expected popup action to be '${expectedAction}' not '${type}`)
|
|
62
62
|
}
|
|
63
|
-
this.clear()
|
|
63
|
+
this.clear()
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
module.exports = Popup
|
|
67
|
+
module.exports = Popup
|
package/lib/mocha/test.js
CHANGED
|
@@ -133,8 +133,10 @@ function cloneTest(test) {
|
|
|
133
133
|
return deserializeTest(serializeTest(test))
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
function testToFileName(test) {
|
|
137
|
-
let fileName =
|
|
136
|
+
function testToFileName(test, suffix = '') {
|
|
137
|
+
let fileName = test.title
|
|
138
|
+
|
|
139
|
+
if (suffix) fileName = `${fileName}_${suffix}`
|
|
138
140
|
// remove tags with empty string (disable for now)
|
|
139
141
|
// fileName = fileName.replace(/\@\w+/g, '')
|
|
140
142
|
fileName = fileName.slice(0, 100)
|
|
@@ -146,6 +148,7 @@ function testToFileName(test) {
|
|
|
146
148
|
// if (test.parent && test.parent.title) {
|
|
147
149
|
// fileName = `${clearString(test.parent.title)}_${fileName}`
|
|
148
150
|
// }
|
|
151
|
+
fileName = clearString(fileName).slice(0, 100)
|
|
149
152
|
return fileName
|
|
150
153
|
}
|
|
151
154
|
|
package/lib/plugin/analyze.js
CHANGED
|
@@ -60,7 +60,7 @@ const defaultConfig = {
|
|
|
60
60
|
|
|
61
61
|
If there is no groups of tests, say: "No patterns found"
|
|
62
62
|
Preserve error messages but cut them if they are too long.
|
|
63
|
-
Respond clearly and directly, without introductory words or phrases like
|
|
63
|
+
Respond clearly and directly, without introductory words or phrases like 'Of course,' 'Here is the answer,' etc.
|
|
64
64
|
Do not list more than 3 errors in the group.
|
|
65
65
|
If you identify that all tests in the group have the same tag, add this tag to the group report, otherwise ignore TAG section.
|
|
66
66
|
If you identify that all tests in the group have the same suite, add this suite to the group report, otherwise ignore SUITE section.
|
|
@@ -160,9 +160,56 @@ const defaultConfig = {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
|
+
* CodeceptJS Analyze Plugin - Uses AI to analyze test failures and provide insights
|
|
163
164
|
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
165
|
+
* This plugin analyzes failed tests using AI to provide detailed explanations and group similar failures.
|
|
166
|
+
* When enabled with --ai flag, it generates reports after test execution.
|
|
167
|
+
*
|
|
168
|
+
* #### Usage
|
|
169
|
+
*
|
|
170
|
+
* ```js
|
|
171
|
+
* // in codecept.conf.js
|
|
172
|
+
* exports.config = {
|
|
173
|
+
* plugins: {
|
|
174
|
+
* analyze: {
|
|
175
|
+
* enabled: true,
|
|
176
|
+
* clusterize: 5,
|
|
177
|
+
* analyze: 2,
|
|
178
|
+
* vision: false
|
|
179
|
+
* }
|
|
180
|
+
* }
|
|
181
|
+
* }
|
|
182
|
+
* ```
|
|
183
|
+
*
|
|
184
|
+
* #### Configuration
|
|
185
|
+
*
|
|
186
|
+
* * `clusterize` (number) - minimum number of failures to trigger clustering analysis. Default: 5
|
|
187
|
+
* * `analyze` (number) - maximum number of individual test failures to analyze in detail. Default: 2
|
|
188
|
+
* * `vision` (boolean) - enables visual analysis of test screenshots. Default: false
|
|
189
|
+
* * `categories` (array) - list of failure categories for classification. Defaults to:
|
|
190
|
+
* - Browser connection error / browser crash
|
|
191
|
+
* - Network errors (server error, timeout, etc)
|
|
192
|
+
* - HTML / page elements (not found, not visible, etc)
|
|
193
|
+
* - Navigation errors (404, etc)
|
|
194
|
+
* - Code errors (syntax error, JS errors, etc)
|
|
195
|
+
* - Library & framework errors
|
|
196
|
+
* - Data errors (password incorrect, invalid format, etc)
|
|
197
|
+
* - Assertion failures
|
|
198
|
+
* - Other errors
|
|
199
|
+
* * `prompts` (object) - customize AI prompts for analysis
|
|
200
|
+
* - `clusterize` - prompt for clustering analysis
|
|
201
|
+
* - `analyze` - prompt for individual test analysis
|
|
202
|
+
*
|
|
203
|
+
* #### Features
|
|
204
|
+
*
|
|
205
|
+
* * Groups similar failures when number of failures >= clusterize value
|
|
206
|
+
* * Provides detailed analysis of individual failures
|
|
207
|
+
* * Analyzes screenshots if vision=true and screenshots are available
|
|
208
|
+
* * Classifies failures into predefined categories
|
|
209
|
+
* * Suggests possible causes and solutions
|
|
210
|
+
*
|
|
211
|
+
* @param {Object} config - Plugin configuration
|
|
212
|
+
* @returns {void}
|
|
166
213
|
*/
|
|
167
214
|
module.exports = function (config = {}) {
|
|
168
215
|
config = Object.assign(defaultConfig, config)
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
const event = require('../event')
|
|
2
2
|
const recorder = require('../recorder')
|
|
3
|
-
const
|
|
4
|
-
const { log } = require('../output')
|
|
5
|
-
|
|
3
|
+
const store = require('../store')
|
|
6
4
|
const defaultConfig = {
|
|
7
5
|
retries: 3,
|
|
8
6
|
defaultIgnoredSteps: ['amOnPage', 'wait*', 'send*', 'execute*', 'run*', 'have*'],
|
|
@@ -70,9 +68,9 @@ const defaultConfig = {
|
|
|
70
68
|
* Use scenario configuration to disable plugin for a test
|
|
71
69
|
*
|
|
72
70
|
* ```js
|
|
73
|
-
* Scenario('scenario tite', () => {
|
|
71
|
+
* Scenario('scenario tite', { disableRetryFailedStep: true }, () => {
|
|
74
72
|
* // test goes here
|
|
75
|
-
* })
|
|
73
|
+
* })
|
|
76
74
|
* ```
|
|
77
75
|
*
|
|
78
76
|
*/
|
|
@@ -85,19 +83,14 @@ module.exports = config => {
|
|
|
85
83
|
|
|
86
84
|
const when = err => {
|
|
87
85
|
if (!enableRetry) return
|
|
88
|
-
const store = require('../store')
|
|
89
86
|
if (store.debugMode) return false
|
|
87
|
+
if (!store.autoRetries) return false
|
|
90
88
|
if (customWhen) return customWhen(err)
|
|
91
89
|
return true
|
|
92
90
|
}
|
|
93
91
|
config.when = when
|
|
94
92
|
|
|
95
93
|
event.dispatcher.on(event.step.started, step => {
|
|
96
|
-
if (process.env.TRY_TO === 'true') {
|
|
97
|
-
log('Info: RetryFailedStep plugin is disabled inside tryTo block')
|
|
98
|
-
return
|
|
99
|
-
}
|
|
100
|
-
|
|
101
94
|
// if a step is ignored - return
|
|
102
95
|
for (const ignored of config.ignoredSteps) {
|
|
103
96
|
if (step.name === ignored) return
|
|
@@ -113,9 +106,15 @@ module.exports = config => {
|
|
|
113
106
|
})
|
|
114
107
|
|
|
115
108
|
event.dispatcher.on(event.test.before, test => {
|
|
116
|
-
|
|
117
|
-
//
|
|
118
|
-
|
|
109
|
+
// pass disableRetryFailedStep is a preferred way to disable retries
|
|
110
|
+
// test.disableRetryFailedStep is used for backward compatibility
|
|
111
|
+
if (test.opts.disableRetryFailedStep || test.disableRetryFailedStep) {
|
|
112
|
+
store.autoRetries = false
|
|
113
|
+
return // disable retry when a test is not active
|
|
114
|
+
}
|
|
115
|
+
// this option is used to set the retries inside _before() block of helpers
|
|
116
|
+
store.autoRetries = true
|
|
117
|
+
test.opts.conditionalRetries = config.retries
|
|
119
118
|
recorder.retry(config)
|
|
120
119
|
})
|
|
121
120
|
}
|
package/lib/plugin/retryTo.js
CHANGED
|
@@ -6,7 +6,7 @@ const defaultConfig = {
|
|
|
6
6
|
|
|
7
7
|
module.exports = function (config) {
|
|
8
8
|
config = Object.assign(defaultConfig, config)
|
|
9
|
-
console.log(`Deprecation Warning: 'retryTo' has been moved to the 'codeceptjs/effects' module
|
|
9
|
+
console.log(`Deprecation Warning: 'retryTo' has been moved to the 'codeceptjs/effects' module. Disable retryTo plugin to remove this warning.`)
|
|
10
10
|
|
|
11
11
|
if (config.registerGlobal) {
|
|
12
12
|
global.retryTo = retryTo
|
|
@@ -83,13 +83,12 @@ module.exports = function (config) {
|
|
|
83
83
|
async () => {
|
|
84
84
|
const dataType = 'image/png'
|
|
85
85
|
// This prevents data driven to be included in the failed screenshot file name
|
|
86
|
-
let fileName
|
|
86
|
+
let fileName
|
|
87
87
|
|
|
88
88
|
if (options.uniqueScreenshotNames && test) {
|
|
89
|
-
|
|
90
|
-
fileName = `${fileName.substring(0, 10)}_${uuid}.failed.png`
|
|
89
|
+
fileName = `${testToFileName(test, _getUUID(test))}.failed.png`
|
|
91
90
|
} else {
|
|
92
|
-
fileName
|
|
91
|
+
fileName = `${testToFileName(test)}.failed.png`
|
|
93
92
|
}
|
|
94
93
|
output.plugin('screenshotOnFail', 'Test failed, try to save a screenshot')
|
|
95
94
|
|
package/lib/plugin/tryTo.js
CHANGED
|
@@ -6,7 +6,7 @@ const defaultConfig = {
|
|
|
6
6
|
|
|
7
7
|
module.exports = function (config) {
|
|
8
8
|
config = Object.assign(defaultConfig, config)
|
|
9
|
-
console.log(`Deprecation Warning: 'tryTo' has been moved to the 'codeceptjs/effects' module
|
|
9
|
+
console.log(`Deprecation Warning: 'tryTo' has been moved to the 'codeceptjs/effects' module. Disable tryTo plugin to remove this warning.`)
|
|
10
10
|
|
|
11
11
|
if (config.registerGlobal) {
|
|
12
12
|
global.tryTo = tryTo
|
package/lib/recorder.js
CHANGED
|
@@ -192,6 +192,7 @@ module.exports = {
|
|
|
192
192
|
.pop()
|
|
193
193
|
// no retries or unnamed tasks
|
|
194
194
|
debug(`${currentQueue()} Running | ${taskName} | Timeout: ${timeout || 'None'}`)
|
|
195
|
+
if (retryOpts) debug(`${currentQueue()} Retry opts`, JSON.stringify(retryOpts))
|
|
195
196
|
|
|
196
197
|
if (!retryOpts || !taskName || !retry) {
|
|
197
198
|
const [promise, timer] = getTimeoutPromise(timeout, taskName)
|
package/lib/store.js
CHANGED
|
@@ -3,17 +3,41 @@
|
|
|
3
3
|
* @namespace
|
|
4
4
|
*/
|
|
5
5
|
const store = {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* If we are in --debug mode
|
|
8
|
+
* @type {boolean}
|
|
9
|
+
*/
|
|
7
10
|
debugMode: false,
|
|
8
|
-
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Is timeouts enabled
|
|
14
|
+
* @type {boolean}
|
|
15
|
+
*/
|
|
9
16
|
timeouts: true,
|
|
10
|
-
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* If auto-retries are enabled by retryFailedStep plugin
|
|
20
|
+
* tryTo effect disables them
|
|
21
|
+
* @type {boolean}
|
|
22
|
+
*/
|
|
23
|
+
autoRetries: false,
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Tests are executed via dry-run
|
|
27
|
+
* @type {boolean}
|
|
28
|
+
*/
|
|
11
29
|
dryRun: false,
|
|
12
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* If we are in pause mode
|
|
32
|
+
* @type {boolean}
|
|
33
|
+
*/
|
|
13
34
|
onPause: false,
|
|
35
|
+
|
|
36
|
+
// current object states
|
|
37
|
+
|
|
14
38
|
/** @type {CodeceptJS.Test | null} */
|
|
15
39
|
currentTest: null,
|
|
16
|
-
/** @type {
|
|
40
|
+
/** @type {CodeceptJS.Step | null} */
|
|
17
41
|
currentStep: null,
|
|
18
42
|
/** @type {CodeceptJS.Suite | null} */
|
|
19
43
|
currentSuite: null,
|
package/lib/utils.js
CHANGED
|
@@ -13,7 +13,7 @@ function deepMerge(target, source) {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
module.exports.genTestId = test => {
|
|
16
|
-
return require('crypto').createHash('sha256').update(test.fullTitle()).digest('base64').slice(0, -2)
|
|
16
|
+
return this.clearString(require('crypto').createHash('sha256').update(test.fullTitle()).digest('base64').slice(0, -2))
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
module.exports.deepMerge = deepMerge
|
package/lib/within.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeceptjs",
|
|
3
|
-
"version": "3.7.0
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "Supercharged End 2 End Testing Framework for NodeJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"acceptance",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"glob": ">=9.0.0 <12",
|
|
99
99
|
"fuse.js": "^7.0.0",
|
|
100
100
|
"html-minifier-terser": "7.2.0",
|
|
101
|
-
"inquirer": "
|
|
101
|
+
"inquirer": "8.2.6",
|
|
102
102
|
"invisi-data": "^1.0.0",
|
|
103
103
|
"joi": "17.13.3",
|
|
104
104
|
"js-beautify": "1.15.1",
|
|
@@ -1760,10 +1760,6 @@ declare namespace CodeceptJS {
|
|
|
1760
1760
|
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1761
1761
|
*/
|
|
1762
1762
|
// @ts-ignore
|
|
1763
|
-
// @ts-ignore
|
|
1764
|
-
// @ts-ignore
|
|
1765
|
-
// @ts-ignore
|
|
1766
|
-
// @ts-ignore
|
|
1767
1763
|
type MockServerConfig = {
|
|
1768
1764
|
port?: number;
|
|
1769
1765
|
host?: string;
|
|
@@ -1889,10 +1885,6 @@ declare namespace CodeceptJS {
|
|
|
1889
1885
|
* ## Methods
|
|
1890
1886
|
*/
|
|
1891
1887
|
// @ts-ignore
|
|
1892
|
-
// @ts-ignore
|
|
1893
|
-
// @ts-ignore
|
|
1894
|
-
// @ts-ignore
|
|
1895
|
-
// @ts-ignore
|
|
1896
1888
|
class MockServer {
|
|
1897
1889
|
/**
|
|
1898
1890
|
* Start the mock server
|
|
@@ -2927,10 +2919,6 @@ declare namespace CodeceptJS {
|
|
|
2927
2919
|
* @property [testIdAttribute = data-testid] - locate elements based on the testIdAttribute. See more of [locate by test id](https://playwright.dev/docs/locators#locate-by-test-id).
|
|
2928
2920
|
*/
|
|
2929
2921
|
// @ts-ignore
|
|
2930
|
-
// @ts-ignore
|
|
2931
|
-
// @ts-ignore
|
|
2932
|
-
// @ts-ignore
|
|
2933
|
-
// @ts-ignore
|
|
2934
2922
|
type PlaywrightConfig = {
|
|
2935
2923
|
url?: string;
|
|
2936
2924
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -6308,10 +6296,6 @@ declare namespace CodeceptJS {
|
|
|
6308
6296
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
6309
6297
|
*/
|
|
6310
6298
|
// @ts-ignore
|
|
6311
|
-
// @ts-ignore
|
|
6312
|
-
// @ts-ignore
|
|
6313
|
-
// @ts-ignore
|
|
6314
|
-
// @ts-ignore
|
|
6315
6299
|
type PuppeteerConfig = {
|
|
6316
6300
|
url: string;
|
|
6317
6301
|
basicAuth?: any;
|
|
@@ -8119,10 +8103,6 @@ declare namespace CodeceptJS {
|
|
|
8119
8103
|
* @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
|
|
8120
8104
|
*/
|
|
8121
8105
|
// @ts-ignore
|
|
8122
|
-
// @ts-ignore
|
|
8123
|
-
// @ts-ignore
|
|
8124
|
-
// @ts-ignore
|
|
8125
|
-
// @ts-ignore
|
|
8126
8106
|
type RESTConfig = {
|
|
8127
8107
|
endpoint?: string;
|
|
8128
8108
|
prettyPrintJson?: boolean;
|
|
@@ -9268,10 +9248,6 @@ declare namespace CodeceptJS {
|
|
|
9268
9248
|
* @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
|
|
9269
9249
|
*/
|
|
9270
9250
|
// @ts-ignore
|
|
9271
|
-
// @ts-ignore
|
|
9272
|
-
// @ts-ignore
|
|
9273
|
-
// @ts-ignore
|
|
9274
|
-
// @ts-ignore
|
|
9275
9251
|
type WebDriverConfig = {
|
|
9276
9252
|
url: string;
|
|
9277
9253
|
browser: string;
|
package/typings/types.d.ts
CHANGED
|
@@ -1787,10 +1787,6 @@ declare namespace CodeceptJS {
|
|
|
1787
1787
|
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1788
1788
|
*/
|
|
1789
1789
|
// @ts-ignore
|
|
1790
|
-
// @ts-ignore
|
|
1791
|
-
// @ts-ignore
|
|
1792
|
-
// @ts-ignore
|
|
1793
|
-
// @ts-ignore
|
|
1794
1790
|
type MockServerConfig = {
|
|
1795
1791
|
port?: number;
|
|
1796
1792
|
host?: string;
|
|
@@ -1916,10 +1912,6 @@ declare namespace CodeceptJS {
|
|
|
1916
1912
|
* ## Methods
|
|
1917
1913
|
*/
|
|
1918
1914
|
// @ts-ignore
|
|
1919
|
-
// @ts-ignore
|
|
1920
|
-
// @ts-ignore
|
|
1921
|
-
// @ts-ignore
|
|
1922
|
-
// @ts-ignore
|
|
1923
1915
|
class MockServer {
|
|
1924
1916
|
/**
|
|
1925
1917
|
* Start the mock server
|
|
@@ -3020,10 +3012,6 @@ declare namespace CodeceptJS {
|
|
|
3020
3012
|
* @property [testIdAttribute = data-testid] - locate elements based on the testIdAttribute. See more of [locate by test id](https://playwright.dev/docs/locators#locate-by-test-id).
|
|
3021
3013
|
*/
|
|
3022
3014
|
// @ts-ignore
|
|
3023
|
-
// @ts-ignore
|
|
3024
|
-
// @ts-ignore
|
|
3025
|
-
// @ts-ignore
|
|
3026
|
-
// @ts-ignore
|
|
3027
3015
|
type PlaywrightConfig = {
|
|
3028
3016
|
url?: string;
|
|
3029
3017
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -6552,10 +6540,6 @@ declare namespace CodeceptJS {
|
|
|
6552
6540
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
6553
6541
|
*/
|
|
6554
6542
|
// @ts-ignore
|
|
6555
|
-
// @ts-ignore
|
|
6556
|
-
// @ts-ignore
|
|
6557
|
-
// @ts-ignore
|
|
6558
|
-
// @ts-ignore
|
|
6559
6543
|
type PuppeteerConfig = {
|
|
6560
6544
|
url: string;
|
|
6561
6545
|
basicAuth?: any;
|
|
@@ -8499,10 +8483,6 @@ declare namespace CodeceptJS {
|
|
|
8499
8483
|
* @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
|
|
8500
8484
|
*/
|
|
8501
8485
|
// @ts-ignore
|
|
8502
|
-
// @ts-ignore
|
|
8503
|
-
// @ts-ignore
|
|
8504
|
-
// @ts-ignore
|
|
8505
|
-
// @ts-ignore
|
|
8506
8486
|
type RESTConfig = {
|
|
8507
8487
|
endpoint?: string;
|
|
8508
8488
|
prettyPrintJson?: boolean;
|
|
@@ -9708,10 +9688,6 @@ declare namespace CodeceptJS {
|
|
|
9708
9688
|
* @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
|
|
9709
9689
|
*/
|
|
9710
9690
|
// @ts-ignore
|
|
9711
|
-
// @ts-ignore
|
|
9712
|
-
// @ts-ignore
|
|
9713
|
-
// @ts-ignore
|
|
9714
|
-
// @ts-ignore
|
|
9715
9691
|
type WebDriverConfig = {
|
|
9716
9692
|
url: string;
|
|
9717
9693
|
browser: string;
|
|
@@ -11793,6 +11769,10 @@ declare namespace CodeceptJS {
|
|
|
11793
11769
|
* Dependency Injection Container
|
|
11794
11770
|
*/
|
|
11795
11771
|
class Container {
|
|
11772
|
+
/**
|
|
11773
|
+
* Get the standard acting helpers of CodeceptJS Container
|
|
11774
|
+
*/
|
|
11775
|
+
static STANDARD_ACTING_HELPERS: any;
|
|
11796
11776
|
/**
|
|
11797
11777
|
* Create container with all required helpers and support objects
|
|
11798
11778
|
*/
|
|
@@ -11837,16 +11817,12 @@ declare namespace CodeceptJS {
|
|
|
11837
11817
|
}, newPlugins: {
|
|
11838
11818
|
[key: string]: any;
|
|
11839
11819
|
}): void;
|
|
11840
|
-
static started(fn: (...params: any[]) => any): Promise<void>;
|
|
11820
|
+
static started(fn: ((...params: any[]) => any) | null): Promise<void>;
|
|
11841
11821
|
/**
|
|
11842
11822
|
* Share data across worker threads
|
|
11843
11823
|
* @param options - set {local: true} to not share among workers
|
|
11844
11824
|
*/
|
|
11845
11825
|
static share(data: any, options: any): void;
|
|
11846
|
-
/**
|
|
11847
|
-
* List of helpers that are used in CodeceptJS and can't be used together
|
|
11848
|
-
*/
|
|
11849
|
-
static STANDARD_ACTING_HELPERS: string[];
|
|
11850
11826
|
}
|
|
11851
11827
|
/**
|
|
11852
11828
|
* Method collect own property and prototype
|
|
@@ -11907,6 +11883,8 @@ declare namespace CodeceptJS {
|
|
|
11907
11883
|
const hook: {
|
|
11908
11884
|
started: 'hook.start';
|
|
11909
11885
|
passed: 'hook.passed';
|
|
11886
|
+
failed: 'hook.failed';
|
|
11887
|
+
finished: 'hook.finished';
|
|
11910
11888
|
};
|
|
11911
11889
|
const step: {
|
|
11912
11890
|
started: 'step.start';
|
|
@@ -12210,12 +12188,13 @@ declare namespace CodeceptJS {
|
|
|
12210
12188
|
args: any[];
|
|
12211
12189
|
opts: Record<string, any>;
|
|
12212
12190
|
actor: string;
|
|
12213
|
-
helperMethod: string;
|
|
12214
12191
|
status: string;
|
|
12215
12192
|
prefix: string;
|
|
12216
12193
|
comment: string;
|
|
12217
12194
|
metaStep: any;
|
|
12218
12195
|
stack: string;
|
|
12196
|
+
helper: any;
|
|
12197
|
+
helperMethod: string;
|
|
12219
12198
|
timeout: any;
|
|
12220
12199
|
/**
|
|
12221
12200
|
* @param timeout - timeout in milliseconds or 0 if no timeout
|
|
@@ -12238,12 +12217,29 @@ declare namespace CodeceptJS {
|
|
|
12238
12217
|
* global values for current session
|
|
12239
12218
|
*/
|
|
12240
12219
|
namespace store {
|
|
12220
|
+
/**
|
|
12221
|
+
* If we are in --debug mode
|
|
12222
|
+
*/
|
|
12241
12223
|
var debugMode: boolean;
|
|
12224
|
+
/**
|
|
12225
|
+
* Is timeouts enabled
|
|
12226
|
+
*/
|
|
12242
12227
|
var timeouts: boolean;
|
|
12228
|
+
/**
|
|
12229
|
+
* If auto-retries are enabled by retryFailedStep plugin
|
|
12230
|
+
* tryTo effect disables them
|
|
12231
|
+
*/
|
|
12232
|
+
var autoRetries: boolean;
|
|
12233
|
+
/**
|
|
12234
|
+
* Tests are executed via dry-run
|
|
12235
|
+
*/
|
|
12243
12236
|
var dryRun: boolean;
|
|
12237
|
+
/**
|
|
12238
|
+
* If we are in pause mode
|
|
12239
|
+
*/
|
|
12244
12240
|
var onPause: boolean;
|
|
12245
12241
|
var currentTest: CodeceptJS.Test | null;
|
|
12246
|
-
var currentStep:
|
|
12242
|
+
var currentStep: CodeceptJS.Step | null;
|
|
12247
12243
|
var currentSuite: CodeceptJS.Suite | null;
|
|
12248
12244
|
}
|
|
12249
12245
|
/**
|
|
@@ -12384,6 +12380,9 @@ declare namespace CodeceptJS {
|
|
|
12384
12380
|
*/
|
|
12385
12381
|
err: Error | null;
|
|
12386
12382
|
}
|
|
12383
|
+
/**
|
|
12384
|
+
* TODO: move to effects
|
|
12385
|
+
*/
|
|
12387
12386
|
function within(context: CodeceptJS.LocatorOrString, fn: (...params: any[]) => any): Promise<any> | undefined;
|
|
12388
12387
|
/**
|
|
12389
12388
|
* This is a wrapper on top of [Detox](https://github.com/wix/Detox) library, aimied to unify testing experience for CodeceptJS framework.
|