codeceptjs 3.5.9 → 3.5.11
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/README.md +14 -16
- package/docs/build/Appium.js +49 -49
- package/docs/build/Expect.js +33 -33
- package/docs/build/Nightmare.js +50 -50
- package/docs/build/Playwright.js +239 -133
- package/docs/build/Protractor.js +59 -59
- package/docs/build/Puppeteer.js +127 -107
- package/docs/build/TestCafe.js +48 -48
- package/docs/build/WebDriver.js +112 -93
- package/docs/helpers/Appium.md +3 -3
- package/docs/helpers/Expect.md +33 -33
- package/docs/helpers/Playwright.md +431 -325
- package/docs/helpers/Puppeteer.md +50 -24
- package/docs/helpers/WebDriver.md +41 -13
- package/docs/internal-api.md +1 -0
- package/docs/parallel.md +114 -2
- package/docs/plugins.md +7 -5
- package/docs/react.md +2 -1
- package/docs/vue.md +22 -0
- package/docs/webapi/grabWebElement.mustache +9 -0
- package/docs/webapi/grabWebElements.mustache +9 -0
- package/docs/webapi/scrollIntoView.mustache +1 -1
- package/lib/ai.js +12 -3
- package/lib/colorUtils.js +10 -0
- package/lib/command/run-multiple.js +1 -1
- package/lib/command/run-workers.js +30 -4
- package/lib/command/workers/runTests.js +39 -0
- package/lib/event.js +2 -0
- package/lib/helper/Appium.js +13 -13
- package/lib/helper/Expect.js +33 -33
- package/lib/helper/Playwright.js +125 -37
- package/lib/helper/Puppeteer.js +49 -38
- package/lib/helper/WebDriver.js +29 -19
- package/lib/helper/extras/PlaywrightReactVueLocator.js +38 -0
- package/lib/html.js +3 -3
- package/lib/interfaces/gherkin.js +8 -1
- package/lib/interfaces/scenarioConfig.js +1 -0
- package/lib/locator.js +2 -2
- package/lib/pause.js +6 -3
- package/lib/plugin/autoLogin.js +4 -2
- package/lib/plugin/heal.js +40 -7
- package/lib/plugin/retryFailedStep.js +6 -1
- package/lib/plugin/stepByStepReport.js +2 -2
- package/lib/plugin/tryTo.js +5 -4
- package/lib/recorder.js +12 -5
- package/lib/ui.js +1 -0
- package/lib/workers.js +2 -0
- package/package.json +28 -25
- package/typings/index.d.ts +1 -1
- package/typings/promiseBasedTypes.d.ts +195 -76
- package/typings/types.d.ts +191 -145
- package/lib/helper/extras/PlaywrightReact.js +0 -9
package/docs/build/Puppeteer.js
CHANGED
|
@@ -259,6 +259,7 @@ class Puppeteer extends Helper {
|
|
|
259
259
|
headless: !this.options.show,
|
|
260
260
|
...this._getOptions(config),
|
|
261
261
|
};
|
|
262
|
+
if (this.puppeteerOptions.headless) this.puppeteerOptions.headless = 'new';
|
|
262
263
|
this.isRemoteBrowser = !!this.puppeteerOptions.browserWSEndpoint;
|
|
263
264
|
popupStore.defaultAction = this.options.defaultPopupAction;
|
|
264
265
|
}
|
|
@@ -297,7 +298,7 @@ class Puppeteer extends Helper {
|
|
|
297
298
|
this.sessionPages = {};
|
|
298
299
|
this.currentRunningTest = test;
|
|
299
300
|
recorder.retry({
|
|
300
|
-
retries: 3,
|
|
301
|
+
retries: process.env.FAILED_STEP_RETRIES || 3,
|
|
301
302
|
when: err => {
|
|
302
303
|
if (!err || typeof (err.message) !== 'string') {
|
|
303
304
|
return false;
|
|
@@ -703,6 +704,11 @@ class Puppeteer extends Helper {
|
|
|
703
704
|
}
|
|
704
705
|
|
|
705
706
|
/**
|
|
707
|
+
*
|
|
708
|
+
* Unlike other drivers Puppeteer changes the size of a viewport, not the window!
|
|
709
|
+
* Puppeteer does not control the window of a browser, so it can't adjust its real size.
|
|
710
|
+
* It also can't maximize a window.
|
|
711
|
+
*
|
|
706
712
|
* Resize the current window to provided width and height.
|
|
707
713
|
* First parameter can be set to `maximize`.
|
|
708
714
|
*
|
|
@@ -711,9 +717,6 @@ class Puppeteer extends Helper {
|
|
|
711
717
|
* @returns {void} automatically synchronized promise through #recorder
|
|
712
718
|
*
|
|
713
719
|
*
|
|
714
|
-
* Unlike other drivers Puppeteer changes the size of a viewport, not the window!
|
|
715
|
-
* Puppeteer does not control the window of a browser so it can't adjust its real size.
|
|
716
|
-
* It also can't maximize a window.
|
|
717
720
|
*/
|
|
718
721
|
async resizeWindow(width, height) {
|
|
719
722
|
if (width === 'maximize') {
|
|
@@ -751,7 +754,7 @@ class Puppeteer extends Helper {
|
|
|
751
754
|
* I.moveCursorTo('#submit', 5,5);
|
|
752
755
|
* ```
|
|
753
756
|
*
|
|
754
|
-
* @param {
|
|
757
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
755
758
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
756
759
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
757
760
|
* @returns {void} automatically synchronized promise through #recorder
|
|
@@ -779,7 +782,7 @@ class Puppeteer extends Helper {
|
|
|
779
782
|
* I.see('#add-to-cart-bnt');
|
|
780
783
|
* ```
|
|
781
784
|
*
|
|
782
|
-
* @param {
|
|
785
|
+
* @param {string | object} locator field located by label|name|CSS|XPath|strict locator.
|
|
783
786
|
* @param {any} [options] Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-focus) for available options object as 2nd argument.
|
|
784
787
|
* @returns {void} automatically synchronized promise through #recorder
|
|
785
788
|
*
|
|
@@ -790,7 +793,8 @@ class Puppeteer extends Helper {
|
|
|
790
793
|
assertElementExists(els, locator, 'Element to focus');
|
|
791
794
|
const el = els[0];
|
|
792
795
|
|
|
793
|
-
await
|
|
796
|
+
await el.click();
|
|
797
|
+
await el.focus();
|
|
794
798
|
return this._waitForAction();
|
|
795
799
|
}
|
|
796
800
|
|
|
@@ -810,7 +814,7 @@ class Puppeteer extends Helper {
|
|
|
810
814
|
* I.dontSee('#add-to-cart-btn');
|
|
811
815
|
* ```
|
|
812
816
|
*
|
|
813
|
-
* @param {
|
|
817
|
+
* @param {string | object} locator field located by label|name|CSS|XPath|strict locator.
|
|
814
818
|
* @param {any} [options] Playwright only: [Additional options](https://playwright.dev/docs/api/class-locator#locator-blur) for available options object as 2nd argument.
|
|
815
819
|
* @returns {void} automatically synchronized promise through #recorder
|
|
816
820
|
*
|
|
@@ -831,8 +835,8 @@ class Puppeteer extends Helper {
|
|
|
831
835
|
* I.dragAndDrop('#dragHandle', '#container');
|
|
832
836
|
* ```
|
|
833
837
|
*
|
|
834
|
-
* @param {
|
|
835
|
-
* @param {
|
|
838
|
+
* @param {string | object} srcElement located by CSS|XPath|strict locator.
|
|
839
|
+
* @param {string | object} destElement located by CSS|XPath|strict locator.
|
|
836
840
|
* @returns {void} automatically synchronized promise through #recorder
|
|
837
841
|
*
|
|
838
842
|
*/
|
|
@@ -900,7 +904,7 @@ class Puppeteer extends Helper {
|
|
|
900
904
|
* I.scrollTo('#submit', 5, 5);
|
|
901
905
|
* ```
|
|
902
906
|
*
|
|
903
|
-
* @param {
|
|
907
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
904
908
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
905
909
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
906
910
|
* @returns {void} automatically synchronized promise through #recorder
|
|
@@ -1026,7 +1030,7 @@ class Puppeteer extends Helper {
|
|
|
1026
1030
|
}
|
|
1027
1031
|
|
|
1028
1032
|
/**
|
|
1029
|
-
* Find a checkbox by providing human
|
|
1033
|
+
* Find a checkbox by providing human-readable text:
|
|
1030
1034
|
* NOTE: Assumes the checkable element exists
|
|
1031
1035
|
*
|
|
1032
1036
|
* ```js
|
|
@@ -1041,7 +1045,7 @@ class Puppeteer extends Helper {
|
|
|
1041
1045
|
}
|
|
1042
1046
|
|
|
1043
1047
|
/**
|
|
1044
|
-
* Find a clickable element by providing human
|
|
1048
|
+
* Find a clickable element by providing human-readable text:
|
|
1045
1049
|
*
|
|
1046
1050
|
* ```js
|
|
1047
1051
|
* this.helpers['Puppeteer']._locateClickable('Next page').then // ...
|
|
@@ -1053,7 +1057,7 @@ class Puppeteer extends Helper {
|
|
|
1053
1057
|
}
|
|
1054
1058
|
|
|
1055
1059
|
/**
|
|
1056
|
-
* Find field elements by providing human
|
|
1060
|
+
* Find field elements by providing human-readable text:
|
|
1057
1061
|
*
|
|
1058
1062
|
* ```js
|
|
1059
1063
|
* this.helpers['Puppeteer']._locateFields('Your email').then // ...
|
|
@@ -1063,6 +1067,23 @@ class Puppeteer extends Helper {
|
|
|
1063
1067
|
return findFields.call(this, locator);
|
|
1064
1068
|
}
|
|
1065
1069
|
|
|
1070
|
+
/**
|
|
1071
|
+
* Grab WebElements for given locator
|
|
1072
|
+
* Resumes test execution, so **should be used inside an async function with `await`** operator.
|
|
1073
|
+
*
|
|
1074
|
+
* ```js
|
|
1075
|
+
* const webElements = await I.grabWebElements('#button');
|
|
1076
|
+
* ```
|
|
1077
|
+
*
|
|
1078
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1079
|
+
* @returns {Promise<*>} WebElement of being used Web helper
|
|
1080
|
+
*
|
|
1081
|
+
*
|
|
1082
|
+
*/
|
|
1083
|
+
async grabWebElements(locator) {
|
|
1084
|
+
return this._locate(locator);
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1066
1087
|
/**
|
|
1067
1088
|
* Switch focus to a particular tab by its number. It waits tabs loading and then switch tab
|
|
1068
1089
|
*
|
|
@@ -1178,7 +1199,7 @@ class Puppeteer extends Helper {
|
|
|
1178
1199
|
* ```js
|
|
1179
1200
|
* I.seeElement('#modal');
|
|
1180
1201
|
* ```
|
|
1181
|
-
* @param {
|
|
1202
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
1182
1203
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1183
1204
|
*
|
|
1184
1205
|
* {{ react }}
|
|
@@ -1199,7 +1220,7 @@ class Puppeteer extends Helper {
|
|
|
1199
1220
|
* I.dontSeeElement('.modal'); // modal is not shown
|
|
1200
1221
|
* ```
|
|
1201
1222
|
*
|
|
1202
|
-
* @param {
|
|
1223
|
+
* @param {string | object} locator located by CSS|XPath|Strict locator.
|
|
1203
1224
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1204
1225
|
*
|
|
1205
1226
|
* {{ react }}
|
|
@@ -1220,7 +1241,7 @@ class Puppeteer extends Helper {
|
|
|
1220
1241
|
* ```js
|
|
1221
1242
|
* I.seeElementInDOM('#modal');
|
|
1222
1243
|
* ```
|
|
1223
|
-
* @param {
|
|
1244
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
1224
1245
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1225
1246
|
*
|
|
1226
1247
|
*/
|
|
@@ -1236,7 +1257,7 @@ class Puppeteer extends Helper {
|
|
|
1236
1257
|
* I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
|
|
1237
1258
|
* ```
|
|
1238
1259
|
*
|
|
1239
|
-
* @param {
|
|
1260
|
+
* @param {string | object} locator located by CSS|XPath|Strict locator.
|
|
1240
1261
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1241
1262
|
*
|
|
1242
1263
|
*/
|
|
@@ -1268,8 +1289,8 @@ class Puppeteer extends Helper {
|
|
|
1268
1289
|
* I.click({css: 'nav a.login'});
|
|
1269
1290
|
* ```
|
|
1270
1291
|
*
|
|
1271
|
-
* @param {
|
|
1272
|
-
* @param {?
|
|
1292
|
+
* @param {string | object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1293
|
+
* @param {?string | object | null} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1273
1294
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1274
1295
|
*
|
|
1275
1296
|
*
|
|
@@ -1305,8 +1326,8 @@ class Puppeteer extends Helper {
|
|
|
1305
1326
|
* I.forceClick({css: 'nav a.login'});
|
|
1306
1327
|
* ```
|
|
1307
1328
|
*
|
|
1308
|
-
* @param {
|
|
1309
|
-
* @param {?
|
|
1329
|
+
* @param {string | object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1330
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1310
1331
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1311
1332
|
*
|
|
1312
1333
|
*
|
|
@@ -1343,8 +1364,8 @@ class Puppeteer extends Helper {
|
|
|
1343
1364
|
* ```js
|
|
1344
1365
|
* I.clickLink('Logout', '#nav');
|
|
1345
1366
|
* ```
|
|
1346
|
-
* @param {
|
|
1347
|
-
* @param {?
|
|
1367
|
+
* @param {string | object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator
|
|
1368
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator
|
|
1348
1369
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1349
1370
|
*
|
|
1350
1371
|
*
|
|
@@ -1358,7 +1379,7 @@ class Puppeteer extends Helper {
|
|
|
1358
1379
|
* Sets a directory to where save files. Allows to test file downloads.
|
|
1359
1380
|
* Should be used with [FileSystem helper](https://codecept.io/helpers/FileSystem) to check that file were downloaded correctly.
|
|
1360
1381
|
*
|
|
1361
|
-
* By default files are saved to `output/downloads`.
|
|
1382
|
+
* By default, files are saved to `output/downloads`.
|
|
1362
1383
|
* This directory is cleaned on every `handleDownloads` call, to ensure no old files are kept.
|
|
1363
1384
|
*
|
|
1364
1385
|
* ```js
|
|
@@ -1462,8 +1483,8 @@ class Puppeteer extends Helper {
|
|
|
1462
1483
|
* I.doubleClick('.btn.edit');
|
|
1463
1484
|
* ```
|
|
1464
1485
|
*
|
|
1465
|
-
* @param {
|
|
1466
|
-
* @param {?
|
|
1486
|
+
* @param {string | object} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1487
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1467
1488
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1468
1489
|
*
|
|
1469
1490
|
*
|
|
@@ -1485,8 +1506,8 @@ class Puppeteer extends Helper {
|
|
|
1485
1506
|
* I.rightClick('Click me', '.context');
|
|
1486
1507
|
* ```
|
|
1487
1508
|
*
|
|
1488
|
-
* @param {
|
|
1489
|
-
* @param {?
|
|
1509
|
+
* @param {string | object} locator clickable element located by CSS|XPath|strict locator.
|
|
1510
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1490
1511
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1491
1512
|
*
|
|
1492
1513
|
*
|
|
@@ -1507,8 +1528,8 @@ class Puppeteer extends Helper {
|
|
|
1507
1528
|
* I.checkOption('I Agree to Terms and Conditions');
|
|
1508
1529
|
* I.checkOption('agree', '//form');
|
|
1509
1530
|
* ```
|
|
1510
|
-
* @param {
|
|
1511
|
-
* @param {?
|
|
1531
|
+
* @param {string | object} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
1532
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1512
1533
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1513
1534
|
*
|
|
1514
1535
|
*/
|
|
@@ -1534,8 +1555,8 @@ class Puppeteer extends Helper {
|
|
|
1534
1555
|
* I.uncheckOption('I Agree to Terms and Conditions');
|
|
1535
1556
|
* I.uncheckOption('agree', '//form');
|
|
1536
1557
|
* ```
|
|
1537
|
-
* @param {
|
|
1538
|
-
* @param {?
|
|
1558
|
+
* @param {string | object} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
1559
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1539
1560
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1540
1561
|
*
|
|
1541
1562
|
*/
|
|
@@ -1559,7 +1580,7 @@ class Puppeteer extends Helper {
|
|
|
1559
1580
|
* I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
1560
1581
|
* ```
|
|
1561
1582
|
*
|
|
1562
|
-
* @param {
|
|
1583
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
1563
1584
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1564
1585
|
*
|
|
1565
1586
|
*/
|
|
@@ -1576,7 +1597,7 @@ class Puppeteer extends Helper {
|
|
|
1576
1597
|
* I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
1577
1598
|
* ```
|
|
1578
1599
|
*
|
|
1579
|
-
* @param {
|
|
1600
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
1580
1601
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1581
1602
|
*
|
|
1582
1603
|
*/
|
|
@@ -1627,6 +1648,8 @@ class Puppeteer extends Helper {
|
|
|
1627
1648
|
}
|
|
1628
1649
|
|
|
1629
1650
|
/**
|
|
1651
|
+
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/puppeteer#1313](https://github.com/GoogleChrome/puppeteer/issues/1313)).
|
|
1652
|
+
*
|
|
1630
1653
|
* Presses a key in the browser (on a focused element).
|
|
1631
1654
|
*
|
|
1632
1655
|
* _Hint:_ For populating text field or textarea, it is recommended to use [`fillField`](#fillfield).
|
|
@@ -1688,8 +1711,6 @@ class Puppeteer extends Helper {
|
|
|
1688
1711
|
* @param {string|string[]} key key or array of keys to press.
|
|
1689
1712
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1690
1713
|
*
|
|
1691
|
-
*
|
|
1692
|
-
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/puppeteer#1313](https://github.com/GoogleChrome/puppeteer/issues/1313)).
|
|
1693
1714
|
*/
|
|
1694
1715
|
async pressKey(key) {
|
|
1695
1716
|
const modifiers = [];
|
|
@@ -1766,8 +1787,8 @@ class Puppeteer extends Helper {
|
|
|
1766
1787
|
* // or by strict locator
|
|
1767
1788
|
* I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
1768
1789
|
* ```
|
|
1769
|
-
* @param {
|
|
1770
|
-
* @param {
|
|
1790
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
1791
|
+
* @param {string | object} value text value to fill.
|
|
1771
1792
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1772
1793
|
*
|
|
1773
1794
|
* {{ react }}
|
|
@@ -1798,7 +1819,7 @@ class Puppeteer extends Helper {
|
|
|
1798
1819
|
* I.clearField('user[email]');
|
|
1799
1820
|
* I.clearField('#email');
|
|
1800
1821
|
* ```
|
|
1801
|
-
* @param {
|
|
1822
|
+
* @param {string | object} editable field located by label|name|CSS|XPath|strict locator.
|
|
1802
1823
|
* @returns {void} automatically synchronized promise through #recorder.
|
|
1803
1824
|
*
|
|
1804
1825
|
*/
|
|
@@ -1815,7 +1836,7 @@ class Puppeteer extends Helper {
|
|
|
1815
1836
|
* // typing secret
|
|
1816
1837
|
* I.appendField('password', secret('123456'));
|
|
1817
1838
|
* ```
|
|
1818
|
-
* @param {
|
|
1839
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator
|
|
1819
1840
|
* @param {string} value text value to append.
|
|
1820
1841
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1821
1842
|
*
|
|
@@ -1841,8 +1862,8 @@ class Puppeteer extends Helper {
|
|
|
1841
1862
|
* I.seeInField('form input[type=hidden]','hidden_value');
|
|
1842
1863
|
* I.seeInField('#searchform input','Search');
|
|
1843
1864
|
* ```
|
|
1844
|
-
* @param {
|
|
1845
|
-
* @param {
|
|
1865
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
1866
|
+
* @param {string | object} value value to check.
|
|
1846
1867
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1847
1868
|
*
|
|
1848
1869
|
*/
|
|
@@ -1860,8 +1881,8 @@ class Puppeteer extends Helper {
|
|
|
1860
1881
|
* I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
1861
1882
|
* ```
|
|
1862
1883
|
*
|
|
1863
|
-
* @param {
|
|
1864
|
-
* @param {
|
|
1884
|
+
* @param {string | object} field located by label|name|CSS|XPath|strict locator.
|
|
1885
|
+
* @param {string | object} value value to check.
|
|
1865
1886
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1866
1887
|
*
|
|
1867
1888
|
*/
|
|
@@ -1871,6 +1892,8 @@ class Puppeteer extends Helper {
|
|
|
1871
1892
|
}
|
|
1872
1893
|
|
|
1873
1894
|
/**
|
|
1895
|
+
* > ⚠ There is an [issue with file upload in Puppeteer 2.1.0 & 2.1.1](https://github.com/puppeteer/puppeteer/issues/5420), downgrade to 2.0.0 if you face it.
|
|
1896
|
+
*
|
|
1874
1897
|
* Attaches a file to element located by label, name, CSS or XPath
|
|
1875
1898
|
* Path to file is relative current codecept directory (where codecept.conf.ts or codecept.conf.js is located).
|
|
1876
1899
|
* File will be uploaded to remote system (if tests are running remotely).
|
|
@@ -1880,12 +1903,10 @@ class Puppeteer extends Helper {
|
|
|
1880
1903
|
* I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
1881
1904
|
* ```
|
|
1882
1905
|
*
|
|
1883
|
-
* @param {
|
|
1906
|
+
* @param {string | object} locator field located by label|name|CSS|XPath|strict locator.
|
|
1884
1907
|
* @param {string} pathToFile local file path relative to codecept.conf.ts or codecept.conf.js config file.
|
|
1885
1908
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1886
1909
|
*
|
|
1887
|
-
*
|
|
1888
|
-
* > ⚠ There is an [issue with file upload in Puppeteer 2.1.0 & 2.1.1](https://github.com/puppeteer/puppeteer/issues/5420), downgrade to 2.0.0 if you face it.
|
|
1889
1910
|
*/
|
|
1890
1911
|
async attachFile(locator, pathToFile) {
|
|
1891
1912
|
const file = path.join(global.codecept_dir, pathToFile);
|
|
@@ -1918,7 +1939,7 @@ class Puppeteer extends Helper {
|
|
|
1918
1939
|
* ```js
|
|
1919
1940
|
* I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
1920
1941
|
* ```
|
|
1921
|
-
* @param {
|
|
1942
|
+
* @param {string | object} select field located by label|name|CSS|XPath|strict locator.
|
|
1922
1943
|
* @param {string|Array<*>} option visible text or value of option.
|
|
1923
1944
|
* @returns {void} automatically synchronized promise through #recorder
|
|
1924
1945
|
*
|
|
@@ -1961,7 +1982,7 @@ class Puppeteer extends Helper {
|
|
|
1961
1982
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
1962
1983
|
* ```
|
|
1963
1984
|
*
|
|
1964
|
-
* @param {
|
|
1985
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
1965
1986
|
* @returns {Promise<number>} number of visible elements
|
|
1966
1987
|
* {{ react }}
|
|
1967
1988
|
*/
|
|
@@ -2045,7 +2066,7 @@ class Puppeteer extends Helper {
|
|
|
2045
2066
|
* I.see('Register', {css: 'form.register'}); // use strict locator
|
|
2046
2067
|
* ```
|
|
2047
2068
|
* @param {string} text expected on page.
|
|
2048
|
-
* @param {?
|
|
2069
|
+
* @param {?string | object} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
2049
2070
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2050
2071
|
*
|
|
2051
2072
|
*
|
|
@@ -2063,7 +2084,7 @@ class Puppeteer extends Helper {
|
|
|
2063
2084
|
* ```
|
|
2064
2085
|
*
|
|
2065
2086
|
* @param {string} text element value to check.
|
|
2066
|
-
* @param {
|
|
2087
|
+
* @param {(string | object)?} [context=null] element located by CSS|XPath|strict locator.
|
|
2067
2088
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2068
2089
|
*
|
|
2069
2090
|
*/
|
|
@@ -2081,7 +2102,7 @@ class Puppeteer extends Helper {
|
|
|
2081
2102
|
* ```
|
|
2082
2103
|
*
|
|
2083
2104
|
* @param {string} text which is not present.
|
|
2084
|
-
* @param {
|
|
2105
|
+
* @param {string | object} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
2085
2106
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2086
2107
|
*
|
|
2087
2108
|
*
|
|
@@ -2175,7 +2196,7 @@ class Puppeteer extends Helper {
|
|
|
2175
2196
|
* I.seeNumberOfElements('#submitBtn', 1);
|
|
2176
2197
|
* ```
|
|
2177
2198
|
*
|
|
2178
|
-
* @param {
|
|
2199
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
2179
2200
|
* @param {number} num number of elements.
|
|
2180
2201
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2181
2202
|
*
|
|
@@ -2195,7 +2216,7 @@ class Puppeteer extends Helper {
|
|
|
2195
2216
|
* I.seeNumberOfVisibleElements('.buttons', 3);
|
|
2196
2217
|
* ```
|
|
2197
2218
|
*
|
|
2198
|
-
* @param {
|
|
2219
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
2199
2220
|
* @param {number} num number of elements.
|
|
2200
2221
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2201
2222
|
*
|
|
@@ -2312,6 +2333,8 @@ class Puppeteer extends Helper {
|
|
|
2312
2333
|
}
|
|
2313
2334
|
|
|
2314
2335
|
/**
|
|
2336
|
+
* If a function returns a Promise, tt will wait for its resolution.
|
|
2337
|
+
*
|
|
2315
2338
|
* Executes sync script on a page.
|
|
2316
2339
|
* Pass arguments to function as additional parameters.
|
|
2317
2340
|
* Will return execution result to a test.
|
|
@@ -2339,8 +2362,6 @@ class Puppeteer extends Helper {
|
|
|
2339
2362
|
* @param {...any} args to be passed to function.
|
|
2340
2363
|
* @returns {Promise<any>} script return value
|
|
2341
2364
|
*
|
|
2342
|
-
*
|
|
2343
|
-
* If a function returns a Promise It will wait for it resolution.
|
|
2344
2365
|
*/
|
|
2345
2366
|
async executeScript(...args) {
|
|
2346
2367
|
let context = this.page;
|
|
@@ -2351,6 +2372,7 @@ class Puppeteer extends Helper {
|
|
|
2351
2372
|
}
|
|
2352
2373
|
|
|
2353
2374
|
/**
|
|
2375
|
+
* Asynchronous scripts can also be executed with `executeScript` if a function returns a Promise.
|
|
2354
2376
|
* Executes async script on page.
|
|
2355
2377
|
* Provided function should execute a passed callback (as first argument) to signal it is finished.
|
|
2356
2378
|
*
|
|
@@ -2376,8 +2398,6 @@ class Puppeteer extends Helper {
|
|
|
2376
2398
|
* @param {...any} args to be passed to function.
|
|
2377
2399
|
* @returns {Promise<any>} script return value
|
|
2378
2400
|
*
|
|
2379
|
-
*
|
|
2380
|
-
* Asynchronous scripts can also be executed with `executeScript` if a function returns a Promise.
|
|
2381
2401
|
*/
|
|
2382
2402
|
async executeAsyncScript(...args) {
|
|
2383
2403
|
const asyncFn = function () {
|
|
@@ -2401,7 +2421,7 @@ class Puppeteer extends Helper {
|
|
|
2401
2421
|
* let pins = await I.grabTextFromAll('#pin li');
|
|
2402
2422
|
* ```
|
|
2403
2423
|
*
|
|
2404
|
-
* @param {
|
|
2424
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
2405
2425
|
* @returns {Promise<string[]>} attribute value
|
|
2406
2426
|
*
|
|
2407
2427
|
* {{ react }}
|
|
@@ -2424,7 +2444,7 @@ class Puppeteer extends Helper {
|
|
|
2424
2444
|
* ```
|
|
2425
2445
|
* If multiple elements found returns first element.
|
|
2426
2446
|
*
|
|
2427
|
-
* @param {
|
|
2447
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
2428
2448
|
* @returns {Promise<string>} attribute value
|
|
2429
2449
|
*
|
|
2430
2450
|
* {{ react }}
|
|
@@ -2446,7 +2466,7 @@ class Puppeteer extends Helper {
|
|
|
2446
2466
|
* ```js
|
|
2447
2467
|
* let inputs = await I.grabValueFromAll('//form/input');
|
|
2448
2468
|
* ```
|
|
2449
|
-
* @param {
|
|
2469
|
+
* @param {string | object} locator field located by label|name|CSS|XPath|strict locator.
|
|
2450
2470
|
* @returns {Promise<string[]>} attribute value
|
|
2451
2471
|
*
|
|
2452
2472
|
*/
|
|
@@ -2467,7 +2487,7 @@ class Puppeteer extends Helper {
|
|
|
2467
2487
|
* ```js
|
|
2468
2488
|
* let email = await I.grabValueFrom('input[name=email]');
|
|
2469
2489
|
* ```
|
|
2470
|
-
* @param {
|
|
2490
|
+
* @param {string | object} locator field located by label|name|CSS|XPath|strict locator.
|
|
2471
2491
|
* @returns {Promise<string>} attribute value
|
|
2472
2492
|
*
|
|
2473
2493
|
*/
|
|
@@ -2489,7 +2509,7 @@ class Puppeteer extends Helper {
|
|
|
2489
2509
|
* let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
2490
2510
|
* ```
|
|
2491
2511
|
*
|
|
2492
|
-
* @param {
|
|
2512
|
+
* @param {string | object} element located by CSS|XPath|strict locator.
|
|
2493
2513
|
* @returns {Promise<string[]>} HTML code for an element
|
|
2494
2514
|
*
|
|
2495
2515
|
*/
|
|
@@ -2508,7 +2528,7 @@ class Puppeteer extends Helper {
|
|
|
2508
2528
|
* let postHTML = await I.grabHTMLFrom('#post');
|
|
2509
2529
|
* ```
|
|
2510
2530
|
*
|
|
2511
|
-
* @param {
|
|
2531
|
+
* @param {string | object} element located by CSS|XPath|strict locator.
|
|
2512
2532
|
* @returns {Promise<string>} HTML code for an element
|
|
2513
2533
|
*
|
|
2514
2534
|
*/
|
|
@@ -2530,7 +2550,7 @@ class Puppeteer extends Helper {
|
|
|
2530
2550
|
* const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
2531
2551
|
* ```
|
|
2532
2552
|
*
|
|
2533
|
-
* @param {
|
|
2553
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
2534
2554
|
* @param {string} cssProperty CSS property name.
|
|
2535
2555
|
* @returns {Promise<string[]>} CSS value
|
|
2536
2556
|
*
|
|
@@ -2553,7 +2573,7 @@ class Puppeteer extends Helper {
|
|
|
2553
2573
|
* const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
2554
2574
|
* ```
|
|
2555
2575
|
*
|
|
2556
|
-
* @param {
|
|
2576
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
2557
2577
|
* @param {string} cssProperty CSS property name.
|
|
2558
2578
|
* @returns {Promise<string>} CSS value
|
|
2559
2579
|
*
|
|
@@ -2577,7 +2597,7 @@ class Puppeteer extends Helper {
|
|
|
2577
2597
|
* I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
2578
2598
|
* ```
|
|
2579
2599
|
*
|
|
2580
|
-
* @param {
|
|
2600
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
2581
2601
|
* @param {object} cssProperties object with CSS properties and their values to check.
|
|
2582
2602
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2583
2603
|
*
|
|
@@ -2589,29 +2609,26 @@ class Puppeteer extends Helper {
|
|
|
2589
2609
|
|
|
2590
2610
|
const cssPropertiesCamelCase = convertCssPropertiesToCamelCase(cssProperties);
|
|
2591
2611
|
const elemAmount = res.length;
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
.
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
}));
|
|
2606
|
-
});
|
|
2607
|
-
});
|
|
2608
|
-
let props = await Promise.all(commands);
|
|
2612
|
+
let props = [];
|
|
2613
|
+
|
|
2614
|
+
for (const element of res) {
|
|
2615
|
+
for (const prop of Object.keys(cssProperties)) {
|
|
2616
|
+
const cssProp = await this.grabCssPropertyFrom(locator, prop);
|
|
2617
|
+
if (isColorProperty(prop)) {
|
|
2618
|
+
props.push(convertColorToRGBA(cssProp));
|
|
2619
|
+
} else {
|
|
2620
|
+
props.push(cssProp);
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
|
|
2609
2625
|
const values = Object.keys(cssPropertiesCamelCase).map(key => cssPropertiesCamelCase[key]);
|
|
2610
2626
|
if (!Array.isArray(props)) props = [props];
|
|
2611
2627
|
let chunked = chunkArray(props, values.length);
|
|
2612
2628
|
chunked = chunked.filter((val) => {
|
|
2613
2629
|
for (let i = 0; i < val.length; ++i) {
|
|
2614
|
-
|
|
2630
|
+
// eslint-disable-next-line eqeqeq
|
|
2631
|
+
if (val[i] != values[i]) return false;
|
|
2615
2632
|
}
|
|
2616
2633
|
return true;
|
|
2617
2634
|
});
|
|
@@ -2625,7 +2642,7 @@ class Puppeteer extends Helper {
|
|
|
2625
2642
|
* I.seeAttributesOnElements('//form', { method: "post"});
|
|
2626
2643
|
* ```
|
|
2627
2644
|
*
|
|
2628
|
-
* @param {
|
|
2645
|
+
* @param {string | object} locator located by CSS|XPath|strict locator.
|
|
2629
2646
|
* @param {object} attributes attributes and their values to check.
|
|
2630
2647
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2631
2648
|
*
|
|
@@ -2651,7 +2668,10 @@ class Puppeteer extends Helper {
|
|
|
2651
2668
|
let chunked = chunkArray(attrs, values.length);
|
|
2652
2669
|
chunked = chunked.filter((val) => {
|
|
2653
2670
|
for (let i = 0; i < val.length; ++i) {
|
|
2654
|
-
|
|
2671
|
+
const _actual = Number.isNaN(val[i]) || (typeof values[i]) === 'string' ? val[i] : Number.parseInt(values[i], 10);
|
|
2672
|
+
const _expected = Number.isNaN(values[i]) || (typeof values[i]) === 'string' ? values[i] : Number.parseInt(values[i], 10);
|
|
2673
|
+
// if the attribute doesn't exist, returns false as well
|
|
2674
|
+
if (!_actual || !_actual.includes(_expected)) return false;
|
|
2655
2675
|
}
|
|
2656
2676
|
return true;
|
|
2657
2677
|
});
|
|
@@ -2667,7 +2687,7 @@ class Puppeteer extends Helper {
|
|
|
2667
2687
|
* I.dragSlider('#slider', -70);
|
|
2668
2688
|
* ```
|
|
2669
2689
|
*
|
|
2670
|
-
* @param {
|
|
2690
|
+
* @param {string | object} locator located by label|name|CSS|XPath|strict locator.
|
|
2671
2691
|
* @param {number} offsetX position to drag.
|
|
2672
2692
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2673
2693
|
*
|
|
@@ -2698,7 +2718,7 @@ class Puppeteer extends Helper {
|
|
|
2698
2718
|
* ```js
|
|
2699
2719
|
* let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
2700
2720
|
* ```
|
|
2701
|
-
* @param {
|
|
2721
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
2702
2722
|
* @param {string} attr attribute name.
|
|
2703
2723
|
* @returns {Promise<string[]>} attribute value
|
|
2704
2724
|
*
|
|
@@ -2722,7 +2742,7 @@ class Puppeteer extends Helper {
|
|
|
2722
2742
|
* ```js
|
|
2723
2743
|
* let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
2724
2744
|
* ```
|
|
2725
|
-
* @param {
|
|
2745
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
2726
2746
|
* @param {string} attr attribute name.
|
|
2727
2747
|
* @returns {Promise<string>} attribute value
|
|
2728
2748
|
*
|
|
@@ -2746,7 +2766,7 @@ class Puppeteer extends Helper {
|
|
|
2746
2766
|
* I.saveElementScreenshot(`#submit`,'debug.png');
|
|
2747
2767
|
* ```
|
|
2748
2768
|
*
|
|
2749
|
-
* @param {
|
|
2769
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
2750
2770
|
* @param {string} fileName file name to save.
|
|
2751
2771
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2752
2772
|
*
|
|
@@ -2854,7 +2874,7 @@ class Puppeteer extends Helper {
|
|
|
2854
2874
|
* Waits for element to become enabled (by default waits for 1sec).
|
|
2855
2875
|
* Element can be located by CSS or XPath.
|
|
2856
2876
|
*
|
|
2857
|
-
* @param {
|
|
2877
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
2858
2878
|
* @param {number} [sec=1] (optional) time in seconds to wait, 1 by default.
|
|
2859
2879
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2860
2880
|
*
|
|
@@ -2893,7 +2913,7 @@ class Puppeteer extends Helper {
|
|
|
2893
2913
|
* I.waitForValue('//input', "GoodValue");
|
|
2894
2914
|
* ```
|
|
2895
2915
|
*
|
|
2896
|
-
* @param {
|
|
2916
|
+
* @param {string | object} field input field.
|
|
2897
2917
|
* @param {string }value expected value.
|
|
2898
2918
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2899
2919
|
* @returns {void} automatically synchronized promise through #recorder
|
|
@@ -2934,7 +2954,7 @@ class Puppeteer extends Helper {
|
|
|
2934
2954
|
* I.waitNumberOfVisibleElements('a', 3);
|
|
2935
2955
|
* ```
|
|
2936
2956
|
*
|
|
2937
|
-
* @param {
|
|
2957
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
2938
2958
|
* @param {number} num number of elements.
|
|
2939
2959
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2940
2960
|
* @returns {void} automatically synchronized promise through #recorder
|
|
@@ -2977,7 +2997,7 @@ class Puppeteer extends Helper {
|
|
|
2977
2997
|
* I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
2978
2998
|
* ```
|
|
2979
2999
|
*
|
|
2980
|
-
* @param {
|
|
3000
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
2981
3001
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
2982
3002
|
* @returns {void} automatically synchronized promise through #recorder
|
|
2983
3003
|
*
|
|
@@ -3004,7 +3024,7 @@ class Puppeteer extends Helper {
|
|
|
3004
3024
|
* I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
3005
3025
|
* ```
|
|
3006
3026
|
*
|
|
3007
|
-
* @param {
|
|
3027
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
3008
3028
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
3009
3029
|
* @returns {void} automatically synchronized promise through #recorder
|
|
3010
3030
|
*
|
|
@@ -3034,12 +3054,12 @@ class Puppeteer extends Helper {
|
|
|
3034
3054
|
* I.waitForVisible('#popup');
|
|
3035
3055
|
* ```
|
|
3036
3056
|
*
|
|
3037
|
-
* @param {
|
|
3057
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
3038
3058
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3039
3059
|
* @returns {void} automatically synchronized promise through #recorder
|
|
3040
3060
|
*
|
|
3041
3061
|
*
|
|
3042
|
-
*
|
|
3062
|
+
* {{ react }}
|
|
3043
3063
|
*/
|
|
3044
3064
|
async waitForVisible(locator, sec) {
|
|
3045
3065
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -3065,7 +3085,7 @@ class Puppeteer extends Helper {
|
|
|
3065
3085
|
* I.waitForInvisible('#popup');
|
|
3066
3086
|
* ```
|
|
3067
3087
|
*
|
|
3068
|
-
* @param {
|
|
3088
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
3069
3089
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3070
3090
|
* @returns {void} automatically synchronized promise through #recorder
|
|
3071
3091
|
*
|
|
@@ -3094,7 +3114,7 @@ class Puppeteer extends Helper {
|
|
|
3094
3114
|
* I.waitToHide('#popup');
|
|
3095
3115
|
* ```
|
|
3096
3116
|
*
|
|
3097
|
-
* @param {
|
|
3117
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
3098
3118
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3099
3119
|
* @returns {void} automatically synchronized promise through #recorder
|
|
3100
3120
|
*
|
|
@@ -3195,7 +3215,7 @@ class Puppeteer extends Helper {
|
|
|
3195
3215
|
*
|
|
3196
3216
|
* @param {string }text to wait for.
|
|
3197
3217
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3198
|
-
* @param {
|
|
3218
|
+
* @param {string | object} [context] (optional) element located by CSS|XPath|strict locator.
|
|
3199
3219
|
* @returns {void} automatically synchronized promise through #recorder
|
|
3200
3220
|
*
|
|
3201
3221
|
*/
|
|
@@ -3272,7 +3292,7 @@ class Puppeteer extends Helper {
|
|
|
3272
3292
|
* I.switchTo(); // switch back to main page
|
|
3273
3293
|
* ```
|
|
3274
3294
|
*
|
|
3275
|
-
* @param {?
|
|
3295
|
+
* @param {?string | object} [locator=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
3276
3296
|
* @returns {void} automatically synchronized promise through #recorder
|
|
3277
3297
|
*
|
|
3278
3298
|
*/
|
|
@@ -3346,9 +3366,9 @@ class Puppeteer extends Helper {
|
|
|
3346
3366
|
}
|
|
3347
3367
|
|
|
3348
3368
|
/**
|
|
3349
|
-
* Waits for navigation to finish. By default takes configured `waitForNavigation` option.
|
|
3369
|
+
* Waits for navigation to finish. By default, takes configured `waitForNavigation` option.
|
|
3350
3370
|
*
|
|
3351
|
-
* See [
|
|
3371
|
+
* See [Puppeteer's reference](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagewaitfornavigationoptions)
|
|
3352
3372
|
*
|
|
3353
3373
|
* @param {*} opts
|
|
3354
3374
|
*/
|
|
@@ -3376,7 +3396,7 @@ class Puppeteer extends Helper {
|
|
|
3376
3396
|
* I.waitForDetached('#popup');
|
|
3377
3397
|
* ```
|
|
3378
3398
|
*
|
|
3379
|
-
* @param {
|
|
3399
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
3380
3400
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3381
3401
|
* @returns {void} automatically synchronized promise through #recorder
|
|
3382
3402
|
*
|
|
@@ -3453,7 +3473,7 @@ class Puppeteer extends Helper {
|
|
|
3453
3473
|
* const width = await I.grabElementBoundingRect('h3', 'width');
|
|
3454
3474
|
* // width == 527
|
|
3455
3475
|
* ```
|
|
3456
|
-
* @param {
|
|
3476
|
+
* @param {string | object} locator element located by CSS|XPath|strict locator.
|
|
3457
3477
|
* @param {string=} elementSize x, y, width or height of the given element.
|
|
3458
3478
|
* @returns {Promise<DOMRect>|Promise<number>} Element bounding rectangle
|
|
3459
3479
|
*
|