codeceptjs 3.6.5-beta.5 → 3.6.6-beta.1
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 +0 -1
- package/docs/webapi/waitForDisabled.mustache +6 -0
- package/lib/helper/Playwright.js +29 -1
- package/lib/helper/REST.js +8 -4
- package/lib/helper/SoftExpectHelper.js +381 -0
- package/lib/locator.js +44 -1
- package/lib/template/heal.js +1 -0
- package/package.json +18 -18
- package/typings/promiseBasedTypes.d.ts +251 -8
- package/typings/types.d.ts +273 -8
package/README.md
CHANGED
|
@@ -9,7 +9,6 @@ Build Status:
|
|
|
9
9
|
|
|
10
10
|
Appium Helper:
|
|
11
11
|
[](https://github.com/codeceptjs/CodeceptJS/actions/workflows/appiumV2_Android.yml)
|
|
12
|
-
[](https://github.com/codeceptjs/CodeceptJS/actions/workflows/appiumV2_iOS.yml)
|
|
13
12
|
|
|
14
13
|
Web Helper:
|
|
15
14
|
[](https://github.com/codeceptjs/CodeceptJS/actions/workflows/playwright.yml)
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Waits for element to become disabled (by default waits for 1sec).
|
|
2
|
+
Element can be located by CSS or XPath.
|
|
3
|
+
|
|
4
|
+
@param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
5
|
+
@param {number} [sec=1] (optional) time in seconds to wait, 1 by default.
|
|
6
|
+
@returns {void} automatically synchronized promise through #recorder
|
package/lib/helper/Playwright.js
CHANGED
|
@@ -2476,7 +2476,7 @@ class Playwright extends Helper {
|
|
|
2476
2476
|
async waitForEnabled(locator, sec) {
|
|
2477
2477
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout
|
|
2478
2478
|
locator = new Locator(locator, 'css')
|
|
2479
|
-
|
|
2479
|
+
|
|
2480
2480
|
let waiter
|
|
2481
2481
|
const context = await this._getContext()
|
|
2482
2482
|
if (!locator.isXPath()) {
|
|
@@ -2498,6 +2498,34 @@ class Playwright extends Helper {
|
|
|
2498
2498
|
})
|
|
2499
2499
|
}
|
|
2500
2500
|
|
|
2501
|
+
/**
|
|
2502
|
+
* {{> waitForDisabled }}
|
|
2503
|
+
*/
|
|
2504
|
+
async waitForDisabled(locator, sec) {
|
|
2505
|
+
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout
|
|
2506
|
+
locator = new Locator(locator, 'css')
|
|
2507
|
+
|
|
2508
|
+
let waiter
|
|
2509
|
+
const context = await this._getContext()
|
|
2510
|
+
if (!locator.isXPath()) {
|
|
2511
|
+
const valueFn = function ([locator]) {
|
|
2512
|
+
return Array.from(document.querySelectorAll(locator)).filter((el) => el.disabled).length > 0
|
|
2513
|
+
}
|
|
2514
|
+
waiter = context.waitForFunction(valueFn, [locator.value], { timeout: waitTimeout })
|
|
2515
|
+
} else {
|
|
2516
|
+
const disabledFn = function ([locator, $XPath]) {
|
|
2517
|
+
eval($XPath) // eslint-disable-line no-eval
|
|
2518
|
+
return $XPath(null, locator).filter((el) => el.disabled).length > 0
|
|
2519
|
+
}
|
|
2520
|
+
waiter = context.waitForFunction(disabledFn, [locator.value, $XPath.toString()], { timeout: waitTimeout })
|
|
2521
|
+
}
|
|
2522
|
+
return waiter.catch((err) => {
|
|
2523
|
+
throw new Error(
|
|
2524
|
+
`element (${locator.toString()}) is still enabled after ${waitTimeout / 1000} sec\n${err.message}`,
|
|
2525
|
+
)
|
|
2526
|
+
})
|
|
2527
|
+
}
|
|
2528
|
+
|
|
2501
2529
|
/**
|
|
2502
2530
|
* {{> waitForValue }}
|
|
2503
2531
|
*/
|
package/lib/helper/REST.js
CHANGED
|
@@ -206,7 +206,7 @@ class REST extends Helper {
|
|
|
206
206
|
: this.debugSection('Request', JSON.stringify(_debugRequest))
|
|
207
207
|
|
|
208
208
|
if (this.options.printCurl) {
|
|
209
|
-
this.debugSection('CURL Request', curlize(request))
|
|
209
|
+
this.debugSection('CURL Request', curlize(request))
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
let response
|
|
@@ -393,8 +393,13 @@ class REST extends Helper {
|
|
|
393
393
|
module.exports = REST
|
|
394
394
|
|
|
395
395
|
function curlize(request) {
|
|
396
|
-
if (request.data?.constructor.name.toLowerCase() === 'formdata')
|
|
397
|
-
|
|
396
|
+
if (request.data?.constructor.name.toLowerCase() === 'formdata')
|
|
397
|
+
return 'cURL is not printed as the request body is not a JSON'
|
|
398
|
+
let curl =
|
|
399
|
+
`curl --location --request ${request.method ? request.method.toUpperCase() : 'GET'} ${request.baseURL} `.replace(
|
|
400
|
+
"'",
|
|
401
|
+
'',
|
|
402
|
+
)
|
|
398
403
|
|
|
399
404
|
if (request.headers) {
|
|
400
405
|
Object.entries(request.headers).forEach(([key, value]) => {
|
|
@@ -411,4 +416,3 @@ function curlize(request) {
|
|
|
411
416
|
}
|
|
412
417
|
return curl
|
|
413
418
|
}
|
|
414
|
-
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
const ExpectHelper = require('./ExpectHelper')
|
|
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
|
+
module.exports = SoftAssertHelper
|
package/lib/locator.js
CHANGED
|
@@ -175,7 +175,7 @@ class Locator {
|
|
|
175
175
|
*/
|
|
176
176
|
toXPath(pseudoSelector = '') {
|
|
177
177
|
const locator = `${this.value}${pseudoSelector}`;
|
|
178
|
-
const limitation = [':nth-of-type', ':first-of-type', ':last-of-type', ':nth-last-child', ':nth-last-of-type', ':checked', ':disabled', ':enabled', ':required', ':lang', ':nth-child'];
|
|
178
|
+
const limitation = [':nth-of-type', ':first-of-type', ':last-of-type', ':nth-last-child', ':nth-last-of-type', ':checked', ':disabled', ':enabled', ':required', ':lang', ':nth-child', ':has'];
|
|
179
179
|
|
|
180
180
|
if (limitation.some(item => locator.includes(item))) {
|
|
181
181
|
cssToXPath = require('css-to-xpath');
|
|
@@ -299,6 +299,49 @@ class Locator {
|
|
|
299
299
|
return new Locator({ xpath });
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
+
/**
|
|
303
|
+
* Adds condition: attribute value starts with text
|
|
304
|
+
* (analog of XPATH: [starts-with(@attr,'startValue')] or CSS [attr^='startValue']
|
|
305
|
+
* Example: I.click(locate('a').withAttrStartsWith('href', 'https://')));
|
|
306
|
+
* Works with any attribute: class, href etc.
|
|
307
|
+
* @param {string} attrName
|
|
308
|
+
* @param {string} startsWith
|
|
309
|
+
* @returns {Locator}
|
|
310
|
+
*/
|
|
311
|
+
withAttrStartsWith(attrName, startsWith) {
|
|
312
|
+
const xpath = sprintf('%s[%s]', this.toXPath(), `starts-with(@${attrName}, "${startsWith}")`);
|
|
313
|
+
return new Locator({ xpath });
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Adds condition: attribute value ends with text
|
|
318
|
+
* (analog of XPATH: [ends-with(@attr,'endValue')] or CSS [attr$='endValue']
|
|
319
|
+
* Example: I.click(locate('a').withAttrEndsWith('href', '.com')));
|
|
320
|
+
* Works with any attribute: class, href etc.
|
|
321
|
+
* @param {string} attrName
|
|
322
|
+
* @param {string} endsWith
|
|
323
|
+
* @returns {Locator}
|
|
324
|
+
*/
|
|
325
|
+
withAttrEndsWith(attrName, endsWith) {
|
|
326
|
+
const xpath = sprintf('%s[%s]', this.toXPath(), `substring(@${attrName}, string-length(@${attrName}) - string-length("${endsWith}") + 1) = "${endsWith}"`,
|
|
327
|
+
);
|
|
328
|
+
return new Locator({ xpath });
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Adds condition: attribute value contains text
|
|
333
|
+
* (analog of XPATH: [contains(@attr,'partOfAttribute')] or CSS [attr*='partOfAttribute']
|
|
334
|
+
* Example: I.click(locate('a').withAttrContains('href', 'google')));
|
|
335
|
+
* Works with any attribute: class, href etc.
|
|
336
|
+
* @param {string} attrName
|
|
337
|
+
* @param {string} partOfAttrValue
|
|
338
|
+
* @returns {Locator}
|
|
339
|
+
*/
|
|
340
|
+
withAttrContains(attrName, partOfAttrValue) {
|
|
341
|
+
const xpath = sprintf('%s[%s]', this.toXPath(), `contains(@${attrName}, "${partOfAttrValue}")`);
|
|
342
|
+
return new Locator({ xpath });
|
|
343
|
+
}
|
|
344
|
+
|
|
302
345
|
/**
|
|
303
346
|
* @param {String} text
|
|
304
347
|
* @returns {Locator}
|
package/lib/template/heal.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeceptjs",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.6-beta.1",
|
|
4
4
|
"description": "Supercharged End 2 End Testing Framework for NodeJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"acceptance",
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
"@cucumber/gherkin": "26",
|
|
76
76
|
"@cucumber/messages": "25.0.1",
|
|
77
77
|
"@xmldom/xmldom": "0.8.10",
|
|
78
|
-
"acorn": "8.
|
|
78
|
+
"acorn": "8.12.1",
|
|
79
79
|
"arrify": "2.0.1",
|
|
80
|
-
"axios": "1.7.
|
|
80
|
+
"axios": "1.7.3",
|
|
81
81
|
"chai": "5.1.1",
|
|
82
82
|
"chai-deep-match": "1.2.1",
|
|
83
83
|
"chai-exclude": "2.1.1",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"cross-spawn": "7.0.3",
|
|
91
91
|
"css-to-xpath": "0.1.0",
|
|
92
92
|
"csstoxpath": "1.6.0",
|
|
93
|
-
"devtools": "8.
|
|
93
|
+
"devtools": "8.40.2",
|
|
94
94
|
"envinfo": "7.11.1",
|
|
95
95
|
"escape-string-regexp": "4.0.0",
|
|
96
96
|
"figures": "3.2.0",
|
|
@@ -99,13 +99,13 @@
|
|
|
99
99
|
"glob": "6.0.1",
|
|
100
100
|
"html-minifier-terser": "7.2.0",
|
|
101
101
|
"inquirer": "6.5.2",
|
|
102
|
-
"joi": "17.13.
|
|
102
|
+
"joi": "17.13.3",
|
|
103
103
|
"js-beautify": "1.15.1",
|
|
104
104
|
"lodash.clonedeep": "4.5.0",
|
|
105
105
|
"lodash.merge": "4.6.2",
|
|
106
106
|
"mkdirp": "1.0.4",
|
|
107
|
-
"mocha": "10.
|
|
108
|
-
"monocart-coverage-reports": "2.
|
|
107
|
+
"mocha": "10.6.0",
|
|
108
|
+
"monocart-coverage-reports": "2.10.0",
|
|
109
109
|
"ms": "2.1.3",
|
|
110
110
|
"ora-classic": "5.4.2",
|
|
111
111
|
"pactum": "3.6.9",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"promise-retry": "1.1.1",
|
|
115
115
|
"resq": "1.11.0",
|
|
116
116
|
"sprintf-js": "1.1.1",
|
|
117
|
-
"uuid": "
|
|
117
|
+
"uuid": "10.0"
|
|
118
118
|
},
|
|
119
119
|
"optionalDependencies": {
|
|
120
120
|
"@codeceptjs/detox-helper": "1.0.8"
|
|
@@ -127,29 +127,29 @@
|
|
|
127
127
|
"@types/chai": "4.3.16",
|
|
128
128
|
"@types/inquirer": "9.0.3",
|
|
129
129
|
"@types/node": "20.11.30",
|
|
130
|
-
"@wdio/sauce-service": "
|
|
130
|
+
"@wdio/sauce-service": "9.0.4",
|
|
131
131
|
"@wdio/selenium-standalone-service": "8.3.2",
|
|
132
|
-
"@wdio/utils": "
|
|
132
|
+
"@wdio/utils": "9.0.6",
|
|
133
133
|
"@xmldom/xmldom": "0.8.10",
|
|
134
134
|
"apollo-server-express": "2.25.3",
|
|
135
135
|
"chai-as-promised": "7.1.2",
|
|
136
136
|
"chai-subset": "1.6.0",
|
|
137
137
|
"contributor-faces": "1.1.0",
|
|
138
138
|
"documentation": "12.3.0",
|
|
139
|
-
"electron": "
|
|
139
|
+
"electron": "31.3.1",
|
|
140
140
|
"eslint": "8.57.0",
|
|
141
141
|
"eslint-config-airbnb-base": "15.0.0",
|
|
142
142
|
"eslint-plugin-import": "2.29.1",
|
|
143
|
-
"eslint-plugin-mocha": "10.
|
|
143
|
+
"eslint-plugin-mocha": "10.5.0",
|
|
144
144
|
"expect": "29.7.0",
|
|
145
145
|
"express": "4.19.2",
|
|
146
146
|
"graphql": "16.9.0",
|
|
147
|
-
"husky": "
|
|
147
|
+
"husky": "9.1.4",
|
|
148
148
|
"inquirer-test": "2.0.1",
|
|
149
149
|
"jsdoc": "4.0.3",
|
|
150
150
|
"jsdoc-typeof-plugin": "1.0.0",
|
|
151
151
|
"json-server": "0.10.1",
|
|
152
|
-
"playwright": "1.45.
|
|
152
|
+
"playwright": "1.45.3",
|
|
153
153
|
"prettier": "^3.3.2",
|
|
154
154
|
"puppeteer": "22.12.1",
|
|
155
155
|
"qrcode-terminal": "0.12.0",
|
|
@@ -162,11 +162,11 @@
|
|
|
162
162
|
"ts-node": "10.9.2",
|
|
163
163
|
"tsd": "^0.31.0",
|
|
164
164
|
"tsd-jsdoc": "2.5.0",
|
|
165
|
-
"typedoc": "0.
|
|
166
|
-
"typedoc-plugin-markdown": "4.
|
|
167
|
-
"typescript": "5.
|
|
165
|
+
"typedoc": "0.26.5",
|
|
166
|
+
"typedoc-plugin-markdown": "4.2.6",
|
|
167
|
+
"typescript": "5.5.3",
|
|
168
168
|
"wdio-docker-service": "1.5.0",
|
|
169
|
-
"webdriverio": "8.
|
|
169
|
+
"webdriverio": "8.39.1",
|
|
170
170
|
"xml2js": "0.6.2",
|
|
171
171
|
"xpath": "0.0.34"
|
|
172
172
|
},
|
|
@@ -1181,7 +1181,6 @@ declare namespace CodeceptJS {
|
|
|
1181
1181
|
* ## Methods
|
|
1182
1182
|
*/
|
|
1183
1183
|
// @ts-ignore
|
|
1184
|
-
// @ts-ignore
|
|
1185
1184
|
class ExpectHelper {
|
|
1186
1185
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1187
1186
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
@@ -1294,7 +1293,6 @@ declare namespace CodeceptJS {
|
|
|
1294
1293
|
* ## Methods
|
|
1295
1294
|
*/
|
|
1296
1295
|
// @ts-ignore
|
|
1297
|
-
// @ts-ignore
|
|
1298
1296
|
class ExpectHelper {
|
|
1299
1297
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1300
1298
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
@@ -1967,7 +1965,6 @@ declare namespace CodeceptJS {
|
|
|
1967
1965
|
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1968
1966
|
*/
|
|
1969
1967
|
// @ts-ignore
|
|
1970
|
-
// @ts-ignore
|
|
1971
1968
|
type MockServerConfig = {
|
|
1972
1969
|
port?: number;
|
|
1973
1970
|
host?: string;
|
|
@@ -2093,7 +2090,6 @@ declare namespace CodeceptJS {
|
|
|
2093
2090
|
* ## Methods
|
|
2094
2091
|
*/
|
|
2095
2092
|
// @ts-ignore
|
|
2096
|
-
// @ts-ignore
|
|
2097
2093
|
class MockServer {
|
|
2098
2094
|
/**
|
|
2099
2095
|
* Start the mock server
|
|
@@ -3168,7 +3164,6 @@ declare namespace CodeceptJS {
|
|
|
3168
3164
|
* @property [testIdAttribute = data-testid] - locate elements based on the testIdAttribute. See more of [locate by test id](https://playwright.dev/docs/locators#locate-by-test-id).
|
|
3169
3165
|
*/
|
|
3170
3166
|
// @ts-ignore
|
|
3171
|
-
// @ts-ignore
|
|
3172
3167
|
type PlaywrightConfig = {
|
|
3173
3168
|
url?: string;
|
|
3174
3169
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -4762,6 +4757,13 @@ declare namespace CodeceptJS {
|
|
|
4762
4757
|
* @param [sec = 1] - (optional) time in seconds to wait, 1 by default.
|
|
4763
4758
|
*/
|
|
4764
4759
|
waitForEnabled(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<any>;
|
|
4760
|
+
/**
|
|
4761
|
+
* Waits for element to become disabled (by default waits for 1sec).
|
|
4762
|
+
* Element can be located by CSS or XPath.
|
|
4763
|
+
* @param locator - element located by CSS|XPath|strict locator.
|
|
4764
|
+
* @param [sec = 1] - (optional) time in seconds to wait, 1 by default.
|
|
4765
|
+
*/
|
|
4766
|
+
waitForDisabled(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<any>;
|
|
4765
4767
|
/**
|
|
4766
4768
|
* Waits for the specified value to be in value attribute.
|
|
4767
4769
|
*
|
|
@@ -6539,7 +6541,6 @@ declare namespace CodeceptJS {
|
|
|
6539
6541
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
6540
6542
|
*/
|
|
6541
6543
|
// @ts-ignore
|
|
6542
|
-
// @ts-ignore
|
|
6543
6544
|
type PuppeteerConfig = {
|
|
6544
6545
|
url: string;
|
|
6545
6546
|
basicAuth?: any;
|
|
@@ -8347,7 +8348,6 @@ declare namespace CodeceptJS {
|
|
|
8347
8348
|
* @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
|
|
8348
8349
|
*/
|
|
8349
8350
|
// @ts-ignore
|
|
8350
|
-
// @ts-ignore
|
|
8351
8351
|
type RESTConfig = {
|
|
8352
8352
|
endpoint?: string;
|
|
8353
8353
|
prettyPrintJson?: boolean;
|
|
@@ -8513,6 +8513,250 @@ declare namespace CodeceptJS {
|
|
|
8513
8513
|
*/
|
|
8514
8514
|
sendDeleteRequest(url: any, headers?: any): Promise<any>;
|
|
8515
8515
|
}
|
|
8516
|
+
/**
|
|
8517
|
+
* SoftAssertHelper is a utility class for performing soft assertions.
|
|
8518
|
+
* Unlike traditional assertions that stop the execution on failure,
|
|
8519
|
+
* soft assertions allow the execution to continue and report all failures at the end.
|
|
8520
|
+
*
|
|
8521
|
+
* ### Examples
|
|
8522
|
+
*
|
|
8523
|
+
* Zero-configuration when paired with other helpers like REST, Playwright:
|
|
8524
|
+
*
|
|
8525
|
+
* ```js
|
|
8526
|
+
* // inside codecept.conf.js
|
|
8527
|
+
* {
|
|
8528
|
+
* helpers: {
|
|
8529
|
+
* Playwright: {...},
|
|
8530
|
+
* SoftExpectHelper: {},
|
|
8531
|
+
* }
|
|
8532
|
+
* }
|
|
8533
|
+
* ```
|
|
8534
|
+
*
|
|
8535
|
+
* ```js
|
|
8536
|
+
* // in scenario
|
|
8537
|
+
* I.softExpectEqual('a', 'b')
|
|
8538
|
+
* I.flushSoftAssertions() // Throws an error if any soft assertions have failed. The error message contains all the accumulated failures.
|
|
8539
|
+
* ```
|
|
8540
|
+
*
|
|
8541
|
+
* ## Methods
|
|
8542
|
+
*/
|
|
8543
|
+
class SoftAssertHelperTs {
|
|
8544
|
+
/**
|
|
8545
|
+
* Performs a soft assertion by executing the provided assertion function.
|
|
8546
|
+
* If the assertion fails, the error is caught and stored without halting the execution.
|
|
8547
|
+
* @param assertionFn - The assertion function to execute.
|
|
8548
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8549
|
+
*/
|
|
8550
|
+
softAssert(assertionFn: (...params: any[]) => any, customErrorMsg?: string): Promise<any>;
|
|
8551
|
+
/**
|
|
8552
|
+
* Throws an error if any soft assertions have failed.
|
|
8553
|
+
* The error message contains all the accumulated failures.
|
|
8554
|
+
*/
|
|
8555
|
+
flushSoftAssertions(): Promise<any>;
|
|
8556
|
+
/**
|
|
8557
|
+
* Softly asserts that two values are equal.
|
|
8558
|
+
* @param actualValue - The actual value.
|
|
8559
|
+
* @param expectedValue - The expected value.
|
|
8560
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8561
|
+
*/
|
|
8562
|
+
softExpectEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): Promise<any>;
|
|
8563
|
+
/**
|
|
8564
|
+
* Softly asserts that two values are not equal.
|
|
8565
|
+
* @param actualValue - The actual value.
|
|
8566
|
+
* @param expectedValue - The expected value.
|
|
8567
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8568
|
+
*/
|
|
8569
|
+
softExpectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): Promise<any>;
|
|
8570
|
+
/**
|
|
8571
|
+
* Softly asserts that two values are deeply equal.
|
|
8572
|
+
* @param actualValue - The actual value.
|
|
8573
|
+
* @param expectedValue - The expected value.
|
|
8574
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8575
|
+
*/
|
|
8576
|
+
softExpectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): Promise<any>;
|
|
8577
|
+
/**
|
|
8578
|
+
* Softly asserts that two values are not deeply equal.
|
|
8579
|
+
* @param actualValue - The actual value.
|
|
8580
|
+
* @param expectedValue - The expected value.
|
|
8581
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8582
|
+
*/
|
|
8583
|
+
softExpectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): Promise<any>;
|
|
8584
|
+
/**
|
|
8585
|
+
* Softly asserts that a value contains the expected value.
|
|
8586
|
+
* @param actualValue - The actual value.
|
|
8587
|
+
* @param expectedValueToContain - The value that should be contained within the actual value.
|
|
8588
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8589
|
+
*/
|
|
8590
|
+
softExpectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: string): Promise<any>;
|
|
8591
|
+
/**
|
|
8592
|
+
* Softly asserts that a value does not contain the expected value.
|
|
8593
|
+
* @param actualValue - The actual value.
|
|
8594
|
+
* @param expectedValueToNotContain - The value that should not be contained within the actual value.
|
|
8595
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8596
|
+
*/
|
|
8597
|
+
softExpectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: string): Promise<any>;
|
|
8598
|
+
/**
|
|
8599
|
+
* Softly asserts that a value starts with the expected value.
|
|
8600
|
+
* @param actualValue - The actual value.
|
|
8601
|
+
* @param expectedValueToStartWith - The value that the actual value should start with.
|
|
8602
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8603
|
+
*/
|
|
8604
|
+
softExpectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: string): Promise<any>;
|
|
8605
|
+
/**
|
|
8606
|
+
* Softly asserts that a value does not start with the expected value.
|
|
8607
|
+
* @param actualValue - The actual value.
|
|
8608
|
+
* @param expectedValueToNotStartWith - The value that the actual value should not start with.
|
|
8609
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8610
|
+
*/
|
|
8611
|
+
softExpectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: string): Promise<any>;
|
|
8612
|
+
/**
|
|
8613
|
+
* Softly asserts that a value ends with the expected value.
|
|
8614
|
+
* @param actualValue - The actual value.
|
|
8615
|
+
* @param expectedValueToEndWith - The value that the actual value should end with.
|
|
8616
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8617
|
+
*/
|
|
8618
|
+
softExpectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: string): Promise<any>;
|
|
8619
|
+
/**
|
|
8620
|
+
* Softly asserts that a value does not end with the expected value.
|
|
8621
|
+
* @param actualValue - The actual value.
|
|
8622
|
+
* @param expectedValueToNotEndWith - The value that the actual value should not end with.
|
|
8623
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8624
|
+
*/
|
|
8625
|
+
softExpectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: string): Promise<any>;
|
|
8626
|
+
/**
|
|
8627
|
+
* Softly asserts that the target data matches the given JSON schema.
|
|
8628
|
+
* @param targetData - The data to validate.
|
|
8629
|
+
* @param jsonSchema - The JSON schema to validate against.
|
|
8630
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8631
|
+
*/
|
|
8632
|
+
softExpectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: string): Promise<any>;
|
|
8633
|
+
/**
|
|
8634
|
+
* Softly asserts that the target data matches the given JSON schema using AJV.
|
|
8635
|
+
* @param targetData - The data to validate.
|
|
8636
|
+
* @param jsonSchema - The JSON schema to validate against.
|
|
8637
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8638
|
+
* @param [ajvOptions = { allErrors: true }] - Options to pass to AJV.
|
|
8639
|
+
*/
|
|
8640
|
+
softExpectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: string, ajvOptions?: any): Promise<any>;
|
|
8641
|
+
/**
|
|
8642
|
+
* Softly asserts that the target data has the specified property.
|
|
8643
|
+
* @param targetData - The data to check.
|
|
8644
|
+
* @param propertyName - The property name to check for.
|
|
8645
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion
|
|
8646
|
+
* fails.
|
|
8647
|
+
*/
|
|
8648
|
+
softExpectHasProperty(targetData: any, propertyName: string, customErrorMsg?: string): Promise<any>;
|
|
8649
|
+
/**
|
|
8650
|
+
* Softly asserts that the target data has a property with the specified name.
|
|
8651
|
+
* @param targetData - The data to check.
|
|
8652
|
+
* @param propertyName - The property name to check for.
|
|
8653
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8654
|
+
*/
|
|
8655
|
+
softExpectHasAProperty(targetData: any, propertyName: string, customErrorMsg?: string): Promise<any>;
|
|
8656
|
+
/**
|
|
8657
|
+
* Softly asserts that the target data is of a specific type.
|
|
8658
|
+
* @param targetData - The data to check.
|
|
8659
|
+
* @param type - The expected type (e.g., 'string', 'number').
|
|
8660
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8661
|
+
*/
|
|
8662
|
+
softExpectToBeA(targetData: any, type: string, customErrorMsg?: string): Promise<any>;
|
|
8663
|
+
/**
|
|
8664
|
+
* Softly asserts that the target data is of a specific type (alternative for articles).
|
|
8665
|
+
* @param targetData - The data to check.
|
|
8666
|
+
* @param type - The expected type (e.g., 'string', 'number').
|
|
8667
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8668
|
+
*/
|
|
8669
|
+
softExpectToBeAn(targetData: any, type: string, customErrorMsg?: string): Promise<any>;
|
|
8670
|
+
/**
|
|
8671
|
+
* Softly asserts that the target data has a specified length.
|
|
8672
|
+
* @param targetData - The data to check.
|
|
8673
|
+
* @param length - The expected length.
|
|
8674
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8675
|
+
*/
|
|
8676
|
+
softExpectLengthOf(targetData: any, length: number, customErrorMsg?: string): Promise<any>;
|
|
8677
|
+
/**
|
|
8678
|
+
* Softly asserts that the target data is empty.
|
|
8679
|
+
* @param targetData - The data to check.
|
|
8680
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8681
|
+
*/
|
|
8682
|
+
softExpectEmpty(targetData: any, customErrorMsg?: string): Promise<any>;
|
|
8683
|
+
/**
|
|
8684
|
+
* Softly asserts that the target data is true.
|
|
8685
|
+
* @param targetData - The data to check.
|
|
8686
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8687
|
+
*/
|
|
8688
|
+
softExpectTrue(targetData: any, customErrorMsg?: string): Promise<any>;
|
|
8689
|
+
/**
|
|
8690
|
+
* Softly asserts that the target data is false.
|
|
8691
|
+
* @param targetData - The data to check.
|
|
8692
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8693
|
+
*/
|
|
8694
|
+
softExpectFalse(targetData: any, customErrorMsg?: string): Promise<any>;
|
|
8695
|
+
/**
|
|
8696
|
+
* Softly asserts that the target data is above a specified value.
|
|
8697
|
+
* @param targetData - The data to check.
|
|
8698
|
+
* @param aboveThan - The value that the target data should be above.
|
|
8699
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8700
|
+
*/
|
|
8701
|
+
softExpectAbove(targetData: any, aboveThan: any, customErrorMsg?: string): Promise<any>;
|
|
8702
|
+
/**
|
|
8703
|
+
* Softly asserts that the target data is below a specified value.
|
|
8704
|
+
* @param targetData - The data to check.
|
|
8705
|
+
* @param belowThan - The value that the target data should be below.
|
|
8706
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8707
|
+
*/
|
|
8708
|
+
softExpectBelow(targetData: any, belowThan: any, customErrorMsg?: string): Promise<any>;
|
|
8709
|
+
/**
|
|
8710
|
+
* Softly asserts that the length of the target data is above a specified value.
|
|
8711
|
+
* @param targetData - The data to check.
|
|
8712
|
+
* @param lengthAboveThan - The length that the target data should be above.
|
|
8713
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8714
|
+
*/
|
|
8715
|
+
softExpectLengthAboveThan(targetData: any, lengthAboveThan: number, customErrorMsg?: string): Promise<any>;
|
|
8716
|
+
/**
|
|
8717
|
+
* Softly asserts that the length of the target data is below a specified value.
|
|
8718
|
+
* @param targetData - The data to check.
|
|
8719
|
+
* @param lengthBelowThan - The length that the target data should be below.
|
|
8720
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8721
|
+
*/
|
|
8722
|
+
softExpectLengthBelowThan(targetData: any, lengthBelowThan: number, customErrorMsg?: string): Promise<any>;
|
|
8723
|
+
/**
|
|
8724
|
+
* Softly asserts that two values are equal, ignoring case.
|
|
8725
|
+
* @param actualValue - The actual string value.
|
|
8726
|
+
* @param expectedValue - The expected string value.
|
|
8727
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8728
|
+
*/
|
|
8729
|
+
softExpectEqualIgnoreCase(actualValue: string, expectedValue: string, customErrorMsg?: string): Promise<any>;
|
|
8730
|
+
/**
|
|
8731
|
+
* Softly asserts that two arrays have deep equality, considering members in any order.
|
|
8732
|
+
* @param actualValue - The actual array.
|
|
8733
|
+
* @param expectedValue - The expected array.
|
|
8734
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8735
|
+
*/
|
|
8736
|
+
softExpectDeepMembers(actualValue: any[], expectedValue: any[], customErrorMsg?: string): Promise<any>;
|
|
8737
|
+
/**
|
|
8738
|
+
* Softly asserts that an array (superset) deeply includes all members of another array (set).
|
|
8739
|
+
* @param superset - The array that should contain the expected members.
|
|
8740
|
+
* @param set - The array with members that should be included.
|
|
8741
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8742
|
+
*/
|
|
8743
|
+
softExpectDeepIncludeMembers(superset: any[], set: any[], customErrorMsg?: string): Promise<any>;
|
|
8744
|
+
/**
|
|
8745
|
+
* Softly asserts that two objects are deeply equal, excluding specified fields.
|
|
8746
|
+
* @param actualValue - The actual object.
|
|
8747
|
+
* @param expectedValue - The expected object.
|
|
8748
|
+
* @param fieldsToExclude - The fields to exclude from the comparison.
|
|
8749
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8750
|
+
*/
|
|
8751
|
+
softExpectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: string[], customErrorMsg?: string): Promise<any>;
|
|
8752
|
+
/**
|
|
8753
|
+
* Softly asserts that a value matches the expected pattern.
|
|
8754
|
+
* @param actualValue - The actual value.
|
|
8755
|
+
* @param expectedPattern - The pattern the value should match.
|
|
8756
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8757
|
+
*/
|
|
8758
|
+
softExpectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: string): Promise<any>;
|
|
8759
|
+
}
|
|
8516
8760
|
/**
|
|
8517
8761
|
* Client Functions
|
|
8518
8762
|
*/
|
|
@@ -9467,7 +9711,6 @@ declare namespace CodeceptJS {
|
|
|
9467
9711
|
* @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
|
|
9468
9712
|
*/
|
|
9469
9713
|
// @ts-ignore
|
|
9470
|
-
// @ts-ignore
|
|
9471
9714
|
type WebDriverConfig = {
|
|
9472
9715
|
url: string;
|
|
9473
9716
|
browser: string;
|
package/typings/types.d.ts
CHANGED
|
@@ -1205,7 +1205,6 @@ declare namespace CodeceptJS {
|
|
|
1205
1205
|
* ## Methods
|
|
1206
1206
|
*/
|
|
1207
1207
|
// @ts-ignore
|
|
1208
|
-
// @ts-ignore
|
|
1209
1208
|
class ExpectHelper {
|
|
1210
1209
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1211
1210
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
@@ -1318,7 +1317,6 @@ declare namespace CodeceptJS {
|
|
|
1318
1317
|
* ## Methods
|
|
1319
1318
|
*/
|
|
1320
1319
|
// @ts-ignore
|
|
1321
|
-
// @ts-ignore
|
|
1322
1320
|
class ExpectHelper {
|
|
1323
1321
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1324
1322
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
@@ -1994,7 +1992,6 @@ declare namespace CodeceptJS {
|
|
|
1994
1992
|
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1995
1993
|
*/
|
|
1996
1994
|
// @ts-ignore
|
|
1997
|
-
// @ts-ignore
|
|
1998
1995
|
type MockServerConfig = {
|
|
1999
1996
|
port?: number;
|
|
2000
1997
|
host?: string;
|
|
@@ -2120,7 +2117,6 @@ declare namespace CodeceptJS {
|
|
|
2120
2117
|
* ## Methods
|
|
2121
2118
|
*/
|
|
2122
2119
|
// @ts-ignore
|
|
2123
|
-
// @ts-ignore
|
|
2124
2120
|
class MockServer {
|
|
2125
2121
|
/**
|
|
2126
2122
|
* Start the mock server
|
|
@@ -3261,7 +3257,6 @@ declare namespace CodeceptJS {
|
|
|
3261
3257
|
* @property [testIdAttribute = data-testid] - locate elements based on the testIdAttribute. See more of [locate by test id](https://playwright.dev/docs/locators#locate-by-test-id).
|
|
3262
3258
|
*/
|
|
3263
3259
|
// @ts-ignore
|
|
3264
|
-
// @ts-ignore
|
|
3265
3260
|
type PlaywrightConfig = {
|
|
3266
3261
|
url?: string;
|
|
3267
3262
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -4914,6 +4909,14 @@ declare namespace CodeceptJS {
|
|
|
4914
4909
|
* @returns automatically synchronized promise through #recorder
|
|
4915
4910
|
*/
|
|
4916
4911
|
waitForEnabled(locator: CodeceptJS.LocatorOrString, sec?: number): void;
|
|
4912
|
+
/**
|
|
4913
|
+
* Waits for element to become disabled (by default waits for 1sec).
|
|
4914
|
+
* Element can be located by CSS or XPath.
|
|
4915
|
+
* @param locator - element located by CSS|XPath|strict locator.
|
|
4916
|
+
* @param [sec = 1] - (optional) time in seconds to wait, 1 by default.
|
|
4917
|
+
* @returns automatically synchronized promise through #recorder
|
|
4918
|
+
*/
|
|
4919
|
+
waitForDisabled(locator: CodeceptJS.LocatorOrString, sec?: number): void;
|
|
4917
4920
|
/**
|
|
4918
4921
|
* Waits for the specified value to be in value attribute.
|
|
4919
4922
|
*
|
|
@@ -6782,7 +6785,6 @@ declare namespace CodeceptJS {
|
|
|
6782
6785
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
6783
6786
|
*/
|
|
6784
6787
|
// @ts-ignore
|
|
6785
|
-
// @ts-ignore
|
|
6786
6788
|
type PuppeteerConfig = {
|
|
6787
6789
|
url: string;
|
|
6788
6790
|
basicAuth?: any;
|
|
@@ -8726,7 +8728,6 @@ declare namespace CodeceptJS {
|
|
|
8726
8728
|
* @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
|
|
8727
8729
|
*/
|
|
8728
8730
|
// @ts-ignore
|
|
8729
|
-
// @ts-ignore
|
|
8730
8731
|
type RESTConfig = {
|
|
8731
8732
|
endpoint?: string;
|
|
8732
8733
|
prettyPrintJson?: boolean;
|
|
@@ -8892,6 +8893,250 @@ declare namespace CodeceptJS {
|
|
|
8892
8893
|
*/
|
|
8893
8894
|
sendDeleteRequest(url: any, headers?: any): Promise<any>;
|
|
8894
8895
|
}
|
|
8896
|
+
/**
|
|
8897
|
+
* SoftAssertHelper is a utility class for performing soft assertions.
|
|
8898
|
+
* Unlike traditional assertions that stop the execution on failure,
|
|
8899
|
+
* soft assertions allow the execution to continue and report all failures at the end.
|
|
8900
|
+
*
|
|
8901
|
+
* ### Examples
|
|
8902
|
+
*
|
|
8903
|
+
* Zero-configuration when paired with other helpers like REST, Playwright:
|
|
8904
|
+
*
|
|
8905
|
+
* ```js
|
|
8906
|
+
* // inside codecept.conf.js
|
|
8907
|
+
* {
|
|
8908
|
+
* helpers: {
|
|
8909
|
+
* Playwright: {...},
|
|
8910
|
+
* SoftExpectHelper: {},
|
|
8911
|
+
* }
|
|
8912
|
+
* }
|
|
8913
|
+
* ```
|
|
8914
|
+
*
|
|
8915
|
+
* ```js
|
|
8916
|
+
* // in scenario
|
|
8917
|
+
* I.softExpectEqual('a', 'b')
|
|
8918
|
+
* I.flushSoftAssertions() // Throws an error if any soft assertions have failed. The error message contains all the accumulated failures.
|
|
8919
|
+
* ```
|
|
8920
|
+
*
|
|
8921
|
+
* ## Methods
|
|
8922
|
+
*/
|
|
8923
|
+
class SoftAssertHelper {
|
|
8924
|
+
/**
|
|
8925
|
+
* Performs a soft assertion by executing the provided assertion function.
|
|
8926
|
+
* If the assertion fails, the error is caught and stored without halting the execution.
|
|
8927
|
+
* @param assertionFn - The assertion function to execute.
|
|
8928
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8929
|
+
*/
|
|
8930
|
+
softAssert(assertionFn: (...params: any[]) => any, customErrorMsg?: string): void;
|
|
8931
|
+
/**
|
|
8932
|
+
* Throws an error if any soft assertions have failed.
|
|
8933
|
+
* The error message contains all the accumulated failures.
|
|
8934
|
+
*/
|
|
8935
|
+
flushSoftAssertions(): void;
|
|
8936
|
+
/**
|
|
8937
|
+
* Softly asserts that two values are equal.
|
|
8938
|
+
* @param actualValue - The actual value.
|
|
8939
|
+
* @param expectedValue - The expected value.
|
|
8940
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8941
|
+
*/
|
|
8942
|
+
softExpectEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
|
|
8943
|
+
/**
|
|
8944
|
+
* Softly asserts that two values are not equal.
|
|
8945
|
+
* @param actualValue - The actual value.
|
|
8946
|
+
* @param expectedValue - The expected value.
|
|
8947
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8948
|
+
*/
|
|
8949
|
+
softExpectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
|
|
8950
|
+
/**
|
|
8951
|
+
* Softly asserts that two values are deeply equal.
|
|
8952
|
+
* @param actualValue - The actual value.
|
|
8953
|
+
* @param expectedValue - The expected value.
|
|
8954
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8955
|
+
*/
|
|
8956
|
+
softExpectDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
|
|
8957
|
+
/**
|
|
8958
|
+
* Softly asserts that two values are not deeply equal.
|
|
8959
|
+
* @param actualValue - The actual value.
|
|
8960
|
+
* @param expectedValue - The expected value.
|
|
8961
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8962
|
+
*/
|
|
8963
|
+
softExpectNotDeepEqual(actualValue: any, expectedValue: any, customErrorMsg?: string): void;
|
|
8964
|
+
/**
|
|
8965
|
+
* Softly asserts that a value contains the expected value.
|
|
8966
|
+
* @param actualValue - The actual value.
|
|
8967
|
+
* @param expectedValueToContain - The value that should be contained within the actual value.
|
|
8968
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8969
|
+
*/
|
|
8970
|
+
softExpectContain(actualValue: any, expectedValueToContain: any, customErrorMsg?: string): void;
|
|
8971
|
+
/**
|
|
8972
|
+
* Softly asserts that a value does not contain the expected value.
|
|
8973
|
+
* @param actualValue - The actual value.
|
|
8974
|
+
* @param expectedValueToNotContain - The value that should not be contained within the actual value.
|
|
8975
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8976
|
+
*/
|
|
8977
|
+
softExpectNotContain(actualValue: any, expectedValueToNotContain: any, customErrorMsg?: string): void;
|
|
8978
|
+
/**
|
|
8979
|
+
* Softly asserts that a value starts with the expected value.
|
|
8980
|
+
* @param actualValue - The actual value.
|
|
8981
|
+
* @param expectedValueToStartWith - The value that the actual value should start with.
|
|
8982
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8983
|
+
*/
|
|
8984
|
+
softExpectStartsWith(actualValue: any, expectedValueToStartWith: any, customErrorMsg?: string): void;
|
|
8985
|
+
/**
|
|
8986
|
+
* Softly asserts that a value does not start with the expected value.
|
|
8987
|
+
* @param actualValue - The actual value.
|
|
8988
|
+
* @param expectedValueToNotStartWith - The value that the actual value should not start with.
|
|
8989
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8990
|
+
*/
|
|
8991
|
+
softExpectNotStartsWith(actualValue: any, expectedValueToNotStartWith: any, customErrorMsg?: string): void;
|
|
8992
|
+
/**
|
|
8993
|
+
* Softly asserts that a value ends with the expected value.
|
|
8994
|
+
* @param actualValue - The actual value.
|
|
8995
|
+
* @param expectedValueToEndWith - The value that the actual value should end with.
|
|
8996
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
8997
|
+
*/
|
|
8998
|
+
softExpectEndsWith(actualValue: any, expectedValueToEndWith: any, customErrorMsg?: string): void;
|
|
8999
|
+
/**
|
|
9000
|
+
* Softly asserts that a value does not end with the expected value.
|
|
9001
|
+
* @param actualValue - The actual value.
|
|
9002
|
+
* @param expectedValueToNotEndWith - The value that the actual value should not end with.
|
|
9003
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9004
|
+
*/
|
|
9005
|
+
softExpectNotEndsWith(actualValue: any, expectedValueToNotEndWith: any, customErrorMsg?: string): void;
|
|
9006
|
+
/**
|
|
9007
|
+
* Softly asserts that the target data matches the given JSON schema.
|
|
9008
|
+
* @param targetData - The data to validate.
|
|
9009
|
+
* @param jsonSchema - The JSON schema to validate against.
|
|
9010
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9011
|
+
*/
|
|
9012
|
+
softExpectJsonSchema(targetData: any, jsonSchema: any, customErrorMsg?: string): void;
|
|
9013
|
+
/**
|
|
9014
|
+
* Softly asserts that the target data matches the given JSON schema using AJV.
|
|
9015
|
+
* @param targetData - The data to validate.
|
|
9016
|
+
* @param jsonSchema - The JSON schema to validate against.
|
|
9017
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9018
|
+
* @param [ajvOptions = { allErrors: true }] - Options to pass to AJV.
|
|
9019
|
+
*/
|
|
9020
|
+
softExpectJsonSchemaUsingAJV(targetData: any, jsonSchema: any, customErrorMsg?: string, ajvOptions?: any): void;
|
|
9021
|
+
/**
|
|
9022
|
+
* Softly asserts that the target data has the specified property.
|
|
9023
|
+
* @param targetData - The data to check.
|
|
9024
|
+
* @param propertyName - The property name to check for.
|
|
9025
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion
|
|
9026
|
+
* fails.
|
|
9027
|
+
*/
|
|
9028
|
+
softExpectHasProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
|
|
9029
|
+
/**
|
|
9030
|
+
* Softly asserts that the target data has a property with the specified name.
|
|
9031
|
+
* @param targetData - The data to check.
|
|
9032
|
+
* @param propertyName - The property name to check for.
|
|
9033
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9034
|
+
*/
|
|
9035
|
+
softExpectHasAProperty(targetData: any, propertyName: string, customErrorMsg?: string): void;
|
|
9036
|
+
/**
|
|
9037
|
+
* Softly asserts that the target data is of a specific type.
|
|
9038
|
+
* @param targetData - The data to check.
|
|
9039
|
+
* @param type - The expected type (e.g., 'string', 'number').
|
|
9040
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9041
|
+
*/
|
|
9042
|
+
softExpectToBeA(targetData: any, type: string, customErrorMsg?: string): void;
|
|
9043
|
+
/**
|
|
9044
|
+
* Softly asserts that the target data is of a specific type (alternative for articles).
|
|
9045
|
+
* @param targetData - The data to check.
|
|
9046
|
+
* @param type - The expected type (e.g., 'string', 'number').
|
|
9047
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9048
|
+
*/
|
|
9049
|
+
softExpectToBeAn(targetData: any, type: string, customErrorMsg?: string): void;
|
|
9050
|
+
/**
|
|
9051
|
+
* Softly asserts that the target data has a specified length.
|
|
9052
|
+
* @param targetData - The data to check.
|
|
9053
|
+
* @param length - The expected length.
|
|
9054
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9055
|
+
*/
|
|
9056
|
+
softExpectLengthOf(targetData: any, length: number, customErrorMsg?: string): void;
|
|
9057
|
+
/**
|
|
9058
|
+
* Softly asserts that the target data is empty.
|
|
9059
|
+
* @param targetData - The data to check.
|
|
9060
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9061
|
+
*/
|
|
9062
|
+
softExpectEmpty(targetData: any, customErrorMsg?: string): void;
|
|
9063
|
+
/**
|
|
9064
|
+
* Softly asserts that the target data is true.
|
|
9065
|
+
* @param targetData - The data to check.
|
|
9066
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9067
|
+
*/
|
|
9068
|
+
softExpectTrue(targetData: any, customErrorMsg?: string): void;
|
|
9069
|
+
/**
|
|
9070
|
+
* Softly asserts that the target data is false.
|
|
9071
|
+
* @param targetData - The data to check.
|
|
9072
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9073
|
+
*/
|
|
9074
|
+
softExpectFalse(targetData: any, customErrorMsg?: string): void;
|
|
9075
|
+
/**
|
|
9076
|
+
* Softly asserts that the target data is above a specified value.
|
|
9077
|
+
* @param targetData - The data to check.
|
|
9078
|
+
* @param aboveThan - The value that the target data should be above.
|
|
9079
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9080
|
+
*/
|
|
9081
|
+
softExpectAbove(targetData: any, aboveThan: any, customErrorMsg?: string): void;
|
|
9082
|
+
/**
|
|
9083
|
+
* Softly asserts that the target data is below a specified value.
|
|
9084
|
+
* @param targetData - The data to check.
|
|
9085
|
+
* @param belowThan - The value that the target data should be below.
|
|
9086
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9087
|
+
*/
|
|
9088
|
+
softExpectBelow(targetData: any, belowThan: any, customErrorMsg?: string): void;
|
|
9089
|
+
/**
|
|
9090
|
+
* Softly asserts that the length of the target data is above a specified value.
|
|
9091
|
+
* @param targetData - The data to check.
|
|
9092
|
+
* @param lengthAboveThan - The length that the target data should be above.
|
|
9093
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9094
|
+
*/
|
|
9095
|
+
softExpectLengthAboveThan(targetData: any, lengthAboveThan: number, customErrorMsg?: string): void;
|
|
9096
|
+
/**
|
|
9097
|
+
* Softly asserts that the length of the target data is below a specified value.
|
|
9098
|
+
* @param targetData - The data to check.
|
|
9099
|
+
* @param lengthBelowThan - The length that the target data should be below.
|
|
9100
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9101
|
+
*/
|
|
9102
|
+
softExpectLengthBelowThan(targetData: any, lengthBelowThan: number, customErrorMsg?: string): void;
|
|
9103
|
+
/**
|
|
9104
|
+
* Softly asserts that two values are equal, ignoring case.
|
|
9105
|
+
* @param actualValue - The actual string value.
|
|
9106
|
+
* @param expectedValue - The expected string value.
|
|
9107
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9108
|
+
*/
|
|
9109
|
+
softExpectEqualIgnoreCase(actualValue: string, expectedValue: string, customErrorMsg?: string): void;
|
|
9110
|
+
/**
|
|
9111
|
+
* Softly asserts that two arrays have deep equality, considering members in any order.
|
|
9112
|
+
* @param actualValue - The actual array.
|
|
9113
|
+
* @param expectedValue - The expected array.
|
|
9114
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9115
|
+
*/
|
|
9116
|
+
softExpectDeepMembers(actualValue: any[], expectedValue: any[], customErrorMsg?: string): void;
|
|
9117
|
+
/**
|
|
9118
|
+
* Softly asserts that an array (superset) deeply includes all members of another array (set).
|
|
9119
|
+
* @param superset - The array that should contain the expected members.
|
|
9120
|
+
* @param set - The array with members that should be included.
|
|
9121
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9122
|
+
*/
|
|
9123
|
+
softExpectDeepIncludeMembers(superset: any[], set: any[], customErrorMsg?: string): void;
|
|
9124
|
+
/**
|
|
9125
|
+
* Softly asserts that two objects are deeply equal, excluding specified fields.
|
|
9126
|
+
* @param actualValue - The actual object.
|
|
9127
|
+
* @param expectedValue - The expected object.
|
|
9128
|
+
* @param fieldsToExclude - The fields to exclude from the comparison.
|
|
9129
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9130
|
+
*/
|
|
9131
|
+
softExpectDeepEqualExcluding(actualValue: any, expectedValue: any, fieldsToExclude: string[], customErrorMsg?: string): void;
|
|
9132
|
+
/**
|
|
9133
|
+
* Softly asserts that a value matches the expected pattern.
|
|
9134
|
+
* @param actualValue - The actual value.
|
|
9135
|
+
* @param expectedPattern - The pattern the value should match.
|
|
9136
|
+
* @param [customErrorMsg = ''] - A custom error message to display if the assertion fails.
|
|
9137
|
+
*/
|
|
9138
|
+
softExpectMatchesPattern(actualValue: any, expectedPattern: any, customErrorMsg?: string): void;
|
|
9139
|
+
}
|
|
8895
9140
|
/**
|
|
8896
9141
|
* Client Functions
|
|
8897
9142
|
*/
|
|
@@ -9906,7 +10151,6 @@ declare namespace CodeceptJS {
|
|
|
9906
10151
|
* @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
|
|
9907
10152
|
*/
|
|
9908
10153
|
// @ts-ignore
|
|
9909
|
-
// @ts-ignore
|
|
9910
10154
|
type WebDriverConfig = {
|
|
9911
10155
|
url: string;
|
|
9912
10156
|
browser: string;
|
|
@@ -12376,6 +12620,27 @@ declare namespace CodeceptJS {
|
|
|
12376
12620
|
withAttr(attributes: {
|
|
12377
12621
|
[key: string]: string;
|
|
12378
12622
|
}): Locator;
|
|
12623
|
+
/**
|
|
12624
|
+
* Adds condition: attribute value starts with text
|
|
12625
|
+
* (analog of XPATH: [starts-with(@attr,'startValue')] or CSS [attr^='startValue']
|
|
12626
|
+
* Example: I.click(locate('a').withAttrStartsWith('href', 'https://')));
|
|
12627
|
+
* Works with any attribute: class, href etc.
|
|
12628
|
+
*/
|
|
12629
|
+
withAttrStartsWith(attrName: string, startsWith: string): Locator;
|
|
12630
|
+
/**
|
|
12631
|
+
* Adds condition: attribute value ends with text
|
|
12632
|
+
* (analog of XPATH: [ends-with(@attr,'endValue')] or CSS [attr$='endValue']
|
|
12633
|
+
* Example: I.click(locate('a').withAttrEndsWith('href', '.com')));
|
|
12634
|
+
* Works with any attribute: class, href etc.
|
|
12635
|
+
*/
|
|
12636
|
+
withAttrEndsWith(attrName: string, endsWith: string): Locator;
|
|
12637
|
+
/**
|
|
12638
|
+
* Adds condition: attribute value contains text
|
|
12639
|
+
* (analog of XPATH: [contains(@attr,'partOfAttribute')] or CSS [attr*='partOfAttribute']
|
|
12640
|
+
* Example: I.click(locate('a').withAttrContains('href', 'google')));
|
|
12641
|
+
* Works with any attribute: class, href etc.
|
|
12642
|
+
*/
|
|
12643
|
+
withAttrContains(attrName: string, partOfAttrValue: string): Locator;
|
|
12379
12644
|
withClassAttr(text: string): Locator;
|
|
12380
12645
|
as(output: string): Locator;
|
|
12381
12646
|
inside(locator: CodeceptJS.LocatorOrString): Locator;
|