codeceptjs 3.7.0-beta.7 → 3.7.0-beta.9
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/lib/actor.js +1 -2
- package/lib/ai.js +130 -121
- package/lib/codecept.js +4 -4
- package/lib/command/check.js +4 -0
- package/lib/command/run-workers.js +1 -53
- package/lib/command/workers/runTests.js +25 -189
- package/lib/container.js +16 -0
- package/lib/els.js +87 -106
- package/lib/event.js +18 -17
- package/lib/helper/Playwright.js +7 -1
- package/lib/listener/exit.js +5 -8
- package/lib/listener/globalTimeout.js +26 -9
- package/lib/listener/result.js +12 -0
- package/lib/listener/steps.js +0 -6
- package/lib/listener/store.js +9 -1
- package/lib/mocha/asyncWrapper.js +12 -2
- package/lib/mocha/cli.js +65 -31
- package/lib/mocha/hooks.js +32 -3
- package/lib/mocha/suite.js +27 -1
- package/lib/mocha/test.js +91 -7
- package/lib/mocha/types.d.ts +5 -0
- package/lib/output.js +2 -1
- package/lib/plugin/analyze.js +348 -0
- package/lib/plugin/commentStep.js +5 -0
- package/lib/plugin/customReporter.js +52 -0
- package/lib/plugin/heal.js +2 -2
- package/lib/plugin/pageInfo.js +140 -0
- package/lib/plugin/retryTo.js +10 -2
- package/lib/plugin/screenshotOnFail.js +11 -16
- package/lib/plugin/stepByStepReport.js +5 -4
- package/lib/plugin/stepTimeout.js +1 -1
- package/lib/plugin/tryTo.js +9 -1
- package/lib/recorder.js +4 -4
- package/lib/rerun.js +43 -42
- package/lib/result.js +161 -0
- package/lib/step/base.js +52 -4
- package/lib/step/func.js +46 -0
- package/lib/step/helper.js +3 -0
- package/lib/step/meta.js +9 -1
- package/lib/step/record.js +5 -5
- package/lib/step/section.js +55 -0
- package/lib/step.js +6 -0
- package/lib/steps.js +28 -1
- package/lib/store.js +2 -0
- package/lib/{step/timeout.js → timeout.js} +24 -0
- package/lib/utils.js +35 -0
- package/lib/workers.js +28 -38
- package/package.json +7 -6
- package/typings/promiseBasedTypes.d.ts +104 -0
- package/typings/types.d.ts +104 -0
- package/lib/listener/artifacts.js +0 -19
- package/lib/plugin/debugErrors.js +0 -67
|
@@ -36,7 +36,31 @@ function getCurrentTimeout(timeouts) {
|
|
|
36
36
|
return totalTimeout
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
class TimeoutError extends Error {
|
|
40
|
+
constructor(message) {
|
|
41
|
+
super(message)
|
|
42
|
+
this.name = 'TimeoutError'
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
class TestTimeoutError extends TimeoutError {
|
|
47
|
+
constructor(timeout) {
|
|
48
|
+
super(`Timeout ${timeout}s exceeded (with Before hook)`)
|
|
49
|
+
this.name = 'TestTimeoutError'
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
class StepTimeoutError extends TimeoutError {
|
|
54
|
+
constructor(timeout, step) {
|
|
55
|
+
super(`Step ${step.toCode().trim()} timed out after ${timeout}s`)
|
|
56
|
+
this.name = 'StepTimeoutError'
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
39
60
|
module.exports = {
|
|
40
61
|
TIMEOUT_ORDER,
|
|
41
62
|
getCurrentTimeout,
|
|
63
|
+
TimeoutError,
|
|
64
|
+
TestTimeoutError,
|
|
65
|
+
StepTimeoutError,
|
|
42
66
|
}
|
package/lib/utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const fs = require('fs')
|
|
2
2
|
const os = require('os')
|
|
3
3
|
const path = require('path')
|
|
4
|
+
const chalk = require('chalk')
|
|
4
5
|
const getFunctionArguments = require('fn-args')
|
|
5
6
|
const deepClone = require('lodash.clonedeep')
|
|
6
7
|
const { convertColorToRGBA, isColorProperty } = require('./colorUtils')
|
|
@@ -542,3 +543,37 @@ module.exports.humanizeString = function (string) {
|
|
|
542
543
|
_result[0] = _result[0] === 'i' ? this.ucfirst(_result[0]) : _result[0]
|
|
543
544
|
return _result.join(' ').trim()
|
|
544
545
|
}
|
|
546
|
+
|
|
547
|
+
module.exports.serializeError = function (error) {
|
|
548
|
+
if (error) {
|
|
549
|
+
const { stack, uncaught, message, actual, expected } = error
|
|
550
|
+
return { stack, uncaught, message, actual, expected }
|
|
551
|
+
}
|
|
552
|
+
return null
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
module.exports.base64EncodeFile = function (filePath) {
|
|
556
|
+
return Buffer.from(fs.readFileSync(filePath)).toString('base64')
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
module.exports.markdownToAnsi = function (markdown) {
|
|
560
|
+
return (
|
|
561
|
+
markdown
|
|
562
|
+
// Headers (# Text) - make blue and bold
|
|
563
|
+
.replace(/^(#{1,6})\s+(.+)$/gm, (_, hashes, text) => {
|
|
564
|
+
return chalk.bold.blue(`${hashes} ${text}`)
|
|
565
|
+
})
|
|
566
|
+
// Bullet points - replace with yellow bullet character
|
|
567
|
+
.replace(/^[-*]\s+(.+)$/gm, (_, text) => {
|
|
568
|
+
return `${chalk.yellow('•')} ${text}`
|
|
569
|
+
})
|
|
570
|
+
// Bold (**text**) - make bold
|
|
571
|
+
.replace(/\*\*(.+?)\*\*/g, (_, text) => {
|
|
572
|
+
return chalk.bold(text)
|
|
573
|
+
})
|
|
574
|
+
// Italic (*text*) - make italic (dim in terminals)
|
|
575
|
+
.replace(/\*(.+?)\*/g, (_, text) => {
|
|
576
|
+
return chalk.italic(text)
|
|
577
|
+
})
|
|
578
|
+
)
|
|
579
|
+
}
|
package/lib/workers.js
CHANGED
|
@@ -12,7 +12,8 @@ const { replaceValueDeep, deepClone } = require('./utils')
|
|
|
12
12
|
const mainConfig = require('./config')
|
|
13
13
|
const output = require('./output')
|
|
14
14
|
const event = require('./event')
|
|
15
|
-
const {
|
|
15
|
+
const { deserializeTest } = require('./mocha/test')
|
|
16
|
+
const { deserializeSuite } = require('./mocha/suite')
|
|
16
17
|
const recorder = require('./recorder')
|
|
17
18
|
const runHook = require('./hooks')
|
|
18
19
|
const WorkerStorage = require('./workerStorage')
|
|
@@ -230,17 +231,10 @@ class Workers extends EventEmitter {
|
|
|
230
231
|
super()
|
|
231
232
|
this.setMaxListeners(50)
|
|
232
233
|
this.codecept = initializeCodecept(config.testConfig, config.options)
|
|
233
|
-
this.failuresLog = []
|
|
234
234
|
this.errors = []
|
|
235
235
|
this.numberOfWorkers = 0
|
|
236
236
|
this.closedWorkers = 0
|
|
237
237
|
this.workers = []
|
|
238
|
-
this.stats = {
|
|
239
|
-
passes: 0,
|
|
240
|
-
failures: 0,
|
|
241
|
-
tests: 0,
|
|
242
|
-
pending: 0,
|
|
243
|
-
}
|
|
244
238
|
this.testGroups = []
|
|
245
239
|
|
|
246
240
|
createOutputDir(config.testConfig)
|
|
@@ -353,8 +347,6 @@ class Workers extends EventEmitter {
|
|
|
353
347
|
}
|
|
354
348
|
|
|
355
349
|
run() {
|
|
356
|
-
this.stats.start = new Date()
|
|
357
|
-
this.stats.failedHooks = 0
|
|
358
350
|
recorder.startUnlessRunning()
|
|
359
351
|
event.dispatcher.emit(event.workers.before)
|
|
360
352
|
process.env.RUNS_WITH_WORKERS = 'true'
|
|
@@ -380,7 +372,7 @@ class Workers extends EventEmitter {
|
|
|
380
372
|
* @returns {Boolean}
|
|
381
373
|
*/
|
|
382
374
|
isFailed() {
|
|
383
|
-
return (
|
|
375
|
+
return (Container.result().failures.length || this.errors.length) > 0
|
|
384
376
|
}
|
|
385
377
|
|
|
386
378
|
_listenWorkerEvents(worker) {
|
|
@@ -393,33 +385,37 @@ class Workers extends EventEmitter {
|
|
|
393
385
|
}
|
|
394
386
|
|
|
395
387
|
switch (message.event) {
|
|
396
|
-
case event.all.
|
|
397
|
-
|
|
398
|
-
|
|
388
|
+
case event.all.result:
|
|
389
|
+
// we ensure consistency of result by adding tests in the very end
|
|
390
|
+
Container.result().addFailures(message.data.failures)
|
|
391
|
+
Container.result().addStats(message.data.stats)
|
|
392
|
+
message.data.tests.forEach(test => {
|
|
393
|
+
Container.result().addTest(deserializeTest(test))
|
|
394
|
+
})
|
|
399
395
|
break
|
|
400
396
|
case event.suite.before:
|
|
401
|
-
this.emit(event.suite.before,
|
|
397
|
+
this.emit(event.suite.before, deserializeSuite(message.data))
|
|
402
398
|
break
|
|
403
399
|
case event.test.before:
|
|
404
|
-
this.emit(event.test.before,
|
|
400
|
+
this.emit(event.test.before, deserializeTest(message.data))
|
|
405
401
|
break
|
|
406
402
|
case event.test.started:
|
|
407
|
-
this.emit(event.test.started,
|
|
403
|
+
this.emit(event.test.started, deserializeTest(message.data))
|
|
408
404
|
break
|
|
409
405
|
case event.test.failed:
|
|
410
|
-
this.emit(event.test.failed,
|
|
406
|
+
this.emit(event.test.failed, deserializeTest(message.data))
|
|
411
407
|
break
|
|
412
408
|
case event.test.passed:
|
|
413
|
-
this.emit(event.test.passed,
|
|
409
|
+
this.emit(event.test.passed, deserializeTest(message.data))
|
|
414
410
|
break
|
|
415
411
|
case event.test.skipped:
|
|
416
|
-
this.emit(event.test.skipped,
|
|
412
|
+
this.emit(event.test.skipped, deserializeTest(message.data))
|
|
417
413
|
break
|
|
418
414
|
case event.test.finished:
|
|
419
|
-
this.emit(event.test.finished,
|
|
415
|
+
this.emit(event.test.finished, deserializeTest(message.data))
|
|
420
416
|
break
|
|
421
417
|
case event.test.after:
|
|
422
|
-
this.emit(event.test.after,
|
|
418
|
+
this.emit(event.test.after, deserializeTest(message.data))
|
|
423
419
|
break
|
|
424
420
|
case event.step.finished:
|
|
425
421
|
this.emit(event.step.finished, message.data)
|
|
@@ -431,7 +427,7 @@ class Workers extends EventEmitter {
|
|
|
431
427
|
this.emit(event.step.passed, message.data)
|
|
432
428
|
break
|
|
433
429
|
case event.step.failed:
|
|
434
|
-
this.emit(event.step.failed, message.data)
|
|
430
|
+
this.emit(event.step.failed, message.data, message.data.error)
|
|
435
431
|
break
|
|
436
432
|
}
|
|
437
433
|
})
|
|
@@ -450,33 +446,26 @@ class Workers extends EventEmitter {
|
|
|
450
446
|
|
|
451
447
|
_finishRun() {
|
|
452
448
|
event.dispatcher.emit(event.workers.after, { tests: this.workers.map(worker => worker.tests) })
|
|
453
|
-
if (
|
|
449
|
+
if (Container.result().hasFailed) {
|
|
454
450
|
process.exitCode = 1
|
|
455
451
|
} else {
|
|
456
452
|
process.exitCode = 0
|
|
457
453
|
}
|
|
458
|
-
// removed this.finishedTests because in all /lib only first argument (!this.isFailed()) is used)
|
|
459
|
-
this.emit(event.all.result, !this.isFailed())
|
|
460
|
-
this.emit('end') // internal event
|
|
461
|
-
}
|
|
462
454
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
this.
|
|
466
|
-
this.stats.tests += newStats.tests
|
|
467
|
-
this.stats.pending += newStats.pending
|
|
468
|
-
this.stats.failedHooks += newStats.failedHooks
|
|
455
|
+
this.emit(event.all.result, Container.result())
|
|
456
|
+
event.dispatcher.emit(event.workers.result, Container.result())
|
|
457
|
+
this.emit('end') // internal event
|
|
469
458
|
}
|
|
470
459
|
|
|
471
460
|
printResults() {
|
|
472
|
-
|
|
473
|
-
|
|
461
|
+
const result = Container.result()
|
|
462
|
+
result.finish()
|
|
474
463
|
|
|
475
464
|
// Reset process for logs in main thread
|
|
476
465
|
output.process(null)
|
|
477
466
|
output.print()
|
|
478
467
|
|
|
479
|
-
this.failuresLog =
|
|
468
|
+
this.failuresLog = result.failures
|
|
480
469
|
.filter(log => log.length && typeof log[1] === 'number')
|
|
481
470
|
// mocha/lib/reporters/base.js
|
|
482
471
|
.map(([format, num, title, message, stack], i) => [format, i + 1, title, message, stack])
|
|
@@ -487,7 +476,8 @@ class Workers extends EventEmitter {
|
|
|
487
476
|
this.failuresLog.forEach(log => output.print(...log))
|
|
488
477
|
}
|
|
489
478
|
|
|
490
|
-
output.result(
|
|
479
|
+
output.result(result.stats.passes, result.stats.failures, result.stats.pending, ms(result.duration), result.stats.failedHooks)
|
|
480
|
+
|
|
491
481
|
process.env.RUNS_WITH_WORKERS = 'false'
|
|
492
482
|
}
|
|
493
483
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeceptjs",
|
|
3
|
-
"version": "3.7.0-beta.
|
|
3
|
+
"version": "3.7.0-beta.9",
|
|
4
4
|
"description": "Supercharged End 2 End Testing Framework for NodeJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"acceptance",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@cucumber/cucumber-expressions": "18",
|
|
80
80
|
"@cucumber/gherkin": "30",
|
|
81
81
|
"@cucumber/messages": "27.0.2",
|
|
82
|
-
"@xmldom/xmldom": "0.9.
|
|
82
|
+
"@xmldom/xmldom": "0.9.7",
|
|
83
83
|
"acorn": "8.14.0",
|
|
84
84
|
"arrify": "3.0.0",
|
|
85
85
|
"axios": "1.7.9",
|
|
@@ -93,8 +93,9 @@
|
|
|
93
93
|
"escape-string-regexp": "4.0.0",
|
|
94
94
|
"figures": "3.2.0",
|
|
95
95
|
"fn-args": "4.0.0",
|
|
96
|
+
"fs-extra": "11.3.0",
|
|
96
97
|
"fs-extra": "11.2.0",
|
|
97
|
-
"glob": "
|
|
98
|
+
"glob": "^11.0.1",
|
|
98
99
|
"fuse.js": "^7.0.0",
|
|
99
100
|
"html-minifier-terser": "7.2.0",
|
|
100
101
|
"inquirer": "6.5.2",
|
|
@@ -105,7 +106,7 @@
|
|
|
105
106
|
"lodash.merge": "4.6.2",
|
|
106
107
|
"mkdirp": "3.0.1",
|
|
107
108
|
"mocha": "11.1.0",
|
|
108
|
-
"monocart-coverage-reports": "2.
|
|
109
|
+
"monocart-coverage-reports": "2.12.0",
|
|
109
110
|
"ms": "2.1.3",
|
|
110
111
|
"ora-classic": "5.4.2",
|
|
111
112
|
"parse-function": "5.6.10",
|
|
@@ -133,7 +134,7 @@
|
|
|
133
134
|
"@wdio/sauce-service": "9.5.7",
|
|
134
135
|
"@wdio/selenium-standalone-service": "8.15.0",
|
|
135
136
|
"@wdio/utils": "9.5.0",
|
|
136
|
-
"@xmldom/xmldom": "0.9.
|
|
137
|
+
"@xmldom/xmldom": "0.9.7",
|
|
137
138
|
"chai": "^4.0.0",
|
|
138
139
|
"chai-as-promised": "7.1.2",
|
|
139
140
|
"chai-subset": "1.6.0",
|
|
@@ -154,7 +155,7 @@
|
|
|
154
155
|
"json-server": "0.17.4",
|
|
155
156
|
"playwright": "1.49.1",
|
|
156
157
|
"prettier": "^3.3.2",
|
|
157
|
-
"puppeteer": "24.
|
|
158
|
+
"puppeteer": "24.1.0",
|
|
158
159
|
"qrcode-terminal": "0.12.0",
|
|
159
160
|
"rosie": "2.1.1",
|
|
160
161
|
"runok": "0.9.3",
|
|
@@ -1204,6 +1204,19 @@ declare namespace CodeceptJS {
|
|
|
1204
1204
|
// @ts-ignore
|
|
1205
1205
|
// @ts-ignore
|
|
1206
1206
|
// @ts-ignore
|
|
1207
|
+
// @ts-ignore
|
|
1208
|
+
// @ts-ignore
|
|
1209
|
+
// @ts-ignore
|
|
1210
|
+
// @ts-ignore
|
|
1211
|
+
// @ts-ignore
|
|
1212
|
+
// @ts-ignore
|
|
1213
|
+
// @ts-ignore
|
|
1214
|
+
// @ts-ignore
|
|
1215
|
+
// @ts-ignore
|
|
1216
|
+
// @ts-ignore
|
|
1217
|
+
// @ts-ignore
|
|
1218
|
+
// @ts-ignore
|
|
1219
|
+
// @ts-ignore
|
|
1207
1220
|
class ExpectHelper {
|
|
1208
1221
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1209
1222
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
@@ -1321,6 +1334,19 @@ declare namespace CodeceptJS {
|
|
|
1321
1334
|
// @ts-ignore
|
|
1322
1335
|
// @ts-ignore
|
|
1323
1336
|
// @ts-ignore
|
|
1337
|
+
// @ts-ignore
|
|
1338
|
+
// @ts-ignore
|
|
1339
|
+
// @ts-ignore
|
|
1340
|
+
// @ts-ignore
|
|
1341
|
+
// @ts-ignore
|
|
1342
|
+
// @ts-ignore
|
|
1343
|
+
// @ts-ignore
|
|
1344
|
+
// @ts-ignore
|
|
1345
|
+
// @ts-ignore
|
|
1346
|
+
// @ts-ignore
|
|
1347
|
+
// @ts-ignore
|
|
1348
|
+
// @ts-ignore
|
|
1349
|
+
// @ts-ignore
|
|
1324
1350
|
class ExpectHelper {
|
|
1325
1351
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1326
1352
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
@@ -1999,6 +2025,19 @@ declare namespace CodeceptJS {
|
|
|
1999
2025
|
// @ts-ignore
|
|
2000
2026
|
// @ts-ignore
|
|
2001
2027
|
// @ts-ignore
|
|
2028
|
+
// @ts-ignore
|
|
2029
|
+
// @ts-ignore
|
|
2030
|
+
// @ts-ignore
|
|
2031
|
+
// @ts-ignore
|
|
2032
|
+
// @ts-ignore
|
|
2033
|
+
// @ts-ignore
|
|
2034
|
+
// @ts-ignore
|
|
2035
|
+
// @ts-ignore
|
|
2036
|
+
// @ts-ignore
|
|
2037
|
+
// @ts-ignore
|
|
2038
|
+
// @ts-ignore
|
|
2039
|
+
// @ts-ignore
|
|
2040
|
+
// @ts-ignore
|
|
2002
2041
|
type MockServerConfig = {
|
|
2003
2042
|
port?: number;
|
|
2004
2043
|
host?: string;
|
|
@@ -2129,6 +2168,19 @@ declare namespace CodeceptJS {
|
|
|
2129
2168
|
// @ts-ignore
|
|
2130
2169
|
// @ts-ignore
|
|
2131
2170
|
// @ts-ignore
|
|
2171
|
+
// @ts-ignore
|
|
2172
|
+
// @ts-ignore
|
|
2173
|
+
// @ts-ignore
|
|
2174
|
+
// @ts-ignore
|
|
2175
|
+
// @ts-ignore
|
|
2176
|
+
// @ts-ignore
|
|
2177
|
+
// @ts-ignore
|
|
2178
|
+
// @ts-ignore
|
|
2179
|
+
// @ts-ignore
|
|
2180
|
+
// @ts-ignore
|
|
2181
|
+
// @ts-ignore
|
|
2182
|
+
// @ts-ignore
|
|
2183
|
+
// @ts-ignore
|
|
2132
2184
|
class MockServer {
|
|
2133
2185
|
/**
|
|
2134
2186
|
* Start the mock server
|
|
@@ -3208,6 +3260,19 @@ declare namespace CodeceptJS {
|
|
|
3208
3260
|
// @ts-ignore
|
|
3209
3261
|
// @ts-ignore
|
|
3210
3262
|
// @ts-ignore
|
|
3263
|
+
// @ts-ignore
|
|
3264
|
+
// @ts-ignore
|
|
3265
|
+
// @ts-ignore
|
|
3266
|
+
// @ts-ignore
|
|
3267
|
+
// @ts-ignore
|
|
3268
|
+
// @ts-ignore
|
|
3269
|
+
// @ts-ignore
|
|
3270
|
+
// @ts-ignore
|
|
3271
|
+
// @ts-ignore
|
|
3272
|
+
// @ts-ignore
|
|
3273
|
+
// @ts-ignore
|
|
3274
|
+
// @ts-ignore
|
|
3275
|
+
// @ts-ignore
|
|
3211
3276
|
type PlaywrightConfig = {
|
|
3212
3277
|
url?: string;
|
|
3213
3278
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -6590,6 +6655,19 @@ declare namespace CodeceptJS {
|
|
|
6590
6655
|
// @ts-ignore
|
|
6591
6656
|
// @ts-ignore
|
|
6592
6657
|
// @ts-ignore
|
|
6658
|
+
// @ts-ignore
|
|
6659
|
+
// @ts-ignore
|
|
6660
|
+
// @ts-ignore
|
|
6661
|
+
// @ts-ignore
|
|
6662
|
+
// @ts-ignore
|
|
6663
|
+
// @ts-ignore
|
|
6664
|
+
// @ts-ignore
|
|
6665
|
+
// @ts-ignore
|
|
6666
|
+
// @ts-ignore
|
|
6667
|
+
// @ts-ignore
|
|
6668
|
+
// @ts-ignore
|
|
6669
|
+
// @ts-ignore
|
|
6670
|
+
// @ts-ignore
|
|
6593
6671
|
type PuppeteerConfig = {
|
|
6594
6672
|
url: string;
|
|
6595
6673
|
basicAuth?: any;
|
|
@@ -8402,6 +8480,19 @@ declare namespace CodeceptJS {
|
|
|
8402
8480
|
// @ts-ignore
|
|
8403
8481
|
// @ts-ignore
|
|
8404
8482
|
// @ts-ignore
|
|
8483
|
+
// @ts-ignore
|
|
8484
|
+
// @ts-ignore
|
|
8485
|
+
// @ts-ignore
|
|
8486
|
+
// @ts-ignore
|
|
8487
|
+
// @ts-ignore
|
|
8488
|
+
// @ts-ignore
|
|
8489
|
+
// @ts-ignore
|
|
8490
|
+
// @ts-ignore
|
|
8491
|
+
// @ts-ignore
|
|
8492
|
+
// @ts-ignore
|
|
8493
|
+
// @ts-ignore
|
|
8494
|
+
// @ts-ignore
|
|
8495
|
+
// @ts-ignore
|
|
8405
8496
|
type RESTConfig = {
|
|
8406
8497
|
endpoint?: string;
|
|
8407
8498
|
prettyPrintJson?: boolean;
|
|
@@ -9796,6 +9887,19 @@ declare namespace CodeceptJS {
|
|
|
9796
9887
|
// @ts-ignore
|
|
9797
9888
|
// @ts-ignore
|
|
9798
9889
|
// @ts-ignore
|
|
9890
|
+
// @ts-ignore
|
|
9891
|
+
// @ts-ignore
|
|
9892
|
+
// @ts-ignore
|
|
9893
|
+
// @ts-ignore
|
|
9894
|
+
// @ts-ignore
|
|
9895
|
+
// @ts-ignore
|
|
9896
|
+
// @ts-ignore
|
|
9897
|
+
// @ts-ignore
|
|
9898
|
+
// @ts-ignore
|
|
9899
|
+
// @ts-ignore
|
|
9900
|
+
// @ts-ignore
|
|
9901
|
+
// @ts-ignore
|
|
9902
|
+
// @ts-ignore
|
|
9799
9903
|
type WebDriverConfig = {
|
|
9800
9904
|
url: string;
|
|
9801
9905
|
browser: string;
|
package/typings/types.d.ts
CHANGED
|
@@ -1228,6 +1228,19 @@ declare namespace CodeceptJS {
|
|
|
1228
1228
|
// @ts-ignore
|
|
1229
1229
|
// @ts-ignore
|
|
1230
1230
|
// @ts-ignore
|
|
1231
|
+
// @ts-ignore
|
|
1232
|
+
// @ts-ignore
|
|
1233
|
+
// @ts-ignore
|
|
1234
|
+
// @ts-ignore
|
|
1235
|
+
// @ts-ignore
|
|
1236
|
+
// @ts-ignore
|
|
1237
|
+
// @ts-ignore
|
|
1238
|
+
// @ts-ignore
|
|
1239
|
+
// @ts-ignore
|
|
1240
|
+
// @ts-ignore
|
|
1241
|
+
// @ts-ignore
|
|
1242
|
+
// @ts-ignore
|
|
1243
|
+
// @ts-ignore
|
|
1231
1244
|
class ExpectHelper {
|
|
1232
1245
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1233
1246
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
@@ -1345,6 +1358,19 @@ declare namespace CodeceptJS {
|
|
|
1345
1358
|
// @ts-ignore
|
|
1346
1359
|
// @ts-ignore
|
|
1347
1360
|
// @ts-ignore
|
|
1361
|
+
// @ts-ignore
|
|
1362
|
+
// @ts-ignore
|
|
1363
|
+
// @ts-ignore
|
|
1364
|
+
// @ts-ignore
|
|
1365
|
+
// @ts-ignore
|
|
1366
|
+
// @ts-ignore
|
|
1367
|
+
// @ts-ignore
|
|
1368
|
+
// @ts-ignore
|
|
1369
|
+
// @ts-ignore
|
|
1370
|
+
// @ts-ignore
|
|
1371
|
+
// @ts-ignore
|
|
1372
|
+
// @ts-ignore
|
|
1373
|
+
// @ts-ignore
|
|
1348
1374
|
class ExpectHelper {
|
|
1349
1375
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1350
1376
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
@@ -2026,6 +2052,19 @@ declare namespace CodeceptJS {
|
|
|
2026
2052
|
// @ts-ignore
|
|
2027
2053
|
// @ts-ignore
|
|
2028
2054
|
// @ts-ignore
|
|
2055
|
+
// @ts-ignore
|
|
2056
|
+
// @ts-ignore
|
|
2057
|
+
// @ts-ignore
|
|
2058
|
+
// @ts-ignore
|
|
2059
|
+
// @ts-ignore
|
|
2060
|
+
// @ts-ignore
|
|
2061
|
+
// @ts-ignore
|
|
2062
|
+
// @ts-ignore
|
|
2063
|
+
// @ts-ignore
|
|
2064
|
+
// @ts-ignore
|
|
2065
|
+
// @ts-ignore
|
|
2066
|
+
// @ts-ignore
|
|
2067
|
+
// @ts-ignore
|
|
2029
2068
|
type MockServerConfig = {
|
|
2030
2069
|
port?: number;
|
|
2031
2070
|
host?: string;
|
|
@@ -2156,6 +2195,19 @@ declare namespace CodeceptJS {
|
|
|
2156
2195
|
// @ts-ignore
|
|
2157
2196
|
// @ts-ignore
|
|
2158
2197
|
// @ts-ignore
|
|
2198
|
+
// @ts-ignore
|
|
2199
|
+
// @ts-ignore
|
|
2200
|
+
// @ts-ignore
|
|
2201
|
+
// @ts-ignore
|
|
2202
|
+
// @ts-ignore
|
|
2203
|
+
// @ts-ignore
|
|
2204
|
+
// @ts-ignore
|
|
2205
|
+
// @ts-ignore
|
|
2206
|
+
// @ts-ignore
|
|
2207
|
+
// @ts-ignore
|
|
2208
|
+
// @ts-ignore
|
|
2209
|
+
// @ts-ignore
|
|
2210
|
+
// @ts-ignore
|
|
2159
2211
|
class MockServer {
|
|
2160
2212
|
/**
|
|
2161
2213
|
* Start the mock server
|
|
@@ -3301,6 +3353,19 @@ declare namespace CodeceptJS {
|
|
|
3301
3353
|
// @ts-ignore
|
|
3302
3354
|
// @ts-ignore
|
|
3303
3355
|
// @ts-ignore
|
|
3356
|
+
// @ts-ignore
|
|
3357
|
+
// @ts-ignore
|
|
3358
|
+
// @ts-ignore
|
|
3359
|
+
// @ts-ignore
|
|
3360
|
+
// @ts-ignore
|
|
3361
|
+
// @ts-ignore
|
|
3362
|
+
// @ts-ignore
|
|
3363
|
+
// @ts-ignore
|
|
3364
|
+
// @ts-ignore
|
|
3365
|
+
// @ts-ignore
|
|
3366
|
+
// @ts-ignore
|
|
3367
|
+
// @ts-ignore
|
|
3368
|
+
// @ts-ignore
|
|
3304
3369
|
type PlaywrightConfig = {
|
|
3305
3370
|
url?: string;
|
|
3306
3371
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -6834,6 +6899,19 @@ declare namespace CodeceptJS {
|
|
|
6834
6899
|
// @ts-ignore
|
|
6835
6900
|
// @ts-ignore
|
|
6836
6901
|
// @ts-ignore
|
|
6902
|
+
// @ts-ignore
|
|
6903
|
+
// @ts-ignore
|
|
6904
|
+
// @ts-ignore
|
|
6905
|
+
// @ts-ignore
|
|
6906
|
+
// @ts-ignore
|
|
6907
|
+
// @ts-ignore
|
|
6908
|
+
// @ts-ignore
|
|
6909
|
+
// @ts-ignore
|
|
6910
|
+
// @ts-ignore
|
|
6911
|
+
// @ts-ignore
|
|
6912
|
+
// @ts-ignore
|
|
6913
|
+
// @ts-ignore
|
|
6914
|
+
// @ts-ignore
|
|
6837
6915
|
type PuppeteerConfig = {
|
|
6838
6916
|
url: string;
|
|
6839
6917
|
basicAuth?: any;
|
|
@@ -8782,6 +8860,19 @@ declare namespace CodeceptJS {
|
|
|
8782
8860
|
// @ts-ignore
|
|
8783
8861
|
// @ts-ignore
|
|
8784
8862
|
// @ts-ignore
|
|
8863
|
+
// @ts-ignore
|
|
8864
|
+
// @ts-ignore
|
|
8865
|
+
// @ts-ignore
|
|
8866
|
+
// @ts-ignore
|
|
8867
|
+
// @ts-ignore
|
|
8868
|
+
// @ts-ignore
|
|
8869
|
+
// @ts-ignore
|
|
8870
|
+
// @ts-ignore
|
|
8871
|
+
// @ts-ignore
|
|
8872
|
+
// @ts-ignore
|
|
8873
|
+
// @ts-ignore
|
|
8874
|
+
// @ts-ignore
|
|
8875
|
+
// @ts-ignore
|
|
8785
8876
|
type RESTConfig = {
|
|
8786
8877
|
endpoint?: string;
|
|
8787
8878
|
prettyPrintJson?: boolean;
|
|
@@ -10236,6 +10327,19 @@ declare namespace CodeceptJS {
|
|
|
10236
10327
|
// @ts-ignore
|
|
10237
10328
|
// @ts-ignore
|
|
10238
10329
|
// @ts-ignore
|
|
10330
|
+
// @ts-ignore
|
|
10331
|
+
// @ts-ignore
|
|
10332
|
+
// @ts-ignore
|
|
10333
|
+
// @ts-ignore
|
|
10334
|
+
// @ts-ignore
|
|
10335
|
+
// @ts-ignore
|
|
10336
|
+
// @ts-ignore
|
|
10337
|
+
// @ts-ignore
|
|
10338
|
+
// @ts-ignore
|
|
10339
|
+
// @ts-ignore
|
|
10340
|
+
// @ts-ignore
|
|
10341
|
+
// @ts-ignore
|
|
10342
|
+
// @ts-ignore
|
|
10239
10343
|
type WebDriverConfig = {
|
|
10240
10344
|
url: string;
|
|
10241
10345
|
browser: string;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const event = require('../event')
|
|
2
|
-
const recorder = require('../recorder')
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Create and clean up empty artifacts
|
|
6
|
-
*/
|
|
7
|
-
module.exports = function () {
|
|
8
|
-
event.dispatcher.on(event.test.before, test => {
|
|
9
|
-
test.artifacts = {}
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
event.dispatcher.on(event.test.after, test => {
|
|
13
|
-
recorder.add('clean up empty artifacts', () => {
|
|
14
|
-
for (const key in test.artifacts || {}) {
|
|
15
|
-
if (!test.artifacts[key]) delete test.artifacts[key]
|
|
16
|
-
}
|
|
17
|
-
})
|
|
18
|
-
})
|
|
19
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
const Container = require('../container')
|
|
2
|
-
const recorder = require('../recorder')
|
|
3
|
-
const event = require('../event')
|
|
4
|
-
const supportedHelpers = require('./standardActingHelpers')
|
|
5
|
-
const { scanForErrorMessages } = require('../html')
|
|
6
|
-
const { output } = require('..')
|
|
7
|
-
|
|
8
|
-
const defaultConfig = {
|
|
9
|
-
errorClasses: ['error', 'warning', 'alert', 'danger'],
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Prints errors found in HTML code after each failed test.
|
|
14
|
-
*
|
|
15
|
-
* It scans HTML and searches for elements with error classes.
|
|
16
|
-
* If an element found prints a text from it to console and adds as artifact to the test.
|
|
17
|
-
*
|
|
18
|
-
* Enable this plugin in config:
|
|
19
|
-
*
|
|
20
|
-
* ```js
|
|
21
|
-
* plugins: {
|
|
22
|
-
* debugErrors: {
|
|
23
|
-
* enabled: true,
|
|
24
|
-
* }
|
|
25
|
-
* ```
|
|
26
|
-
*
|
|
27
|
-
* Additional config options:
|
|
28
|
-
*
|
|
29
|
-
* * `errorClasses` - list of classes to search for errors (default: `['error', 'warning', 'alert', 'danger']`)
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
module.exports = function (config = {}) {
|
|
33
|
-
const helpers = Container.helpers()
|
|
34
|
-
let helper
|
|
35
|
-
|
|
36
|
-
config = Object.assign(defaultConfig, config)
|
|
37
|
-
|
|
38
|
-
for (const helperName of supportedHelpers) {
|
|
39
|
-
if (Object.keys(helpers).indexOf(helperName) > -1) {
|
|
40
|
-
helper = helpers[helperName]
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (!helper) return // no helpers for screenshot
|
|
45
|
-
|
|
46
|
-
event.dispatcher.on(event.test.failed, test => {
|
|
47
|
-
recorder.add('HTML snapshot failed test', async () => {
|
|
48
|
-
try {
|
|
49
|
-
const currentOutputLevel = output.level()
|
|
50
|
-
output.level(0)
|
|
51
|
-
const html = await helper.grabHTMLFrom('body')
|
|
52
|
-
output.level(currentOutputLevel)
|
|
53
|
-
|
|
54
|
-
if (!html) return
|
|
55
|
-
|
|
56
|
-
const errors = scanForErrorMessages(html, config.errorClasses)
|
|
57
|
-
if (errors.length) {
|
|
58
|
-
output.debug('Detected errors in HTML code')
|
|
59
|
-
errors.forEach(error => output.debug(error))
|
|
60
|
-
test.artifacts.errors = errors
|
|
61
|
-
}
|
|
62
|
-
} catch (err) {
|
|
63
|
-
// not really needed
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
})
|
|
67
|
-
}
|