codeceptjs 3.3.0 → 3.3.3
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/CHANGELOG.md +50 -1
- package/README.md +6 -1
- package/docs/api.md +1 -1
- package/docs/bdd.md +1 -0
- package/docs/best.md +1 -1
- package/docs/build/ApiDataFactory.js +4 -3
- package/docs/build/Appium.js +21 -16
- package/docs/build/GraphQL.js +4 -2
- package/docs/build/GraphQLDataFactory.js +3 -3
- package/docs/build/JSONResponse.js +1 -1
- package/docs/build/Nightmare.js +54 -25
- package/docs/build/Playwright.js +105 -52
- package/docs/build/Protractor.js +72 -34
- package/docs/build/Puppeteer.js +80 -37
- package/docs/build/REST.js +5 -2
- package/docs/build/TestCafe.js +54 -23
- package/docs/build/WebDriver.js +115 -67
- package/docs/changelog.md +50 -1
- package/docs/custom-helpers.md +1 -1
- package/docs/data.md +2 -2
- package/docs/helpers/ApiDataFactory.md +7 -3
- package/docs/helpers/Appium.md +217 -175
- package/docs/helpers/GraphQL.md +6 -0
- package/docs/helpers/GraphQLDataFactory.md +3 -3
- package/docs/helpers/JSONResponse.md +1 -1
- package/docs/helpers/Nightmare.md +98 -45
- package/docs/helpers/Playwright.md +151 -59
- package/docs/helpers/Puppeteer.md +103 -26
- package/docs/helpers/REST.md +1 -1
- package/docs/helpers/TestCafe.md +77 -22
- package/docs/helpers/WebDriver.md +150 -62
- package/docs/index.md +1 -1
- package/docs/locators.md +1 -1
- package/docs/webapi/amOnPage.mustache +2 -1
- package/docs/webapi/appendField.mustache +2 -1
- package/docs/webapi/attachFile.mustache +2 -1
- package/docs/webapi/checkOption.mustache +2 -1
- package/docs/webapi/clearCookie.mustache +2 -1
- package/docs/webapi/clearField.mustache +1 -0
- package/docs/webapi/click.mustache +2 -1
- package/docs/webapi/clickLink.mustache +2 -1
- package/docs/webapi/closeCurrentTab.mustache +6 -4
- package/docs/webapi/closeOtherTabs.mustache +6 -4
- package/docs/webapi/dontSee.mustache +1 -0
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -0
- package/docs/webapi/dontSeeCookie.mustache +2 -1
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +2 -1
- package/docs/webapi/dontSeeElement.mustache +2 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +2 -1
- package/docs/webapi/dontSeeInCurrentUrl.mustache +2 -1
- package/docs/webapi/dontSeeInField.mustache +2 -1
- package/docs/webapi/dontSeeInSource.mustache +1 -0
- package/docs/webapi/dontSeeInTitle.mustache +2 -1
- package/docs/webapi/doubleClick.mustache +1 -0
- package/docs/webapi/downloadFile.mustache +2 -1
- package/docs/webapi/dragAndDrop.mustache +1 -0
- package/docs/webapi/dragSlider.mustache +2 -1
- package/docs/webapi/executeAsyncScript.mustache +1 -1
- package/docs/webapi/executeScript.mustache +1 -1
- package/docs/webapi/fillField.mustache +1 -0
- package/docs/webapi/forceClick.mustache +1 -0
- package/docs/webapi/forceRightClick.mustache +1 -0
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +2 -1
- package/docs/webapi/moveCursorTo.mustache +1 -0
- package/docs/webapi/openNewTab.mustache +6 -4
- package/docs/webapi/pressKey.mustache +2 -1
- package/docs/webapi/pressKeyDown.mustache +1 -0
- package/docs/webapi/pressKeyUp.mustache +1 -0
- package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -0
- package/docs/webapi/refreshPage.mustache +1 -0
- package/docs/webapi/resizeWindow.mustache +2 -1
- package/docs/webapi/rightClick.mustache +1 -0
- package/docs/webapi/saveElementScreenshot.mustache +1 -0
- package/docs/webapi/saveScreenshot.mustache +2 -1
- package/docs/webapi/say.mustache +2 -1
- package/docs/webapi/scrollIntoView.mustache +1 -0
- package/docs/webapi/scrollPageToBottom.mustache +1 -0
- package/docs/webapi/scrollPageToTop.mustache +1 -0
- package/docs/webapi/scrollTo.mustache +2 -1
- package/docs/webapi/see.mustache +2 -1
- package/docs/webapi/seeAttributesOnElements.mustache +2 -1
- package/docs/webapi/seeCheckboxIsChecked.mustache +1 -0
- package/docs/webapi/seeCookie.mustache +1 -0
- package/docs/webapi/seeCssPropertiesOnElements.mustache +2 -1
- package/docs/webapi/seeCurrentUrlEquals.mustache +2 -1
- package/docs/webapi/seeElement.mustache +2 -1
- package/docs/webapi/seeElementInDOM.mustache +1 -0
- package/docs/webapi/seeInCurrentUrl.mustache +2 -1
- package/docs/webapi/seeInField.mustache +1 -0
- package/docs/webapi/seeInPopup.mustache +1 -0
- package/docs/webapi/seeInSource.mustache +2 -1
- package/docs/webapi/seeInTitle.mustache +2 -1
- package/docs/webapi/seeNumberOfElements.mustache +1 -0
- package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -0
- package/docs/webapi/seeTextEquals.mustache +2 -1
- package/docs/webapi/seeTitleEquals.mustache +6 -5
- package/docs/webapi/selectOption.mustache +1 -0
- package/docs/webapi/setCookie.mustache +1 -0
- package/docs/webapi/setGeoLocation.mustache +1 -0
- package/docs/webapi/switchTo.mustache +2 -1
- package/docs/webapi/switchToNextTab.mustache +8 -7
- package/docs/webapi/switchToPreviousTab.mustache +8 -7
- package/docs/webapi/type.mustache +1 -0
- package/docs/webapi/uncheckOption.mustache +2 -1
- package/docs/webapi/wait.mustache +2 -1
- package/docs/webapi/waitForClickable.mustache +2 -1
- package/docs/webapi/waitForDetached.mustache +2 -1
- package/docs/webapi/waitForElement.mustache +2 -1
- package/docs/webapi/waitForEnabled.mustache +2 -1
- package/docs/webapi/waitForFunction.mustache +1 -0
- package/docs/webapi/waitForInvisible.mustache +2 -1
- package/docs/webapi/waitForText.mustache +2 -1
- package/docs/webapi/waitForValue.mustache +1 -0
- package/docs/webapi/waitForVisible.mustache +1 -0
- package/docs/webapi/waitInUrl.mustache +2 -1
- package/docs/webapi/waitNumberOfVisibleElements.mustache +2 -1
- package/docs/webapi/waitToHide.mustache +2 -1
- package/docs/webapi/waitUrlEquals.mustache +2 -1
- package/lib/cli.js +1 -1
- package/lib/command/definitions.js +9 -0
- package/lib/command/run-workers.js +1 -1
- package/lib/command/run.js +2 -2
- package/lib/command/workers/runTests.js +55 -0
- package/lib/helper/ApiDataFactory.js +4 -3
- package/lib/helper/Appium.js +2 -7
- package/lib/helper/GraphQL.js +4 -2
- package/lib/helper/GraphQLDataFactory.js +3 -3
- package/lib/helper/JSONResponse.js +1 -1
- package/lib/helper/Playwright.js +28 -17
- package/lib/helper/REST.js +5 -2
- package/lib/helper/WebDriver.js +4 -0
- package/lib/interfaces/bdd.js +5 -0
- package/lib/listener/steps.js +1 -0
- package/lib/output.js +4 -0
- package/lib/plugin/fakerTransform.js +1 -1
- package/lib/plugin/stepByStepReport.js +8 -6
- package/lib/workers.js +12 -0
- package/package.json +3 -3
- package/typings/types.d.ts +534 -112
package/docs/build/Puppeteer.js
CHANGED
|
@@ -444,7 +444,7 @@ class Puppeteer extends Helper {
|
|
|
444
444
|
* I.seeInPopup('Popup text');
|
|
445
445
|
* ```
|
|
446
446
|
* @param {string} text value to check.
|
|
447
|
-
*
|
|
447
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
448
448
|
*/
|
|
449
449
|
async seeInPopup(text) {
|
|
450
450
|
popupStore.assertPopupVisible();
|
|
@@ -639,6 +639,7 @@ class Puppeteer extends Helper {
|
|
|
639
639
|
* ```
|
|
640
640
|
*
|
|
641
641
|
* @param {string} url url path or global url.
|
|
642
|
+
* @return {void} automatically synchronized promise with recorder #!
|
|
642
643
|
*/
|
|
643
644
|
async amOnPage(url) {
|
|
644
645
|
if (!(/^\w+\:\/\//.test(url))) {
|
|
@@ -673,6 +674,7 @@ class Puppeteer extends Helper {
|
|
|
673
674
|
*
|
|
674
675
|
* @param {number} width width in pixels or `maximize`.
|
|
675
676
|
* @param {number} height height in pixels.
|
|
677
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
676
678
|
*
|
|
677
679
|
* Unlike other drivers Puppeteer changes the size of a viewport, not the window!
|
|
678
680
|
* Puppeteer does not control the window of a browser so it can't adjust its real size.
|
|
@@ -717,7 +719,7 @@ class Puppeteer extends Helper {
|
|
|
717
719
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
718
720
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
719
721
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
720
|
-
*
|
|
722
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
721
723
|
* {{ react }}
|
|
722
724
|
*/
|
|
723
725
|
async moveCursorTo(locator, offsetX = 0, offsetY = 0) {
|
|
@@ -739,7 +741,7 @@ class Puppeteer extends Helper {
|
|
|
739
741
|
*
|
|
740
742
|
* @param {LocatorOrString} srcElement located by CSS|XPath|strict locator.
|
|
741
743
|
* @param {LocatorOrString} destElement located by CSS|XPath|strict locator.
|
|
742
|
-
*
|
|
744
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
743
745
|
*/
|
|
744
746
|
async dragAndDrop(srcElement, destElement) {
|
|
745
747
|
return proceedDragAndDrop.call(this, srcElement, destElement);
|
|
@@ -751,7 +753,7 @@ class Puppeteer extends Helper {
|
|
|
751
753
|
* ```js
|
|
752
754
|
* I.refreshPage();
|
|
753
755
|
* ```
|
|
754
|
-
*
|
|
756
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
755
757
|
*/
|
|
756
758
|
async refreshPage() {
|
|
757
759
|
return this.page.reload({ timeout: this.options.getPageTimeout, waitUntil: this.options.waitForNavigation });
|
|
@@ -763,7 +765,7 @@ class Puppeteer extends Helper {
|
|
|
763
765
|
* ```js
|
|
764
766
|
* I.scrollPageToTop();
|
|
765
767
|
* ```
|
|
766
|
-
*
|
|
768
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
767
769
|
*/
|
|
768
770
|
scrollPageToTop() {
|
|
769
771
|
return this.executeScript(() => {
|
|
@@ -777,7 +779,7 @@ class Puppeteer extends Helper {
|
|
|
777
779
|
* ```js
|
|
778
780
|
* I.scrollPageToBottom();
|
|
779
781
|
* ```
|
|
780
|
-
*
|
|
782
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
781
783
|
*/
|
|
782
784
|
scrollPageToBottom() {
|
|
783
785
|
return this.executeScript(() => {
|
|
@@ -802,6 +804,7 @@ class Puppeteer extends Helper {
|
|
|
802
804
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
803
805
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
804
806
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
807
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
805
808
|
*/
|
|
806
809
|
async scrollTo(locator, offsetX = 0, offsetY = 0) {
|
|
807
810
|
if (typeof locator === 'number' && typeof offsetX === 'number') {
|
|
@@ -830,6 +833,7 @@ class Puppeteer extends Helper {
|
|
|
830
833
|
* ```
|
|
831
834
|
*
|
|
832
835
|
* @param {string} text text value to check.
|
|
836
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
833
837
|
*/
|
|
834
838
|
async seeInTitle(text) {
|
|
835
839
|
const title = await this.page.title();
|
|
@@ -860,14 +864,14 @@ class Puppeteer extends Helper {
|
|
|
860
864
|
}
|
|
861
865
|
|
|
862
866
|
/**
|
|
863
|
-
*
|
|
864
|
-
*
|
|
865
|
-
* ```js
|
|
866
|
-
* I.seeTitleEquals('Test title.');
|
|
867
|
-
* ```
|
|
867
|
+
* Checks that title is equal to provided one.
|
|
868
868
|
*
|
|
869
|
-
*
|
|
869
|
+
* ```js
|
|
870
|
+
* I.seeTitleEquals('Test title.');
|
|
871
|
+
* ```
|
|
870
872
|
*
|
|
873
|
+
* @param {string} text value to check.
|
|
874
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
871
875
|
*/
|
|
872
876
|
async seeTitleEquals(text) {
|
|
873
877
|
const title = await this.page.title();
|
|
@@ -882,6 +886,7 @@ class Puppeteer extends Helper {
|
|
|
882
886
|
* ```
|
|
883
887
|
*
|
|
884
888
|
* @param {string} text value to check.
|
|
889
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
885
890
|
*/
|
|
886
891
|
async dontSeeInTitle(text) {
|
|
887
892
|
const title = await this.page.title();
|
|
@@ -1070,6 +1075,7 @@ class Puppeteer extends Helper {
|
|
|
1070
1075
|
* I.seeElement('#modal');
|
|
1071
1076
|
* ```
|
|
1072
1077
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
1078
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1073
1079
|
* {{ react }}
|
|
1074
1080
|
*/
|
|
1075
1081
|
async seeElement(locator) {
|
|
@@ -1089,6 +1095,7 @@ class Puppeteer extends Helper {
|
|
|
1089
1095
|
* ```
|
|
1090
1096
|
*
|
|
1091
1097
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
1098
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1092
1099
|
* {{ react }}
|
|
1093
1100
|
*/
|
|
1094
1101
|
async dontSeeElement(locator) {
|
|
@@ -1108,7 +1115,7 @@ class Puppeteer extends Helper {
|
|
|
1108
1115
|
* I.seeElementInDOM('#modal');
|
|
1109
1116
|
* ```
|
|
1110
1117
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1111
|
-
*
|
|
1118
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1112
1119
|
*/
|
|
1113
1120
|
async seeElementInDOM(locator) {
|
|
1114
1121
|
const els = await this._locate(locator);
|
|
@@ -1123,6 +1130,7 @@ class Puppeteer extends Helper {
|
|
|
1123
1130
|
* ```
|
|
1124
1131
|
*
|
|
1125
1132
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
1133
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1126
1134
|
*/
|
|
1127
1135
|
async dontSeeElementInDOM(locator) {
|
|
1128
1136
|
const els = await this._locate(locator);
|
|
@@ -1153,7 +1161,8 @@ class Puppeteer extends Helper {
|
|
|
1153
1161
|
* ```
|
|
1154
1162
|
*
|
|
1155
1163
|
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1156
|
-
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1164
|
+
* @param {?CodeceptJS.LocatorOrString | null} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1165
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1157
1166
|
*
|
|
1158
1167
|
*
|
|
1159
1168
|
* {{ react }}
|
|
@@ -1190,6 +1199,7 @@ class Puppeteer extends Helper {
|
|
|
1190
1199
|
*
|
|
1191
1200
|
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1192
1201
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1202
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1193
1203
|
*
|
|
1194
1204
|
*
|
|
1195
1205
|
* {{ react }}
|
|
@@ -1227,6 +1237,7 @@ class Puppeteer extends Helper {
|
|
|
1227
1237
|
* ```
|
|
1228
1238
|
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator
|
|
1229
1239
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator
|
|
1240
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1230
1241
|
*
|
|
1231
1242
|
* {{ react }}
|
|
1232
1243
|
*/
|
|
@@ -1339,7 +1350,7 @@ class Puppeteer extends Helper {
|
|
|
1339
1350
|
*
|
|
1340
1351
|
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1341
1352
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1342
|
-
*
|
|
1353
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1343
1354
|
*
|
|
1344
1355
|
* {{ react }}
|
|
1345
1356
|
*/
|
|
@@ -1361,7 +1372,7 @@ class Puppeteer extends Helper {
|
|
|
1361
1372
|
*
|
|
1362
1373
|
* @param {CodeceptJS.LocatorOrString} locator clickable element located by CSS|XPath|strict locator.
|
|
1363
1374
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1364
|
-
*
|
|
1375
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1365
1376
|
*
|
|
1366
1377
|
* {{ react }}
|
|
1367
1378
|
*/
|
|
@@ -1382,6 +1393,7 @@ class Puppeteer extends Helper {
|
|
|
1382
1393
|
* ```
|
|
1383
1394
|
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
1384
1395
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1396
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1385
1397
|
*/
|
|
1386
1398
|
async checkOption(field, context = null) {
|
|
1387
1399
|
const elm = await this._locateCheckable(field, context);
|
|
@@ -1407,6 +1419,7 @@ class Puppeteer extends Helper {
|
|
|
1407
1419
|
* ```
|
|
1408
1420
|
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
1409
1421
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1422
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1410
1423
|
*/
|
|
1411
1424
|
async uncheckOption(field, context = null) {
|
|
1412
1425
|
const elm = await this._locateCheckable(field, context);
|
|
@@ -1429,7 +1442,7 @@ class Puppeteer extends Helper {
|
|
|
1429
1442
|
* ```
|
|
1430
1443
|
*
|
|
1431
1444
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1432
|
-
*
|
|
1445
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1433
1446
|
*/
|
|
1434
1447
|
async seeCheckboxIsChecked(field) {
|
|
1435
1448
|
return proceedIsChecked.call(this, 'assert', field);
|
|
@@ -1445,7 +1458,7 @@ class Puppeteer extends Helper {
|
|
|
1445
1458
|
* ```
|
|
1446
1459
|
*
|
|
1447
1460
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1448
|
-
*
|
|
1461
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1449
1462
|
*/
|
|
1450
1463
|
async dontSeeCheckboxIsChecked(field) {
|
|
1451
1464
|
return proceedIsChecked.call(this, 'negate', field);
|
|
@@ -1463,7 +1476,7 @@ class Puppeteer extends Helper {
|
|
|
1463
1476
|
* ```
|
|
1464
1477
|
*
|
|
1465
1478
|
* @param {string} key name of key to press down.
|
|
1466
|
-
*
|
|
1479
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1467
1480
|
*/
|
|
1468
1481
|
async pressKeyDown(key) {
|
|
1469
1482
|
key = getNormalizedKey.call(this, key);
|
|
@@ -1483,7 +1496,7 @@ class Puppeteer extends Helper {
|
|
|
1483
1496
|
* ```
|
|
1484
1497
|
*
|
|
1485
1498
|
* @param {string} key name of key to release.
|
|
1486
|
-
*
|
|
1499
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1487
1500
|
*/
|
|
1488
1501
|
async pressKeyUp(key) {
|
|
1489
1502
|
key = getNormalizedKey.call(this, key);
|
|
@@ -1551,6 +1564,7 @@ class Puppeteer extends Helper {
|
|
|
1551
1564
|
* - `'Tab'`
|
|
1552
1565
|
*
|
|
1553
1566
|
* @param {string|string[]} key key or array of keys to press.
|
|
1567
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1554
1568
|
*
|
|
1555
1569
|
*
|
|
1556
1570
|
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/puppeteer#1313](https://github.com/GoogleChrome/puppeteer/issues/1313)).
|
|
@@ -1598,7 +1612,7 @@ class Puppeteer extends Helper {
|
|
|
1598
1612
|
*
|
|
1599
1613
|
* @param {string|string[]} key or array of keys to type.
|
|
1600
1614
|
* @param {?number} [delay=null] (optional) delay in ms between key presses
|
|
1601
|
-
*
|
|
1615
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1602
1616
|
*/
|
|
1603
1617
|
async type(keys, delay = null) {
|
|
1604
1618
|
if (!Array.isArray(keys)) {
|
|
@@ -1627,7 +1641,7 @@ class Puppeteer extends Helper {
|
|
|
1627
1641
|
* ```
|
|
1628
1642
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1629
1643
|
* @param {CodeceptJS.StringOrSecret} value text value to fill.
|
|
1630
|
-
*
|
|
1644
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1631
1645
|
* {{ react }}
|
|
1632
1646
|
*/
|
|
1633
1647
|
async fillField(field, value) {
|
|
@@ -1654,7 +1668,7 @@ class Puppeteer extends Helper {
|
|
|
1654
1668
|
* I.clearField('#email');
|
|
1655
1669
|
* ```
|
|
1656
1670
|
* @param {LocatorOrString} editable field located by label|name|CSS|XPath|strict locator.
|
|
1657
|
-
*
|
|
1671
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1658
1672
|
*/
|
|
1659
1673
|
async clearField(field) {
|
|
1660
1674
|
return this.fillField(field, '');
|
|
@@ -1669,6 +1683,7 @@ class Puppeteer extends Helper {
|
|
|
1669
1683
|
* ```
|
|
1670
1684
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
|
|
1671
1685
|
* @param {string} value text value to append.
|
|
1686
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1672
1687
|
*
|
|
1673
1688
|
* {{ react }}
|
|
1674
1689
|
*/
|
|
@@ -1692,7 +1707,7 @@ class Puppeteer extends Helper {
|
|
|
1692
1707
|
* ```
|
|
1693
1708
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1694
1709
|
* @param {string} value value to check.
|
|
1695
|
-
*
|
|
1710
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1696
1711
|
*/
|
|
1697
1712
|
async seeInField(field, value) {
|
|
1698
1713
|
return proceedSeeInField.call(this, 'assert', field, value);
|
|
@@ -1709,6 +1724,7 @@ class Puppeteer extends Helper {
|
|
|
1709
1724
|
*
|
|
1710
1725
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1711
1726
|
* @param {string} value value to check.
|
|
1727
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1712
1728
|
*/
|
|
1713
1729
|
async dontSeeInField(field, value) {
|
|
1714
1730
|
return proceedSeeInField.call(this, 'negate', field, value);
|
|
@@ -1726,6 +1742,7 @@ class Puppeteer extends Helper {
|
|
|
1726
1742
|
*
|
|
1727
1743
|
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
1728
1744
|
* @param {string} pathToFile local file path relative to codecept.json config file.
|
|
1745
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1729
1746
|
*
|
|
1730
1747
|
* > ⚠ 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.
|
|
1731
1748
|
*/
|
|
@@ -1762,7 +1779,7 @@ class Puppeteer extends Helper {
|
|
|
1762
1779
|
* ```
|
|
1763
1780
|
* @param {LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
|
|
1764
1781
|
* @param {string|Array<*>} option visible text or value of option.
|
|
1765
|
-
*
|
|
1782
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1766
1783
|
*/
|
|
1767
1784
|
async selectOption(select, option) {
|
|
1768
1785
|
const els = await findVisibleFields.call(this, select);
|
|
@@ -1822,6 +1839,7 @@ class Puppeteer extends Helper {
|
|
|
1822
1839
|
* ```
|
|
1823
1840
|
*
|
|
1824
1841
|
* @param {string} url a fragment to check
|
|
1842
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1825
1843
|
*/
|
|
1826
1844
|
async seeInCurrentUrl(url) {
|
|
1827
1845
|
stringIncludes('url').assert(url, await this._getPageUrl());
|
|
@@ -1831,6 +1849,7 @@ class Puppeteer extends Helper {
|
|
|
1831
1849
|
* Checks that current url does not contain a provided fragment.
|
|
1832
1850
|
*
|
|
1833
1851
|
* @param {string} url value to check.
|
|
1852
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1834
1853
|
*/
|
|
1835
1854
|
async dontSeeInCurrentUrl(url) {
|
|
1836
1855
|
stringIncludes('url').negate(url, await this._getPageUrl());
|
|
@@ -1847,6 +1866,7 @@ class Puppeteer extends Helper {
|
|
|
1847
1866
|
* ```
|
|
1848
1867
|
*
|
|
1849
1868
|
* @param {string} url value to check.
|
|
1869
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1850
1870
|
*/
|
|
1851
1871
|
async seeCurrentUrlEquals(url) {
|
|
1852
1872
|
urlEquals(this.options.url).assert(url, await this._getPageUrl());
|
|
@@ -1862,6 +1882,7 @@ class Puppeteer extends Helper {
|
|
|
1862
1882
|
* ```
|
|
1863
1883
|
*
|
|
1864
1884
|
* @param {string} url value to check.
|
|
1885
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1865
1886
|
*/
|
|
1866
1887
|
async dontSeeCurrentUrlEquals(url) {
|
|
1867
1888
|
urlEquals(this.options.url).negate(url, await this._getPageUrl());
|
|
@@ -1878,6 +1899,7 @@ class Puppeteer extends Helper {
|
|
|
1878
1899
|
* ```
|
|
1879
1900
|
* @param {string} text expected on page.
|
|
1880
1901
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
1902
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1881
1903
|
*
|
|
1882
1904
|
* {{ react }}
|
|
1883
1905
|
*/
|
|
@@ -1894,6 +1916,7 @@ class Puppeteer extends Helper {
|
|
|
1894
1916
|
*
|
|
1895
1917
|
* @param {string} text element value to check.
|
|
1896
1918
|
* @param {CodeceptJS.LocatorOrString?} [context=null] element located by CSS|XPath|strict locator.
|
|
1919
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1897
1920
|
*/
|
|
1898
1921
|
async seeTextEquals(text, context = null) {
|
|
1899
1922
|
return proceedSee.call(this, 'assert', text, context, true);
|
|
@@ -1910,7 +1933,7 @@ class Puppeteer extends Helper {
|
|
|
1910
1933
|
*
|
|
1911
1934
|
* @param {string} text which is not present.
|
|
1912
1935
|
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
1913
|
-
*
|
|
1936
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1914
1937
|
*
|
|
1915
1938
|
* {{ react }}
|
|
1916
1939
|
*/
|
|
@@ -1969,6 +1992,7 @@ class Puppeteer extends Helper {
|
|
|
1969
1992
|
* I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
1970
1993
|
* ```
|
|
1971
1994
|
* @param {string} text value to check.
|
|
1995
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1972
1996
|
*/
|
|
1973
1997
|
async seeInSource(text) {
|
|
1974
1998
|
const source = await this.page.content();
|
|
@@ -1983,7 +2007,7 @@ class Puppeteer extends Helper {
|
|
|
1983
2007
|
* ```
|
|
1984
2008
|
*
|
|
1985
2009
|
* @param {string} value to check.
|
|
1986
|
-
*
|
|
2010
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1987
2011
|
*/
|
|
1988
2012
|
async dontSeeInSource(text) {
|
|
1989
2013
|
const source = await this.page.content();
|
|
@@ -2001,7 +2025,7 @@ class Puppeteer extends Helper {
|
|
|
2001
2025
|
*
|
|
2002
2026
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2003
2027
|
* @param {number} num number of elements.
|
|
2004
|
-
*
|
|
2028
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2005
2029
|
*
|
|
2006
2030
|
* {{ react }}
|
|
2007
2031
|
*/
|
|
@@ -2020,7 +2044,7 @@ class Puppeteer extends Helper {
|
|
|
2020
2044
|
*
|
|
2021
2045
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2022
2046
|
* @param {number} num number of elements.
|
|
2023
|
-
*
|
|
2047
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2024
2048
|
*
|
|
2025
2049
|
* {{ react }}
|
|
2026
2050
|
*/
|
|
@@ -2045,7 +2069,7 @@ class Puppeteer extends Helper {
|
|
|
2045
2069
|
* ```
|
|
2046
2070
|
*
|
|
2047
2071
|
* @param {Cookie|Array<Cookie>} cookie a cookie object or array of cookie objects.
|
|
2048
|
-
*
|
|
2072
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2049
2073
|
*/
|
|
2050
2074
|
async setCookie(cookie) {
|
|
2051
2075
|
if (Array.isArray(cookie)) {
|
|
@@ -2062,7 +2086,7 @@ class Puppeteer extends Helper {
|
|
|
2062
2086
|
* ```
|
|
2063
2087
|
*
|
|
2064
2088
|
* @param {string} name cookie name.
|
|
2065
|
-
*
|
|
2089
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2066
2090
|
*
|
|
2067
2091
|
*/
|
|
2068
2092
|
async seeCookie(name) {
|
|
@@ -2078,6 +2102,7 @@ class Puppeteer extends Helper {
|
|
|
2078
2102
|
* ```
|
|
2079
2103
|
*
|
|
2080
2104
|
* @param {string} name cookie name.
|
|
2105
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2081
2106
|
*/
|
|
2082
2107
|
async dontSeeCookie(name) {
|
|
2083
2108
|
const cookies = await this.page.cookies();
|
|
@@ -2117,6 +2142,7 @@ class Puppeteer extends Helper {
|
|
|
2117
2142
|
* ```
|
|
2118
2143
|
*
|
|
2119
2144
|
* @param {?string} [cookie=null] (optional, `null` by default) cookie name
|
|
2145
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2120
2146
|
*/
|
|
2121
2147
|
async clearCookie(name) {
|
|
2122
2148
|
const cookies = await this.page.cookies();
|
|
@@ -2154,7 +2180,7 @@ class Puppeteer extends Helper {
|
|
|
2154
2180
|
*
|
|
2155
2181
|
* @param {string|function} fn function to be executed in browser context.
|
|
2156
2182
|
* @param {...any} args to be passed to function.
|
|
2157
|
-
*
|
|
2183
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2158
2184
|
*
|
|
2159
2185
|
*
|
|
2160
2186
|
* If a function returns a Promise It will wait for it resolution.
|
|
@@ -2191,7 +2217,7 @@ class Puppeteer extends Helper {
|
|
|
2191
2217
|
*
|
|
2192
2218
|
* @param {string|function} fn function to be executed in browser context.
|
|
2193
2219
|
* @param {...any} args to be passed to function.
|
|
2194
|
-
*
|
|
2220
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2195
2221
|
*
|
|
2196
2222
|
*
|
|
2197
2223
|
* Asynchronous scripts can also be executed with `executeScript` if a function returns a Promise.
|
|
@@ -2396,6 +2422,7 @@ class Puppeteer extends Helper {
|
|
|
2396
2422
|
*
|
|
2397
2423
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
2398
2424
|
* @param {object} cssProperties object with CSS properties and their values to check.
|
|
2425
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2399
2426
|
* {{ react }}
|
|
2400
2427
|
*/
|
|
2401
2428
|
async seeCssPropertiesOnElements(locator, cssProperties) {
|
|
@@ -2442,6 +2469,7 @@ class Puppeteer extends Helper {
|
|
|
2442
2469
|
*
|
|
2443
2470
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
2444
2471
|
* @param {object} attributes attributes and their values to check.
|
|
2472
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2445
2473
|
* {{ react }}
|
|
2446
2474
|
*/
|
|
2447
2475
|
async seeAttributesOnElements(locator, attributes) {
|
|
@@ -2482,6 +2510,7 @@ class Puppeteer extends Helper {
|
|
|
2482
2510
|
*
|
|
2483
2511
|
* @param {CodeceptJS.LocatorOrString} locator located by label|name|CSS|XPath|strict locator.
|
|
2484
2512
|
* @param {number} offsetX position to drag.
|
|
2513
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2485
2514
|
* {{ react }}
|
|
2486
2515
|
*/
|
|
2487
2516
|
async dragSlider(locator, offsetX = 0) {
|
|
@@ -2559,7 +2588,7 @@ class Puppeteer extends Helper {
|
|
|
2559
2588
|
*
|
|
2560
2589
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2561
2590
|
* @param {string} fileName file name to save.
|
|
2562
|
-
*
|
|
2591
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2563
2592
|
*/
|
|
2564
2593
|
async saveElementScreenshot(locator, fileName) {
|
|
2565
2594
|
const outputFile = screenshotOutputFolder(fileName);
|
|
@@ -2584,6 +2613,7 @@ class Puppeteer extends Helper {
|
|
|
2584
2613
|
*
|
|
2585
2614
|
* @param {string} fileName file name to save.
|
|
2586
2615
|
* @param {boolean} [fullPage=false] (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
2616
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2587
2617
|
*/
|
|
2588
2618
|
async saveScreenshot(fileName, fullPage) {
|
|
2589
2619
|
const fullPageOption = fullPage || this.options.fullPageScreenshots;
|
|
@@ -2618,6 +2648,7 @@ class Puppeteer extends Helper {
|
|
|
2618
2648
|
* ```
|
|
2619
2649
|
*
|
|
2620
2650
|
* @param {number} sec number of second to wait.
|
|
2651
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2621
2652
|
*/
|
|
2622
2653
|
async wait(sec) {
|
|
2623
2654
|
return new Promise(((done) => {
|
|
@@ -2631,6 +2662,7 @@ class Puppeteer extends Helper {
|
|
|
2631
2662
|
*
|
|
2632
2663
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2633
2664
|
* @param {number} [sec=1] (optional) time in seconds to wait, 1 by default.
|
|
2665
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2634
2666
|
*/
|
|
2635
2667
|
async waitForEnabled(locator, sec) {
|
|
2636
2668
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -2669,7 +2701,7 @@ class Puppeteer extends Helper {
|
|
|
2669
2701
|
* @param {LocatorOrString} field input field.
|
|
2670
2702
|
* @param {string }value expected value.
|
|
2671
2703
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2672
|
-
*
|
|
2704
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2673
2705
|
*/
|
|
2674
2706
|
async waitForValue(field, value, sec) {
|
|
2675
2707
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -2709,6 +2741,7 @@ class Puppeteer extends Helper {
|
|
|
2709
2741
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2710
2742
|
* @param {number} num number of elements.
|
|
2711
2743
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2744
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2712
2745
|
* {{ react }}
|
|
2713
2746
|
*/
|
|
2714
2747
|
async waitNumberOfVisibleElements(locator, num, sec) {
|
|
@@ -2749,6 +2782,7 @@ class Puppeteer extends Helper {
|
|
|
2749
2782
|
*
|
|
2750
2783
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2751
2784
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
2785
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2752
2786
|
*/
|
|
2753
2787
|
async waitForClickable(locator, waitTimeout) {
|
|
2754
2788
|
const els = await this._locate(locator);
|
|
@@ -2774,6 +2808,7 @@ class Puppeteer extends Helper {
|
|
|
2774
2808
|
*
|
|
2775
2809
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2776
2810
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
2811
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2777
2812
|
* {{ react }}
|
|
2778
2813
|
*/
|
|
2779
2814
|
async waitForElement(locator, sec) {
|
|
@@ -2802,7 +2837,7 @@ class Puppeteer extends Helper {
|
|
|
2802
2837
|
*
|
|
2803
2838
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2804
2839
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2805
|
-
*
|
|
2840
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2806
2841
|
*
|
|
2807
2842
|
* This method accepts [React selectors](https://codecept.io/react).
|
|
2808
2843
|
*/
|
|
@@ -2832,6 +2867,7 @@ class Puppeteer extends Helper {
|
|
|
2832
2867
|
*
|
|
2833
2868
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2834
2869
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2870
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2835
2871
|
*/
|
|
2836
2872
|
async waitForInvisible(locator, sec) {
|
|
2837
2873
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -2859,6 +2895,7 @@ class Puppeteer extends Helper {
|
|
|
2859
2895
|
*
|
|
2860
2896
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2861
2897
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2898
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2862
2899
|
*/
|
|
2863
2900
|
async waitToHide(locator, sec) {
|
|
2864
2901
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -2891,6 +2928,7 @@ class Puppeteer extends Helper {
|
|
|
2891
2928
|
*
|
|
2892
2929
|
* @param {string} urlPart value to check.
|
|
2893
2930
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2931
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2894
2932
|
*/
|
|
2895
2933
|
async waitInUrl(urlPart, sec = null) {
|
|
2896
2934
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -2918,6 +2956,7 @@ class Puppeteer extends Helper {
|
|
|
2918
2956
|
*
|
|
2919
2957
|
* @param {string} urlPart value to check.
|
|
2920
2958
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2959
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2921
2960
|
*/
|
|
2922
2961
|
async waitUrlEquals(urlPart, sec = null) {
|
|
2923
2962
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -2953,6 +2992,7 @@ class Puppeteer extends Helper {
|
|
|
2953
2992
|
* @param {string }text to wait for.
|
|
2954
2993
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2955
2994
|
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator.
|
|
2995
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2956
2996
|
*/
|
|
2957
2997
|
async waitForText(text, sec = null, context = null) {
|
|
2958
2998
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -3028,6 +3068,7 @@ class Puppeteer extends Helper {
|
|
|
3028
3068
|
* ```
|
|
3029
3069
|
*
|
|
3030
3070
|
* @param {?CodeceptJS.LocatorOrString} [locator=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
3071
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
3031
3072
|
*/
|
|
3032
3073
|
async switchTo(locator) {
|
|
3033
3074
|
if (Number.isInteger(locator)) {
|
|
@@ -3081,7 +3122,7 @@ class Puppeteer extends Helper {
|
|
|
3081
3122
|
* @param {string|function} fn to be executed in browser context.
|
|
3082
3123
|
* @param {any[]|number} [argsOrSec] (optional, `1` by default) arguments for function or seconds.
|
|
3083
3124
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
3084
|
-
*
|
|
3125
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
3085
3126
|
*/
|
|
3086
3127
|
async waitForFunction(fn, argsOrSec = null, sec = null) {
|
|
3087
3128
|
let args = [];
|
|
@@ -3130,6 +3171,7 @@ class Puppeteer extends Helper {
|
|
|
3130
3171
|
*
|
|
3131
3172
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
3132
3173
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3174
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
3133
3175
|
*/
|
|
3134
3176
|
async waitForDetached(locator, sec) {
|
|
3135
3177
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -3178,6 +3220,7 @@ class Puppeteer extends Helper {
|
|
|
3178
3220
|
* loadEventEnd: 241
|
|
3179
3221
|
* }
|
|
3180
3222
|
* ```
|
|
3223
|
+
* @return {Promise<any>} automatically synchronized promise through #recorder
|
|
3181
3224
|
*/
|
|
3182
3225
|
async grabDataFromPerformanceTiming() {
|
|
3183
3226
|
return perfTiming;
|
package/docs/build/REST.js
CHANGED
|
@@ -87,7 +87,7 @@ class REST extends Helper {
|
|
|
87
87
|
* @param {object} headers headers list
|
|
88
88
|
*/
|
|
89
89
|
haveRequestHeaders(headers) {
|
|
90
|
-
this.headers = { ...headers, ...
|
|
90
|
+
this.headers = { ...this.headers, ...headers };
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/**
|
|
@@ -98,7 +98,7 @@ class REST extends Helper {
|
|
|
98
98
|
* I.amBearerAuthenticated(secret('heregoestoken'))
|
|
99
99
|
* ```
|
|
100
100
|
*
|
|
101
|
-
* @param {string} accessToken Bearer access token
|
|
101
|
+
* @param {string | CodeceptJS.Secret} accessToken Bearer access token
|
|
102
102
|
*/
|
|
103
103
|
amBearerAuthenticated(accessToken) {
|
|
104
104
|
this.haveRequestHeaders({ Authorization: `Bearer ${accessToken}` });
|
|
@@ -112,6 +112,9 @@ class REST extends Helper {
|
|
|
112
112
|
* @returns {Promise<*>} response
|
|
113
113
|
*/
|
|
114
114
|
async _executeRequest(request) {
|
|
115
|
+
// Add custom headers. They can be set by amBearerAuthenticated() or haveRequestHeaders()
|
|
116
|
+
request.headers = { ...this.headers, ...request.headers };
|
|
117
|
+
|
|
115
118
|
const _debugRequest = { ...request };
|
|
116
119
|
this.axios.defaults.timeout = request.timeout || this.options.timeout;
|
|
117
120
|
|