codeceptjs 4.0.0-beta.2 → 4.0.0-beta.21
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 +133 -120
- package/bin/codecept.js +107 -96
- package/bin/test-server.js +64 -0
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/click.mustache +5 -1
- package/lib/actor.js +73 -103
- package/lib/ai.js +159 -188
- package/lib/assert/empty.js +22 -24
- package/lib/assert/equal.js +30 -37
- package/lib/assert/error.js +14 -14
- package/lib/assert/include.js +43 -48
- package/lib/assert/throws.js +11 -11
- package/lib/assert/truth.js +22 -22
- package/lib/assert.js +20 -18
- package/lib/codecept.js +262 -162
- package/lib/colorUtils.js +50 -52
- package/lib/command/check.js +206 -0
- package/lib/command/configMigrate.js +56 -51
- package/lib/command/definitions.js +96 -109
- package/lib/command/dryRun.js +77 -79
- package/lib/command/generate.js +234 -194
- package/lib/command/gherkin/init.js +42 -33
- package/lib/command/gherkin/snippets.js +76 -74
- package/lib/command/gherkin/steps.js +20 -17
- package/lib/command/info.js +74 -38
- package/lib/command/init.js +301 -290
- package/lib/command/interactive.js +41 -32
- package/lib/command/list.js +28 -27
- package/lib/command/run-multiple/chunk.js +51 -48
- package/lib/command/run-multiple/collection.js +5 -5
- package/lib/command/run-multiple/run.js +5 -1
- package/lib/command/run-multiple.js +97 -97
- package/lib/command/run-rerun.js +19 -25
- package/lib/command/run-workers.js +68 -92
- package/lib/command/run.js +39 -27
- package/lib/command/utils.js +80 -64
- package/lib/command/workers/runTests.js +388 -226
- package/lib/config.js +109 -50
- package/lib/container.js +765 -261
- package/lib/data/context.js +60 -61
- package/lib/data/dataScenarioConfig.js +47 -47
- package/lib/data/dataTableArgument.js +32 -32
- package/lib/data/table.js +22 -22
- package/lib/effects.js +307 -0
- package/lib/element/WebElement.js +327 -0
- package/lib/els.js +160 -0
- package/lib/event.js +173 -163
- package/lib/globals.js +141 -0
- package/lib/heal.js +89 -85
- package/lib/helper/AI.js +131 -41
- package/lib/helper/ApiDataFactory.js +107 -75
- package/lib/helper/Appium.js +542 -404
- package/lib/helper/FileSystem.js +100 -79
- package/lib/helper/GraphQL.js +44 -43
- package/lib/helper/GraphQLDataFactory.js +52 -52
- package/lib/helper/JSONResponse.js +126 -88
- package/lib/helper/Mochawesome.js +54 -29
- package/lib/helper/Playwright.js +2547 -1316
- package/lib/helper/Puppeteer.js +1578 -1181
- package/lib/helper/REST.js +209 -68
- package/lib/helper/WebDriver.js +1482 -1342
- package/lib/helper/errors/ConnectionRefused.js +6 -6
- package/lib/helper/errors/ElementAssertion.js +11 -16
- package/lib/helper/errors/ElementNotFound.js +5 -9
- package/lib/helper/errors/RemoteBrowserConnectionRefused.js +5 -5
- package/lib/helper/extras/Console.js +11 -11
- package/lib/helper/extras/PlaywrightLocator.js +110 -0
- package/lib/helper/extras/PlaywrightPropEngine.js +18 -18
- package/lib/helper/extras/PlaywrightReactVueLocator.js +17 -8
- package/lib/helper/extras/PlaywrightRestartOpts.js +25 -11
- package/lib/helper/extras/Popup.js +22 -22
- package/lib/helper/extras/React.js +27 -28
- package/lib/helper/network/actions.js +36 -42
- package/lib/helper/network/utils.js +78 -84
- package/lib/helper/scripts/blurElement.js +5 -5
- package/lib/helper/scripts/focusElement.js +5 -5
- package/lib/helper/scripts/highlightElement.js +8 -8
- package/lib/helper/scripts/isElementClickable.js +34 -34
- package/lib/helper.js +2 -3
- package/lib/history.js +23 -19
- package/lib/hooks.js +8 -8
- package/lib/html.js +94 -104
- package/lib/index.js +38 -27
- package/lib/listener/config.js +30 -23
- package/lib/listener/emptyRun.js +54 -0
- package/lib/listener/enhancedGlobalRetry.js +110 -0
- package/lib/listener/exit.js +16 -18
- package/lib/listener/globalRetry.js +70 -0
- package/lib/listener/globalTimeout.js +181 -0
- package/lib/listener/helpers.js +76 -51
- package/lib/listener/mocha.js +10 -11
- package/lib/listener/result.js +11 -0
- package/lib/listener/retryEnhancer.js +85 -0
- package/lib/listener/steps.js +71 -59
- package/lib/listener/store.js +20 -0
- package/lib/locator.js +214 -197
- package/lib/mocha/asyncWrapper.js +274 -0
- package/lib/mocha/bdd.js +167 -0
- package/lib/mocha/cli.js +341 -0
- package/lib/mocha/factory.js +163 -0
- package/lib/mocha/featureConfig.js +89 -0
- package/lib/mocha/gherkin.js +231 -0
- package/lib/mocha/hooks.js +121 -0
- package/lib/mocha/index.js +21 -0
- package/lib/mocha/inject.js +46 -0
- package/lib/{interfaces → mocha}/scenarioConfig.js +58 -34
- package/lib/mocha/suite.js +89 -0
- package/lib/mocha/test.js +184 -0
- package/lib/mocha/types.d.ts +42 -0
- package/lib/mocha/ui.js +242 -0
- package/lib/output.js +141 -71
- package/lib/parser.js +54 -44
- package/lib/pause.js +173 -145
- package/lib/plugin/analyze.js +403 -0
- package/lib/plugin/{autoLogin.js → auth.js} +178 -79
- package/lib/plugin/autoDelay.js +36 -40
- package/lib/plugin/coverage.js +131 -78
- package/lib/plugin/customLocator.js +22 -21
- package/lib/plugin/customReporter.js +53 -0
- package/lib/plugin/enhancedRetryFailedStep.js +99 -0
- package/lib/plugin/heal.js +101 -110
- package/lib/plugin/htmlReporter.js +3648 -0
- package/lib/plugin/pageInfo.js +140 -0
- package/lib/plugin/pauseOnFail.js +12 -11
- package/lib/plugin/retryFailedStep.js +82 -47
- package/lib/plugin/screenshotOnFail.js +111 -92
- package/lib/plugin/stepByStepReport.js +159 -101
- package/lib/plugin/stepTimeout.js +20 -25
- package/lib/plugin/subtitles.js +38 -38
- package/lib/recorder.js +193 -130
- package/lib/rerun.js +94 -49
- package/lib/result.js +238 -0
- package/lib/retryCoordinator.js +207 -0
- package/lib/secret.js +20 -18
- package/lib/session.js +95 -89
- package/lib/step/base.js +239 -0
- package/lib/step/comment.js +10 -0
- package/lib/step/config.js +50 -0
- package/lib/step/func.js +46 -0
- package/lib/step/helper.js +50 -0
- package/lib/step/meta.js +99 -0
- package/lib/step/record.js +74 -0
- package/lib/step/retry.js +11 -0
- package/lib/step/section.js +55 -0
- package/lib/step.js +18 -329
- package/lib/steps.js +54 -0
- package/lib/store.js +38 -7
- package/lib/template/heal.js +3 -12
- package/lib/template/prompts/generatePageObject.js +31 -0
- package/lib/template/prompts/healStep.js +13 -0
- package/lib/template/prompts/writeStep.js +9 -0
- package/lib/test-server.js +334 -0
- package/lib/timeout.js +60 -0
- package/lib/transform.js +8 -8
- package/lib/translation.js +34 -21
- package/lib/utils/loaderCheck.js +124 -0
- package/lib/utils/mask_data.js +47 -0
- package/lib/utils/typescript.js +237 -0
- package/lib/utils.js +411 -228
- package/lib/workerStorage.js +37 -34
- package/lib/workers.js +532 -296
- package/package.json +124 -95
- package/translations/de-DE.js +5 -3
- package/translations/fr-FR.js +5 -4
- package/translations/index.js +22 -12
- package/translations/it-IT.js +4 -3
- package/translations/ja-JP.js +4 -3
- package/translations/nl-NL.js +76 -0
- package/translations/pl-PL.js +4 -3
- package/translations/pt-BR.js +4 -3
- package/translations/ru-RU.js +4 -3
- package/translations/utils.js +10 -0
- package/translations/zh-CN.js +4 -3
- package/translations/zh-TW.js +4 -3
- package/typings/index.d.ts +546 -185
- package/typings/promiseBasedTypes.d.ts +150 -875
- package/typings/types.d.ts +547 -992
- package/lib/cli.js +0 -249
- package/lib/dirname.js +0 -5
- package/lib/helper/Expect.js +0 -425
- package/lib/helper/ExpectHelper.js +0 -399
- package/lib/helper/MockServer.js +0 -223
- package/lib/helper/Nightmare.js +0 -1411
- package/lib/helper/Protractor.js +0 -1835
- package/lib/helper/SoftExpectHelper.js +0 -381
- package/lib/helper/TestCafe.js +0 -1410
- package/lib/helper/clientscripts/nightmare.js +0 -213
- package/lib/helper/testcafe/testControllerHolder.js +0 -42
- package/lib/helper/testcafe/testcafe-utils.js +0 -63
- package/lib/interfaces/bdd.js +0 -98
- package/lib/interfaces/featureConfig.js +0 -69
- package/lib/interfaces/gherkin.js +0 -195
- package/lib/listener/artifacts.js +0 -19
- package/lib/listener/retry.js +0 -68
- package/lib/listener/timeout.js +0 -109
- package/lib/mochaFactory.js +0 -110
- package/lib/plugin/allure.js +0 -15
- package/lib/plugin/commentStep.js +0 -136
- package/lib/plugin/debugErrors.js +0 -67
- package/lib/plugin/eachElement.js +0 -127
- package/lib/plugin/fakerTransform.js +0 -49
- package/lib/plugin/retryTo.js +0 -121
- package/lib/plugin/selenoid.js +0 -371
- package/lib/plugin/standardActingHelpers.js +0 -9
- package/lib/plugin/tryTo.js +0 -105
- package/lib/plugin/wdio.js +0 -246
- package/lib/scenario.js +0 -222
- package/lib/ui.js +0 -238
- package/lib/within.js +0 -70
|
@@ -1,381 +0,0 @@
|
|
|
1
|
-
import ExpectHelper from './ExpectHelper.js'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* SoftAssertHelper is a utility class for performing soft assertions.
|
|
5
|
-
* Unlike traditional assertions that stop the execution on failure,
|
|
6
|
-
* soft assertions allow the execution to continue and report all failures at the end.
|
|
7
|
-
*
|
|
8
|
-
* ### Examples
|
|
9
|
-
*
|
|
10
|
-
* Zero-configuration when paired with other helpers like REST, Playwright:
|
|
11
|
-
*
|
|
12
|
-
* ```js
|
|
13
|
-
* // inside codecept.conf.js
|
|
14
|
-
* {
|
|
15
|
-
* helpers: {
|
|
16
|
-
* Playwright: {...},
|
|
17
|
-
* SoftExpectHelper: {},
|
|
18
|
-
* }
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* ```js
|
|
23
|
-
* // in scenario
|
|
24
|
-
* I.softExpectEqual('a', 'b')
|
|
25
|
-
* I.flushSoftAssertions() // Throws an error if any soft assertions have failed. The error message contains all the accumulated failures.
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* ## Methods
|
|
29
|
-
*/
|
|
30
|
-
class SoftAssertHelper extends ExpectHelper {
|
|
31
|
-
constructor() {
|
|
32
|
-
super()
|
|
33
|
-
this.errors = []
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Performs a soft assertion by executing the provided assertion function.
|
|
38
|
-
* If the assertion fails, the error is caught and stored without halting the execution.
|
|
39
|
-
*
|
|
40
|
-
* @param {Function} assertionFn - The assertion function to execute.
|
|
41
|
-
* @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
|
|
42
|
-
*/
|
|
43
|
-
softAssert(assertionFn, customErrorMsg = '') {
|
|
44
|
-
try {
|
|
45
|
-
assertionFn()
|
|
46
|
-
} catch (error) {
|
|
47
|
-
this.errors.push({ customErrorMsg, error })
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Throws an error if any soft assertions have failed.
|
|
53
|
-
* The error message contains all the accumulated failures.
|
|
54
|
-
*
|
|
55
|
-
* @throws {Error} If there are any soft assertion failures.
|
|
56
|
-
*/
|
|
57
|
-
flushSoftAssertions() {
|
|
58
|
-
if (this.errors.length > 0) {
|
|
59
|
-
let errorMessage = 'Soft assertions failed:\n'
|
|
60
|
-
this.errors.forEach((err, index) => {
|
|
61
|
-
errorMessage += `\n[${index + 1}] ${err.customErrorMsg}\n${err.error.message}\n`
|
|
62
|
-
})
|
|
63
|
-
this.errors = []
|
|
64
|
-
throw new Error(errorMessage)
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Softly asserts that two values are equal.
|
|
70
|
-
*
|
|
71
|
-
* @param {*} actualValue - The actual value.
|
|
72
|
-
* @param {*} expectedValue - The expected value.
|
|
73
|
-
* @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
|
|
74
|
-
*/
|
|
75
|
-
softExpectEqual(actualValue, expectedValue, customErrorMsg = '') {
|
|
76
|
-
this.softAssert(() => this.expectEqual(actualValue, expectedValue, customErrorMsg), customErrorMsg)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Softly asserts that two values are not equal.
|
|
81
|
-
*
|
|
82
|
-
* @param {*} actualValue - The actual value.
|
|
83
|
-
* @param {*} expectedValue - The expected value.
|
|
84
|
-
* @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
|
|
85
|
-
*/
|
|
86
|
-
softExpectNotEqual(actualValue, expectedValue, customErrorMsg = '') {
|
|
87
|
-
this.softAssert(() => this.expectNotEqual(actualValue, expectedValue, customErrorMsg), customErrorMsg)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Softly asserts that two values are deeply equal.
|
|
92
|
-
*
|
|
93
|
-
* @param {*} actualValue - The actual value.
|
|
94
|
-
* @param {*} expectedValue - The expected value.
|
|
95
|
-
* @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
|
|
96
|
-
*/
|
|
97
|
-
softExpectDeepEqual(actualValue, expectedValue, customErrorMsg = '') {
|
|
98
|
-
this.softAssert(() => this.expectDeepEqual(actualValue, expectedValue, customErrorMsg), customErrorMsg)
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Softly asserts that two values are not deeply equal.
|
|
103
|
-
*
|
|
104
|
-
* @param {*} actualValue - The actual value.
|
|
105
|
-
* @param {*} expectedValue - The expected value.
|
|
106
|
-
* @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
|
|
107
|
-
*/
|
|
108
|
-
softExpectNotDeepEqual(actualValue, expectedValue, customErrorMsg = '') {
|
|
109
|
-
this.softAssert(() => this.expectNotDeepEqual(actualValue, expectedValue, customErrorMsg), customErrorMsg)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Softly asserts that a value contains the expected value.
|
|
114
|
-
*
|
|
115
|
-
* @param {*} actualValue - The actual value.
|
|
116
|
-
* @param {*} expectedValueToContain - The value that should be contained within the actual value.
|
|
117
|
-
* @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
|
|
118
|
-
*/
|
|
119
|
-
softExpectContain(actualValue, expectedValueToContain, customErrorMsg = '') {
|
|
120
|
-
this.softAssert(() => this.expectContain(actualValue, expectedValueToContain, customErrorMsg), customErrorMsg)
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Softly asserts that a value does not contain the expected value.
|
|
125
|
-
*
|
|
126
|
-
* @param {*} actualValue - The actual value.
|
|
127
|
-
* @param {*} expectedValueToNotContain - The value that should not be contained within the actual value.
|
|
128
|
-
* @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
|
|
129
|
-
*/
|
|
130
|
-
softExpectNotContain(actualValue, expectedValueToNotContain, customErrorMsg = '') {
|
|
131
|
-
this.softAssert(() => this.expectNotContain(actualValue, expectedValueToNotContain, customErrorMsg), customErrorMsg)
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Softly asserts that a value starts with the expected value.
|
|
136
|
-
*
|
|
137
|
-
* @param {*} actualValue - The actual value.
|
|
138
|
-
* @param {*} expectedValueToStartWith - The value that the actual value should start with.
|
|
139
|
-
* @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
|
|
140
|
-
*/
|
|
141
|
-
softExpectStartsWith(actualValue, expectedValueToStartWith, customErrorMsg = '') {
|
|
142
|
-
this.softAssert(() => this.expectStartsWith(actualValue, expectedValueToStartWith, customErrorMsg), customErrorMsg)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Softly asserts that a value does not start with the expected value.
|
|
147
|
-
*
|
|
148
|
-
* @param {*} actualValue - The actual value.
|
|
149
|
-
* @param {*} expectedValueToNotStartWith - The value that the actual value should not start with.
|
|
150
|
-
* @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
|
|
151
|
-
*/
|
|
152
|
-
softExpectNotStartsWith(actualValue, expectedValueToNotStartWith, customErrorMsg = '') {
|
|
153
|
-
this.softAssert(
|
|
154
|
-
() => this.expectNotStartsWith(actualValue, expectedValueToNotStartWith, customErrorMsg),
|
|
155
|
-
customErrorMsg,
|
|
156
|
-
)
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Softly asserts that a value ends with the expected value.
|
|
161
|
-
*
|
|
162
|
-
* @param {*} actualValue - The actual value.
|
|
163
|
-
* @param {*} expectedValueToEndWith - The value that the actual value should end with.
|
|
164
|
-
* @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
|
|
165
|
-
*/
|
|
166
|
-
softExpectEndsWith(actualValue, expectedValueToEndWith, customErrorMsg = '') {
|
|
167
|
-
this.softAssert(() => this.expectEndsWith(actualValue, expectedValueToEndWith, customErrorMsg), customErrorMsg)
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Softly asserts that a value does not end with the expected value.
|
|
172
|
-
*
|
|
173
|
-
* @param {*} actualValue - The actual value.
|
|
174
|
-
* @param {*} expectedValueToNotEndWith - The value that the actual value should not end with.
|
|
175
|
-
* @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
|
|
176
|
-
*/
|
|
177
|
-
softExpectNotEndsWith(actualValue, expectedValueToNotEndWith, customErrorMsg = '') {
|
|
178
|
-
this.softAssert(
|
|
179
|
-
() => this.expectNotEndsWith(actualValue, expectedValueToNotEndWith, customErrorMsg),
|
|
180
|
-
customErrorMsg,
|
|
181
|
-
)
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Softly asserts that the target data matches the given JSON schema.
|
|
186
|
-
*
|
|
187
|
-
* @param {*} targetData - The data to validate.
|
|
188
|
-
* @param {Object} jsonSchema - The JSON schema to validate against.
|
|
189
|
-
* @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
|
|
190
|
-
*/
|
|
191
|
-
softExpectJsonSchema(targetData, jsonSchema, customErrorMsg = '') {
|
|
192
|
-
this.softAssert(() => this.expectJsonSchema(targetData, jsonSchema, customErrorMsg), customErrorMsg)
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Softly asserts that the target data matches the given JSON schema using AJV.
|
|
197
|
-
*
|
|
198
|
-
* @param {*} targetData - The data to validate.
|
|
199
|
-
* @param {Object} jsonSchema - The JSON schema to validate against.
|
|
200
|
-
* @param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
|
|
201
|
-
* @param {Object} [ajvOptions={ allErrors: true }] - Options to pass to AJV.
|
|
202
|
-
*/
|
|
203
|
-
softExpectJsonSchemaUsingAJV(targetData, jsonSchema, customErrorMsg = '', ajvOptions = { allErrors: true }) {
|
|
204
|
-
this.softAssert(
|
|
205
|
-
() => this.expectJsonSchemaUsingAJV(targetData, jsonSchema, customErrorMsg, ajvOptions),
|
|
206
|
-
customErrorMsg,
|
|
207
|
-
)
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Softly asserts that the target data has the specified property.
|
|
212
|
-
*
|
|
213
|
-
* @param {*} targetData - The data to check.
|
|
214
|
-
* @param {string} propertyName - The property name to check for.
|
|
215
|
-
* @param {string} [customErrorMsg=''] - A custom error message to display if the assertion
|
|
216
|
-
fails. */ softExpectHasProperty(targetData, propertyName, customErrorMsg = '') {
|
|
217
|
-
this.softAssert(() => this.expectHasProperty(targetData, propertyName, customErrorMsg), customErrorMsg)
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
Softly asserts that the target data has a property with the specified name.
|
|
222
|
-
@param {*} targetData - The data to check.
|
|
223
|
-
@param {string} propertyName - The property name to check for.
|
|
224
|
-
@param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails.
|
|
225
|
-
*/
|
|
226
|
-
softExpectHasAProperty(targetData, propertyName, customErrorMsg = '') {
|
|
227
|
-
this.softAssert(() => this.expectHasAProperty(targetData, propertyName, customErrorMsg), customErrorMsg)
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
Softly asserts that the target data is of a specific type.
|
|
232
|
-
@param {*} targetData - The data to check.
|
|
233
|
-
@param {string} type - The expected type (e.g., 'string', 'number').
|
|
234
|
-
@param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
|
|
235
|
-
softExpectToBeA(targetData, type, customErrorMsg = '') {
|
|
236
|
-
this.softAssert(() => this.expectToBeA(targetData, type, customErrorMsg), customErrorMsg)
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
Softly asserts that the target data is of a specific type (alternative for articles).
|
|
241
|
-
@param {*} targetData - The data to check.
|
|
242
|
-
@param {string} type - The expected type (e.g., 'string', 'number').
|
|
243
|
-
@param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
|
|
244
|
-
softExpectToBeAn(targetData, type, customErrorMsg = '') {
|
|
245
|
-
this.softAssert(() => this.expectToBeAn(targetData, type, customErrorMsg), customErrorMsg)
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
/*
|
|
249
|
-
Softly asserts that the target data matches the specified regular expression.
|
|
250
|
-
@param {*} targetData - The data to check.
|
|
251
|
-
@param {RegExp} regex - The regular expression to match.
|
|
252
|
-
@param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
|
|
253
|
-
softExpectMatchRegex(targetData, regex, customErrorMsg = '') {
|
|
254
|
-
this.softAssert(() => this.expectMatchRegex(targetData, regex, customErrorMsg), customErrorMsg)
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
Softly asserts that the target data has a specified length.
|
|
259
|
-
@param {*} targetData - The data to check.
|
|
260
|
-
@param {number} length - The expected length.
|
|
261
|
-
@param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
|
|
262
|
-
softExpectLengthOf(targetData, length, customErrorMsg = '') {
|
|
263
|
-
this.softAssert(() => this.expectLengthOf(targetData, length, customErrorMsg), customErrorMsg)
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
|
|
268
|
-
Softly asserts that the target data is empty.
|
|
269
|
-
@param {*} targetData - The data to check.
|
|
270
|
-
@param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
|
|
271
|
-
softExpectEmpty(targetData, customErrorMsg = '') {
|
|
272
|
-
this.softAssert(() => this.expectEmpty(targetData, customErrorMsg), customErrorMsg)
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
|
|
277
|
-
Softly asserts that the target data is true.
|
|
278
|
-
@param {*} targetData - The data to check.
|
|
279
|
-
@param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
|
|
280
|
-
softExpectTrue(targetData, customErrorMsg = '') {
|
|
281
|
-
this.softAssert(() => this.expectTrue(targetData, customErrorMsg), customErrorMsg)
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
|
|
286
|
-
Softly asserts that the target data is false.
|
|
287
|
-
@param {*} targetData - The data to check.
|
|
288
|
-
@param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
|
|
289
|
-
softExpectFalse(targetData, customErrorMsg = '') {
|
|
290
|
-
this.softAssert(() => this.expectFalse(targetData, customErrorMsg), customErrorMsg)
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
|
|
295
|
-
Softly asserts that the target data is above a specified value.
|
|
296
|
-
@param {*} targetData - The data to check.
|
|
297
|
-
@param {*} aboveThan - The value that the target data should be above.
|
|
298
|
-
@param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
|
|
299
|
-
softExpectAbove(targetData, aboveThan, customErrorMsg = '') {
|
|
300
|
-
this.softAssert(() => this.expectAbove(targetData, aboveThan, customErrorMsg), customErrorMsg)
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
|
|
305
|
-
Softly asserts that the target data is below a specified value.
|
|
306
|
-
@param {*} targetData - The data to check.
|
|
307
|
-
@param {*} belowThan - The value that the target data should be below.
|
|
308
|
-
@param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
|
|
309
|
-
softExpectBelow(targetData, belowThan, customErrorMsg = '') {
|
|
310
|
-
this.softAssert(() => this.expectBelow(targetData, belowThan, customErrorMsg), customErrorMsg)
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
/**
|
|
314
|
-
|
|
315
|
-
Softly asserts that the length of the target data is above a specified value.
|
|
316
|
-
@param {*} targetData - The data to check.
|
|
317
|
-
@param {number} lengthAboveThan - The length that the target data should be above.
|
|
318
|
-
@param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
|
|
319
|
-
softExpectLengthAboveThan(targetData, lengthAboveThan, customErrorMsg = '') {
|
|
320
|
-
this.softAssert(() => this.expectLengthAboveThan(targetData, lengthAboveThan, customErrorMsg), customErrorMsg)
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
Softly asserts that the length of the target data is below a specified value.
|
|
325
|
-
@param {*} targetData - The data to check.
|
|
326
|
-
@param {number} lengthBelowThan - The length that the target data should be below.
|
|
327
|
-
@param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
|
|
328
|
-
softExpectLengthBelowThan(targetData, lengthBelowThan, customErrorMsg = '') {
|
|
329
|
-
this.softAssert(() => this.expectLengthBelowThan(targetData, lengthBelowThan, customErrorMsg), customErrorMsg)
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
Softly asserts that two values are equal, ignoring case.
|
|
334
|
-
@param {string} actualValue - The actual string value.
|
|
335
|
-
@param {string} expectedValue - The expected string value.
|
|
336
|
-
@param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
|
|
337
|
-
softExpectEqualIgnoreCase(actualValue, expectedValue, customErrorMsg = '') {
|
|
338
|
-
this.softAssert(() => this.expectEqualIgnoreCase(actualValue, expectedValue, customErrorMsg), customErrorMsg)
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
Softly asserts that two arrays have deep equality, considering members in any order.
|
|
343
|
-
@param {Array} actualValue - The actual array.
|
|
344
|
-
@param {Array} expectedValue - The expected array.
|
|
345
|
-
@param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
|
|
346
|
-
softExpectDeepMembers(actualValue, expectedValue, customErrorMsg = '') {
|
|
347
|
-
this.softAssert(() => this.expectDeepMembers(actualValue, expectedValue, customErrorMsg), customErrorMsg)
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
/**
|
|
351
|
-
Softly asserts that an array (superset) deeply includes all members of another array (set).
|
|
352
|
-
@param {Array} superset - The array that should contain the expected members.
|
|
353
|
-
@param {Array} set - The array with members that should be included.
|
|
354
|
-
@param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
|
|
355
|
-
softExpectDeepIncludeMembers(superset, set, customErrorMsg = '') {
|
|
356
|
-
this.softAssert(() => this.expectDeepIncludeMembers(superset, set, customErrorMsg), customErrorMsg)
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
Softly asserts that two objects are deeply equal, excluding specified fields.
|
|
361
|
-
@param {Object} actualValue - The actual object.
|
|
362
|
-
@param {Object} expectedValue - The expected object.
|
|
363
|
-
@param {Array<string>} fieldsToExclude - The fields to exclude from the comparison.
|
|
364
|
-
@param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
|
|
365
|
-
softExpectDeepEqualExcluding(actualValue, expectedValue, fieldsToExclude, customErrorMsg = '') {
|
|
366
|
-
this.softAssert(
|
|
367
|
-
() => this.expectDeepEqualExcluding(actualValue, expectedValue, fieldsToExclude, customErrorMsg),
|
|
368
|
-
customErrorMsg,
|
|
369
|
-
)
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
Softly asserts that a value matches the expected pattern.
|
|
374
|
-
@param {*} actualValue - The actual value.
|
|
375
|
-
@param {*} expectedPattern - The pattern the value should match.
|
|
376
|
-
@param {string} [customErrorMsg=''] - A custom error message to display if the assertion fails. */
|
|
377
|
-
softExpectMatchesPattern(actualValue, expectedPattern, customErrorMsg = '') {
|
|
378
|
-
this.softAssert(() => this.expectMatchesPattern(actualValue, expectedPattern, customErrorMsg), customErrorMsg)
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
export default SoftAssertHelper
|