codeceptjs 3.6.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/lib/helper/SoftExpectHelper.js +381 -0
- package/lib/locator.js +43 -0
- package/lib/template/heal.js +1 -0
- package/package.json +10 -10
- package/typings/promiseBasedTypes.d.ts +252 -0
- package/typings/types.d.ts +273 -0
|
@@ -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
|
@@ -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",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"@xmldom/xmldom": "0.8.10",
|
|
78
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",
|
|
@@ -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,24 +127,24 @@
|
|
|
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": "31.3.
|
|
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": "9.1.
|
|
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",
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
"tsd": "^0.31.0",
|
|
164
164
|
"tsd-jsdoc": "2.5.0",
|
|
165
165
|
"typedoc": "0.26.5",
|
|
166
|
-
"typedoc-plugin-markdown": "4.2.
|
|
166
|
+
"typedoc-plugin-markdown": "4.2.6",
|
|
167
167
|
"typescript": "5.5.3",
|
|
168
168
|
"wdio-docker-service": "1.5.0",
|
|
169
169
|
"webdriverio": "8.39.1",
|
|
@@ -1180,6 +1180,7 @@ declare namespace CodeceptJS {
|
|
|
1180
1180
|
*
|
|
1181
1181
|
* ## Methods
|
|
1182
1182
|
*/
|
|
1183
|
+
// @ts-ignore
|
|
1183
1184
|
class ExpectHelper {
|
|
1184
1185
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1185
1186
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
@@ -1291,6 +1292,7 @@ declare namespace CodeceptJS {
|
|
|
1291
1292
|
*
|
|
1292
1293
|
* ## Methods
|
|
1293
1294
|
*/
|
|
1295
|
+
// @ts-ignore
|
|
1294
1296
|
class ExpectHelper {
|
|
1295
1297
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1296
1298
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
@@ -1962,6 +1964,7 @@ declare namespace CodeceptJS {
|
|
|
1962
1964
|
* @property [host = "0.0.0.0"] - Mock server host
|
|
1963
1965
|
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1964
1966
|
*/
|
|
1967
|
+
// @ts-ignore
|
|
1965
1968
|
type MockServerConfig = {
|
|
1966
1969
|
port?: number;
|
|
1967
1970
|
host?: string;
|
|
@@ -2086,6 +2089,7 @@ declare namespace CodeceptJS {
|
|
|
2086
2089
|
*
|
|
2087
2090
|
* ## Methods
|
|
2088
2091
|
*/
|
|
2092
|
+
// @ts-ignore
|
|
2089
2093
|
class MockServer {
|
|
2090
2094
|
/**
|
|
2091
2095
|
* Start the mock server
|
|
@@ -3159,6 +3163,7 @@ declare namespace CodeceptJS {
|
|
|
3159
3163
|
* @property [recordHar] - record HAR and will be saved to `output/har`. See more of [HAR options](https://playwright.dev/docs/api/class-browser#browser-new-context-option-record-har).
|
|
3160
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).
|
|
3161
3165
|
*/
|
|
3166
|
+
// @ts-ignore
|
|
3162
3167
|
type PlaywrightConfig = {
|
|
3163
3168
|
url?: string;
|
|
3164
3169
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -6535,6 +6540,7 @@ declare namespace CodeceptJS {
|
|
|
6535
6540
|
* @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
|
|
6536
6541
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
6537
6542
|
*/
|
|
6543
|
+
// @ts-ignore
|
|
6538
6544
|
type PuppeteerConfig = {
|
|
6539
6545
|
url: string;
|
|
6540
6546
|
basicAuth?: any;
|
|
@@ -8341,6 +8347,7 @@ declare namespace CodeceptJS {
|
|
|
8341
8347
|
* @property [onResponse] - an async function which can update response object.
|
|
8342
8348
|
* @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
|
|
8343
8349
|
*/
|
|
8350
|
+
// @ts-ignore
|
|
8344
8351
|
type RESTConfig = {
|
|
8345
8352
|
endpoint?: string;
|
|
8346
8353
|
prettyPrintJson?: boolean;
|
|
@@ -8506,6 +8513,250 @@ declare namespace CodeceptJS {
|
|
|
8506
8513
|
*/
|
|
8507
8514
|
sendDeleteRequest(url: any, headers?: any): Promise<any>;
|
|
8508
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
|
+
}
|
|
8509
8760
|
/**
|
|
8510
8761
|
* Client Functions
|
|
8511
8762
|
*/
|
|
@@ -9459,6 +9710,7 @@ declare namespace CodeceptJS {
|
|
|
9459
9710
|
* @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
|
|
9460
9711
|
* @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
|
|
9461
9712
|
*/
|
|
9713
|
+
// @ts-ignore
|
|
9462
9714
|
type WebDriverConfig = {
|
|
9463
9715
|
url: string;
|
|
9464
9716
|
browser: string;
|
package/typings/types.d.ts
CHANGED
|
@@ -1204,6 +1204,7 @@ declare namespace CodeceptJS {
|
|
|
1204
1204
|
*
|
|
1205
1205
|
* ## Methods
|
|
1206
1206
|
*/
|
|
1207
|
+
// @ts-ignore
|
|
1207
1208
|
class ExpectHelper {
|
|
1208
1209
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1209
1210
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
@@ -1315,6 +1316,7 @@ declare namespace CodeceptJS {
|
|
|
1315
1316
|
*
|
|
1316
1317
|
* ## Methods
|
|
1317
1318
|
*/
|
|
1319
|
+
// @ts-ignore
|
|
1318
1320
|
class ExpectHelper {
|
|
1319
1321
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1320
1322
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
@@ -1989,6 +1991,7 @@ declare namespace CodeceptJS {
|
|
|
1989
1991
|
* @property [host = "0.0.0.0"] - Mock server host
|
|
1990
1992
|
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1991
1993
|
*/
|
|
1994
|
+
// @ts-ignore
|
|
1992
1995
|
type MockServerConfig = {
|
|
1993
1996
|
port?: number;
|
|
1994
1997
|
host?: string;
|
|
@@ -2113,6 +2116,7 @@ declare namespace CodeceptJS {
|
|
|
2113
2116
|
*
|
|
2114
2117
|
* ## Methods
|
|
2115
2118
|
*/
|
|
2119
|
+
// @ts-ignore
|
|
2116
2120
|
class MockServer {
|
|
2117
2121
|
/**
|
|
2118
2122
|
* Start the mock server
|
|
@@ -3252,6 +3256,7 @@ declare namespace CodeceptJS {
|
|
|
3252
3256
|
* @property [recordHar] - record HAR and will be saved to `output/har`. See more of [HAR options](https://playwright.dev/docs/api/class-browser#browser-new-context-option-record-har).
|
|
3253
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).
|
|
3254
3258
|
*/
|
|
3259
|
+
// @ts-ignore
|
|
3255
3260
|
type PlaywrightConfig = {
|
|
3256
3261
|
url?: string;
|
|
3257
3262
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -6779,6 +6784,7 @@ declare namespace CodeceptJS {
|
|
|
6779
6784
|
* @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
|
|
6780
6785
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
6781
6786
|
*/
|
|
6787
|
+
// @ts-ignore
|
|
6782
6788
|
type PuppeteerConfig = {
|
|
6783
6789
|
url: string;
|
|
6784
6790
|
basicAuth?: any;
|
|
@@ -8721,6 +8727,7 @@ declare namespace CodeceptJS {
|
|
|
8721
8727
|
* @property [onResponse] - an async function which can update response object.
|
|
8722
8728
|
* @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
|
|
8723
8729
|
*/
|
|
8730
|
+
// @ts-ignore
|
|
8724
8731
|
type RESTConfig = {
|
|
8725
8732
|
endpoint?: string;
|
|
8726
8733
|
prettyPrintJson?: boolean;
|
|
@@ -8886,6 +8893,250 @@ declare namespace CodeceptJS {
|
|
|
8886
8893
|
*/
|
|
8887
8894
|
sendDeleteRequest(url: any, headers?: any): Promise<any>;
|
|
8888
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
|
+
}
|
|
8889
9140
|
/**
|
|
8890
9141
|
* Client Functions
|
|
8891
9142
|
*/
|
|
@@ -9899,6 +10150,7 @@ declare namespace CodeceptJS {
|
|
|
9899
10150
|
* @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
|
|
9900
10151
|
* @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
|
|
9901
10152
|
*/
|
|
10153
|
+
// @ts-ignore
|
|
9902
10154
|
type WebDriverConfig = {
|
|
9903
10155
|
url: string;
|
|
9904
10156
|
browser: string;
|
|
@@ -12368,6 +12620,27 @@ declare namespace CodeceptJS {
|
|
|
12368
12620
|
withAttr(attributes: {
|
|
12369
12621
|
[key: string]: string;
|
|
12370
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;
|
|
12371
12644
|
withClassAttr(text: string): Locator;
|
|
12372
12645
|
as(output: string): Locator;
|
|
12373
12646
|
inside(locator: CodeceptJS.LocatorOrString): Locator;
|