codeceptjs 3.6.6-beta.6 → 3.6.7

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.
@@ -3,9 +3,7 @@ Resumes test execution, so **should be used inside async function with `await`**
3
3
 
4
4
  ```js
5
5
  let numOfElements = await I.grabNumberOfVisibleElements('p');
6
- let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
7
6
  ```
8
7
 
9
8
  @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
10
- @param {number} [sec] (optional, `1` by default) time in seconds to wait
11
- @returns {Promise<number>} number of visible elements
9
+ @returns {Promise<number>} number of visible elements
package/lib/cli.js CHANGED
@@ -145,6 +145,7 @@ class Cli extends Base {
145
145
 
146
146
  result() {
147
147
  const stats = this.stats;
148
+ stats.failedHooks = 0;
148
149
  console.log();
149
150
 
150
151
  // passes
@@ -216,8 +217,14 @@ class Cli extends Base {
216
217
  console.log();
217
218
  }
218
219
 
220
+ this.failures.forEach((failure) => {
221
+ if (failure.constructor.name === 'Hook') {
222
+ stats.failures -= stats.failures
223
+ stats.failedHooks += 1
224
+ }
225
+ })
219
226
  event.emit(event.all.failures, { failuresLog, stats });
220
- output.result(stats.passes, stats.failures, stats.pending, ms(stats.duration));
227
+ output.result(stats.passes, stats.failures, stats.pending, ms(stats.duration), stats.failedHooks);
221
228
 
222
229
  if (stats.failures && output.level() < 3) {
223
230
  output.print(output.styles.debug('Run with --verbose flag to see complete NodeJS stacktrace'));
@@ -17,10 +17,6 @@ module.exports = async function (test, options) {
17
17
  const testRoot = getTestRoot(configFile)
18
18
  createOutputDir(config, testRoot)
19
19
 
20
- function processError(err) {
21
- printError(err)
22
- process.exit(1)
23
- }
24
20
  const codecept = new Codecept(config, options)
25
21
 
26
22
  try {
@@ -161,7 +161,7 @@ function initializeListeners() {
161
161
  actor: step.actor,
162
162
  name: step.name,
163
163
  status: step.status,
164
- args: _args,
164
+ args: JSON.stringify(_args),
165
165
  startedAt: step.startedAt,
166
166
  startTime: step.startTime,
167
167
  endTime: step.endTime,
@@ -264,7 +264,10 @@ function collectStats() {
264
264
  event.dispatcher.on(event.test.passed, () => {
265
265
  stats.passes++;
266
266
  });
267
- event.dispatcher.on(event.test.failed, () => {
267
+ event.dispatcher.on(event.test.failed, (test) => {
268
+ if (test.ctx._runnable.title.includes('hook: AfterSuite')) {
269
+ stats.failedHooks += 1;
270
+ }
268
271
  stats.failures++;
269
272
  });
270
273
  event.dispatcher.on(event.test.skipped, () => {
package/lib/helper/AI.js CHANGED
@@ -74,7 +74,7 @@ class AI extends Helper {
74
74
  for (const chunk of htmlChunks) {
75
75
  const messages = [
76
76
  { role: gtpRole.user, content: prompt },
77
- { role: gtpRole.user, content: `Within this HTML: ${minifyHtml(chunk)}` },
77
+ { role: gtpRole.user, content: `Within this HTML: ${await minifyHtml(chunk)}` },
78
78
  ]
79
79
 
80
80
  if (htmlChunks.length > 1)
@@ -110,7 +110,7 @@ class AI extends Helper {
110
110
 
111
111
  const messages = [
112
112
  { role: gtpRole.user, content: prompt },
113
- { role: gtpRole.user, content: `Within this HTML: ${minifyHtml(html)}` },
113
+ { role: gtpRole.user, content: `Within this HTML: ${await minifyHtml(html)}` },
114
114
  ]
115
115
 
116
116
  const response = await this._processAIRequest(messages)
@@ -24,7 +24,6 @@ const {
24
24
  clearString,
25
25
  requireWithFallback,
26
26
  normalizeSpacesInString,
27
- promiseWithTimeout,
28
27
  } = require('../utils')
29
28
  const { isColorProperty, convertColorToRGBA } = require('../colorUtils')
30
29
  const ElementNotFound = require('./errors/ElementNotFound')
@@ -1852,19 +1851,10 @@ class Playwright extends Helper {
1852
1851
  * {{> grabNumberOfVisibleElements }}
1853
1852
  *
1854
1853
  */
1855
- async grabNumberOfVisibleElements(locator, sec) {
1856
- const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout
1854
+ async grabNumberOfVisibleElements(locator) {
1857
1855
  let els = await this._locate(locator)
1858
-
1859
- const visibilityChecks = els.map((el) => promiseWithTimeout(el.isVisible(), waitTimeout))
1860
-
1861
- try {
1862
- els = await Promise.all(visibilityChecks)
1863
- return els.filter((v) => v).length
1864
- } catch (error) {
1865
- console.error(error)
1866
- return 0
1867
- }
1856
+ els = await Promise.all(els.map((el) => el.isVisible()))
1857
+ return els.filter((v) => v).length
1868
1858
  }
1869
1859
 
1870
1860
  /**
@@ -28,7 +28,6 @@ const {
28
28
  isModifierKey,
29
29
  requireWithFallback,
30
30
  normalizeSpacesInString,
31
- promiseWithTimeout,
32
31
  } = require('../utils')
33
32
  const { isColorProperty, convertColorToRGBA } = require('../colorUtils')
34
33
  const ElementNotFound = require('./errors/ElementNotFound')
@@ -1515,20 +1514,17 @@ class Puppeteer extends Helper {
1515
1514
  * {{> grabNumberOfVisibleElements }}
1516
1515
  * {{ react }}
1517
1516
  */
1518
- async grabNumberOfVisibleElements(locator, sec) {
1519
- const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout
1517
+ async grabNumberOfVisibleElements(locator) {
1520
1518
  let els = await this._locate(locator)
1521
- els = (await Promise.all(els.map((el) => promiseWithTimeout(el.boundingBox() && el, waitTimeout)))).filter((v) => v)
1519
+ els = (await Promise.all(els.map((el) => el.boundingBox() && el))).filter((v) => v)
1522
1520
  // Puppeteer visibility was ignored? | Remove when Puppeteer is fixed
1523
1521
  els = await Promise.all(
1524
- els.map((el) =>
1525
- promiseWithTimeout(
1526
- el.evaluate(
1522
+ els.map(
1523
+ async (el) =>
1524
+ (await el.evaluate(
1527
1525
  (node) =>
1528
1526
  window.getComputedStyle(node).visibility !== 'hidden' && window.getComputedStyle(node).display !== 'none',
1529
- ) && el,
1530
- waitTimeout,
1531
- ),
1527
+ )) && el,
1532
1528
  ),
1533
1529
  )
1534
1530
 
@@ -63,6 +63,22 @@ const config = {}
63
63
  * }
64
64
  * ```
65
65
  *
66
+ * ```js
67
+ * {
68
+ * helpers: {
69
+ * REST: {
70
+ * endpoint: 'http://site.com/api',
71
+ * prettyPrintJson: true,
72
+ * httpAgent: {
73
+ * ca: fs.readFileSync(__dirname + '/path/to/ca.pem'),
74
+ * rejectUnauthorized: false,
75
+ * keepAlive: true
76
+ * }
77
+ * }
78
+ * }
79
+ * }
80
+ * ```
81
+ *
66
82
  * ## Access From Helpers
67
83
  *
68
84
  * Send REST requests by accessing `_executeRequest` method:
@@ -101,9 +117,13 @@ class REST extends Helper {
101
117
 
102
118
  // Create an agent with SSL certificate
103
119
  if (this.options.httpAgent) {
104
- if (!this.options.httpAgent.key || !this.options.httpAgent.cert)
120
+ // if one of those keys is there, all good to go
121
+ if (this.options.httpAgent.ca || this.options.httpAgent.key || this.options.httpAgent.cert) {
122
+ this.httpsAgent = new Agent(this.options.httpAgent)
123
+ } else {
124
+ // otherwise, throws an error of httpAgent config
105
125
  throw Error('Please recheck your httpAgent config!')
106
- this.httpsAgent = new Agent(this.options.httpAgent)
126
+ }
107
127
  }
108
128
 
109
129
  this.axios = this.httpsAgent ? axios.create({ httpsAgent: this.httpsAgent }) : axios.create()
@@ -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
@@ -15,7 +15,7 @@ const stringIncludes = require('../assert/include').includes
15
15
  const { urlEquals } = require('../assert/equal')
16
16
  const { empty } = require('../assert/empty')
17
17
  const { truth } = require('../assert/truth')
18
- const { xpathLocator, normalizeSpacesInString, promiseWithTimeout } = require('../utils')
18
+ const { xpathLocator, normalizeSpacesInString } = require('../utils')
19
19
  const Locator = require('../locator')
20
20
 
21
21
  /**
@@ -696,12 +696,8 @@ class TestCafe extends Helper {
696
696
  /**
697
697
  * {{> grabNumberOfVisibleElements }}
698
698
  */
699
- async grabNumberOfVisibleElements(locator, sec) {
700
- const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout
701
-
702
- const elements = await promiseWithTimeout(findElements.call(this, this.context, locator), waitTimeout)
703
- const visibleElements = await elements.filterVisible()
704
- const count = visibleElements.count
699
+ async grabNumberOfVisibleElements(locator) {
700
+ const count = (await findElements.call(this, this.context, locator)).filterVisible().count
705
701
  return count
706
702
  }
707
703
 
@@ -19,7 +19,6 @@ const {
19
19
  screenshotOutputFolder,
20
20
  getNormalizedKeyAttributeValue,
21
21
  modifierKeys,
22
- promiseWithTimeout,
23
22
  } = require('../utils')
24
23
  const { isColorProperty, convertColorToRGBA } = require('../colorUtils')
25
24
  const ElementNotFound = require('./errors/ElementNotFound')
@@ -1702,16 +1701,12 @@ class WebDriver extends Helper {
1702
1701
  /**
1703
1702
  * {{> grabNumberOfVisibleElements }}
1704
1703
  */
1705
- async grabNumberOfVisibleElements(locator, sec) {
1706
- const waitTimeout = sec || this.options.waitForTimeoutInSeconds
1704
+ async grabNumberOfVisibleElements(locator) {
1707
1705
  const res = await this._locate(locator)
1708
1706
 
1709
- let selected = await forEachAsync(res, async (el) => promiseWithTimeout(el.isDisplayed(), waitTimeout))
1710
-
1707
+ let selected = await forEachAsync(res, async (el) => el.isDisplayed())
1711
1708
  if (!Array.isArray(selected)) selected = [selected]
1712
-
1713
1709
  selected = selected.filter((val) => val === true)
1714
-
1715
1710
  return selected.length
1716
1711
  }
1717
1712
 
package/lib/output.js CHANGED
@@ -206,7 +206,7 @@ module.exports = {
206
206
  * @param {number} skipped
207
207
  * @param {number|string} duration
208
208
  */
209
- result(passed, failed, skipped, duration) {
209
+ result(passed, failed, skipped, duration, failedHooks = 0) {
210
210
  let style = colors.bgGreen;
211
211
  let msg = ` ${passed || 0} passed`;
212
212
  let status = style.bold(' OK ');
@@ -215,6 +215,12 @@ module.exports = {
215
215
  status = style.bold(' FAIL ');
216
216
  msg += `, ${failed} failed`;
217
217
  }
218
+
219
+ if (failedHooks > 0) {
220
+ style = style.bgRed;
221
+ status = style.bold(' FAIL ');
222
+ msg += `, ${failedHooks} failedHooks`;
223
+ }
218
224
  status += style.grey(' |');
219
225
 
220
226
  if (skipped) {
package/lib/rerun.js CHANGED
@@ -70,6 +70,7 @@ class CodeceptRerunner extends BaseCodecept {
70
70
  await this.runTests(test);
71
71
  } catch (e) {
72
72
  output.error(e.stack);
73
+ throw e;
73
74
  } finally {
74
75
  event.emit(event.all.result, this);
75
76
  event.emit(event.all.after, this);
package/lib/utils.js CHANGED
@@ -476,11 +476,3 @@ module.exports.printObjectProperties = (obj) => {
476
476
  module.exports.normalizeSpacesInString = (string) => {
477
477
  return string.replace(/\s+/g, ' ');
478
478
  };
479
-
480
- module.exports.promiseWithTimeout = (promise, timeout = 1000) => {
481
- return Promise.race([
482
- promise,
483
- new Promise((_, reject) => { setTimeout(() => reject(new Error(`Set timeout: ${timeout / 1000} sec(s). Timeout exceeded`)), timeout) },
484
- ),
485
- ]);
486
- };
package/lib/workers.js CHANGED
@@ -357,6 +357,7 @@ class Workers extends EventEmitter {
357
357
 
358
358
  run() {
359
359
  this.stats.start = new Date();
360
+ this.stats.failedHooks = 0
360
361
  recorder.startUnlessRunning();
361
362
  event.dispatcher.emit(event.workers.before);
362
363
  process.env.RUNS_WITH_WORKERS = 'true';
@@ -471,6 +472,7 @@ class Workers extends EventEmitter {
471
472
  this.stats.failures += newStats.failures;
472
473
  this.stats.tests += newStats.tests;
473
474
  this.stats.pending += newStats.pending;
475
+ this.stats.failedHooks += newStats.failedHooks;
474
476
  }
475
477
 
476
478
  printResults() {
@@ -492,7 +494,7 @@ class Workers extends EventEmitter {
492
494
  this.failuresLog.forEach(log => output.print(...log));
493
495
  }
494
496
 
495
- output.result(this.stats.passes, this.stats.failures, this.stats.pending, ms(this.stats.duration));
497
+ output.result(this.stats.passes, this.stats.failures, this.stats.pending, ms(this.stats.duration), this.stats.failedHooks);
496
498
  process.env.RUNS_WITH_WORKERS = 'false';
497
499
  }
498
500
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.6.6-beta.6",
3
+ "version": "3.6.7",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",
@@ -92,7 +92,7 @@
92
92
  "css-to-xpath": "0.1.0",
93
93
  "csstoxpath": "1.6.0",
94
94
  "devtools": "8.40.2",
95
- "envinfo": "7.11.1",
95
+ "envinfo": "7.14.0",
96
96
  "escape-string-regexp": "4.0.0",
97
97
  "figures": "3.2.0",
98
98
  "fn-args": "4.0.0",
@@ -105,7 +105,7 @@
105
105
  "lodash.clonedeep": "4.5.0",
106
106
  "lodash.merge": "4.6.2",
107
107
  "mkdirp": "1.0.4",
108
- "mocha": "10.6.0",
108
+ "mocha": "10.7.3",
109
109
  "monocart-coverage-reports": "2.10.3",
110
110
  "ms": "2.1.3",
111
111
  "ora-classic": "5.4.2",
@@ -118,17 +118,17 @@
118
118
  "uuid": "10.0"
119
119
  },
120
120
  "optionalDependencies": {
121
- "@codeceptjs/detox-helper": "1.0.8"
121
+ "@codeceptjs/detox-helper": "1.1.2"
122
122
  },
123
123
  "devDependencies": {
124
124
  "@codeceptjs/mock-request": "0.3.1",
125
125
  "@faker-js/faker": "7.6.0",
126
126
  "@pollyjs/adapter-puppeteer": "6.0.6",
127
127
  "@pollyjs/core": "5.1.0",
128
- "@types/chai": "4.3.16",
128
+ "@types/chai": "4.3.19",
129
129
  "@types/inquirer": "9.0.3",
130
- "@types/node": "20.11.30",
131
- "@wdio/sauce-service": "9.0.4",
130
+ "@types/node": "22.5.5",
131
+ "@wdio/sauce-service": "9.0.9",
132
132
  "@wdio/selenium-standalone-service": "8.3.2",
133
133
  "@wdio/utils": "9.0.6",
134
134
  "@xmldom/xmldom": "0.8.10",
@@ -140,19 +140,19 @@
140
140
  "electron": "31.3.1",
141
141
  "eslint": "8.57.0",
142
142
  "eslint-config-airbnb-base": "15.0.0",
143
- "eslint-plugin-import": "2.29.1",
143
+ "eslint-plugin-import": "2.30.0",
144
144
  "eslint-plugin-mocha": "10.5.0",
145
145
  "expect": "29.7.0",
146
146
  "express": "4.19.2",
147
147
  "graphql": "16.9.0",
148
- "husky": "9.1.4",
148
+ "husky": "9.1.6",
149
149
  "inquirer-test": "2.0.1",
150
150
  "jsdoc": "4.0.3",
151
151
  "jsdoc-typeof-plugin": "1.0.0",
152
152
  "json-server": "0.10.1",
153
153
  "playwright": "1.45.3",
154
154
  "prettier": "^3.3.2",
155
- "puppeteer": "22.12.1",
155
+ "puppeteer": "23.3.0",
156
156
  "qrcode-terminal": "0.12.0",
157
157
  "rosie": "2.1.1",
158
158
  "runok": "0.9.3",
@@ -164,9 +164,9 @@
164
164
  "ts-node": "10.9.2",
165
165
  "tsd": "^0.31.0",
166
166
  "tsd-jsdoc": "2.5.0",
167
- "typedoc": "0.26.5",
167
+ "typedoc": "0.26.7",
168
168
  "typedoc-plugin-markdown": "4.2.6",
169
- "typescript": "5.5.3",
169
+ "typescript": "5.6.2",
170
170
  "wdio-docker-service": "1.5.0",
171
171
  "webdriverio": "8.39.1",
172
172
  "xml2js": "0.6.2",
@@ -963,13 +963,11 @@ declare namespace CodeceptJS {
963
963
  *
964
964
  * ```js
965
965
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
966
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
967
966
  * ```
968
967
  * @param locator - located by CSS|XPath|strict locator.
969
- * @param [sec] - (optional, `1` by default) time in seconds to wait
970
968
  * @returns number of visible elements
971
969
  */
972
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
970
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
973
971
  /**
974
972
  * Can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
975
973
  *
@@ -1183,6 +1181,9 @@ declare namespace CodeceptJS {
1183
1181
  * ## Methods
1184
1182
  */
1185
1183
  // @ts-ignore
1184
+ // @ts-ignore
1185
+ // @ts-ignore
1186
+ // @ts-ignore
1186
1187
  class ExpectHelper {
1187
1188
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1188
1189
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
@@ -1295,6 +1296,9 @@ declare namespace CodeceptJS {
1295
1296
  * ## Methods
1296
1297
  */
1297
1298
  // @ts-ignore
1299
+ // @ts-ignore
1300
+ // @ts-ignore
1301
+ // @ts-ignore
1298
1302
  class ExpectHelper {
1299
1303
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1300
1304
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
@@ -1967,6 +1971,9 @@ declare namespace CodeceptJS {
1967
1971
  * @property [httpsOpts] - key & cert values are the paths to .key and .crt files
1968
1972
  */
1969
1973
  // @ts-ignore
1974
+ // @ts-ignore
1975
+ // @ts-ignore
1976
+ // @ts-ignore
1970
1977
  type MockServerConfig = {
1971
1978
  port?: number;
1972
1979
  host?: string;
@@ -2092,6 +2099,9 @@ declare namespace CodeceptJS {
2092
2099
  * ## Methods
2093
2100
  */
2094
2101
  // @ts-ignore
2102
+ // @ts-ignore
2103
+ // @ts-ignore
2104
+ // @ts-ignore
2095
2105
  class MockServer {
2096
2106
  /**
2097
2107
  * Start the mock server
@@ -2407,13 +2417,11 @@ declare namespace CodeceptJS {
2407
2417
  *
2408
2418
  * ```js
2409
2419
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
2410
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
2411
2420
  * ```
2412
2421
  * @param locator - located by CSS|XPath|strict locator.
2413
- * @param [sec] - (optional, `1` by default) time in seconds to wait
2414
2422
  * @returns number of visible elements
2415
2423
  */
2416
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
2424
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
2417
2425
  /**
2418
2426
  * Perform a click on a link or a button, given by a locator.
2419
2427
  * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
@@ -3168,6 +3176,9 @@ declare namespace CodeceptJS {
3168
3176
  * @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
3177
  */
3170
3178
  // @ts-ignore
3179
+ // @ts-ignore
3180
+ // @ts-ignore
3181
+ // @ts-ignore
3171
3182
  type PlaywrightConfig = {
3172
3183
  url?: string;
3173
3184
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -4316,13 +4327,11 @@ declare namespace CodeceptJS {
4316
4327
  *
4317
4328
  * ```js
4318
4329
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
4319
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
4320
4330
  * ```
4321
4331
  * @param locator - located by CSS|XPath|strict locator.
4322
- * @param [sec] - (optional, `1` by default) time in seconds to wait
4323
4332
  * @returns number of visible elements
4324
4333
  */
4325
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
4334
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
4326
4335
  /**
4327
4336
  * Checks that current url contains a provided fragment.
4328
4337
  *
@@ -5979,13 +5988,11 @@ declare namespace CodeceptJS {
5979
5988
  *
5980
5989
  * ```js
5981
5990
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
5982
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
5983
5991
  * ```
5984
5992
  * @param locator - located by CSS|XPath|strict locator.
5985
- * @param [sec] - (optional, `1` by default) time in seconds to wait
5986
5993
  * @returns number of visible elements
5987
5994
  */
5988
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
5995
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
5989
5996
  /**
5990
5997
  * Checks that all elements with given locator have given CSS properties.
5991
5998
  *
@@ -6549,6 +6556,9 @@ declare namespace CodeceptJS {
6549
6556
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6550
6557
  */
6551
6558
  // @ts-ignore
6559
+ // @ts-ignore
6560
+ // @ts-ignore
6561
+ // @ts-ignore
6552
6562
  type PuppeteerConfig = {
6553
6563
  url: string;
6554
6564
  basicAuth?: any;
@@ -7490,15 +7500,12 @@ declare namespace CodeceptJS {
7490
7500
  *
7491
7501
  * ```js
7492
7502
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
7493
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
7494
7503
  * ```
7495
7504
  * @param locator - located by CSS|XPath|strict locator.
7496
- * @param [sec] - (optional, `1` by default) time in seconds to wait
7497
7505
  * @returns number of visible elements
7498
- *
7499
7506
  * {{ react }}
7500
7507
  */
7501
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
7508
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
7502
7509
  /**
7503
7510
  * Checks that current url contains a provided fragment.
7504
7511
  *
@@ -8359,6 +8366,9 @@ declare namespace CodeceptJS {
8359
8366
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
8360
8367
  */
8361
8368
  // @ts-ignore
8369
+ // @ts-ignore
8370
+ // @ts-ignore
8371
+ // @ts-ignore
8362
8372
  type RESTConfig = {
8363
8373
  endpoint?: string;
8364
8374
  prettyPrintJson?: boolean;
@@ -8411,6 +8421,22 @@ declare namespace CodeceptJS {
8411
8421
  * }
8412
8422
  * ```
8413
8423
  *
8424
+ * ```js
8425
+ * {
8426
+ * helpers: {
8427
+ * REST: {
8428
+ * endpoint: 'http://site.com/api',
8429
+ * prettyPrintJson: true,
8430
+ * httpAgent: {
8431
+ * ca: fs.readFileSync(__dirname + '/path/to/ca.pem'),
8432
+ * rejectUnauthorized: false,
8433
+ * keepAlive: true
8434
+ * }
8435
+ * }
8436
+ * }
8437
+ * }
8438
+ * ```
8439
+ *
8414
8440
  * ## Access From Helpers
8415
8441
  *
8416
8442
  * Send REST requests by accessing `_executeRequest` method:
@@ -9265,13 +9291,11 @@ declare namespace CodeceptJS {
9265
9291
  *
9266
9292
  * ```js
9267
9293
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
9268
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
9269
9294
  * ```
9270
9295
  * @param locator - located by CSS|XPath|strict locator.
9271
- * @param [sec] - (optional, `1` by default) time in seconds to wait
9272
9296
  * @returns number of visible elements
9273
9297
  */
9274
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
9298
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
9275
9299
  /**
9276
9300
  * Checks that the given input field or textarea equals to given value.
9277
9301
  * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
@@ -9724,6 +9748,9 @@ declare namespace CodeceptJS {
9724
9748
  * @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
9725
9749
  */
9726
9750
  // @ts-ignore
9751
+ // @ts-ignore
9752
+ // @ts-ignore
9753
+ // @ts-ignore
9727
9754
  type WebDriverConfig = {
9728
9755
  url: string;
9729
9756
  browser: string;
@@ -10812,13 +10839,11 @@ declare namespace CodeceptJS {
10812
10839
  *
10813
10840
  * ```js
10814
10841
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
10815
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
10816
10842
  * ```
10817
10843
  * @param locator - located by CSS|XPath|strict locator.
10818
- * @param [sec] - (optional, `1` by default) time in seconds to wait
10819
10844
  * @returns number of visible elements
10820
10845
  */
10821
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
10846
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
10822
10847
  /**
10823
10848
  * Checks that current url contains a provided fragment.
10824
10849
  *
@@ -971,13 +971,11 @@ declare namespace CodeceptJS {
971
971
  *
972
972
  * ```js
973
973
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
974
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
975
974
  * ```
976
975
  * @param locator - located by CSS|XPath|strict locator.
977
- * @param [sec] - (optional, `1` by default) time in seconds to wait
978
976
  * @returns number of visible elements
979
977
  */
980
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
978
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
981
979
  /**
982
980
  * Can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
983
981
  *
@@ -1207,6 +1205,9 @@ declare namespace CodeceptJS {
1207
1205
  * ## Methods
1208
1206
  */
1209
1207
  // @ts-ignore
1208
+ // @ts-ignore
1209
+ // @ts-ignore
1210
+ // @ts-ignore
1210
1211
  class ExpectHelper {
1211
1212
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1212
1213
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
@@ -1319,6 +1320,9 @@ declare namespace CodeceptJS {
1319
1320
  * ## Methods
1320
1321
  */
1321
1322
  // @ts-ignore
1323
+ // @ts-ignore
1324
+ // @ts-ignore
1325
+ // @ts-ignore
1322
1326
  class ExpectHelper {
1323
1327
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1324
1328
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
@@ -1994,6 +1998,9 @@ declare namespace CodeceptJS {
1994
1998
  * @property [httpsOpts] - key & cert values are the paths to .key and .crt files
1995
1999
  */
1996
2000
  // @ts-ignore
2001
+ // @ts-ignore
2002
+ // @ts-ignore
2003
+ // @ts-ignore
1997
2004
  type MockServerConfig = {
1998
2005
  port?: number;
1999
2006
  host?: string;
@@ -2119,6 +2126,9 @@ declare namespace CodeceptJS {
2119
2126
  * ## Methods
2120
2127
  */
2121
2128
  // @ts-ignore
2129
+ // @ts-ignore
2130
+ // @ts-ignore
2131
+ // @ts-ignore
2122
2132
  class MockServer {
2123
2133
  /**
2124
2134
  * Start the mock server
@@ -2454,13 +2464,11 @@ declare namespace CodeceptJS {
2454
2464
  *
2455
2465
  * ```js
2456
2466
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
2457
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
2458
2467
  * ```
2459
2468
  * @param locator - located by CSS|XPath|strict locator.
2460
- * @param [sec] - (optional, `1` by default) time in seconds to wait
2461
2469
  * @returns number of visible elements
2462
2470
  */
2463
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
2471
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
2464
2472
  /**
2465
2473
  * Perform a click on a link or a button, given by a locator.
2466
2474
  * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
@@ -3261,6 +3269,9 @@ declare namespace CodeceptJS {
3261
3269
  * @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
3270
  */
3263
3271
  // @ts-ignore
3272
+ // @ts-ignore
3273
+ // @ts-ignore
3274
+ // @ts-ignore
3264
3275
  type PlaywrightConfig = {
3265
3276
  url?: string;
3266
3277
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -4446,13 +4457,11 @@ declare namespace CodeceptJS {
4446
4457
  *
4447
4458
  * ```js
4448
4459
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
4449
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
4450
4460
  * ```
4451
4461
  * @param locator - located by CSS|XPath|strict locator.
4452
- * @param [sec] - (optional, `1` by default) time in seconds to wait
4453
4462
  * @returns number of visible elements
4454
4463
  */
4455
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
4464
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
4456
4465
  /**
4457
4466
  * Checks that current url contains a provided fragment.
4458
4467
  *
@@ -6187,13 +6196,11 @@ declare namespace CodeceptJS {
6187
6196
  *
6188
6197
  * ```js
6189
6198
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
6190
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
6191
6199
  * ```
6192
6200
  * @param locator - located by CSS|XPath|strict locator.
6193
- * @param [sec] - (optional, `1` by default) time in seconds to wait
6194
6201
  * @returns number of visible elements
6195
6202
  */
6196
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
6203
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
6197
6204
  /**
6198
6205
  * Checks that all elements with given locator have given CSS properties.
6199
6206
  *
@@ -6793,6 +6800,9 @@ declare namespace CodeceptJS {
6793
6800
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6794
6801
  */
6795
6802
  // @ts-ignore
6803
+ // @ts-ignore
6804
+ // @ts-ignore
6805
+ // @ts-ignore
6796
6806
  type PuppeteerConfig = {
6797
6807
  url: string;
6798
6808
  basicAuth?: any;
@@ -7798,15 +7808,12 @@ declare namespace CodeceptJS {
7798
7808
  *
7799
7809
  * ```js
7800
7810
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
7801
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
7802
7811
  * ```
7803
7812
  * @param locator - located by CSS|XPath|strict locator.
7804
- * @param [sec] - (optional, `1` by default) time in seconds to wait
7805
7813
  * @returns number of visible elements
7806
- *
7807
7814
  * {{ react }}
7808
7815
  */
7809
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
7816
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
7810
7817
  /**
7811
7818
  * Checks that current url contains a provided fragment.
7812
7819
  *
@@ -8739,6 +8746,9 @@ declare namespace CodeceptJS {
8739
8746
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
8740
8747
  */
8741
8748
  // @ts-ignore
8749
+ // @ts-ignore
8750
+ // @ts-ignore
8751
+ // @ts-ignore
8742
8752
  type RESTConfig = {
8743
8753
  endpoint?: string;
8744
8754
  prettyPrintJson?: boolean;
@@ -8791,6 +8801,22 @@ declare namespace CodeceptJS {
8791
8801
  * }
8792
8802
  * ```
8793
8803
  *
8804
+ * ```js
8805
+ * {
8806
+ * helpers: {
8807
+ * REST: {
8808
+ * endpoint: 'http://site.com/api',
8809
+ * prettyPrintJson: true,
8810
+ * httpAgent: {
8811
+ * ca: fs.readFileSync(__dirname + '/path/to/ca.pem'),
8812
+ * rejectUnauthorized: false,
8813
+ * keepAlive: true
8814
+ * }
8815
+ * }
8816
+ * }
8817
+ * }
8818
+ * ```
8819
+ *
8794
8820
  * ## Access From Helpers
8795
8821
  *
8796
8822
  * Send REST requests by accessing `_executeRequest` method:
@@ -9679,13 +9705,11 @@ declare namespace CodeceptJS {
9679
9705
  *
9680
9706
  * ```js
9681
9707
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
9682
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
9683
9708
  * ```
9684
9709
  * @param locator - located by CSS|XPath|strict locator.
9685
- * @param [sec] - (optional, `1` by default) time in seconds to wait
9686
9710
  * @returns number of visible elements
9687
9711
  */
9688
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
9712
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
9689
9713
  /**
9690
9714
  * Checks that the given input field or textarea equals to given value.
9691
9715
  * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
@@ -10164,6 +10188,9 @@ declare namespace CodeceptJS {
10164
10188
  * @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
10165
10189
  */
10166
10190
  // @ts-ignore
10191
+ // @ts-ignore
10192
+ // @ts-ignore
10193
+ // @ts-ignore
10167
10194
  type WebDriverConfig = {
10168
10195
  url: string;
10169
10196
  browser: string;
@@ -11319,13 +11346,11 @@ declare namespace CodeceptJS {
11319
11346
  *
11320
11347
  * ```js
11321
11348
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
11322
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
11323
11349
  * ```
11324
11350
  * @param locator - located by CSS|XPath|strict locator.
11325
- * @param [sec] - (optional, `1` by default) time in seconds to wait
11326
11351
  * @returns number of visible elements
11327
11352
  */
11328
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
11353
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
11329
11354
  /**
11330
11355
  * Checks that current url contains a provided fragment.
11331
11356
  *
@@ -12950,6 +12975,7 @@ declare namespace CodeceptJS {
12950
12975
  * * `reloadReactNative` - should be enabled for React Native applications.
12951
12976
  * * `reuse` - reuse application for tests. By default, Detox reinstalls and relaunches app.
12952
12977
  * * `registerGlobals` - (default: true) Register Detox helper functions `by`, `element`, `expect`, `waitFor` globally.
12978
+ * * `url` - URL to open via deep-link each time the app is launched (android) or immediately afterwards (iOS). Useful for opening a bundle URL at the beginning of tests when working with Expo.
12953
12979
  */
12954
12980
  class Detox {
12955
12981
  /**