codeceptjs 3.6.2 → 3.6.3-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/README.md +1 -1
- package/lib/cli.js +15 -11
- package/lib/command/gherkin/init.js +18 -8
- package/lib/command/utils.js +15 -4
- package/lib/helper/{Expect.js → ExpectHelper.js} +1 -1
- package/lib/helper/Playwright.js +1 -1
- package/lib/helper/Puppeteer.js +3 -3
- package/lib/helper/WebDriver.js +1 -1
- package/lib/plugin/coverage.js +34 -1
- package/lib/plugin/retryTo.js +33 -25
- package/lib/scenario.js +52 -49
- package/package.json +20 -20
- package/typings/promiseBasedTypes.d.ts +165 -1
- package/typings/types.d.ts +165 -1
package/README.md
CHANGED
|
@@ -315,8 +315,8 @@ Thanks all to those who are and will have contributing to this awesome project!
|
|
|
315
315
|
<a href="https://github.com/VikalpP"><img src="https://avatars.githubusercontent.com/u/11846339?v=4" title="VikalpP" width="80" height="80"></a>
|
|
316
316
|
<a href="https://github.com/elaichenkov"><img src="https://avatars.githubusercontent.com/u/29764053?v=4" title="elaichenkov" width="80" height="80"></a>
|
|
317
317
|
<a href="https://github.com/BorisOsipov"><img src="https://avatars.githubusercontent.com/u/6514276?v=4" title="BorisOsipov" width="80" height="80"></a>
|
|
318
|
-
<a href="https://github.com/hubidu"><img src="https://avatars.githubusercontent.com/u/13134082?v=4" title="hubidu" width="80" height="80"></a>
|
|
319
318
|
<a href="https://github.com/nitschSB"><img src="https://avatars.githubusercontent.com/u/39341455?v=4" title="nitschSB" width="80" height="80"></a>
|
|
319
|
+
<a href="https://github.com/hubidu"><img src="https://avatars.githubusercontent.com/u/13134082?v=4" title="hubidu" width="80" height="80"></a>
|
|
320
320
|
<a href="https://github.com/jploskonka"><img src="https://avatars.githubusercontent.com/u/669483?v=4" title="jploskonka" width="80" height="80"></a>
|
|
321
321
|
<a href="https://github.com/ngraf"><img src="https://avatars.githubusercontent.com/u/7094389?v=4" title="ngraf" width="80" height="80"></a>
|
|
322
322
|
<a href="https://github.com/maojunxyz"><img src="https://avatars.githubusercontent.com/u/28778042?v=4" title="maojunxyz" width="80" height="80"></a>
|
package/lib/cli.js
CHANGED
|
@@ -186,20 +186,24 @@ class Cli extends Base {
|
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
stack.
|
|
192
|
-
|
|
189
|
+
try {
|
|
190
|
+
let stack = err.stack ? err.stack.split('\n') : [];
|
|
191
|
+
if (stack[0] && stack[0].includes(err.message)) {
|
|
192
|
+
stack.shift();
|
|
193
|
+
}
|
|
193
194
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
if (output.level() < 3) {
|
|
196
|
+
stack = stack.slice(0, 3);
|
|
197
|
+
}
|
|
197
198
|
|
|
198
|
-
|
|
199
|
+
err.stack = `${stack.join('\n')}\n\n${output.colors.blue(log)}`;
|
|
199
200
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
201
|
+
// clone err object so stack trace adjustments won't affect test other reports
|
|
202
|
+
test.err = err;
|
|
203
|
+
return test;
|
|
204
|
+
} catch (e) {
|
|
205
|
+
throw Error(e);
|
|
206
|
+
}
|
|
203
207
|
});
|
|
204
208
|
|
|
205
209
|
const originalLog = Base.consoleLog;
|
|
@@ -4,7 +4,7 @@ const mkdirp = require('mkdirp');
|
|
|
4
4
|
const output = require('../../output');
|
|
5
5
|
const { fileExists } = require('../../utils');
|
|
6
6
|
const {
|
|
7
|
-
getConfig, getTestRoot, updateConfig, safeFileWrite,
|
|
7
|
+
getConfig, getTestRoot, updateConfig, safeFileWrite, findConfigFile,
|
|
8
8
|
} = require('../utils');
|
|
9
9
|
|
|
10
10
|
const featureFile = `Feature: Business rules
|
|
@@ -26,7 +26,17 @@ Given('I have a defined step', () => {
|
|
|
26
26
|
|
|
27
27
|
module.exports = function (genPath) {
|
|
28
28
|
const testsPath = getTestRoot(genPath);
|
|
29
|
+
const configFile = findConfigFile(testsPath);
|
|
30
|
+
|
|
31
|
+
if (!configFile) {
|
|
32
|
+
output.error(
|
|
33
|
+
"Can't initialize Gherkin. This command must be run in an already initialized project.",
|
|
34
|
+
);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
|
|
29
38
|
const config = getConfig(testsPath);
|
|
39
|
+
const extension = path.extname(configFile).substring(1);
|
|
30
40
|
|
|
31
41
|
output.print('Initializing Gherkin (Cucumber BDD) for CodeceptJS');
|
|
32
42
|
output.print('--------------------------');
|
|
@@ -53,18 +63,18 @@ module.exports = function (genPath) {
|
|
|
53
63
|
output.success(`Created ${dir}, place step definitions into it`);
|
|
54
64
|
}
|
|
55
65
|
|
|
56
|
-
if (safeFileWrite(path.join(dir,
|
|
57
|
-
output.success(
|
|
66
|
+
if (safeFileWrite(path.join(dir, `steps.${extension}`), stepsFile)) {
|
|
67
|
+
output.success(
|
|
68
|
+
`Created sample steps file: step_definitions/steps.${extension}`,
|
|
69
|
+
);
|
|
58
70
|
}
|
|
59
71
|
|
|
60
72
|
config.gherkin = {
|
|
61
|
-
features:
|
|
62
|
-
steps: [
|
|
63
|
-
'./step_definitions/steps.js',
|
|
64
|
-
],
|
|
73
|
+
features: "./features/*.feature",
|
|
74
|
+
steps: [`./step_definitions/steps.${extension}`],
|
|
65
75
|
};
|
|
66
76
|
|
|
67
|
-
updateConfig(testsPath, config);
|
|
77
|
+
updateConfig(testsPath, config, extension);
|
|
68
78
|
|
|
69
79
|
output.success('Gherkin setup is done.');
|
|
70
80
|
output.success('Start writing feature files and implement corresponding steps.');
|
package/lib/command/utils.js
CHANGED
|
@@ -41,15 +41,15 @@ function fail(msg) {
|
|
|
41
41
|
|
|
42
42
|
module.exports.fail = fail;
|
|
43
43
|
|
|
44
|
-
function updateConfig(testsPath, config,
|
|
44
|
+
function updateConfig(testsPath, config, extension) {
|
|
45
45
|
const configFile = path.join(testsPath, `codecept.conf.${extension}`);
|
|
46
46
|
if (!fileExists(configFile)) {
|
|
47
|
-
console.log();
|
|
48
47
|
const msg = `codecept.conf.${extension} config can\'t be updated automatically`;
|
|
48
|
+
console.log();
|
|
49
49
|
console.log(`${output.colors.bold.red(msg)}`);
|
|
50
|
-
console.log('Please update it manually:');
|
|
50
|
+
console.log(`${output.colors.bold.red('Please update it manually:')}`);
|
|
51
51
|
console.log();
|
|
52
|
-
console.log(
|
|
52
|
+
console.log(config);
|
|
53
53
|
console.log();
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
@@ -104,3 +104,14 @@ module.exports.createOutputDir = (config, testRoot) => {
|
|
|
104
104
|
mkdirp.sync(outputDir);
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
|
+
|
|
108
|
+
module.exports.findConfigFile = (testsPath) => {
|
|
109
|
+
const extensions = ['js', 'ts'];
|
|
110
|
+
for (const ext of extensions) {
|
|
111
|
+
const configFile = path.join(testsPath, `codecept.conf.${ext}`);
|
|
112
|
+
if (fileExists(configFile)) {
|
|
113
|
+
return configFile;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
};
|
package/lib/helper/Playwright.js
CHANGED
|
@@ -1981,7 +1981,7 @@ class Playwright extends Helper {
|
|
|
1981
1981
|
*/
|
|
1982
1982
|
async dontSeeCookie(name) {
|
|
1983
1983
|
const cookies = await this.browserContext.cookies();
|
|
1984
|
-
empty(`cookie ${name} to be set`).assert(cookies.filter(c => c.name === name));
|
|
1984
|
+
empty(`cookie ${name} not to be set`).assert(cookies.filter(c => c.name === name));
|
|
1985
1985
|
}
|
|
1986
1986
|
|
|
1987
1987
|
/**
|
package/lib/helper/Puppeteer.js
CHANGED
|
@@ -1627,7 +1627,7 @@ class Puppeteer extends Helper {
|
|
|
1627
1627
|
*/
|
|
1628
1628
|
async dontSeeCookie(name) {
|
|
1629
1629
|
const cookies = await this.page.cookies();
|
|
1630
|
-
empty(`cookie ${name} to be set`).assert(cookies.filter(c => c.name === name));
|
|
1630
|
+
empty(`cookie ${name} not to be set`).assert(cookies.filter(c => c.name === name));
|
|
1631
1631
|
}
|
|
1632
1632
|
|
|
1633
1633
|
/**
|
|
@@ -2472,12 +2472,12 @@ class Puppeteer extends Helper {
|
|
|
2472
2472
|
}
|
|
2473
2473
|
|
|
2474
2474
|
/**
|
|
2475
|
-
* Mocks network request using [`Request Interception`](https://pptr.dev/
|
|
2475
|
+
* Mocks network request using [`Request Interception`](https://pptr.dev/guides/network-interception)
|
|
2476
2476
|
*
|
|
2477
2477
|
* ```js
|
|
2478
2478
|
* I.mockRoute(/(\.png$)|(\.jpg$)/, route => route.abort());
|
|
2479
2479
|
* ```
|
|
2480
|
-
* This method allows intercepting and mocking requests & responses. [Learn more about it](https://pptr.dev/
|
|
2480
|
+
* This method allows intercepting and mocking requests & responses. [Learn more about it](https://pptr.dev/guides/network-interception)
|
|
2481
2481
|
*
|
|
2482
2482
|
* @param {string|RegExp} [url] URL, regex or pattern for to match URL
|
|
2483
2483
|
* @param {function} [handler] a function to process request
|
package/lib/helper/WebDriver.js
CHANGED
|
@@ -642,6 +642,7 @@ class WebDriver extends Helper {
|
|
|
642
642
|
|
|
643
643
|
if (this.options.automationProtocol) {
|
|
644
644
|
this.puppeteerBrowser = await this.browser.getPuppeteer();
|
|
645
|
+
this.page = (await this.puppeteerBrowser.pages())[0];
|
|
645
646
|
}
|
|
646
647
|
|
|
647
648
|
return this.browser;
|
|
@@ -2731,7 +2732,6 @@ class WebDriver extends Helper {
|
|
|
2731
2732
|
this.recording = true;
|
|
2732
2733
|
this.recordedAtLeastOnce = true;
|
|
2733
2734
|
|
|
2734
|
-
this.page = (await this.puppeteerBrowser.pages())[0];
|
|
2735
2735
|
await this.page.setRequestInterception(true);
|
|
2736
2736
|
|
|
2737
2737
|
this.page.on('request', (request) => {
|
package/lib/plugin/coverage.js
CHANGED
|
@@ -11,7 +11,7 @@ const defaultConfig = {
|
|
|
11
11
|
outputDir: 'output/coverage',
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
const supportedHelpers = ['Puppeteer', 'Playwright'];
|
|
14
|
+
const supportedHelpers = ['Puppeteer', 'Playwright', 'WebDriver'];
|
|
15
15
|
|
|
16
16
|
const v8CoverageHelpers = {
|
|
17
17
|
Playwright: {
|
|
@@ -61,6 +61,33 @@ const v8CoverageHelpers = {
|
|
|
61
61
|
await coverageReport.add(coverageList);
|
|
62
62
|
},
|
|
63
63
|
},
|
|
64
|
+
WebDriver: {
|
|
65
|
+
startCoverage: async (page) => {
|
|
66
|
+
await Promise.all([
|
|
67
|
+
page.coverage.startJSCoverage({
|
|
68
|
+
resetOnNavigation: false,
|
|
69
|
+
includeRawScriptCoverage: true,
|
|
70
|
+
}),
|
|
71
|
+
page.coverage.startCSSCoverage({
|
|
72
|
+
resetOnNavigation: false,
|
|
73
|
+
}),
|
|
74
|
+
]);
|
|
75
|
+
},
|
|
76
|
+
takeCoverage: async (page, coverageReport) => {
|
|
77
|
+
const [jsCoverage, cssCoverage] = await Promise.all([
|
|
78
|
+
page.coverage.stopJSCoverage(),
|
|
79
|
+
page.coverage.stopCSSCoverage(),
|
|
80
|
+
]);
|
|
81
|
+
// to raw V8 script coverage
|
|
82
|
+
const coverageList = [...jsCoverage.map((it) => {
|
|
83
|
+
return {
|
|
84
|
+
source: it.text,
|
|
85
|
+
...it.rawScriptCoverage,
|
|
86
|
+
};
|
|
87
|
+
}), ...cssCoverage];
|
|
88
|
+
await coverageReport.add(coverageList);
|
|
89
|
+
},
|
|
90
|
+
},
|
|
64
91
|
};
|
|
65
92
|
|
|
66
93
|
/**
|
|
@@ -109,11 +136,17 @@ module.exports = function (config) {
|
|
|
109
136
|
const debug = debugModule(`codeceptjs:plugin:${helperName.toLowerCase()}Coverage`);
|
|
110
137
|
|
|
111
138
|
const helper = helpers[helperName];
|
|
139
|
+
|
|
140
|
+
if (helperName === 'WebDriver' && !helper.config.devtoolsProtocol) throw Error('Coverage is currently supporting the WebDriver running with Devtools protocol.');
|
|
141
|
+
|
|
112
142
|
const v8Helper = v8CoverageHelpers[helperName];
|
|
113
143
|
|
|
114
144
|
const coverageOptions = {
|
|
115
145
|
...config,
|
|
116
146
|
};
|
|
147
|
+
|
|
148
|
+
if (helperName === 'WebDriver') coverageOptions.coverageProvider = 'v8';
|
|
149
|
+
|
|
117
150
|
const coverageReport = new CoverageReport(coverageOptions);
|
|
118
151
|
coverageReport.cleanCache();
|
|
119
152
|
|
package/lib/plugin/retryTo.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const recorder = require('../recorder');
|
|
2
|
-
const store = require('../store');
|
|
3
2
|
const { debug } = require('../output');
|
|
4
3
|
|
|
5
4
|
const defaultConfig = {
|
|
@@ -73,49 +72,58 @@ const defaultConfig = {
|
|
|
73
72
|
* const retryTo = codeceptjs.container.plugins('retryTo');
|
|
74
73
|
* ```
|
|
75
74
|
*
|
|
76
|
-
*/
|
|
75
|
+
*/
|
|
77
76
|
module.exports = function (config) {
|
|
78
77
|
config = Object.assign(defaultConfig, config);
|
|
78
|
+
function retryTo(callback, maxTries, pollInterval = config.pollInterval) {
|
|
79
|
+
return new Promise((done, reject) => {
|
|
80
|
+
let tries = 1;
|
|
79
81
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
function handleRetryException(err) {
|
|
83
|
+
recorder.throw(err);
|
|
84
|
+
reject(err);
|
|
85
|
+
}
|
|
84
86
|
|
|
85
|
-
function retryTo(callback, maxTries, pollInterval = undefined) {
|
|
86
|
-
let tries = 1;
|
|
87
|
-
if (!pollInterval) pollInterval = config.pollInterval;
|
|
88
|
-
|
|
89
|
-
let err = null;
|
|
90
|
-
|
|
91
|
-
return new Promise((done) => {
|
|
92
87
|
const tryBlock = async () => {
|
|
88
|
+
tries++;
|
|
93
89
|
recorder.session.start(`retryTo ${tries}`);
|
|
94
|
-
|
|
90
|
+
try {
|
|
91
|
+
await callback(tries);
|
|
92
|
+
} catch (err) {
|
|
93
|
+
handleRetryException(err);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Call done if no errors
|
|
95
97
|
recorder.add(() => {
|
|
96
98
|
recorder.session.restore(`retryTo ${tries}`);
|
|
97
99
|
done(null);
|
|
98
100
|
});
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
|
|
102
|
+
// Catch errors and retry
|
|
103
|
+
recorder.session.catch((err) => {
|
|
101
104
|
recorder.session.restore(`retryTo ${tries}`);
|
|
102
|
-
tries++;
|
|
103
105
|
if (tries <= maxTries) {
|
|
104
106
|
debug(`Error ${err}... Retrying`);
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
recorder.add(`retryTo ${tries}`, () =>
|
|
108
|
+
setTimeout(tryBlock, pollInterval)
|
|
109
|
+
);
|
|
108
110
|
} else {
|
|
109
|
-
|
|
111
|
+
// if maxTries reached
|
|
112
|
+
handleRetryException(err);
|
|
110
113
|
}
|
|
111
114
|
});
|
|
112
115
|
};
|
|
113
116
|
|
|
114
|
-
recorder.add('retryTo',
|
|
115
|
-
|
|
117
|
+
recorder.add('retryTo', tryBlock).catch(err => {
|
|
118
|
+
console.error('An error occurred:', err);
|
|
119
|
+
done(null);
|
|
116
120
|
});
|
|
117
|
-
}).then(() => {
|
|
118
|
-
if (err) recorder.throw(err);
|
|
119
121
|
});
|
|
120
122
|
}
|
|
123
|
+
|
|
124
|
+
if (config.registerGlobal) {
|
|
125
|
+
global.retryTo = retryTo;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return retryTo;
|
|
121
129
|
};
|
package/lib/scenario.js
CHANGED
|
@@ -18,6 +18,16 @@ const injectHook = function (inject, suite) {
|
|
|
18
18
|
return recorder.promise();
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
function makeDoneCallableOnce(done) {
|
|
22
|
+
let called = false;
|
|
23
|
+
return function (err) {
|
|
24
|
+
if (called) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
called = true;
|
|
28
|
+
return done(err);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
21
31
|
/**
|
|
22
32
|
* Wraps test function, injects support objects from container,
|
|
23
33
|
* starts promise chain with recorder, performs before/after hooks
|
|
@@ -34,15 +44,17 @@ module.exports.test = (test) => {
|
|
|
34
44
|
test.async = true;
|
|
35
45
|
|
|
36
46
|
test.fn = function (done) {
|
|
47
|
+
const doneFn = makeDoneCallableOnce(done);
|
|
37
48
|
recorder.errHandler((err) => {
|
|
38
49
|
recorder.session.start('teardown');
|
|
39
50
|
recorder.cleanAsyncErr();
|
|
40
|
-
if (test.throws) {
|
|
51
|
+
if (test.throws) {
|
|
52
|
+
// check that test should actually fail
|
|
41
53
|
try {
|
|
42
54
|
assertThrown(err, test.throws);
|
|
43
55
|
event.emit(event.test.passed, test);
|
|
44
56
|
event.emit(event.test.finished, test);
|
|
45
|
-
recorder.add(
|
|
57
|
+
recorder.add(doneFn);
|
|
46
58
|
return;
|
|
47
59
|
} catch (newErr) {
|
|
48
60
|
err = newErr;
|
|
@@ -50,40 +62,26 @@ module.exports.test = (test) => {
|
|
|
50
62
|
}
|
|
51
63
|
event.emit(event.test.failed, test, err);
|
|
52
64
|
event.emit(event.test.finished, test);
|
|
53
|
-
recorder.add(() =>
|
|
65
|
+
recorder.add(() => doneFn(err));
|
|
54
66
|
});
|
|
55
67
|
|
|
56
68
|
if (isAsyncFunction(testFn)) {
|
|
57
69
|
event.emit(event.test.started, test);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
testFn
|
|
71
|
+
.call(test, getInjectedArguments(testFn, test))
|
|
72
|
+
.then(() => {
|
|
73
|
+
recorder.add('fire test.passed', () => {
|
|
74
|
+
event.emit(event.test.passed, test);
|
|
75
|
+
event.emit(event.test.finished, test);
|
|
76
|
+
});
|
|
77
|
+
recorder.add('finish test', doneFn);
|
|
78
|
+
})
|
|
79
|
+
.catch((err) => {
|
|
80
|
+
recorder.throw(err);
|
|
81
|
+
})
|
|
82
|
+
.finally(() => {
|
|
83
|
+
recorder.catch();
|
|
68
84
|
});
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
let injectedArguments;
|
|
72
|
-
try {
|
|
73
|
-
injectedArguments = getInjectedArguments(testFn, test);
|
|
74
|
-
} catch (e) {
|
|
75
|
-
catchError(e);
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
testFn.call(test, injectedArguments).then(() => {
|
|
80
|
-
recorder.add('fire test.passed', () => {
|
|
81
|
-
event.emit(event.test.passed, test);
|
|
82
|
-
event.emit(event.test.finished, test);
|
|
83
|
-
});
|
|
84
|
-
recorder.add('finish test', () => done());
|
|
85
|
-
recorder.catch();
|
|
86
|
-
}).catch(catchError);
|
|
87
85
|
return;
|
|
88
86
|
}
|
|
89
87
|
|
|
@@ -97,7 +95,7 @@ module.exports.test = (test) => {
|
|
|
97
95
|
event.emit(event.test.passed, test);
|
|
98
96
|
event.emit(event.test.finished, test);
|
|
99
97
|
});
|
|
100
|
-
recorder.add('finish test',
|
|
98
|
+
recorder.add('finish test', doneFn);
|
|
101
99
|
recorder.catch();
|
|
102
100
|
}
|
|
103
101
|
};
|
|
@@ -109,13 +107,14 @@ module.exports.test = (test) => {
|
|
|
109
107
|
*/
|
|
110
108
|
module.exports.injected = function (fn, suite, hookName) {
|
|
111
109
|
return function (done) {
|
|
110
|
+
const doneFn = makeDoneCallableOnce(done);
|
|
112
111
|
const errHandler = (err) => {
|
|
113
112
|
recorder.session.start('teardown');
|
|
114
113
|
recorder.cleanAsyncErr();
|
|
115
114
|
event.emit(event.test.failed, suite, err);
|
|
116
115
|
if (hookName === 'after') event.emit(event.test.after, suite);
|
|
117
116
|
if (hookName === 'afterSuite') event.emit(event.suite.after, suite);
|
|
118
|
-
recorder.add(() =>
|
|
117
|
+
recorder.add(() => doneFn(err));
|
|
119
118
|
};
|
|
120
119
|
|
|
121
120
|
recorder.errHandler((err) => {
|
|
@@ -137,28 +136,32 @@ module.exports.injected = function (fn, suite, hookName) {
|
|
|
137
136
|
const opts = suite.opts || {};
|
|
138
137
|
const retries = opts[`retry${ucfirst(hookName)}`] || 0;
|
|
139
138
|
|
|
140
|
-
promiseRetry(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
139
|
+
promiseRetry(
|
|
140
|
+
async (retry, number) => {
|
|
141
|
+
try {
|
|
142
|
+
recorder.startUnlessRunning();
|
|
143
|
+
await fn.call(this, getInjectedArguments(fn));
|
|
144
|
+
await recorder.promise().catch((err) => retry(err));
|
|
145
|
+
} catch (err) {
|
|
146
|
+
retry(err);
|
|
147
|
+
} finally {
|
|
148
|
+
if (number < retries) {
|
|
149
|
+
recorder.stop();
|
|
150
|
+
recorder.start();
|
|
151
|
+
}
|
|
151
152
|
}
|
|
152
|
-
}
|
|
153
|
-
|
|
153
|
+
},
|
|
154
|
+
{ retries },
|
|
155
|
+
)
|
|
154
156
|
.then(() => {
|
|
155
157
|
recorder.add('fire hook.passed', () => event.emit(event.hook.passed, suite));
|
|
156
|
-
recorder.add(`finish ${hookName} hook`,
|
|
158
|
+
recorder.add(`finish ${hookName} hook`, doneFn);
|
|
157
159
|
recorder.catch();
|
|
158
|
-
})
|
|
160
|
+
})
|
|
161
|
+
.catch((e) => {
|
|
159
162
|
recorder.throw(e);
|
|
160
163
|
recorder.catch((e) => {
|
|
161
|
-
const err =
|
|
164
|
+
const err = recorder.getAsyncErr() === null ? e : recorder.getAsyncErr();
|
|
162
165
|
errHandler(err);
|
|
163
166
|
});
|
|
164
167
|
recorder.add('fire hook.failed', () => event.emit(event.hook.failed, suite, e));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeceptjs",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.3-beta.3",
|
|
4
4
|
"description": "Supercharged End 2 End Testing Framework for NodeJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"acceptance",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"@xmldom/xmldom": "0.8.10",
|
|
77
77
|
"acorn": "8.11.3",
|
|
78
78
|
"arrify": "2.0.1",
|
|
79
|
-
"axios": "1.
|
|
80
|
-
"chai": "5.1.
|
|
79
|
+
"axios": "1.7.2",
|
|
80
|
+
"chai": "5.1.1",
|
|
81
81
|
"chai-deep-match": "1.2.1",
|
|
82
82
|
"chai-exclude": "2.1.0",
|
|
83
83
|
"chai-json-schema": "1.5.1",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"cross-spawn": "7.0.3",
|
|
90
90
|
"css-to-xpath": "0.1.0",
|
|
91
91
|
"csstoxpath": "1.6.0",
|
|
92
|
-
"devtools": "8.
|
|
92
|
+
"devtools": "8.38.2",
|
|
93
93
|
"envinfo": "7.11.1",
|
|
94
94
|
"escape-string-regexp": "4.0.0",
|
|
95
95
|
"figures": "3.2.0",
|
|
@@ -104,10 +104,10 @@
|
|
|
104
104
|
"lodash.merge": "4.6.2",
|
|
105
105
|
"mkdirp": "1.0.4",
|
|
106
106
|
"mocha": "10.4.0",
|
|
107
|
-
"monocart-coverage-reports": "2.
|
|
107
|
+
"monocart-coverage-reports": "2.8.3",
|
|
108
108
|
"ms": "2.1.3",
|
|
109
109
|
"ora-classic": "5.4.2",
|
|
110
|
-
"pactum": "3.6.
|
|
110
|
+
"pactum": "3.6.9",
|
|
111
111
|
"parse-function": "5.6.10",
|
|
112
112
|
"parse5": "7.1.2",
|
|
113
113
|
"promise-retry": "1.1.1",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"uuid": "9.0"
|
|
117
117
|
},
|
|
118
118
|
"optionalDependencies": {
|
|
119
|
-
"@codeceptjs/detox-helper": "1.0.
|
|
119
|
+
"@codeceptjs/detox-helper": "1.0.7"
|
|
120
120
|
},
|
|
121
121
|
"devDependencies": {
|
|
122
122
|
"@codeceptjs/mock-request": "0.3.1",
|
|
@@ -131,40 +131,40 @@
|
|
|
131
131
|
"@wdio/utils": "8.36.1",
|
|
132
132
|
"@xmldom/xmldom": "0.8.10",
|
|
133
133
|
"apollo-server-express": "2.25.3",
|
|
134
|
-
"chai-as-promised": "7.1.
|
|
134
|
+
"chai-as-promised": "7.1.2",
|
|
135
135
|
"chai-subset": "1.6.0",
|
|
136
136
|
"contributor-faces": "1.1.0",
|
|
137
137
|
"documentation": "12.3.0",
|
|
138
|
-
"electron": "30.0
|
|
139
|
-
"eslint": "8.
|
|
138
|
+
"electron": "30.1.0",
|
|
139
|
+
"eslint": "8.57.0",
|
|
140
140
|
"eslint-config-airbnb-base": "15.0.0",
|
|
141
141
|
"eslint-plugin-import": "2.29.1",
|
|
142
|
-
"eslint-plugin-mocha": "
|
|
142
|
+
"eslint-plugin-mocha": "10.4.3",
|
|
143
143
|
"expect": "29.7.0",
|
|
144
144
|
"express": "4.19.2",
|
|
145
145
|
"graphql": "14.6.0",
|
|
146
146
|
"husky": "8.0.3",
|
|
147
147
|
"inquirer-test": "2.0.1",
|
|
148
|
-
"jsdoc": "
|
|
148
|
+
"jsdoc": "4.0.3",
|
|
149
149
|
"jsdoc-typeof-plugin": "1.0.0",
|
|
150
150
|
"json-server": "0.10.1",
|
|
151
|
-
"playwright": "1.
|
|
152
|
-
"puppeteer": "22.
|
|
151
|
+
"playwright": "1.44.1",
|
|
152
|
+
"puppeteer": "22.10.0",
|
|
153
153
|
"qrcode-terminal": "0.12.0",
|
|
154
154
|
"rosie": "2.1.1",
|
|
155
155
|
"runok": "0.9.3",
|
|
156
|
-
"sinon": "
|
|
156
|
+
"sinon": "18.0.0",
|
|
157
157
|
"sinon-chai": "3.7.0",
|
|
158
158
|
"testcafe": "3.5.0",
|
|
159
159
|
"ts-morph": "21.0.1",
|
|
160
160
|
"ts-node": "10.9.2",
|
|
161
161
|
"tsd": "^0.31.0",
|
|
162
162
|
"tsd-jsdoc": "2.5.0",
|
|
163
|
-
"typedoc": "0.25.
|
|
164
|
-
"typedoc-plugin-markdown": "
|
|
165
|
-
"typescript": "5.
|
|
163
|
+
"typedoc": "0.25.13",
|
|
164
|
+
"typedoc-plugin-markdown": "4.0.3",
|
|
165
|
+
"typescript": "5.4.5",
|
|
166
166
|
"wdio-docker-service": "1.5.0",
|
|
167
|
-
"webdriverio": "8.
|
|
167
|
+
"webdriverio": "8.38.2",
|
|
168
168
|
"xml2js": "0.6.2",
|
|
169
169
|
"xpath": "0.0.34"
|
|
170
170
|
},
|
|
@@ -179,4 +179,4 @@
|
|
|
179
179
|
"strict": false
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
}
|
|
182
|
+
}
|
|
@@ -1147,13 +1147,15 @@ declare namespace CodeceptJS {
|
|
|
1147
1147
|
* {
|
|
1148
1148
|
* helpers: {
|
|
1149
1149
|
* Playwright: {...},
|
|
1150
|
-
*
|
|
1150
|
+
* ExpectHelper: {},
|
|
1151
1151
|
* }
|
|
1152
1152
|
* }
|
|
1153
1153
|
* ```
|
|
1154
1154
|
*
|
|
1155
1155
|
* ## Methods
|
|
1156
1156
|
*/
|
|
1157
|
+
// @ts-ignore
|
|
1158
|
+
// @ts-ignore
|
|
1157
1159
|
class ExpectHelper {
|
|
1158
1160
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1159
1161
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
@@ -1200,6 +1202,164 @@ declare namespace CodeceptJS {
|
|
|
1200
1202
|
* expects a JSON object matches a provided pattern
|
|
1201
1203
|
*/
|
|
1202
1204
|
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): Promise<any>;
|
|
1205
|
+
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1206
|
+
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1207
|
+
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1208
|
+
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1209
|
+
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): Promise<any>;
|
|
1210
|
+
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): Promise<any>;
|
|
1211
|
+
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): Promise<any>;
|
|
1212
|
+
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): Promise<any>;
|
|
1213
|
+
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): Promise<any>;
|
|
1214
|
+
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): Promise<any>;
|
|
1215
|
+
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): Promise<any>;
|
|
1216
|
+
/**
|
|
1217
|
+
* @param [ajvOptions] - Pass AJV options
|
|
1218
|
+
*/
|
|
1219
|
+
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): Promise<any>;
|
|
1220
|
+
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
|
|
1221
|
+
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
|
|
1222
|
+
expectToBeA(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
|
|
1223
|
+
expectToBeAn(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
|
|
1224
|
+
expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): Promise<any>;
|
|
1225
|
+
expectLengthOf(targetData: any, length: any, customErrorMsg?: any): Promise<any>;
|
|
1226
|
+
expectEmpty(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1227
|
+
expectTrue(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1228
|
+
expectFalse(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1229
|
+
expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): Promise<any>;
|
|
1230
|
+
expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): Promise<any>;
|
|
1231
|
+
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): Promise<any>;
|
|
1232
|
+
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): Promise<any>;
|
|
1233
|
+
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1234
|
+
/**
|
|
1235
|
+
* expects members of two arrays are deeply equal
|
|
1236
|
+
*/
|
|
1237
|
+
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1238
|
+
/**
|
|
1239
|
+
* expects an array to be a superset of another array
|
|
1240
|
+
*/
|
|
1241
|
+
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): Promise<any>;
|
|
1242
|
+
/**
|
|
1243
|
+
* expects members of two JSON objects are deeply equal excluding some properties
|
|
1244
|
+
*/
|
|
1245
|
+
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): Promise<any>;
|
|
1246
|
+
/**
|
|
1247
|
+
* expects a JSON object matches a provided pattern
|
|
1248
|
+
*/
|
|
1249
|
+
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): Promise<any>;
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* This helper allows performing assertions based on Chai.
|
|
1253
|
+
*
|
|
1254
|
+
* ### Examples
|
|
1255
|
+
*
|
|
1256
|
+
* Zero-configuration when paired with other helpers like REST, Playwright:
|
|
1257
|
+
*
|
|
1258
|
+
* ```js
|
|
1259
|
+
* // inside codecept.conf.js
|
|
1260
|
+
* {
|
|
1261
|
+
* helpers: {
|
|
1262
|
+
* Playwright: {...},
|
|
1263
|
+
* ExpectHelper: {},
|
|
1264
|
+
* }
|
|
1265
|
+
* }
|
|
1266
|
+
* ```
|
|
1267
|
+
*
|
|
1268
|
+
* ## Methods
|
|
1269
|
+
*/
|
|
1270
|
+
// @ts-ignore
|
|
1271
|
+
// @ts-ignore
|
|
1272
|
+
class ExpectHelper {
|
|
1273
|
+
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1274
|
+
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1275
|
+
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1276
|
+
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1277
|
+
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): Promise<any>;
|
|
1278
|
+
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): Promise<any>;
|
|
1279
|
+
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): Promise<any>;
|
|
1280
|
+
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): Promise<any>;
|
|
1281
|
+
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): Promise<any>;
|
|
1282
|
+
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): Promise<any>;
|
|
1283
|
+
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): Promise<any>;
|
|
1284
|
+
/**
|
|
1285
|
+
* @param [ajvOptions] - Pass AJV options
|
|
1286
|
+
*/
|
|
1287
|
+
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): Promise<any>;
|
|
1288
|
+
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
|
|
1289
|
+
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
|
|
1290
|
+
expectToBeA(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
|
|
1291
|
+
expectToBeAn(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
|
|
1292
|
+
expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): Promise<any>;
|
|
1293
|
+
expectLengthOf(targetData: any, length: any, customErrorMsg?: any): Promise<any>;
|
|
1294
|
+
expectEmpty(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1295
|
+
expectTrue(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1296
|
+
expectFalse(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1297
|
+
expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): Promise<any>;
|
|
1298
|
+
expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): Promise<any>;
|
|
1299
|
+
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): Promise<any>;
|
|
1300
|
+
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): Promise<any>;
|
|
1301
|
+
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1302
|
+
/**
|
|
1303
|
+
* expects members of two arrays are deeply equal
|
|
1304
|
+
*/
|
|
1305
|
+
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1306
|
+
/**
|
|
1307
|
+
* expects an array to be a superset of another array
|
|
1308
|
+
*/
|
|
1309
|
+
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): Promise<any>;
|
|
1310
|
+
/**
|
|
1311
|
+
* expects members of two JSON objects are deeply equal excluding some properties
|
|
1312
|
+
*/
|
|
1313
|
+
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): Promise<any>;
|
|
1314
|
+
/**
|
|
1315
|
+
* expects a JSON object matches a provided pattern
|
|
1316
|
+
*/
|
|
1317
|
+
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): Promise<any>;
|
|
1318
|
+
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1319
|
+
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1320
|
+
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1321
|
+
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1322
|
+
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): Promise<any>;
|
|
1323
|
+
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): Promise<any>;
|
|
1324
|
+
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): Promise<any>;
|
|
1325
|
+
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): Promise<any>;
|
|
1326
|
+
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): Promise<any>;
|
|
1327
|
+
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): Promise<any>;
|
|
1328
|
+
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): Promise<any>;
|
|
1329
|
+
/**
|
|
1330
|
+
* @param [ajvOptions] - Pass AJV options
|
|
1331
|
+
*/
|
|
1332
|
+
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): Promise<any>;
|
|
1333
|
+
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
|
|
1334
|
+
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): Promise<any>;
|
|
1335
|
+
expectToBeA(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
|
|
1336
|
+
expectToBeAn(targetData: any, type: any, customErrorMsg?: any): Promise<any>;
|
|
1337
|
+
expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): Promise<any>;
|
|
1338
|
+
expectLengthOf(targetData: any, length: any, customErrorMsg?: any): Promise<any>;
|
|
1339
|
+
expectEmpty(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1340
|
+
expectTrue(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1341
|
+
expectFalse(targetData: any, customErrorMsg?: any): Promise<any>;
|
|
1342
|
+
expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): Promise<any>;
|
|
1343
|
+
expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): Promise<any>;
|
|
1344
|
+
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): Promise<any>;
|
|
1345
|
+
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): Promise<any>;
|
|
1346
|
+
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1347
|
+
/**
|
|
1348
|
+
* expects members of two arrays are deeply equal
|
|
1349
|
+
*/
|
|
1350
|
+
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1351
|
+
/**
|
|
1352
|
+
* expects an array to be a superset of another array
|
|
1353
|
+
*/
|
|
1354
|
+
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): Promise<any>;
|
|
1355
|
+
/**
|
|
1356
|
+
* expects members of two JSON objects are deeply equal excluding some properties
|
|
1357
|
+
*/
|
|
1358
|
+
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): Promise<any>;
|
|
1359
|
+
/**
|
|
1360
|
+
* expects a JSON object matches a provided pattern
|
|
1361
|
+
*/
|
|
1362
|
+
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): Promise<any>;
|
|
1203
1363
|
}
|
|
1204
1364
|
/**
|
|
1205
1365
|
* Helper for testing filesystem.
|
|
@@ -1780,6 +1940,8 @@ declare namespace CodeceptJS {
|
|
|
1780
1940
|
* @property [host = "0.0.0.0"] - Mock server host
|
|
1781
1941
|
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1782
1942
|
*/
|
|
1943
|
+
// @ts-ignore
|
|
1944
|
+
// @ts-ignore
|
|
1783
1945
|
type MockServerConfig = {
|
|
1784
1946
|
port?: number;
|
|
1785
1947
|
host?: string;
|
|
@@ -1904,6 +2066,8 @@ declare namespace CodeceptJS {
|
|
|
1904
2066
|
*
|
|
1905
2067
|
* ## Methods
|
|
1906
2068
|
*/
|
|
2069
|
+
// @ts-ignore
|
|
2070
|
+
// @ts-ignore
|
|
1907
2071
|
class MockServer {
|
|
1908
2072
|
/**
|
|
1909
2073
|
* Start the mock server
|
package/typings/types.d.ts
CHANGED
|
@@ -1171,13 +1171,15 @@ declare namespace CodeceptJS {
|
|
|
1171
1171
|
* {
|
|
1172
1172
|
* helpers: {
|
|
1173
1173
|
* Playwright: {...},
|
|
1174
|
-
*
|
|
1174
|
+
* ExpectHelper: {},
|
|
1175
1175
|
* }
|
|
1176
1176
|
* }
|
|
1177
1177
|
* ```
|
|
1178
1178
|
*
|
|
1179
1179
|
* ## Methods
|
|
1180
1180
|
*/
|
|
1181
|
+
// @ts-ignore
|
|
1182
|
+
// @ts-ignore
|
|
1181
1183
|
class ExpectHelper {
|
|
1182
1184
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1183
1185
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
@@ -1224,6 +1226,164 @@ declare namespace CodeceptJS {
|
|
|
1224
1226
|
* expects a JSON object matches a provided pattern
|
|
1225
1227
|
*/
|
|
1226
1228
|
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
|
|
1229
|
+
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1230
|
+
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1231
|
+
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1232
|
+
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1233
|
+
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
|
|
1234
|
+
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
|
|
1235
|
+
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
|
|
1236
|
+
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
|
|
1237
|
+
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
|
|
1238
|
+
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
|
|
1239
|
+
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
|
|
1240
|
+
/**
|
|
1241
|
+
* @param [ajvOptions] - Pass AJV options
|
|
1242
|
+
*/
|
|
1243
|
+
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
|
|
1244
|
+
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1245
|
+
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1246
|
+
expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1247
|
+
expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1248
|
+
expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
|
|
1249
|
+
expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
|
|
1250
|
+
expectEmpty(targetData: any, customErrorMsg?: any): void;
|
|
1251
|
+
expectTrue(targetData: any, customErrorMsg?: any): void;
|
|
1252
|
+
expectFalse(targetData: any, customErrorMsg?: any): void;
|
|
1253
|
+
expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
|
|
1254
|
+
expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
|
|
1255
|
+
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
|
|
1256
|
+
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
|
|
1257
|
+
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1258
|
+
/**
|
|
1259
|
+
* expects members of two arrays are deeply equal
|
|
1260
|
+
*/
|
|
1261
|
+
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1262
|
+
/**
|
|
1263
|
+
* expects an array to be a superset of another array
|
|
1264
|
+
*/
|
|
1265
|
+
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
|
|
1266
|
+
/**
|
|
1267
|
+
* expects members of two JSON objects are deeply equal excluding some properties
|
|
1268
|
+
*/
|
|
1269
|
+
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
|
|
1270
|
+
/**
|
|
1271
|
+
* expects a JSON object matches a provided pattern
|
|
1272
|
+
*/
|
|
1273
|
+
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* This helper allows performing assertions based on Chai.
|
|
1277
|
+
*
|
|
1278
|
+
* ### Examples
|
|
1279
|
+
*
|
|
1280
|
+
* Zero-configuration when paired with other helpers like REST, Playwright:
|
|
1281
|
+
*
|
|
1282
|
+
* ```js
|
|
1283
|
+
* // inside codecept.conf.js
|
|
1284
|
+
* {
|
|
1285
|
+
* helpers: {
|
|
1286
|
+
* Playwright: {...},
|
|
1287
|
+
* ExpectHelper: {},
|
|
1288
|
+
* }
|
|
1289
|
+
* }
|
|
1290
|
+
* ```
|
|
1291
|
+
*
|
|
1292
|
+
* ## Methods
|
|
1293
|
+
*/
|
|
1294
|
+
// @ts-ignore
|
|
1295
|
+
// @ts-ignore
|
|
1296
|
+
class ExpectHelper {
|
|
1297
|
+
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1298
|
+
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1299
|
+
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1300
|
+
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1301
|
+
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
|
|
1302
|
+
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
|
|
1303
|
+
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
|
|
1304
|
+
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
|
|
1305
|
+
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
|
|
1306
|
+
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
|
|
1307
|
+
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
|
|
1308
|
+
/**
|
|
1309
|
+
* @param [ajvOptions] - Pass AJV options
|
|
1310
|
+
*/
|
|
1311
|
+
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
|
|
1312
|
+
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1313
|
+
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1314
|
+
expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1315
|
+
expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1316
|
+
expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
|
|
1317
|
+
expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
|
|
1318
|
+
expectEmpty(targetData: any, customErrorMsg?: any): void;
|
|
1319
|
+
expectTrue(targetData: any, customErrorMsg?: any): void;
|
|
1320
|
+
expectFalse(targetData: any, customErrorMsg?: any): void;
|
|
1321
|
+
expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
|
|
1322
|
+
expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
|
|
1323
|
+
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
|
|
1324
|
+
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
|
|
1325
|
+
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1326
|
+
/**
|
|
1327
|
+
* expects members of two arrays are deeply equal
|
|
1328
|
+
*/
|
|
1329
|
+
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1330
|
+
/**
|
|
1331
|
+
* expects an array to be a superset of another array
|
|
1332
|
+
*/
|
|
1333
|
+
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
|
|
1334
|
+
/**
|
|
1335
|
+
* expects members of two JSON objects are deeply equal excluding some properties
|
|
1336
|
+
*/
|
|
1337
|
+
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
|
|
1338
|
+
/**
|
|
1339
|
+
* expects a JSON object matches a provided pattern
|
|
1340
|
+
*/
|
|
1341
|
+
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
|
|
1342
|
+
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1343
|
+
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1344
|
+
expectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1345
|
+
expectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1346
|
+
expectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: any): void;
|
|
1347
|
+
expectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: any): void;
|
|
1348
|
+
expectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: any): void;
|
|
1349
|
+
expectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: any): void;
|
|
1350
|
+
expectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: any): void;
|
|
1351
|
+
expectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: any): void;
|
|
1352
|
+
expectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: any): void;
|
|
1353
|
+
/**
|
|
1354
|
+
* @param [ajvOptions] - Pass AJV options
|
|
1355
|
+
*/
|
|
1356
|
+
expectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: any, ajvOptions?: any): void;
|
|
1357
|
+
expectHasProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1358
|
+
expectHasAProperty(targetData: any, propertyName: any, customErrorMsg?: any): void;
|
|
1359
|
+
expectToBeA(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1360
|
+
expectToBeAn(targetData: any, type: any, customErrorMsg?: any): void;
|
|
1361
|
+
expectMatchRegex(targetData: any, regex: any, customErrorMsg?: any): void;
|
|
1362
|
+
expectLengthOf(targetData: any, length: any, customErrorMsg?: any): void;
|
|
1363
|
+
expectEmpty(targetData: any, customErrorMsg?: any): void;
|
|
1364
|
+
expectTrue(targetData: any, customErrorMsg?: any): void;
|
|
1365
|
+
expectFalse(targetData: any, customErrorMsg?: any): void;
|
|
1366
|
+
expectAbove(targetData: any, aboveThan: any, customErrorMsg?: any): void;
|
|
1367
|
+
expectBelow(targetData: any, belowThan: any, customErrorMsg?: any): void;
|
|
1368
|
+
expectLengthAboveThan(targetData: any, lengthAboveThan: any, customErrorMsg?: any): void;
|
|
1369
|
+
expectLengthBelowThan(targetData: any, lengthBelowThan: any, customErrorMsg?: any): void;
|
|
1370
|
+
expectEqualIgnoreCase(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1371
|
+
/**
|
|
1372
|
+
* expects members of two arrays are deeply equal
|
|
1373
|
+
*/
|
|
1374
|
+
expectDeepMembers(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1375
|
+
/**
|
|
1376
|
+
* expects an array to be a superset of another array
|
|
1377
|
+
*/
|
|
1378
|
+
expectDeepIncludeMembers(superset: any, set: any, customErrorMsg?: any): void;
|
|
1379
|
+
/**
|
|
1380
|
+
* expects members of two JSON objects are deeply equal excluding some properties
|
|
1381
|
+
*/
|
|
1382
|
+
expectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: any, customErrorMsg?: any): void;
|
|
1383
|
+
/**
|
|
1384
|
+
* expects a JSON object matches a provided pattern
|
|
1385
|
+
*/
|
|
1386
|
+
expectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: any): void;
|
|
1227
1387
|
}
|
|
1228
1388
|
/**
|
|
1229
1389
|
* Helper for testing filesystem.
|
|
@@ -1807,6 +1967,8 @@ declare namespace CodeceptJS {
|
|
|
1807
1967
|
* @property [host = "0.0.0.0"] - Mock server host
|
|
1808
1968
|
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1809
1969
|
*/
|
|
1970
|
+
// @ts-ignore
|
|
1971
|
+
// @ts-ignore
|
|
1810
1972
|
type MockServerConfig = {
|
|
1811
1973
|
port?: number;
|
|
1812
1974
|
host?: string;
|
|
@@ -1931,6 +2093,8 @@ declare namespace CodeceptJS {
|
|
|
1931
2093
|
*
|
|
1932
2094
|
* ## Methods
|
|
1933
2095
|
*/
|
|
2096
|
+
// @ts-ignore
|
|
2097
|
+
// @ts-ignore
|
|
1934
2098
|
class MockServer {
|
|
1935
2099
|
/**
|
|
1936
2100
|
* Start the mock server
|