codeceptjs 3.6.6-beta.5 → 3.6.6-beta.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,7 +3,9 @@ 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
6
7
  ```
7
8
 
8
9
  @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
9
- @returns {Promise<number>} number of visible elements
10
+ @param {number} [sec] (optional, `1` by default) time in seconds to wait
11
+ @returns {Promise<number>} number of visible elements
package/lib/cli.js CHANGED
@@ -145,7 +145,6 @@ class Cli extends Base {
145
145
 
146
146
  result() {
147
147
  const stats = this.stats;
148
- stats.failedHooks = 0;
149
148
  console.log();
150
149
 
151
150
  // passes
@@ -217,14 +216,8 @@ class Cli extends Base {
217
216
  console.log();
218
217
  }
219
218
 
220
- this.failures.forEach((failure) => {
221
- if (failure.constructor.name === 'Hook') {
222
- stats.failures -= stats.failures
223
- stats.failedHooks += 1
224
- }
225
- })
226
219
  event.emit(event.all.failures, { failuresLog, stats });
227
- output.result(stats.passes, stats.failures, stats.pending, ms(stats.duration), stats.failedHooks);
220
+ output.result(stats.passes, stats.failures, stats.pending, ms(stats.duration));
228
221
 
229
222
  if (stats.failures && output.level() < 3) {
230
223
  output.print(output.styles.debug('Run with --verbose flag to see complete NodeJS stacktrace'));
@@ -264,10 +264,7 @@ function collectStats() {
264
264
  event.dispatcher.on(event.test.passed, () => {
265
265
  stats.passes++;
266
266
  });
267
- event.dispatcher.on(event.test.failed, (test) => {
268
- if (test.ctx._runnable.title.includes('hook: AfterSuite')) {
269
- stats.failedHooks += 1;
270
- }
267
+ event.dispatcher.on(event.test.failed, () => {
271
268
  stats.failures++;
272
269
  });
273
270
  event.dispatcher.on(event.test.skipped, () => {
@@ -24,6 +24,7 @@ const {
24
24
  clearString,
25
25
  requireWithFallback,
26
26
  normalizeSpacesInString,
27
+ promiseWithTimeout,
27
28
  } = require('../utils')
28
29
  const { isColorProperty, convertColorToRGBA } = require('../colorUtils')
29
30
  const ElementNotFound = require('./errors/ElementNotFound')
@@ -1851,10 +1852,19 @@ class Playwright extends Helper {
1851
1852
  * {{> grabNumberOfVisibleElements }}
1852
1853
  *
1853
1854
  */
1854
- async grabNumberOfVisibleElements(locator) {
1855
+ async grabNumberOfVisibleElements(locator, sec) {
1856
+ const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout
1855
1857
  let els = await this._locate(locator)
1856
- els = await Promise.all(els.map((el) => el.isVisible()))
1857
- return els.filter((v) => v).length
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
+ }
1858
1868
  }
1859
1869
 
1860
1870
  /**
@@ -28,6 +28,7 @@ const {
28
28
  isModifierKey,
29
29
  requireWithFallback,
30
30
  normalizeSpacesInString,
31
+ promiseWithTimeout,
31
32
  } = require('../utils')
32
33
  const { isColorProperty, convertColorToRGBA } = require('../colorUtils')
33
34
  const ElementNotFound = require('./errors/ElementNotFound')
@@ -1514,17 +1515,20 @@ class Puppeteer extends Helper {
1514
1515
  * {{> grabNumberOfVisibleElements }}
1515
1516
  * {{ react }}
1516
1517
  */
1517
- async grabNumberOfVisibleElements(locator) {
1518
+ async grabNumberOfVisibleElements(locator, sec) {
1519
+ const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout
1518
1520
  let els = await this._locate(locator)
1519
- els = (await Promise.all(els.map((el) => el.boundingBox() && el))).filter((v) => v)
1521
+ els = (await Promise.all(els.map((el) => promiseWithTimeout(el.boundingBox() && el, waitTimeout)))).filter((v) => v)
1520
1522
  // Puppeteer visibility was ignored? | Remove when Puppeteer is fixed
1521
1523
  els = await Promise.all(
1522
- els.map(
1523
- async (el) =>
1524
- (await el.evaluate(
1524
+ els.map((el) =>
1525
+ promiseWithTimeout(
1526
+ el.evaluate(
1525
1527
  (node) =>
1526
1528
  window.getComputedStyle(node).visibility !== 'hidden' && window.getComputedStyle(node).display !== 'none',
1527
- )) && el,
1529
+ ) && el,
1530
+ waitTimeout,
1531
+ ),
1528
1532
  ),
1529
1533
  )
1530
1534
 
@@ -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 } = require('../utils')
18
+ const { xpathLocator, normalizeSpacesInString, promiseWithTimeout } = require('../utils')
19
19
  const Locator = require('../locator')
20
20
 
21
21
  /**
@@ -696,8 +696,12 @@ class TestCafe extends Helper {
696
696
  /**
697
697
  * {{> grabNumberOfVisibleElements }}
698
698
  */
699
- async grabNumberOfVisibleElements(locator) {
700
- const count = (await findElements.call(this, this.context, locator)).filterVisible().count
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
701
705
  return count
702
706
  }
703
707
 
@@ -19,6 +19,7 @@ const {
19
19
  screenshotOutputFolder,
20
20
  getNormalizedKeyAttributeValue,
21
21
  modifierKeys,
22
+ promiseWithTimeout,
22
23
  } = require('../utils')
23
24
  const { isColorProperty, convertColorToRGBA } = require('../colorUtils')
24
25
  const ElementNotFound = require('./errors/ElementNotFound')
@@ -1701,12 +1702,16 @@ class WebDriver extends Helper {
1701
1702
  /**
1702
1703
  * {{> grabNumberOfVisibleElements }}
1703
1704
  */
1704
- async grabNumberOfVisibleElements(locator) {
1705
+ async grabNumberOfVisibleElements(locator, sec) {
1706
+ const waitTimeout = sec || this.options.waitForTimeoutInSeconds
1705
1707
  const res = await this._locate(locator)
1706
1708
 
1707
- let selected = await forEachAsync(res, async (el) => el.isDisplayed())
1709
+ let selected = await forEachAsync(res, async (el) => promiseWithTimeout(el.isDisplayed(), waitTimeout))
1710
+
1708
1711
  if (!Array.isArray(selected)) selected = [selected]
1712
+
1709
1713
  selected = selected.filter((val) => val === true)
1714
+
1710
1715
  return selected.length
1711
1716
  }
1712
1717
 
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, failedHooks = 0) {
209
+ result(passed, failed, skipped, duration) {
210
210
  let style = colors.bgGreen;
211
211
  let msg = ` ${passed || 0} passed`;
212
212
  let status = style.bold(' OK ');
@@ -215,12 +215,6 @@ 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
- }
224
218
  status += style.grey(' |');
225
219
 
226
220
  if (skipped) {
package/lib/utils.js CHANGED
@@ -476,3 +476,11 @@ 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,7 +357,6 @@ class Workers extends EventEmitter {
357
357
 
358
358
  run() {
359
359
  this.stats.start = new Date();
360
- this.stats.failedHooks = 0
361
360
  recorder.startUnlessRunning();
362
361
  event.dispatcher.emit(event.workers.before);
363
362
  process.env.RUNS_WITH_WORKERS = 'true';
@@ -472,7 +471,6 @@ class Workers extends EventEmitter {
472
471
  this.stats.failures += newStats.failures;
473
472
  this.stats.tests += newStats.tests;
474
473
  this.stats.pending += newStats.pending;
475
- this.stats.failedHooks += newStats.failedHooks;
476
474
  }
477
475
 
478
476
  printResults() {
@@ -494,7 +492,7 @@ class Workers extends EventEmitter {
494
492
  this.failuresLog.forEach(log => output.print(...log));
495
493
  }
496
494
 
497
- output.result(this.stats.passes, this.stats.failures, this.stats.pending, ms(this.stats.duration), this.stats.failedHooks);
495
+ output.result(this.stats.passes, this.stats.failures, this.stats.pending, ms(this.stats.duration));
498
496
  process.env.RUNS_WITH_WORKERS = 'false';
499
497
  }
500
498
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeceptjs",
3
- "version": "3.6.6-beta.5",
3
+ "version": "3.6.6-beta.6",
4
4
  "description": "Supercharged End 2 End Testing Framework for NodeJS",
5
5
  "keywords": [
6
6
  "acceptance",
@@ -78,7 +78,7 @@
78
78
  "@xmldom/xmldom": "0.8.10",
79
79
  "acorn": "8.12.1",
80
80
  "arrify": "2.0.1",
81
- "axios": "1.7.3",
81
+ "axios": "1.7.7",
82
82
  "chai": "5.1.1",
83
83
  "chai-deep-match": "1.2.1",
84
84
  "chai-exclude": "2.1.1",
@@ -963,11 +963,13 @@ 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
966
967
  * ```
967
968
  * @param locator - located by CSS|XPath|strict locator.
969
+ * @param [sec] - (optional, `1` by default) time in seconds to wait
968
970
  * @returns number of visible elements
969
971
  */
970
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
972
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
971
973
  /**
972
974
  * Can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
973
975
  *
@@ -1181,14 +1183,6 @@ declare namespace CodeceptJS {
1181
1183
  * ## Methods
1182
1184
  */
1183
1185
  // @ts-ignore
1184
- // @ts-ignore
1185
- // @ts-ignore
1186
- // @ts-ignore
1187
- // @ts-ignore
1188
- // @ts-ignore
1189
- // @ts-ignore
1190
- // @ts-ignore
1191
- // @ts-ignore
1192
1186
  class ExpectHelper {
1193
1187
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1194
1188
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
@@ -1301,14 +1295,6 @@ declare namespace CodeceptJS {
1301
1295
  * ## Methods
1302
1296
  */
1303
1297
  // @ts-ignore
1304
- // @ts-ignore
1305
- // @ts-ignore
1306
- // @ts-ignore
1307
- // @ts-ignore
1308
- // @ts-ignore
1309
- // @ts-ignore
1310
- // @ts-ignore
1311
- // @ts-ignore
1312
1298
  class ExpectHelper {
1313
1299
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
1314
1300
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
@@ -1981,14 +1967,6 @@ declare namespace CodeceptJS {
1981
1967
  * @property [httpsOpts] - key & cert values are the paths to .key and .crt files
1982
1968
  */
1983
1969
  // @ts-ignore
1984
- // @ts-ignore
1985
- // @ts-ignore
1986
- // @ts-ignore
1987
- // @ts-ignore
1988
- // @ts-ignore
1989
- // @ts-ignore
1990
- // @ts-ignore
1991
- // @ts-ignore
1992
1970
  type MockServerConfig = {
1993
1971
  port?: number;
1994
1972
  host?: string;
@@ -2114,14 +2092,6 @@ declare namespace CodeceptJS {
2114
2092
  * ## Methods
2115
2093
  */
2116
2094
  // @ts-ignore
2117
- // @ts-ignore
2118
- // @ts-ignore
2119
- // @ts-ignore
2120
- // @ts-ignore
2121
- // @ts-ignore
2122
- // @ts-ignore
2123
- // @ts-ignore
2124
- // @ts-ignore
2125
2095
  class MockServer {
2126
2096
  /**
2127
2097
  * Start the mock server
@@ -2437,11 +2407,13 @@ declare namespace CodeceptJS {
2437
2407
  *
2438
2408
  * ```js
2439
2409
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
2410
+ * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
2440
2411
  * ```
2441
2412
  * @param locator - located by CSS|XPath|strict locator.
2413
+ * @param [sec] - (optional, `1` by default) time in seconds to wait
2442
2414
  * @returns number of visible elements
2443
2415
  */
2444
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
2416
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
2445
2417
  /**
2446
2418
  * Perform a click on a link or a button, given by a locator.
2447
2419
  * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
@@ -3196,14 +3168,6 @@ declare namespace CodeceptJS {
3196
3168
  * @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).
3197
3169
  */
3198
3170
  // @ts-ignore
3199
- // @ts-ignore
3200
- // @ts-ignore
3201
- // @ts-ignore
3202
- // @ts-ignore
3203
- // @ts-ignore
3204
- // @ts-ignore
3205
- // @ts-ignore
3206
- // @ts-ignore
3207
3171
  type PlaywrightConfig = {
3208
3172
  url?: string;
3209
3173
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -4352,11 +4316,13 @@ declare namespace CodeceptJS {
4352
4316
  *
4353
4317
  * ```js
4354
4318
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
4319
+ * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
4355
4320
  * ```
4356
4321
  * @param locator - located by CSS|XPath|strict locator.
4322
+ * @param [sec] - (optional, `1` by default) time in seconds to wait
4357
4323
  * @returns number of visible elements
4358
4324
  */
4359
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
4325
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
4360
4326
  /**
4361
4327
  * Checks that current url contains a provided fragment.
4362
4328
  *
@@ -6013,11 +5979,13 @@ declare namespace CodeceptJS {
6013
5979
  *
6014
5980
  * ```js
6015
5981
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
5982
+ * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
6016
5983
  * ```
6017
5984
  * @param locator - located by CSS|XPath|strict locator.
5985
+ * @param [sec] - (optional, `1` by default) time in seconds to wait
6018
5986
  * @returns number of visible elements
6019
5987
  */
6020
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
5988
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
6021
5989
  /**
6022
5990
  * Checks that all elements with given locator have given CSS properties.
6023
5991
  *
@@ -6581,14 +6549,6 @@ declare namespace CodeceptJS {
6581
6549
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6582
6550
  */
6583
6551
  // @ts-ignore
6584
- // @ts-ignore
6585
- // @ts-ignore
6586
- // @ts-ignore
6587
- // @ts-ignore
6588
- // @ts-ignore
6589
- // @ts-ignore
6590
- // @ts-ignore
6591
- // @ts-ignore
6592
6552
  type PuppeteerConfig = {
6593
6553
  url: string;
6594
6554
  basicAuth?: any;
@@ -7530,12 +7490,15 @@ declare namespace CodeceptJS {
7530
7490
  *
7531
7491
  * ```js
7532
7492
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
7493
+ * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
7533
7494
  * ```
7534
7495
  * @param locator - located by CSS|XPath|strict locator.
7496
+ * @param [sec] - (optional, `1` by default) time in seconds to wait
7535
7497
  * @returns number of visible elements
7498
+ *
7536
7499
  * {{ react }}
7537
7500
  */
7538
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
7501
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
7539
7502
  /**
7540
7503
  * Checks that current url contains a provided fragment.
7541
7504
  *
@@ -8396,14 +8359,6 @@ declare namespace CodeceptJS {
8396
8359
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
8397
8360
  */
8398
8361
  // @ts-ignore
8399
- // @ts-ignore
8400
- // @ts-ignore
8401
- // @ts-ignore
8402
- // @ts-ignore
8403
- // @ts-ignore
8404
- // @ts-ignore
8405
- // @ts-ignore
8406
- // @ts-ignore
8407
8362
  type RESTConfig = {
8408
8363
  endpoint?: string;
8409
8364
  prettyPrintJson?: boolean;
@@ -9310,11 +9265,13 @@ declare namespace CodeceptJS {
9310
9265
  *
9311
9266
  * ```js
9312
9267
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
9268
+ * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
9313
9269
  * ```
9314
9270
  * @param locator - located by CSS|XPath|strict locator.
9271
+ * @param [sec] - (optional, `1` by default) time in seconds to wait
9315
9272
  * @returns number of visible elements
9316
9273
  */
9317
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
9274
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
9318
9275
  /**
9319
9276
  * Checks that the given input field or textarea equals to given value.
9320
9277
  * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
@@ -9767,14 +9724,6 @@ declare namespace CodeceptJS {
9767
9724
  * @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
9768
9725
  */
9769
9726
  // @ts-ignore
9770
- // @ts-ignore
9771
- // @ts-ignore
9772
- // @ts-ignore
9773
- // @ts-ignore
9774
- // @ts-ignore
9775
- // @ts-ignore
9776
- // @ts-ignore
9777
- // @ts-ignore
9778
9727
  type WebDriverConfig = {
9779
9728
  url: string;
9780
9729
  browser: string;
@@ -10863,11 +10812,13 @@ declare namespace CodeceptJS {
10863
10812
  *
10864
10813
  * ```js
10865
10814
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
10815
+ * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
10866
10816
  * ```
10867
10817
  * @param locator - located by CSS|XPath|strict locator.
10818
+ * @param [sec] - (optional, `1` by default) time in seconds to wait
10868
10819
  * @returns number of visible elements
10869
10820
  */
10870
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
10821
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
10871
10822
  /**
10872
10823
  * Checks that current url contains a provided fragment.
10873
10824
  *
@@ -971,11 +971,13 @@ 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
974
975
  * ```
975
976
  * @param locator - located by CSS|XPath|strict locator.
977
+ * @param [sec] - (optional, `1` by default) time in seconds to wait
976
978
  * @returns number of visible elements
977
979
  */
978
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
980
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
979
981
  /**
980
982
  * Can be used for apps only with several values ("contentDescription", "text", "className", "resourceId")
981
983
  *
@@ -1205,14 +1207,6 @@ declare namespace CodeceptJS {
1205
1207
  * ## Methods
1206
1208
  */
1207
1209
  // @ts-ignore
1208
- // @ts-ignore
1209
- // @ts-ignore
1210
- // @ts-ignore
1211
- // @ts-ignore
1212
- // @ts-ignore
1213
- // @ts-ignore
1214
- // @ts-ignore
1215
- // @ts-ignore
1216
1210
  class ExpectHelper {
1217
1211
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1218
1212
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
@@ -1325,14 +1319,6 @@ declare namespace CodeceptJS {
1325
1319
  * ## Methods
1326
1320
  */
1327
1321
  // @ts-ignore
1328
- // @ts-ignore
1329
- // @ts-ignore
1330
- // @ts-ignore
1331
- // @ts-ignore
1332
- // @ts-ignore
1333
- // @ts-ignore
1334
- // @ts-ignore
1335
- // @ts-ignore
1336
1322
  class ExpectHelper {
1337
1323
  expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
1338
1324
  expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
@@ -2008,14 +1994,6 @@ declare namespace CodeceptJS {
2008
1994
  * @property [httpsOpts] - key & cert values are the paths to .key and .crt files
2009
1995
  */
2010
1996
  // @ts-ignore
2011
- // @ts-ignore
2012
- // @ts-ignore
2013
- // @ts-ignore
2014
- // @ts-ignore
2015
- // @ts-ignore
2016
- // @ts-ignore
2017
- // @ts-ignore
2018
- // @ts-ignore
2019
1997
  type MockServerConfig = {
2020
1998
  port?: number;
2021
1999
  host?: string;
@@ -2141,14 +2119,6 @@ declare namespace CodeceptJS {
2141
2119
  * ## Methods
2142
2120
  */
2143
2121
  // @ts-ignore
2144
- // @ts-ignore
2145
- // @ts-ignore
2146
- // @ts-ignore
2147
- // @ts-ignore
2148
- // @ts-ignore
2149
- // @ts-ignore
2150
- // @ts-ignore
2151
- // @ts-ignore
2152
2122
  class MockServer {
2153
2123
  /**
2154
2124
  * Start the mock server
@@ -2484,11 +2454,13 @@ declare namespace CodeceptJS {
2484
2454
  *
2485
2455
  * ```js
2486
2456
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
2457
+ * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
2487
2458
  * ```
2488
2459
  * @param locator - located by CSS|XPath|strict locator.
2460
+ * @param [sec] - (optional, `1` by default) time in seconds to wait
2489
2461
  * @returns number of visible elements
2490
2462
  */
2491
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
2463
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
2492
2464
  /**
2493
2465
  * Perform a click on a link or a button, given by a locator.
2494
2466
  * If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
@@ -3289,14 +3261,6 @@ declare namespace CodeceptJS {
3289
3261
  * @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).
3290
3262
  */
3291
3263
  // @ts-ignore
3292
- // @ts-ignore
3293
- // @ts-ignore
3294
- // @ts-ignore
3295
- // @ts-ignore
3296
- // @ts-ignore
3297
- // @ts-ignore
3298
- // @ts-ignore
3299
- // @ts-ignore
3300
3264
  type PlaywrightConfig = {
3301
3265
  url?: string;
3302
3266
  browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
@@ -4482,11 +4446,13 @@ declare namespace CodeceptJS {
4482
4446
  *
4483
4447
  * ```js
4484
4448
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
4449
+ * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
4485
4450
  * ```
4486
4451
  * @param locator - located by CSS|XPath|strict locator.
4452
+ * @param [sec] - (optional, `1` by default) time in seconds to wait
4487
4453
  * @returns number of visible elements
4488
4454
  */
4489
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
4455
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
4490
4456
  /**
4491
4457
  * Checks that current url contains a provided fragment.
4492
4458
  *
@@ -6221,11 +6187,13 @@ declare namespace CodeceptJS {
6221
6187
  *
6222
6188
  * ```js
6223
6189
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
6190
+ * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
6224
6191
  * ```
6225
6192
  * @param locator - located by CSS|XPath|strict locator.
6193
+ * @param [sec] - (optional, `1` by default) time in seconds to wait
6226
6194
  * @returns number of visible elements
6227
6195
  */
6228
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
6196
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
6229
6197
  /**
6230
6198
  * Checks that all elements with given locator have given CSS properties.
6231
6199
  *
@@ -6825,14 +6793,6 @@ declare namespace CodeceptJS {
6825
6793
  * @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
6826
6794
  */
6827
6795
  // @ts-ignore
6828
- // @ts-ignore
6829
- // @ts-ignore
6830
- // @ts-ignore
6831
- // @ts-ignore
6832
- // @ts-ignore
6833
- // @ts-ignore
6834
- // @ts-ignore
6835
- // @ts-ignore
6836
6796
  type PuppeteerConfig = {
6837
6797
  url: string;
6838
6798
  basicAuth?: any;
@@ -7838,12 +7798,15 @@ declare namespace CodeceptJS {
7838
7798
  *
7839
7799
  * ```js
7840
7800
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
7801
+ * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
7841
7802
  * ```
7842
7803
  * @param locator - located by CSS|XPath|strict locator.
7804
+ * @param [sec] - (optional, `1` by default) time in seconds to wait
7843
7805
  * @returns number of visible elements
7806
+ *
7844
7807
  * {{ react }}
7845
7808
  */
7846
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
7809
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
7847
7810
  /**
7848
7811
  * Checks that current url contains a provided fragment.
7849
7812
  *
@@ -8776,14 +8739,6 @@ declare namespace CodeceptJS {
8776
8739
  * @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
8777
8740
  */
8778
8741
  // @ts-ignore
8779
- // @ts-ignore
8780
- // @ts-ignore
8781
- // @ts-ignore
8782
- // @ts-ignore
8783
- // @ts-ignore
8784
- // @ts-ignore
8785
- // @ts-ignore
8786
- // @ts-ignore
8787
8742
  type RESTConfig = {
8788
8743
  endpoint?: string;
8789
8744
  prettyPrintJson?: boolean;
@@ -9724,11 +9679,13 @@ declare namespace CodeceptJS {
9724
9679
  *
9725
9680
  * ```js
9726
9681
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
9682
+ * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
9727
9683
  * ```
9728
9684
  * @param locator - located by CSS|XPath|strict locator.
9685
+ * @param [sec] - (optional, `1` by default) time in seconds to wait
9729
9686
  * @returns number of visible elements
9730
9687
  */
9731
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
9688
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
9732
9689
  /**
9733
9690
  * Checks that the given input field or textarea equals to given value.
9734
9691
  * For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
@@ -10207,14 +10164,6 @@ declare namespace CodeceptJS {
10207
10164
  * @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
10208
10165
  */
10209
10166
  // @ts-ignore
10210
- // @ts-ignore
10211
- // @ts-ignore
10212
- // @ts-ignore
10213
- // @ts-ignore
10214
- // @ts-ignore
10215
- // @ts-ignore
10216
- // @ts-ignore
10217
- // @ts-ignore
10218
10167
  type WebDriverConfig = {
10219
10168
  url: string;
10220
10169
  browser: string;
@@ -11370,11 +11319,13 @@ declare namespace CodeceptJS {
11370
11319
  *
11371
11320
  * ```js
11372
11321
  * let numOfElements = await I.grabNumberOfVisibleElements('p');
11322
+ * let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
11373
11323
  * ```
11374
11324
  * @param locator - located by CSS|XPath|strict locator.
11325
+ * @param [sec] - (optional, `1` by default) time in seconds to wait
11375
11326
  * @returns number of visible elements
11376
11327
  */
11377
- grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
11328
+ grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
11378
11329
  /**
11379
11330
  * Checks that current url contains a provided fragment.
11380
11331
  *