codeceptjs 3.6.6-beta.6 → 3.6.6

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.6",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",
@@ -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,16 +118,16 @@
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",
130
+ "@types/node": "22.5.5",
131
131
  "@wdio/sauce-service": "9.0.4",
132
132
  "@wdio/selenium-standalone-service": "8.3.2",
133
133
  "@wdio/utils": "9.0.6",
@@ -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.5",
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",
@@ -183,4 +183,4 @@
183
183
  "strict": false
184
184
  }
185
185
  }
186
- }
186
+ }
@@ -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
  *
@@ -1182,7 +1180,6 @@ declare namespace CodeceptJS {
1182
1180
  *
1183
1181
  * ## Methods
1184
1182
  */
1185
- // @ts-ignore
1186
1183
  class ExpectHelper {
1187
1184
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1188
1185
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
@@ -1294,7 +1291,6 @@ declare namespace CodeceptJS {
1294
1291
  *
1295
1292
  * ## Methods
1296
1293
  */
1297
- // @ts-ignore
1298
1294
  class ExpectHelper {
1299
1295
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1300
1296
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
@@ -1966,7 +1962,6 @@ declare namespace CodeceptJS {
1966
1962
  * @property [host = "0.0.0.0"] - Mock server host
1967
1963
  * @property [httpsOpts] - key & cert values are the paths to .key and .crt files
1968
1964
  */
1969
- // @ts-ignore
1970
1965
  type MockServerConfig = {
1971
1966
  port?: number;
1972
1967
  host?: string;
@@ -2091,7 +2086,6 @@ declare namespace CodeceptJS {
2091
2086
  *
2092
2087
  * ## Methods
2093
2088
  */
2094
- // @ts-ignore
2095
2089
  class MockServer {
2096
2090
  /**
2097
2091
  * Start the mock server
@@ -2407,13 +2401,11 @@ declare namespace CodeceptJS {
2407
2401
  *
2408
2402
  * ```js
2409
2403
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
2410
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
2411
2404
  * ```
2412
2405
  * @param locator - located by CSS|XPath|strict locator.
2413
- * @param [sec] - (optional, `1` by default) time in seconds to wait
2414
2406
  * @returns number of visible elements
2415
2407
  */
2416
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
2408
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
2417
2409
  /**
2418
2410
  * Perform a click on a link or a button, given by a locator.
2419
2411
  * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
@@ -3167,7 +3159,6 @@ declare namespace CodeceptJS {
3167
3159
  * @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).
3168
3160
  * @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
3161
  */
3170
- // @ts-ignore
3171
3162
  type PlaywrightConfig = {
3172
3163
  url?: string;
3173
3164
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -4316,13 +4307,11 @@ declare namespace CodeceptJS {
4316
4307
  *
4317
4308
  * ```js
4318
4309
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
4319
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
4320
4310
  * ```
4321
4311
  * @param locator - located by CSS|XPath|strict locator.
4322
- * @param [sec] - (optional, `1` by default) time in seconds to wait
4323
4312
  * @returns number of visible elements
4324
4313
  */
4325
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
4314
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
4326
4315
  /**
4327
4316
  * Checks that current url contains a provided fragment.
4328
4317
  *
@@ -5979,13 +5968,11 @@ declare namespace CodeceptJS {
5979
5968
  *
5980
5969
  * ```js
5981
5970
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
5982
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
5983
5971
  * ```
5984
5972
  * @param locator - located by CSS|XPath|strict locator.
5985
- * @param [sec] - (optional, `1` by default) time in seconds to wait
5986
5973
  * @returns number of visible elements
5987
5974
  */
5988
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
5975
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
5989
5976
  /**
5990
5977
  * Checks that all elements with given locator have given CSS properties.
5991
5978
  *
@@ -6548,7 +6535,6 @@ declare namespace CodeceptJS {
6548
6535
  * @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
6549
6536
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6550
6537
  */
6551
- // @ts-ignore
6552
6538
  type PuppeteerConfig = {
6553
6539
  url: string;
6554
6540
  basicAuth?: any;
@@ -7490,15 +7476,12 @@ declare namespace CodeceptJS {
7490
7476
  *
7491
7477
  * ```js
7492
7478
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
7493
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
7494
7479
  * ```
7495
7480
  * @param locator - located by CSS|XPath|strict locator.
7496
- * @param [sec] - (optional, `1` by default) time in seconds to wait
7497
7481
  * @returns number of visible elements
7498
- *
7499
7482
  * {{ react }}
7500
7483
  */
7501
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
7484
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
7502
7485
  /**
7503
7486
  * Checks that current url contains a provided fragment.
7504
7487
  *
@@ -8358,7 +8341,6 @@ declare namespace CodeceptJS {
8358
8341
  * @property [onResponse] - an async function which can update response object.
8359
8342
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
8360
8343
  */
8361
- // @ts-ignore
8362
8344
  type RESTConfig = {
8363
8345
  endpoint?: string;
8364
8346
  prettyPrintJson?: boolean;
@@ -8411,6 +8393,22 @@ declare namespace CodeceptJS {
8411
8393
  * }
8412
8394
  * ```
8413
8395
  *
8396
+ * ```js
8397
+ * {
8398
+ * helpers: {
8399
+ * REST: {
8400
+ * endpoint: 'http://site.com/api',
8401
+ * prettyPrintJson: true,
8402
+ * httpAgent: {
8403
+ * ca: fs.readFileSync(__dirname + '/path/to/ca.pem'),
8404
+ * rejectUnauthorized: false,
8405
+ * keepAlive: true
8406
+ * }
8407
+ * }
8408
+ * }
8409
+ * }
8410
+ * ```
8411
+ *
8414
8412
  * ## Access From Helpers
8415
8413
  *
8416
8414
  * Send REST requests by accessing `_executeRequest` method:
@@ -9265,13 +9263,11 @@ declare namespace CodeceptJS {
9265
9263
  *
9266
9264
  * ```js
9267
9265
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
9268
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
9269
9266
  * ```
9270
9267
  * @param locator - located by CSS|XPath|strict locator.
9271
- * @param [sec] - (optional, `1` by default) time in seconds to wait
9272
9268
  * @returns number of visible elements
9273
9269
  */
9274
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
9270
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
9275
9271
  /**
9276
9272
  * Checks that the given input field or textarea equals to given value.
9277
9273
  * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
@@ -9723,7 +9719,6 @@ declare namespace CodeceptJS {
9723
9719
  * @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
9724
9720
  * @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
9725
9721
  */
9726
- // @ts-ignore
9727
9722
  type WebDriverConfig = {
9728
9723
  url: string;
9729
9724
  browser: string;
@@ -10812,13 +10807,11 @@ declare namespace CodeceptJS {
10812
10807
  *
10813
10808
  * ```js
10814
10809
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
10815
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
10816
10810
  * ```
10817
10811
  * @param locator - located by CSS|XPath|strict locator.
10818
- * @param [sec] - (optional, `1` by default) time in seconds to wait
10819
10812
  * @returns number of visible elements
10820
10813
  */
10821
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
10814
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
10822
10815
  /**
10823
10816
  * Checks that current url contains a provided fragment.
10824
10817
  *
@@ -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
  *
@@ -1206,7 +1204,6 @@ declare namespace CodeceptJS {
1206
1204
  *
1207
1205
  * ## Methods
1208
1206
  */
1209
- // @ts-ignore
1210
1207
  class ExpectHelper {
1211
1208
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1212
1209
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
@@ -1318,7 +1315,6 @@ declare namespace CodeceptJS {
1318
1315
  *
1319
1316
  * ## Methods
1320
1317
  */
1321
- // @ts-ignore
1322
1318
  class ExpectHelper {
1323
1319
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1324
1320
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
@@ -1993,7 +1989,6 @@ declare namespace CodeceptJS {
1993
1989
  * @property [host = "0.0.0.0"] - Mock server host
1994
1990
  * @property [httpsOpts] - key & cert values are the paths to .key and .crt files
1995
1991
  */
1996
- // @ts-ignore
1997
1992
  type MockServerConfig = {
1998
1993
  port?: number;
1999
1994
  host?: string;
@@ -2118,7 +2113,6 @@ declare namespace CodeceptJS {
2118
2113
  *
2119
2114
  * ## Methods
2120
2115
  */
2121
- // @ts-ignore
2122
2116
  class MockServer {
2123
2117
  /**
2124
2118
  * Start the mock server
@@ -2454,13 +2448,11 @@ declare namespace CodeceptJS {
2454
2448
  *
2455
2449
  * ```js
2456
2450
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
2457
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
2458
2451
  * ```
2459
2452
  * @param locator - located by CSS|XPath|strict locator.
2460
- * @param [sec] - (optional, `1` by default) time in seconds to wait
2461
2453
  * @returns number of visible elements
2462
2454
  */
2463
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
2455
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
2464
2456
  /**
2465
2457
  * Perform a click on a link or a button, given by a locator.
2466
2458
  * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
@@ -3260,7 +3252,6 @@ declare namespace CodeceptJS {
3260
3252
  * @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).
3261
3253
  * @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
3254
  */
3263
- // @ts-ignore
3264
3255
  type PlaywrightConfig = {
3265
3256
  url?: string;
3266
3257
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -4446,13 +4437,11 @@ declare namespace CodeceptJS {
4446
4437
  *
4447
4438
  * ```js
4448
4439
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
4449
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
4450
4440
  * ```
4451
4441
  * @param locator - located by CSS|XPath|strict locator.
4452
- * @param [sec] - (optional, `1` by default) time in seconds to wait
4453
4442
  * @returns number of visible elements
4454
4443
  */
4455
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
4444
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
4456
4445
  /**
4457
4446
  * Checks that current url contains a provided fragment.
4458
4447
  *
@@ -6187,13 +6176,11 @@ declare namespace CodeceptJS {
6187
6176
  *
6188
6177
  * ```js
6189
6178
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
6190
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
6191
6179
  * ```
6192
6180
  * @param locator - located by CSS|XPath|strict locator.
6193
- * @param [sec] - (optional, `1` by default) time in seconds to wait
6194
6181
  * @returns number of visible elements
6195
6182
  */
6196
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
6183
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
6197
6184
  /**
6198
6185
  * Checks that all elements with given locator have given CSS properties.
6199
6186
  *
@@ -6792,7 +6779,6 @@ declare namespace CodeceptJS {
6792
6779
  * @property [chrome] - pass additional [Puppeteer run options](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions).
6793
6780
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6794
6781
  */
6795
- // @ts-ignore
6796
6782
  type PuppeteerConfig = {
6797
6783
  url: string;
6798
6784
  basicAuth?: any;
@@ -7798,15 +7784,12 @@ declare namespace CodeceptJS {
7798
7784
  *
7799
7785
  * ```js
7800
7786
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
7801
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
7802
7787
  * ```
7803
7788
  * @param locator - located by CSS|XPath|strict locator.
7804
- * @param [sec] - (optional, `1` by default) time in seconds to wait
7805
7789
  * @returns number of visible elements
7806
- *
7807
7790
  * {{ react }}
7808
7791
  */
7809
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
7792
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
7810
7793
  /**
7811
7794
  * Checks that current url contains a provided fragment.
7812
7795
  *
@@ -8738,7 +8721,6 @@ declare namespace CodeceptJS {
8738
8721
  * @property [onResponse] - an async function which can update response object.
8739
8722
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
8740
8723
  */
8741
- // @ts-ignore
8742
8724
  type RESTConfig = {
8743
8725
  endpoint?: string;
8744
8726
  prettyPrintJson?: boolean;
@@ -8791,6 +8773,22 @@ declare namespace CodeceptJS {
8791
8773
  * }
8792
8774
  * ```
8793
8775
  *
8776
+ * ```js
8777
+ * {
8778
+ * helpers: {
8779
+ * REST: {
8780
+ * endpoint: 'http://site.com/api',
8781
+ * prettyPrintJson: true,
8782
+ * httpAgent: {
8783
+ * ca: fs.readFileSync(__dirname + '/path/to/ca.pem'),
8784
+ * rejectUnauthorized: false,
8785
+ * keepAlive: true
8786
+ * }
8787
+ * }
8788
+ * }
8789
+ * }
8790
+ * ```
8791
+ *
8794
8792
  * ## Access From Helpers
8795
8793
  *
8796
8794
  * Send REST requests by accessing `_executeRequest` method:
@@ -9679,13 +9677,11 @@ declare namespace CodeceptJS {
9679
9677
  *
9680
9678
  * ```js
9681
9679
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
9682
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
9683
9680
  * ```
9684
9681
  * @param locator - located by CSS|XPath|strict locator.
9685
- * @param [sec] - (optional, `1` by default) time in seconds to wait
9686
9682
  * @returns number of visible elements
9687
9683
  */
9688
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
9684
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
9689
9685
  /**
9690
9686
  * Checks that the given input field or textarea equals to given value.
9691
9687
  * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
@@ -10163,7 +10159,6 @@ declare namespace CodeceptJS {
10163
10159
  * @property [logLevel = silent] - level of logging verbosity. Default: silent. Options: trace | debug | info | warn | error | silent. More info: https://webdriver.io/docs/configuration/#loglevel
10164
10160
  * @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
10165
10161
  */
10166
- // @ts-ignore
10167
10162
  type WebDriverConfig = {
10168
10163
  url: string;
10169
10164
  browser: string;
@@ -11319,13 +11314,11 @@ declare namespace CodeceptJS {
11319
11314
  *
11320
11315
  * ```js
11321
11316
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
11322
- * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
11323
11317
  * ```
11324
11318
  * @param locator - located by CSS|XPath|strict locator.
11325
- * @param [sec] - (optional, `1` by default) time in seconds to wait
11326
11319
  * @returns number of visible elements
11327
11320
  */
11328
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
11321
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
11329
11322
  /**
11330
11323
  * Checks that current url contains a provided fragment.
11331
11324
  *
@@ -12950,6 +12943,7 @@ declare namespace CodeceptJS {
12950
12943
  * * `reloadReactNative` - should be enabled for React Native applications.
12951
12944
  * * `reuse` - reuse application for tests. By default, Detox reinstalls and relaunches app.
12952
12945
  * * `registerGlobals` - (default: true) Register Detox helper functions `by`, `element`, `expect`, `waitFor` globally.
12946
+ * * `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
12947
  */
12954
12948
  class Detox {
12955
12949
  /**