codeceptjs 3.5.9 → 3.5.11
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 +14 -16
- package/docs/build/Appium.js +49 -49
- package/docs/build/Expect.js +33 -33
- package/docs/build/Nightmare.js +50 -50
- package/docs/build/Playwright.js +239 -133
- package/docs/build/Protractor.js +59 -59
- package/docs/build/Puppeteer.js +127 -107
- package/docs/build/TestCafe.js +48 -48
- package/docs/build/WebDriver.js +112 -93
- package/docs/helpers/Appium.md +3 -3
- package/docs/helpers/Expect.md +33 -33
- package/docs/helpers/Playwright.md +431 -325
- package/docs/helpers/Puppeteer.md +50 -24
- package/docs/helpers/WebDriver.md +41 -13
- package/docs/internal-api.md +1 -0
- package/docs/parallel.md +114 -2
- package/docs/plugins.md +7 -5
- package/docs/react.md +2 -1
- package/docs/vue.md +22 -0
- package/docs/webapi/grabWebElement.mustache +9 -0
- package/docs/webapi/grabWebElements.mustache +9 -0
- package/docs/webapi/scrollIntoView.mustache +1 -1
- package/lib/ai.js +12 -3
- package/lib/colorUtils.js +10 -0
- package/lib/command/run-multiple.js +1 -1
- package/lib/command/run-workers.js +30 -4
- package/lib/command/workers/runTests.js +39 -0
- package/lib/event.js +2 -0
- package/lib/helper/Appium.js +13 -13
- package/lib/helper/Expect.js +33 -33
- package/lib/helper/Playwright.js +125 -37
- package/lib/helper/Puppeteer.js +49 -38
- package/lib/helper/WebDriver.js +29 -19
- package/lib/helper/extras/PlaywrightReactVueLocator.js +38 -0
- package/lib/html.js +3 -3
- package/lib/interfaces/gherkin.js +8 -1
- package/lib/interfaces/scenarioConfig.js +1 -0
- package/lib/locator.js +2 -2
- package/lib/pause.js +6 -3
- package/lib/plugin/autoLogin.js +4 -2
- package/lib/plugin/heal.js +40 -7
- package/lib/plugin/retryFailedStep.js +6 -1
- package/lib/plugin/stepByStepReport.js +2 -2
- package/lib/plugin/tryTo.js +5 -4
- package/lib/recorder.js +12 -5
- package/lib/ui.js +1 -0
- package/lib/workers.js +2 -0
- package/package.json +28 -25
- package/typings/index.d.ts +1 -1
- package/typings/promiseBasedTypes.d.ts +195 -76
- package/typings/types.d.ts +191 -145
- package/lib/helper/extras/PlaywrightReact.js +0 -9
package/lib/ai.js
CHANGED
|
@@ -16,6 +16,8 @@ const htmlConfig = {
|
|
|
16
16
|
html: {},
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
+
const aiInstance = null;
|
|
20
|
+
|
|
19
21
|
class AiAssistant {
|
|
20
22
|
constructor() {
|
|
21
23
|
this.config = config.get('ai', defaultConfig);
|
|
@@ -26,7 +28,10 @@ class AiAssistant {
|
|
|
26
28
|
|
|
27
29
|
this.isEnabled = !!process.env.OPENAI_API_KEY;
|
|
28
30
|
|
|
29
|
-
if (!this.isEnabled)
|
|
31
|
+
if (!this.isEnabled) {
|
|
32
|
+
debug('No OpenAI API key provided. AI assistant is disabled.');
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
30
35
|
|
|
31
36
|
const configuration = new Configuration({
|
|
32
37
|
apiKey: process.env.OPENAI_API_KEY,
|
|
@@ -35,13 +40,17 @@ class AiAssistant {
|
|
|
35
40
|
this.openai = new OpenAIApi(configuration);
|
|
36
41
|
}
|
|
37
42
|
|
|
38
|
-
|
|
43
|
+
static getInstance() {
|
|
44
|
+
return aiInstance || new AiAssistant();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async setHtmlContext(html) {
|
|
39
48
|
let processedHTML = html;
|
|
40
49
|
|
|
41
50
|
if (this.htmlConfig.simplify) {
|
|
42
51
|
processedHTML = removeNonInteractiveElements(processedHTML, this.htmlConfig);
|
|
43
52
|
}
|
|
44
|
-
if (this.htmlConfig.minify) processedHTML = minifyHtml(processedHTML);
|
|
53
|
+
if (this.htmlConfig.minify) processedHTML = await minifyHtml(processedHTML);
|
|
45
54
|
if (this.htmlConfig.maxLength) processedHTML = splitByChunks(processedHTML, this.htmlConfig.maxLength)[0];
|
|
46
55
|
|
|
47
56
|
debug(processedHTML);
|
package/lib/colorUtils.js
CHANGED
|
@@ -226,15 +226,25 @@ function isColorProperty(prop) {
|
|
|
226
226
|
'color',
|
|
227
227
|
'background',
|
|
228
228
|
'backgroundColor',
|
|
229
|
+
'background-color',
|
|
229
230
|
'borderColor',
|
|
231
|
+
'border-color',
|
|
230
232
|
'borderBottomColor',
|
|
233
|
+
'border-bottom-color',
|
|
231
234
|
'borderLeftColor',
|
|
235
|
+
'border-left-color',
|
|
232
236
|
'borderRightColor',
|
|
233
237
|
'borderTopColor',
|
|
234
238
|
'caretColor',
|
|
235
239
|
'columnRuleColor',
|
|
236
240
|
'outlineColor',
|
|
237
241
|
'textDecorationColor',
|
|
242
|
+
'border-right-color',
|
|
243
|
+
'border-top-color',
|
|
244
|
+
'caret-color',
|
|
245
|
+
'column-rule-color',
|
|
246
|
+
'outline-color',
|
|
247
|
+
'text-decoration-color',
|
|
238
248
|
].indexOf(prop) > -1;
|
|
239
249
|
}
|
|
240
250
|
|
|
@@ -124,7 +124,7 @@ function executeRun(runName, runConfig) {
|
|
|
124
124
|
if (browserConfig.outputName) {
|
|
125
125
|
outputDir += typeof browserConfig.outputName === 'function' ? browserConfig.outputName() : browserConfig.outputName;
|
|
126
126
|
} else {
|
|
127
|
-
const hash = crypto.createHash('
|
|
127
|
+
const hash = crypto.createHash('sha256');
|
|
128
128
|
hash.update(JSON.stringify(browserConfig));
|
|
129
129
|
outputDir += hash.digest('hex');
|
|
130
130
|
}
|
|
@@ -7,6 +7,11 @@ const Workers = require('../workers');
|
|
|
7
7
|
module.exports = async function (workerCount, selectedRuns, options) {
|
|
8
8
|
process.env.profile = options.profile;
|
|
9
9
|
|
|
10
|
+
const suiteArr = [];
|
|
11
|
+
const passedTestArr = [];
|
|
12
|
+
const failedTestArr = [];
|
|
13
|
+
const skippedTestArr = [];
|
|
14
|
+
|
|
10
15
|
const { config: testConfig, override = '' } = options;
|
|
11
16
|
const overrideConfigs = tryOrDefault(() => JSON.parse(override), {});
|
|
12
17
|
const by = options.suites ? 'suite' : 'test';
|
|
@@ -26,15 +31,36 @@ module.exports = async function (workerCount, selectedRuns, options) {
|
|
|
26
31
|
|
|
27
32
|
const workers = new Workers(numberOfWorkers, config);
|
|
28
33
|
workers.overrideConfig(overrideConfigs);
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
|
|
35
|
+
workers.on(event.suite.before, (suite) => {
|
|
36
|
+
suiteArr.push(suite);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
workers.on(event.test.failed, (test) => {
|
|
40
|
+
failedTestArr.push(test);
|
|
41
|
+
output.test.failed(test);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
workers.on(event.test.passed, (test) => {
|
|
45
|
+
passedTestArr.push(test);
|
|
46
|
+
output.test.passed(test);
|
|
31
47
|
});
|
|
32
48
|
|
|
33
|
-
workers.on(event.test.
|
|
34
|
-
|
|
49
|
+
workers.on(event.test.skipped, (test) => {
|
|
50
|
+
skippedTestArr.push(test);
|
|
51
|
+
output.test.passed(test);
|
|
35
52
|
});
|
|
36
53
|
|
|
37
54
|
workers.on(event.all.result, () => {
|
|
55
|
+
// expose test stats after all workers finished their execution
|
|
56
|
+
event.dispatcher.emit(event.workers.result, {
|
|
57
|
+
suites: suiteArr,
|
|
58
|
+
tests: {
|
|
59
|
+
passed: passedTestArr,
|
|
60
|
+
failed: failedTestArr,
|
|
61
|
+
skipped: skippedTestArr,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
38
64
|
workers.printResults();
|
|
39
65
|
});
|
|
40
66
|
|
|
@@ -132,9 +132,48 @@ function initializeListeners() {
|
|
|
132
132
|
duration: test.duration || 0,
|
|
133
133
|
err,
|
|
134
134
|
parent,
|
|
135
|
+
steps: test.steps ? simplifyStepsInTestObject(test.steps, err) : [],
|
|
135
136
|
};
|
|
136
137
|
}
|
|
137
138
|
|
|
139
|
+
function simplifyStepsInTestObject(steps, err) {
|
|
140
|
+
steps = [...steps];
|
|
141
|
+
const _steps = [];
|
|
142
|
+
|
|
143
|
+
for (step of steps) {
|
|
144
|
+
const _args = [];
|
|
145
|
+
|
|
146
|
+
if (step.args) {
|
|
147
|
+
for (const arg of step.args) {
|
|
148
|
+
// check if arg is a JOI object
|
|
149
|
+
if (arg && arg.$_root) {
|
|
150
|
+
_args.push(JSON.stringify(arg).slice(0, 300));
|
|
151
|
+
// check if arg is a function
|
|
152
|
+
} else if (arg && typeof arg === 'function') {
|
|
153
|
+
_args.push(arg.name);
|
|
154
|
+
} else {
|
|
155
|
+
_args.push(arg);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
_steps.push({
|
|
161
|
+
actor: step.actor,
|
|
162
|
+
name: step.name,
|
|
163
|
+
status: step.status,
|
|
164
|
+
agrs: _args,
|
|
165
|
+
startedAt: step.startedAt,
|
|
166
|
+
startTime: step.startTime,
|
|
167
|
+
endTime: step.endTime,
|
|
168
|
+
finishedAt: step.finishedAt,
|
|
169
|
+
duration: step.duration,
|
|
170
|
+
err,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return _steps;
|
|
175
|
+
}
|
|
176
|
+
|
|
138
177
|
function simplifyStep(step, err = null) {
|
|
139
178
|
step = { ...step };
|
|
140
179
|
|
package/lib/event.js
CHANGED
|
@@ -127,10 +127,12 @@ module.exports = {
|
|
|
127
127
|
* @inner
|
|
128
128
|
* @property {'workers.before'} before
|
|
129
129
|
* @property {'workers.after'} after
|
|
130
|
+
* @property {'workers.result'} result
|
|
130
131
|
*/
|
|
131
132
|
workers: {
|
|
132
133
|
before: 'workers.before',
|
|
133
134
|
after: 'workers.after',
|
|
135
|
+
result: 'workers.result',
|
|
134
136
|
},
|
|
135
137
|
|
|
136
138
|
/**
|
package/lib/helper/Appium.js
CHANGED
|
@@ -276,7 +276,7 @@ class Appium extends Webdriver {
|
|
|
276
276
|
const _convertedCaps = {};
|
|
277
277
|
for (const [key, value] of Object.entries(capabilities)) {
|
|
278
278
|
if (!key.startsWith(vendorPrefix.appium)) {
|
|
279
|
-
if (key !== 'platformName') {
|
|
279
|
+
if (key !== 'platformName' && key !== 'bstack:options') {
|
|
280
280
|
_convertedCaps[`${vendorPrefix.appium}:${key}`] = value;
|
|
281
281
|
} else {
|
|
282
282
|
_convertedCaps[`${key}`] = value;
|
|
@@ -368,7 +368,7 @@ class Appium extends Webdriver {
|
|
|
368
368
|
if (context.web) return this.switchToWeb(context.web);
|
|
369
369
|
if (context.webview) return this.switchToWeb(context.webview);
|
|
370
370
|
}
|
|
371
|
-
return this.
|
|
371
|
+
return this.switchToContext(context);
|
|
372
372
|
}
|
|
373
373
|
|
|
374
374
|
_withinEnd() {
|
|
@@ -423,8 +423,8 @@ class Appium extends Webdriver {
|
|
|
423
423
|
async runOnIOS(caps, fn) {
|
|
424
424
|
if (this.platform !== 'ios') return;
|
|
425
425
|
recorder.session.start('iOS-only actions');
|
|
426
|
-
this._runWithCaps(caps, fn);
|
|
427
|
-
recorder.add('restore from iOS session', () => recorder.session.restore());
|
|
426
|
+
await this._runWithCaps(caps, fn);
|
|
427
|
+
await recorder.add('restore from iOS session', () => recorder.session.restore());
|
|
428
428
|
return recorder.promise();
|
|
429
429
|
}
|
|
430
430
|
|
|
@@ -465,8 +465,8 @@ class Appium extends Webdriver {
|
|
|
465
465
|
async runOnAndroid(caps, fn) {
|
|
466
466
|
if (this.platform !== 'android') return;
|
|
467
467
|
recorder.session.start('Android-only actions');
|
|
468
|
-
this._runWithCaps(caps, fn);
|
|
469
|
-
recorder.add('restore from Android session', () => recorder.session.restore());
|
|
468
|
+
await this._runWithCaps(caps, fn);
|
|
469
|
+
await recorder.add('restore from Android session', () => recorder.session.restore());
|
|
470
470
|
return recorder.promise();
|
|
471
471
|
}
|
|
472
472
|
|
|
@@ -834,7 +834,7 @@ class Appium extends Webdriver {
|
|
|
834
834
|
*
|
|
835
835
|
* @param {*} context the context to switch to
|
|
836
836
|
*/
|
|
837
|
-
async
|
|
837
|
+
async switchToContext(context) {
|
|
838
838
|
return this.browser.switchContext(context);
|
|
839
839
|
}
|
|
840
840
|
|
|
@@ -858,11 +858,11 @@ class Appium extends Webdriver {
|
|
|
858
858
|
this.isWeb = true;
|
|
859
859
|
this.defaultContext = 'body';
|
|
860
860
|
|
|
861
|
-
if (context) return this.
|
|
861
|
+
if (context) return this.switchToContext(context);
|
|
862
862
|
const contexts = await this.grabAllContexts();
|
|
863
863
|
this.debugSection('Contexts', contexts.toString());
|
|
864
864
|
for (const idx in contexts) {
|
|
865
|
-
if (contexts[idx].match(/^WEBVIEW/)) return this.
|
|
865
|
+
if (contexts[idx].match(/^WEBVIEW/)) return this.switchToContext(contexts[idx]);
|
|
866
866
|
}
|
|
867
867
|
|
|
868
868
|
throw new Error('No WEBVIEW could be guessed, please specify one in params');
|
|
@@ -885,8 +885,8 @@ class Appium extends Webdriver {
|
|
|
885
885
|
this.isWeb = false;
|
|
886
886
|
this.defaultContext = '//*';
|
|
887
887
|
|
|
888
|
-
if (context) return this.
|
|
889
|
-
return this.
|
|
888
|
+
if (context) return this.switchToContext(context);
|
|
889
|
+
return this.switchToContext('NATIVE_APP');
|
|
890
890
|
}
|
|
891
891
|
|
|
892
892
|
/**
|
|
@@ -1424,10 +1424,10 @@ class Appium extends Webdriver {
|
|
|
1424
1424
|
*
|
|
1425
1425
|
* @return {Promise<void>}
|
|
1426
1426
|
*
|
|
1427
|
-
* Appium: support
|
|
1427
|
+
* Appium: support both Android and iOS
|
|
1428
1428
|
*/
|
|
1429
1429
|
async closeApp() {
|
|
1430
|
-
onlyForApps.call(this
|
|
1430
|
+
onlyForApps.call(this);
|
|
1431
1431
|
return this.browser.closeApp();
|
|
1432
1432
|
}
|
|
1433
1433
|
|
package/lib/helper/Expect.js
CHANGED
|
@@ -20,7 +20,7 @@ chai.use(require('chai-match-pattern'));
|
|
|
20
20
|
*{
|
|
21
21
|
* helpers: {
|
|
22
22
|
* Playwright: {...},
|
|
23
|
-
*
|
|
23
|
+
* Expect: {},
|
|
24
24
|
* }
|
|
25
25
|
*}
|
|
26
26
|
* ```
|
|
@@ -32,7 +32,7 @@ class ExpectHelper {
|
|
|
32
32
|
*
|
|
33
33
|
* @param {*} actualValue
|
|
34
34
|
* @param {*} expectedValue
|
|
35
|
-
* @param {*} customErrorMsg
|
|
35
|
+
* @param {*} [customErrorMsg]
|
|
36
36
|
*/
|
|
37
37
|
expectEqual(actualValue, expectedValue, customErrorMsg = '') {
|
|
38
38
|
// @ts-ignore
|
|
@@ -44,7 +44,7 @@ class ExpectHelper {
|
|
|
44
44
|
*
|
|
45
45
|
* @param {*} actualValue
|
|
46
46
|
* @param {*} expectedValue
|
|
47
|
-
* @param {*} customErrorMsg
|
|
47
|
+
* @param {*} [customErrorMsg]
|
|
48
48
|
*/
|
|
49
49
|
expectNotEqual(actualValue, expectedValue, customErrorMsg = '') {
|
|
50
50
|
// @ts-ignore
|
|
@@ -56,7 +56,7 @@ class ExpectHelper {
|
|
|
56
56
|
*
|
|
57
57
|
* @param {*} actualValue
|
|
58
58
|
* @param {*} expectedValue
|
|
59
|
-
* @param {*} customErrorMsg
|
|
59
|
+
* @param {*} [customErrorMsg]
|
|
60
60
|
|
|
61
61
|
*/
|
|
62
62
|
expectDeepEqual(actualValue, expectedValue, customErrorMsg = '') {
|
|
@@ -69,7 +69,7 @@ class ExpectHelper {
|
|
|
69
69
|
*
|
|
70
70
|
* @param {*} actualValue
|
|
71
71
|
* @param {*} expectedValue
|
|
72
|
-
* @param {*} customErrorMsg
|
|
72
|
+
* @param {*} [customErrorMsg]
|
|
73
73
|
*/
|
|
74
74
|
expectNotDeepEqual(actualValue, expectedValue, customErrorMsg = '') {
|
|
75
75
|
// @ts-ignore
|
|
@@ -81,7 +81,7 @@ class ExpectHelper {
|
|
|
81
81
|
*
|
|
82
82
|
* @param {*} actualValue
|
|
83
83
|
* @param {*} expectedValueToContain
|
|
84
|
-
* @param {*} customErrorMsg
|
|
84
|
+
* @param {*} [customErrorMsg]
|
|
85
85
|
*/
|
|
86
86
|
expectContain(actualValue, expectedValueToContain, customErrorMsg = '') {
|
|
87
87
|
// @ts-ignore
|
|
@@ -95,7 +95,7 @@ class ExpectHelper {
|
|
|
95
95
|
*
|
|
96
96
|
* @param {*} actualValue
|
|
97
97
|
* @param {*} expectedValueToNotContain
|
|
98
|
-
* @param {*} customErrorMsg
|
|
98
|
+
* @param {*} [customErrorMsg]
|
|
99
99
|
*/
|
|
100
100
|
expectNotContain(
|
|
101
101
|
actualValue,
|
|
@@ -113,7 +113,7 @@ class ExpectHelper {
|
|
|
113
113
|
*
|
|
114
114
|
* @param {*} actualValue
|
|
115
115
|
* @param {*} expectedValueToStartWith
|
|
116
|
-
* @param {*} customErrorMsg
|
|
116
|
+
* @param {*} [customErrorMsg]
|
|
117
117
|
*/
|
|
118
118
|
expectStartsWith(actualValue, expectedValueToStartWith, customErrorMsg = '') {
|
|
119
119
|
// @ts-ignore
|
|
@@ -127,7 +127,7 @@ class ExpectHelper {
|
|
|
127
127
|
*
|
|
128
128
|
* @param {*} actualValue
|
|
129
129
|
* @param {*} expectedValueToNotStartWith
|
|
130
|
-
* @param {*} customErrorMsg
|
|
130
|
+
* @param {*} [customErrorMsg]
|
|
131
131
|
*/
|
|
132
132
|
expectNotStartsWith(
|
|
133
133
|
actualValue,
|
|
@@ -144,7 +144,7 @@ class ExpectHelper {
|
|
|
144
144
|
/**
|
|
145
145
|
* @param {*} actualValue
|
|
146
146
|
* @param {*} expectedValueToEndWith
|
|
147
|
-
* @param {*} customErrorMsg
|
|
147
|
+
* @param {*} [customErrorMsg]
|
|
148
148
|
*/
|
|
149
149
|
expectEndsWith(actualValue, expectedValueToEndWith, customErrorMsg = '') {
|
|
150
150
|
// @ts-ignore
|
|
@@ -157,7 +157,7 @@ class ExpectHelper {
|
|
|
157
157
|
/**
|
|
158
158
|
* @param {*} actualValue
|
|
159
159
|
* @param {*} expectedValueToNotEndWith
|
|
160
|
-
* @param {*} customErrorMsg
|
|
160
|
+
* @param {*} [customErrorMsg]
|
|
161
161
|
*/
|
|
162
162
|
expectNotEndsWith(
|
|
163
163
|
actualValue,
|
|
@@ -174,7 +174,7 @@ class ExpectHelper {
|
|
|
174
174
|
/**
|
|
175
175
|
* @param {*} targetData
|
|
176
176
|
* @param {*} jsonSchema
|
|
177
|
-
* @param {*} customErrorMsg
|
|
177
|
+
* @param {*} [customErrorMsg]
|
|
178
178
|
*/
|
|
179
179
|
expectJsonSchema(targetData, jsonSchema, customErrorMsg = '') {
|
|
180
180
|
// @ts-ignore
|
|
@@ -186,7 +186,7 @@ class ExpectHelper {
|
|
|
186
186
|
/**
|
|
187
187
|
* @param {*} targetData
|
|
188
188
|
* @param {*} jsonSchema
|
|
189
|
-
* @param {*} customErrorMsg
|
|
189
|
+
* @param {*} [customErrorMsg]
|
|
190
190
|
* @param {*} ajvOptions Pass AJV options
|
|
191
191
|
*/
|
|
192
192
|
expectJsonSchemaUsingAJV(
|
|
@@ -204,7 +204,7 @@ class ExpectHelper {
|
|
|
204
204
|
/**
|
|
205
205
|
* @param {*} targetData
|
|
206
206
|
* @param {*} propertyName
|
|
207
|
-
* @param {*} customErrorMsg
|
|
207
|
+
* @param {*} [customErrorMsg]
|
|
208
208
|
*/
|
|
209
209
|
expectHasProperty(targetData, propertyName, customErrorMsg = '') {
|
|
210
210
|
// @ts-ignore
|
|
@@ -215,7 +215,7 @@ class ExpectHelper {
|
|
|
215
215
|
/**
|
|
216
216
|
* @param {*} targetData
|
|
217
217
|
* @param {*} propertyName
|
|
218
|
-
* @param {*} customErrorMsg
|
|
218
|
+
* @param {*} [customErrorMsg]
|
|
219
219
|
*/
|
|
220
220
|
expectHasAProperty(targetData, propertyName, customErrorMsg = '') {
|
|
221
221
|
// @ts-ignore
|
|
@@ -226,7 +226,7 @@ class ExpectHelper {
|
|
|
226
226
|
/**
|
|
227
227
|
* @param {*} targetData
|
|
228
228
|
* @param {*} type
|
|
229
|
-
* @param {*} customErrorMsg
|
|
229
|
+
* @param {*} [customErrorMsg]
|
|
230
230
|
*/
|
|
231
231
|
expectToBeA(targetData, type, customErrorMsg = '') {
|
|
232
232
|
// @ts-ignore
|
|
@@ -237,7 +237,7 @@ class ExpectHelper {
|
|
|
237
237
|
/**
|
|
238
238
|
* @param {*} targetData
|
|
239
239
|
* @param {*} type
|
|
240
|
-
* @param {*} customErrorMsg
|
|
240
|
+
* @param {*} [customErrorMsg]
|
|
241
241
|
*/
|
|
242
242
|
expectToBeAn(targetData, type, customErrorMsg = '') {
|
|
243
243
|
// @ts-ignore
|
|
@@ -248,7 +248,7 @@ class ExpectHelper {
|
|
|
248
248
|
/**
|
|
249
249
|
* @param {*} targetData
|
|
250
250
|
* @param {*} regex
|
|
251
|
-
* @param {*} customErrorMsg
|
|
251
|
+
* @param {*} [customErrorMsg]
|
|
252
252
|
*/
|
|
253
253
|
expectMatchRegex(targetData, regex, customErrorMsg = '') {
|
|
254
254
|
// @ts-ignore
|
|
@@ -259,7 +259,7 @@ class ExpectHelper {
|
|
|
259
259
|
/**
|
|
260
260
|
* @param {*} targetData
|
|
261
261
|
* @param {*} length
|
|
262
|
-
* @param {*} customErrorMsg
|
|
262
|
+
* @param {*} [customErrorMsg]
|
|
263
263
|
*/
|
|
264
264
|
expectLengthOf(targetData, length, customErrorMsg = '') {
|
|
265
265
|
// @ts-ignore
|
|
@@ -269,7 +269,7 @@ class ExpectHelper {
|
|
|
269
269
|
|
|
270
270
|
/**
|
|
271
271
|
* @param {*} targetData
|
|
272
|
-
* @param {*} customErrorMsg
|
|
272
|
+
* @param {*} [customErrorMsg]
|
|
273
273
|
*/
|
|
274
274
|
expectEmpty(targetData, customErrorMsg = '') {
|
|
275
275
|
// @ts-ignore
|
|
@@ -279,7 +279,7 @@ class ExpectHelper {
|
|
|
279
279
|
|
|
280
280
|
/**
|
|
281
281
|
* @param {*} targetData
|
|
282
|
-
* @param {*} customErrorMsg
|
|
282
|
+
* @param {*} [customErrorMsg]
|
|
283
283
|
*/
|
|
284
284
|
expectTrue(targetData, customErrorMsg = '') {
|
|
285
285
|
// @ts-ignore
|
|
@@ -289,7 +289,7 @@ class ExpectHelper {
|
|
|
289
289
|
|
|
290
290
|
/**
|
|
291
291
|
* @param {*} targetData
|
|
292
|
-
* @param {*} customErrorMsg
|
|
292
|
+
* @param {*} [customErrorMsg]
|
|
293
293
|
*/
|
|
294
294
|
expectFalse(targetData, customErrorMsg = '') {
|
|
295
295
|
// @ts-ignore
|
|
@@ -299,8 +299,8 @@ class ExpectHelper {
|
|
|
299
299
|
|
|
300
300
|
/**
|
|
301
301
|
* @param {*} targetData
|
|
302
|
-
* @param {*} aboveThan
|
|
303
|
-
* @param {*} customErrorMsg
|
|
302
|
+
* @param {*} aboveThan
|
|
303
|
+
* @param {*} [customErrorMsg]
|
|
304
304
|
*/
|
|
305
305
|
expectAbove(targetData, aboveThan, customErrorMsg = '') {
|
|
306
306
|
// @ts-ignore
|
|
@@ -310,8 +310,8 @@ class ExpectHelper {
|
|
|
310
310
|
|
|
311
311
|
/**
|
|
312
312
|
* @param {*} targetData
|
|
313
|
-
* @param {*} belowThan
|
|
314
|
-
* @param {*} customErrorMsg
|
|
313
|
+
* @param {*} belowThan
|
|
314
|
+
* @param {*} [customErrorMsg]
|
|
315
315
|
*/
|
|
316
316
|
expectBelow(targetData, belowThan, customErrorMsg = '') {
|
|
317
317
|
// @ts-ignore
|
|
@@ -322,7 +322,7 @@ class ExpectHelper {
|
|
|
322
322
|
/**
|
|
323
323
|
* @param {*} targetData
|
|
324
324
|
* @param {*} lengthAboveThan
|
|
325
|
-
* @param {*} customErrorMsg
|
|
325
|
+
* @param {*} [customErrorMsg]
|
|
326
326
|
*/
|
|
327
327
|
expectLengthAboveThan(targetData, lengthAboveThan, customErrorMsg = '') {
|
|
328
328
|
// @ts-ignore
|
|
@@ -335,7 +335,7 @@ class ExpectHelper {
|
|
|
335
335
|
/**
|
|
336
336
|
* @param {*} targetData
|
|
337
337
|
* @param {*} lengthBelowThan
|
|
338
|
-
* @param {*} customErrorMsg
|
|
338
|
+
* @param {*} [customErrorMsg]
|
|
339
339
|
*/
|
|
340
340
|
expectLengthBelowThan(targetData, lengthBelowThan, customErrorMsg = '') {
|
|
341
341
|
// @ts-ignore
|
|
@@ -348,7 +348,7 @@ class ExpectHelper {
|
|
|
348
348
|
/**
|
|
349
349
|
* @param {*} actualValue
|
|
350
350
|
* @param {*} expectedValue
|
|
351
|
-
* @param {*} customErrorMsg
|
|
351
|
+
* @param {*} [customErrorMsg]
|
|
352
352
|
*/
|
|
353
353
|
expectEqualIgnoreCase(actualValue, expectedValue, customErrorMsg = '') {
|
|
354
354
|
// @ts-ignore
|
|
@@ -362,7 +362,7 @@ class ExpectHelper {
|
|
|
362
362
|
* expects members of two arrays are deeply equal
|
|
363
363
|
* @param {*} actualValue
|
|
364
364
|
* @param {*} expectedValue
|
|
365
|
-
* @param {*} customErrorMsg
|
|
365
|
+
* @param {*} [customErrorMsg]
|
|
366
366
|
*/
|
|
367
367
|
expectDeepMembers(actualValue, expectedValue, customErrorMsg = '') {
|
|
368
368
|
// @ts-ignore
|
|
@@ -376,7 +376,7 @@ class ExpectHelper {
|
|
|
376
376
|
* expects an array to be a superset of another array
|
|
377
377
|
* @param {*} superset
|
|
378
378
|
* @param {*} set
|
|
379
|
-
* @param {*} customErrorMsg
|
|
379
|
+
* @param {*} [customErrorMsg]
|
|
380
380
|
*/
|
|
381
381
|
expectDeepIncludeMembers(superset, set, customErrorMsg = '') {
|
|
382
382
|
// @ts-ignore
|
|
@@ -391,7 +391,7 @@ class ExpectHelper {
|
|
|
391
391
|
* @param {*} actualValue
|
|
392
392
|
* @param {*} expectedValue
|
|
393
393
|
* @param {*} fieldsToExclude
|
|
394
|
-
* @param {*} customErrorMsg
|
|
394
|
+
* @param {*} [customErrorMsg]
|
|
395
395
|
*/
|
|
396
396
|
expectDeepEqualExcluding(
|
|
397
397
|
actualValue,
|
|
@@ -410,7 +410,7 @@ class ExpectHelper {
|
|
|
410
410
|
* expects a JSON object matches a provided pattern
|
|
411
411
|
* @param {*} actualValue
|
|
412
412
|
* @param {*} expectedPattern
|
|
413
|
-
* @param {*} customErrorMsg
|
|
413
|
+
* @param {*} [customErrorMsg]
|
|
414
414
|
*/
|
|
415
415
|
expectMatchesPattern(actualValue, expectedPattern, customErrorMsg = '') {
|
|
416
416
|
// @ts-ignore
|