codeceptjs 3.6.6-beta.4 → 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.
- package/docs/webapi/grabNumberOfVisibleElements.mustache +3 -1
- package/lib/helper/Playwright.js +13 -3
- package/lib/helper/Puppeteer.js +10 -6
- package/lib/helper/TestCafe.js +7 -3
- package/lib/helper/WebDriver.js +7 -2
- package/lib/utils.js +8 -0
- package/package.json +3 -3
- package/typings/promiseBasedTypes.d.ts +22 -55
- package/typings/types.d.ts +22 -55
|
@@ -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
|
-
@
|
|
10
|
+
@param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
11
|
+
@returns {Promise<number>} number of visible elements
|
package/lib/helper/Playwright.js
CHANGED
|
@@ -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
|
-
|
|
1857
|
-
|
|
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
|
/**
|
package/lib/helper/Puppeteer.js
CHANGED
|
@@ -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
|
-
|
|
1524
|
-
|
|
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
|
-
)
|
|
1529
|
+
) && el,
|
|
1530
|
+
waitTimeout,
|
|
1531
|
+
),
|
|
1528
1532
|
),
|
|
1529
1533
|
)
|
|
1530
1534
|
|
package/lib/helper/TestCafe.js
CHANGED
|
@@ -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
|
|
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
|
|
package/lib/helper/WebDriver.js
CHANGED
|
@@ -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/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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeceptjs",
|
|
3
|
-
"version": "3.6.6-beta.
|
|
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.
|
|
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",
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"qrcode-terminal": "0.12.0",
|
|
157
157
|
"rosie": "2.1.1",
|
|
158
158
|
"runok": "0.9.3",
|
|
159
|
-
"semver": "
|
|
159
|
+
"semver": "7.6.3",
|
|
160
160
|
"sinon": "18.0.0",
|
|
161
161
|
"sinon-chai": "3.7.0",
|
|
162
162
|
"testcafe": "3.5.0",
|
|
@@ -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,12 +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
1186
|
class ExpectHelper {
|
|
1191
1187
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1192
1188
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
@@ -1299,12 +1295,6 @@ declare namespace CodeceptJS {
|
|
|
1299
1295
|
* ## Methods
|
|
1300
1296
|
*/
|
|
1301
1297
|
// @ts-ignore
|
|
1302
|
-
// @ts-ignore
|
|
1303
|
-
// @ts-ignore
|
|
1304
|
-
// @ts-ignore
|
|
1305
|
-
// @ts-ignore
|
|
1306
|
-
// @ts-ignore
|
|
1307
|
-
// @ts-ignore
|
|
1308
1298
|
class ExpectHelper {
|
|
1309
1299
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
1310
1300
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): Promise<any>;
|
|
@@ -1977,12 +1967,6 @@ declare namespace CodeceptJS {
|
|
|
1977
1967
|
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
1978
1968
|
*/
|
|
1979
1969
|
// @ts-ignore
|
|
1980
|
-
// @ts-ignore
|
|
1981
|
-
// @ts-ignore
|
|
1982
|
-
// @ts-ignore
|
|
1983
|
-
// @ts-ignore
|
|
1984
|
-
// @ts-ignore
|
|
1985
|
-
// @ts-ignore
|
|
1986
1970
|
type MockServerConfig = {
|
|
1987
1971
|
port?: number;
|
|
1988
1972
|
host?: string;
|
|
@@ -2108,12 +2092,6 @@ declare namespace CodeceptJS {
|
|
|
2108
2092
|
* ## Methods
|
|
2109
2093
|
*/
|
|
2110
2094
|
// @ts-ignore
|
|
2111
|
-
// @ts-ignore
|
|
2112
|
-
// @ts-ignore
|
|
2113
|
-
// @ts-ignore
|
|
2114
|
-
// @ts-ignore
|
|
2115
|
-
// @ts-ignore
|
|
2116
|
-
// @ts-ignore
|
|
2117
2095
|
class MockServer {
|
|
2118
2096
|
/**
|
|
2119
2097
|
* Start the mock server
|
|
@@ -2429,11 +2407,13 @@ declare namespace CodeceptJS {
|
|
|
2429
2407
|
*
|
|
2430
2408
|
* ```js
|
|
2431
2409
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
2410
|
+
* let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
|
|
2432
2411
|
* ```
|
|
2433
2412
|
* @param locator - located by CSS|XPath|strict locator.
|
|
2413
|
+
* @param [sec] - (optional, `1` by default) time in seconds to wait
|
|
2434
2414
|
* @returns number of visible elements
|
|
2435
2415
|
*/
|
|
2436
|
-
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
|
|
2416
|
+
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
|
|
2437
2417
|
/**
|
|
2438
2418
|
* Perform a click on a link or a button, given by a locator.
|
|
2439
2419
|
* If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
|
|
@@ -3188,12 +3168,6 @@ declare namespace CodeceptJS {
|
|
|
3188
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).
|
|
3189
3169
|
*/
|
|
3190
3170
|
// @ts-ignore
|
|
3191
|
-
// @ts-ignore
|
|
3192
|
-
// @ts-ignore
|
|
3193
|
-
// @ts-ignore
|
|
3194
|
-
// @ts-ignore
|
|
3195
|
-
// @ts-ignore
|
|
3196
|
-
// @ts-ignore
|
|
3197
3171
|
type PlaywrightConfig = {
|
|
3198
3172
|
url?: string;
|
|
3199
3173
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -4342,11 +4316,13 @@ declare namespace CodeceptJS {
|
|
|
4342
4316
|
*
|
|
4343
4317
|
* ```js
|
|
4344
4318
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
4319
|
+
* let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
|
|
4345
4320
|
* ```
|
|
4346
4321
|
* @param locator - located by CSS|XPath|strict locator.
|
|
4322
|
+
* @param [sec] - (optional, `1` by default) time in seconds to wait
|
|
4347
4323
|
* @returns number of visible elements
|
|
4348
4324
|
*/
|
|
4349
|
-
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
|
|
4325
|
+
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
|
|
4350
4326
|
/**
|
|
4351
4327
|
* Checks that current url contains a provided fragment.
|
|
4352
4328
|
*
|
|
@@ -6003,11 +5979,13 @@ declare namespace CodeceptJS {
|
|
|
6003
5979
|
*
|
|
6004
5980
|
* ```js
|
|
6005
5981
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
5982
|
+
* let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
|
|
6006
5983
|
* ```
|
|
6007
5984
|
* @param locator - located by CSS|XPath|strict locator.
|
|
5985
|
+
* @param [sec] - (optional, `1` by default) time in seconds to wait
|
|
6008
5986
|
* @returns number of visible elements
|
|
6009
5987
|
*/
|
|
6010
|
-
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
|
|
5988
|
+
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
|
|
6011
5989
|
/**
|
|
6012
5990
|
* Checks that all elements with given locator have given CSS properties.
|
|
6013
5991
|
*
|
|
@@ -6571,12 +6549,6 @@ declare namespace CodeceptJS {
|
|
|
6571
6549
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
6572
6550
|
*/
|
|
6573
6551
|
// @ts-ignore
|
|
6574
|
-
// @ts-ignore
|
|
6575
|
-
// @ts-ignore
|
|
6576
|
-
// @ts-ignore
|
|
6577
|
-
// @ts-ignore
|
|
6578
|
-
// @ts-ignore
|
|
6579
|
-
// @ts-ignore
|
|
6580
6552
|
type PuppeteerConfig = {
|
|
6581
6553
|
url: string;
|
|
6582
6554
|
basicAuth?: any;
|
|
@@ -7518,12 +7490,15 @@ declare namespace CodeceptJS {
|
|
|
7518
7490
|
*
|
|
7519
7491
|
* ```js
|
|
7520
7492
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
7493
|
+
* let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
|
|
7521
7494
|
* ```
|
|
7522
7495
|
* @param locator - located by CSS|XPath|strict locator.
|
|
7496
|
+
* @param [sec] - (optional, `1` by default) time in seconds to wait
|
|
7523
7497
|
* @returns number of visible elements
|
|
7498
|
+
*
|
|
7524
7499
|
* {{ react }}
|
|
7525
7500
|
*/
|
|
7526
|
-
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
|
|
7501
|
+
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
|
|
7527
7502
|
/**
|
|
7528
7503
|
* Checks that current url contains a provided fragment.
|
|
7529
7504
|
*
|
|
@@ -8384,12 +8359,6 @@ declare namespace CodeceptJS {
|
|
|
8384
8359
|
* @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
|
|
8385
8360
|
*/
|
|
8386
8361
|
// @ts-ignore
|
|
8387
|
-
// @ts-ignore
|
|
8388
|
-
// @ts-ignore
|
|
8389
|
-
// @ts-ignore
|
|
8390
|
-
// @ts-ignore
|
|
8391
|
-
// @ts-ignore
|
|
8392
|
-
// @ts-ignore
|
|
8393
8362
|
type RESTConfig = {
|
|
8394
8363
|
endpoint?: string;
|
|
8395
8364
|
prettyPrintJson?: boolean;
|
|
@@ -9296,11 +9265,13 @@ declare namespace CodeceptJS {
|
|
|
9296
9265
|
*
|
|
9297
9266
|
* ```js
|
|
9298
9267
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
9268
|
+
* let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
|
|
9299
9269
|
* ```
|
|
9300
9270
|
* @param locator - located by CSS|XPath|strict locator.
|
|
9271
|
+
* @param [sec] - (optional, `1` by default) time in seconds to wait
|
|
9301
9272
|
* @returns number of visible elements
|
|
9302
9273
|
*/
|
|
9303
|
-
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
|
|
9274
|
+
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
|
|
9304
9275
|
/**
|
|
9305
9276
|
* Checks that the given input field or textarea equals to given value.
|
|
9306
9277
|
* For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
|
|
@@ -9753,12 +9724,6 @@ declare namespace CodeceptJS {
|
|
|
9753
9724
|
* @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
|
|
9754
9725
|
*/
|
|
9755
9726
|
// @ts-ignore
|
|
9756
|
-
// @ts-ignore
|
|
9757
|
-
// @ts-ignore
|
|
9758
|
-
// @ts-ignore
|
|
9759
|
-
// @ts-ignore
|
|
9760
|
-
// @ts-ignore
|
|
9761
|
-
// @ts-ignore
|
|
9762
9727
|
type WebDriverConfig = {
|
|
9763
9728
|
url: string;
|
|
9764
9729
|
browser: string;
|
|
@@ -10847,11 +10812,13 @@ declare namespace CodeceptJS {
|
|
|
10847
10812
|
*
|
|
10848
10813
|
* ```js
|
|
10849
10814
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
10815
|
+
* let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
|
|
10850
10816
|
* ```
|
|
10851
10817
|
* @param locator - located by CSS|XPath|strict locator.
|
|
10818
|
+
* @param [sec] - (optional, `1` by default) time in seconds to wait
|
|
10852
10819
|
* @returns number of visible elements
|
|
10853
10820
|
*/
|
|
10854
|
-
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
|
|
10821
|
+
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
|
|
10855
10822
|
/**
|
|
10856
10823
|
* Checks that current url contains a provided fragment.
|
|
10857
10824
|
*
|
package/typings/types.d.ts
CHANGED
|
@@ -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,12 +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
1210
|
class ExpectHelper {
|
|
1215
1211
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1216
1212
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
@@ -1323,12 +1319,6 @@ declare namespace CodeceptJS {
|
|
|
1323
1319
|
* ## Methods
|
|
1324
1320
|
*/
|
|
1325
1321
|
// @ts-ignore
|
|
1326
|
-
// @ts-ignore
|
|
1327
|
-
// @ts-ignore
|
|
1328
|
-
// @ts-ignore
|
|
1329
|
-
// @ts-ignore
|
|
1330
|
-
// @ts-ignore
|
|
1331
|
-
// @ts-ignore
|
|
1332
1322
|
class ExpectHelper {
|
|
1333
1323
|
expectEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
1334
1324
|
expectNotEqual(actualValue: any, expectedValue: any, customErrorMsg?: any): void;
|
|
@@ -2004,12 +1994,6 @@ declare namespace CodeceptJS {
|
|
|
2004
1994
|
* @property [httpsOpts] - key & cert values are the paths to .key and .crt files
|
|
2005
1995
|
*/
|
|
2006
1996
|
// @ts-ignore
|
|
2007
|
-
// @ts-ignore
|
|
2008
|
-
// @ts-ignore
|
|
2009
|
-
// @ts-ignore
|
|
2010
|
-
// @ts-ignore
|
|
2011
|
-
// @ts-ignore
|
|
2012
|
-
// @ts-ignore
|
|
2013
1997
|
type MockServerConfig = {
|
|
2014
1998
|
port?: number;
|
|
2015
1999
|
host?: string;
|
|
@@ -2135,12 +2119,6 @@ declare namespace CodeceptJS {
|
|
|
2135
2119
|
* ## Methods
|
|
2136
2120
|
*/
|
|
2137
2121
|
// @ts-ignore
|
|
2138
|
-
// @ts-ignore
|
|
2139
|
-
// @ts-ignore
|
|
2140
|
-
// @ts-ignore
|
|
2141
|
-
// @ts-ignore
|
|
2142
|
-
// @ts-ignore
|
|
2143
|
-
// @ts-ignore
|
|
2144
2122
|
class MockServer {
|
|
2145
2123
|
/**
|
|
2146
2124
|
* Start the mock server
|
|
@@ -2476,11 +2454,13 @@ declare namespace CodeceptJS {
|
|
|
2476
2454
|
*
|
|
2477
2455
|
* ```js
|
|
2478
2456
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
2457
|
+
* let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
|
|
2479
2458
|
* ```
|
|
2480
2459
|
* @param locator - located by CSS|XPath|strict locator.
|
|
2460
|
+
* @param [sec] - (optional, `1` by default) time in seconds to wait
|
|
2481
2461
|
* @returns number of visible elements
|
|
2482
2462
|
*/
|
|
2483
|
-
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
|
|
2463
|
+
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
|
|
2484
2464
|
/**
|
|
2485
2465
|
* Perform a click on a link or a button, given by a locator.
|
|
2486
2466
|
* If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
|
|
@@ -3281,12 +3261,6 @@ declare namespace CodeceptJS {
|
|
|
3281
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).
|
|
3282
3262
|
*/
|
|
3283
3263
|
// @ts-ignore
|
|
3284
|
-
// @ts-ignore
|
|
3285
|
-
// @ts-ignore
|
|
3286
|
-
// @ts-ignore
|
|
3287
|
-
// @ts-ignore
|
|
3288
|
-
// @ts-ignore
|
|
3289
|
-
// @ts-ignore
|
|
3290
3264
|
type PlaywrightConfig = {
|
|
3291
3265
|
url?: string;
|
|
3292
3266
|
browser?: 'chromium' | 'firefox' | 'webkit' | 'electron';
|
|
@@ -4472,11 +4446,13 @@ declare namespace CodeceptJS {
|
|
|
4472
4446
|
*
|
|
4473
4447
|
* ```js
|
|
4474
4448
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
4449
|
+
* let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
|
|
4475
4450
|
* ```
|
|
4476
4451
|
* @param locator - located by CSS|XPath|strict locator.
|
|
4452
|
+
* @param [sec] - (optional, `1` by default) time in seconds to wait
|
|
4477
4453
|
* @returns number of visible elements
|
|
4478
4454
|
*/
|
|
4479
|
-
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
|
|
4455
|
+
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
|
|
4480
4456
|
/**
|
|
4481
4457
|
* Checks that current url contains a provided fragment.
|
|
4482
4458
|
*
|
|
@@ -6211,11 +6187,13 @@ declare namespace CodeceptJS {
|
|
|
6211
6187
|
*
|
|
6212
6188
|
* ```js
|
|
6213
6189
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
6190
|
+
* let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
|
|
6214
6191
|
* ```
|
|
6215
6192
|
* @param locator - located by CSS|XPath|strict locator.
|
|
6193
|
+
* @param [sec] - (optional, `1` by default) time in seconds to wait
|
|
6216
6194
|
* @returns number of visible elements
|
|
6217
6195
|
*/
|
|
6218
|
-
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
|
|
6196
|
+
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
|
|
6219
6197
|
/**
|
|
6220
6198
|
* Checks that all elements with given locator have given CSS properties.
|
|
6221
6199
|
*
|
|
@@ -6815,12 +6793,6 @@ declare namespace CodeceptJS {
|
|
|
6815
6793
|
* @property [highlightElement] - highlight the interacting elements. Default: false. Note: only activate under verbose mode (--verbose).
|
|
6816
6794
|
*/
|
|
6817
6795
|
// @ts-ignore
|
|
6818
|
-
// @ts-ignore
|
|
6819
|
-
// @ts-ignore
|
|
6820
|
-
// @ts-ignore
|
|
6821
|
-
// @ts-ignore
|
|
6822
|
-
// @ts-ignore
|
|
6823
|
-
// @ts-ignore
|
|
6824
6796
|
type PuppeteerConfig = {
|
|
6825
6797
|
url: string;
|
|
6826
6798
|
basicAuth?: any;
|
|
@@ -7826,12 +7798,15 @@ declare namespace CodeceptJS {
|
|
|
7826
7798
|
*
|
|
7827
7799
|
* ```js
|
|
7828
7800
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
7801
|
+
* let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
|
|
7829
7802
|
* ```
|
|
7830
7803
|
* @param locator - located by CSS|XPath|strict locator.
|
|
7804
|
+
* @param [sec] - (optional, `1` by default) time in seconds to wait
|
|
7831
7805
|
* @returns number of visible elements
|
|
7806
|
+
*
|
|
7832
7807
|
* {{ react }}
|
|
7833
7808
|
*/
|
|
7834
|
-
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
|
|
7809
|
+
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
|
|
7835
7810
|
/**
|
|
7836
7811
|
* Checks that current url contains a provided fragment.
|
|
7837
7812
|
*
|
|
@@ -8764,12 +8739,6 @@ declare namespace CodeceptJS {
|
|
|
8764
8739
|
* @property [maxUploadFileSize] - set the max content file size in MB when performing api calls.
|
|
8765
8740
|
*/
|
|
8766
8741
|
// @ts-ignore
|
|
8767
|
-
// @ts-ignore
|
|
8768
|
-
// @ts-ignore
|
|
8769
|
-
// @ts-ignore
|
|
8770
|
-
// @ts-ignore
|
|
8771
|
-
// @ts-ignore
|
|
8772
|
-
// @ts-ignore
|
|
8773
8742
|
type RESTConfig = {
|
|
8774
8743
|
endpoint?: string;
|
|
8775
8744
|
prettyPrintJson?: boolean;
|
|
@@ -9710,11 +9679,13 @@ declare namespace CodeceptJS {
|
|
|
9710
9679
|
*
|
|
9711
9680
|
* ```js
|
|
9712
9681
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
9682
|
+
* let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
|
|
9713
9683
|
* ```
|
|
9714
9684
|
* @param locator - located by CSS|XPath|strict locator.
|
|
9685
|
+
* @param [sec] - (optional, `1` by default) time in seconds to wait
|
|
9715
9686
|
* @returns number of visible elements
|
|
9716
9687
|
*/
|
|
9717
|
-
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
|
|
9688
|
+
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
|
|
9718
9689
|
/**
|
|
9719
9690
|
* Checks that the given input field or textarea equals to given value.
|
|
9720
9691
|
* For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath.
|
|
@@ -10193,12 +10164,6 @@ declare namespace CodeceptJS {
|
|
|
10193
10164
|
* @property [devtoolsProtocol = false] - enable devtools protocol. Default: false. More info: https://webdriver.io/docs/automationProtocols/#devtools-protocol.
|
|
10194
10165
|
*/
|
|
10195
10166
|
// @ts-ignore
|
|
10196
|
-
// @ts-ignore
|
|
10197
|
-
// @ts-ignore
|
|
10198
|
-
// @ts-ignore
|
|
10199
|
-
// @ts-ignore
|
|
10200
|
-
// @ts-ignore
|
|
10201
|
-
// @ts-ignore
|
|
10202
10167
|
type WebDriverConfig = {
|
|
10203
10168
|
url: string;
|
|
10204
10169
|
browser: string;
|
|
@@ -11354,11 +11319,13 @@ declare namespace CodeceptJS {
|
|
|
11354
11319
|
*
|
|
11355
11320
|
* ```js
|
|
11356
11321
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
11322
|
+
* let numOfElementsWithWait = await I.grabNumberOfVisibleElements('p', 2); // timeout applied
|
|
11357
11323
|
* ```
|
|
11358
11324
|
* @param locator - located by CSS|XPath|strict locator.
|
|
11325
|
+
* @param [sec] - (optional, `1` by default) time in seconds to wait
|
|
11359
11326
|
* @returns number of visible elements
|
|
11360
11327
|
*/
|
|
11361
|
-
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString): Promise<number>;
|
|
11328
|
+
grabNumberOfVisibleElements(locator: CodeceptJS.LocatorOrString, sec?: number): Promise<number>;
|
|
11362
11329
|
/**
|
|
11363
11330
|
* Checks that current url contains a provided fragment.
|
|
11364
11331
|
*
|