codeceptjs 3.3.0-beta.5 → 3.3.2
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 +45 -30
- package/docs/bdd.md +1 -0
- package/docs/best.md +1 -1
- package/docs/build/ApiDataFactory.js +4 -3
- package/docs/build/Appium.js +53 -48
- 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 +101 -72
- package/docs/build/Playwright.js +166 -113
- package/docs/build/Protractor.js +72 -34
- package/docs/build/Puppeteer.js +143 -100
- package/docs/build/REST.js +5 -2
- package/docs/build/TestCafe.js +97 -66
- package/docs/build/WebDriver.js +183 -135
- package/docs/changelog.md +99 -0
- package/docs/custom-helpers.md +1 -1
- package/docs/data.md +2 -2
- package/docs/email.md +5 -0
- 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/MockRequest.md +8 -6
- 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/videos.md +2 -2
- 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/command/definitions.js +9 -0
- package/lib/command/run.js +2 -2
- package/lib/command/workers/runTests.js +40 -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/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 +578 -109
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.
|
|
@@ -714,10 +716,10 @@ class Puppeteer extends Helper {
|
|
|
714
716
|
* I.moveCursorTo('#submit', 5,5);
|
|
715
717
|
* ```
|
|
716
718
|
*
|
|
717
|
-
* @param {
|
|
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) {
|
|
@@ -737,9 +739,9 @@ class Puppeteer extends Helper {
|
|
|
737
739
|
* I.dragAndDrop('#dragHandle', '#container');
|
|
738
740
|
* ```
|
|
739
741
|
*
|
|
740
|
-
* @param {
|
|
741
|
-
* @param {
|
|
742
|
-
*
|
|
742
|
+
* @param {LocatorOrString} srcElement located by CSS|XPath|strict locator.
|
|
743
|
+
* @param {LocatorOrString} destElement located by CSS|XPath|strict locator.
|
|
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(() => {
|
|
@@ -799,9 +801,10 @@ class Puppeteer extends Helper {
|
|
|
799
801
|
* I.scrollTo('#submit', 5, 5);
|
|
800
802
|
* ```
|
|
801
803
|
*
|
|
802
|
-
* @param {
|
|
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
|
-
*
|
|
867
|
+
* Checks that title is equal to provided one.
|
|
864
868
|
*
|
|
865
|
-
*
|
|
866
|
-
*
|
|
867
|
-
*
|
|
868
|
-
*
|
|
869
|
-
* @param {string} text value to check.
|
|
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();
|
|
@@ -1069,7 +1074,8 @@ class Puppeteer extends Helper {
|
|
|
1069
1074
|
* ```js
|
|
1070
1075
|
* I.seeElement('#modal');
|
|
1071
1076
|
* ```
|
|
1072
|
-
* @param {
|
|
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) {
|
|
@@ -1088,7 +1094,8 @@ class Puppeteer extends Helper {
|
|
|
1088
1094
|
* I.dontSeeElement('.modal'); // modal is not shown
|
|
1089
1095
|
* ```
|
|
1090
1096
|
*
|
|
1091
|
-
* @param {
|
|
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) {
|
|
@@ -1107,8 +1114,8 @@ class Puppeteer extends Helper {
|
|
|
1107
1114
|
* ```js
|
|
1108
1115
|
* I.seeElementInDOM('#modal');
|
|
1109
1116
|
* ```
|
|
1110
|
-
* @param {
|
|
1111
|
-
*
|
|
1117
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
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);
|
|
@@ -1122,7 +1129,8 @@ class Puppeteer extends Helper {
|
|
|
1122
1129
|
* I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not
|
|
1123
1130
|
* ```
|
|
1124
1131
|
*
|
|
1125
|
-
* @param {
|
|
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);
|
|
@@ -1152,8 +1160,9 @@ class Puppeteer extends Helper {
|
|
|
1152
1160
|
* I.click({css: 'nav a.login'});
|
|
1153
1161
|
* ```
|
|
1154
1162
|
*
|
|
1155
|
-
* @param {
|
|
1156
|
-
* @param {?
|
|
1163
|
+
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by 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 }}
|
|
@@ -1188,8 +1197,9 @@ class Puppeteer extends Helper {
|
|
|
1188
1197
|
* I.forceClick({css: 'nav a.login'});
|
|
1189
1198
|
* ```
|
|
1190
1199
|
*
|
|
1191
|
-
* @param {
|
|
1192
|
-
* @param {?
|
|
1200
|
+
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
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 }}
|
|
@@ -1225,8 +1235,9 @@ class Puppeteer extends Helper {
|
|
|
1225
1235
|
* ```js
|
|
1226
1236
|
* I.clickLink('Logout', '#nav');
|
|
1227
1237
|
* ```
|
|
1228
|
-
* @param {
|
|
1229
|
-
* @param {?
|
|
1238
|
+
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator
|
|
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
|
*/
|
|
@@ -1337,9 +1348,9 @@ class Puppeteer extends Helper {
|
|
|
1337
1348
|
* I.doubleClick('.btn.edit');
|
|
1338
1349
|
* ```
|
|
1339
1350
|
*
|
|
1340
|
-
* @param {
|
|
1341
|
-
* @param {?
|
|
1342
|
-
*
|
|
1351
|
+
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1352
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1353
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1343
1354
|
*
|
|
1344
1355
|
* {{ react }}
|
|
1345
1356
|
*/
|
|
@@ -1359,9 +1370,9 @@ class Puppeteer extends Helper {
|
|
|
1359
1370
|
* I.rightClick('Click me', '.context');
|
|
1360
1371
|
* ```
|
|
1361
1372
|
*
|
|
1362
|
-
* @param {
|
|
1363
|
-
* @param {?
|
|
1364
|
-
*
|
|
1373
|
+
* @param {CodeceptJS.LocatorOrString} locator clickable element located by CSS|XPath|strict locator.
|
|
1374
|
+
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1375
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1365
1376
|
*
|
|
1366
1377
|
* {{ react }}
|
|
1367
1378
|
*/
|
|
@@ -1380,8 +1391,9 @@ class Puppeteer extends Helper {
|
|
|
1380
1391
|
* I.checkOption('I Agree to Terms and Conditions');
|
|
1381
1392
|
* I.checkOption('agree', '//form');
|
|
1382
1393
|
* ```
|
|
1383
|
-
* @param {
|
|
1384
|
-
* @param {?
|
|
1394
|
+
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
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);
|
|
@@ -1405,8 +1417,9 @@ class Puppeteer extends Helper {
|
|
|
1405
1417
|
* I.uncheckOption('I Agree to Terms and Conditions');
|
|
1406
1418
|
* I.uncheckOption('agree', '//form');
|
|
1407
1419
|
* ```
|
|
1408
|
-
* @param {
|
|
1409
|
-
* @param {?
|
|
1420
|
+
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
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);
|
|
@@ -1428,8 +1441,8 @@ class Puppeteer extends Helper {
|
|
|
1428
1441
|
* I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'});
|
|
1429
1442
|
* ```
|
|
1430
1443
|
*
|
|
1431
|
-
* @param {
|
|
1432
|
-
*
|
|
1444
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
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);
|
|
@@ -1444,8 +1457,8 @@ class Puppeteer extends Helper {
|
|
|
1444
1457
|
* I.dontSeeCheckboxIsChecked('agree'); // located by name
|
|
1445
1458
|
* ```
|
|
1446
1459
|
*
|
|
1447
|
-
* @param {
|
|
1448
|
-
*
|
|
1460
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
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)) {
|
|
@@ -1625,9 +1639,9 @@ class Puppeteer extends Helper {
|
|
|
1625
1639
|
* // or by strict locator
|
|
1626
1640
|
* I.fillField({css: 'form#login input[name=username]'}, 'John');
|
|
1627
1641
|
* ```
|
|
1628
|
-
* @param {
|
|
1629
|
-
* @param {
|
|
1630
|
-
*
|
|
1642
|
+
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1643
|
+
* @param {CodeceptJS.StringOrSecret} value text value to fill.
|
|
1644
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1631
1645
|
* {{ react }}
|
|
1632
1646
|
*/
|
|
1633
1647
|
async fillField(field, value) {
|
|
@@ -1653,8 +1667,8 @@ class Puppeteer extends Helper {
|
|
|
1653
1667
|
* I.clearField('user[email]');
|
|
1654
1668
|
* I.clearField('#email');
|
|
1655
1669
|
* ```
|
|
1656
|
-
* @param {
|
|
1657
|
-
*
|
|
1670
|
+
* @param {LocatorOrString} editable field located by label|name|CSS|XPath|strict locator.
|
|
1671
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1658
1672
|
*/
|
|
1659
1673
|
async clearField(field) {
|
|
1660
1674
|
return this.fillField(field, '');
|
|
@@ -1667,8 +1681,9 @@ class Puppeteer extends Helper {
|
|
|
1667
1681
|
* ```js
|
|
1668
1682
|
* I.appendField('#myTextField', 'appended');
|
|
1669
1683
|
* ```
|
|
1670
|
-
* @param {
|
|
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
|
*/
|
|
@@ -1690,9 +1705,9 @@ class Puppeteer extends Helper {
|
|
|
1690
1705
|
* I.seeInField('form input[type=hidden]','hidden_value');
|
|
1691
1706
|
* I.seeInField('#searchform input','Search');
|
|
1692
1707
|
* ```
|
|
1693
|
-
* @param {
|
|
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);
|
|
@@ -1707,8 +1722,9 @@ class Puppeteer extends Helper {
|
|
|
1707
1722
|
* I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS
|
|
1708
1723
|
* ```
|
|
1709
1724
|
*
|
|
1710
|
-
* @param {
|
|
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);
|
|
@@ -1724,8 +1740,9 @@ class Puppeteer extends Helper {
|
|
|
1724
1740
|
* I.attachFile('form input[name=avatar]', 'data/avatar.jpg');
|
|
1725
1741
|
* ```
|
|
1726
1742
|
*
|
|
1727
|
-
* @param {
|
|
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
|
*/
|
|
@@ -1760,9 +1777,9 @@ class Puppeteer extends Helper {
|
|
|
1760
1777
|
* ```js
|
|
1761
1778
|
* I.selectOption('Which OS do you use?', ['Android', 'iOS']);
|
|
1762
1779
|
* ```
|
|
1763
|
-
* @param {
|
|
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);
|
|
@@ -1801,7 +1818,7 @@ class Puppeteer extends Helper {
|
|
|
1801
1818
|
* let numOfElements = await I.grabNumberOfVisibleElements('p');
|
|
1802
1819
|
* ```
|
|
1803
1820
|
*
|
|
1804
|
-
* @param {
|
|
1821
|
+
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
1805
1822
|
* @returns {Promise<number>} number of visible elements
|
|
1806
1823
|
* {{ react }}
|
|
1807
1824
|
*/
|
|
@@ -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());
|
|
@@ -1877,7 +1898,8 @@ class Puppeteer extends Helper {
|
|
|
1877
1898
|
* I.see('Register', {css: 'form.register'}); // use strict locator
|
|
1878
1899
|
* ```
|
|
1879
1900
|
* @param {string} text expected on page.
|
|
1880
|
-
* @param {?
|
|
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
|
*/
|
|
@@ -1893,7 +1915,8 @@ class Puppeteer extends Helper {
|
|
|
1893
1915
|
* ```
|
|
1894
1916
|
*
|
|
1895
1917
|
* @param {string} text element value to check.
|
|
1896
|
-
* @param {
|
|
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);
|
|
@@ -1909,8 +1932,8 @@ class Puppeteer extends Helper {
|
|
|
1909
1932
|
* ```
|
|
1910
1933
|
*
|
|
1911
1934
|
* @param {string} text which is not present.
|
|
1912
|
-
* @param {
|
|
1913
|
-
*
|
|
1935
|
+
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
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();
|
|
@@ -1999,9 +2023,9 @@ class Puppeteer extends Helper {
|
|
|
1999
2023
|
* I.seeNumberOfElements('#submitBtn', 1);
|
|
2000
2024
|
* ```
|
|
2001
2025
|
*
|
|
2002
|
-
* @param {
|
|
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
|
*/
|
|
@@ -2018,9 +2042,9 @@ class Puppeteer extends Helper {
|
|
|
2018
2042
|
* I.seeNumberOfVisibleElements('.buttons', 3);
|
|
2019
2043
|
* ```
|
|
2020
2044
|
*
|
|
2021
|
-
* @param {
|
|
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.
|
|
@@ -2218,7 +2244,7 @@ class Puppeteer extends Helper {
|
|
|
2218
2244
|
* let pins = await I.grabTextFromAll('#pin li');
|
|
2219
2245
|
* ```
|
|
2220
2246
|
*
|
|
2221
|
-
* @param {
|
|
2247
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2222
2248
|
* @returns {Promise<string[]>} attribute value
|
|
2223
2249
|
*
|
|
2224
2250
|
* {{ react }}
|
|
@@ -2241,7 +2267,7 @@ class Puppeteer extends Helper {
|
|
|
2241
2267
|
* ```
|
|
2242
2268
|
* If multiple elements found returns first element.
|
|
2243
2269
|
*
|
|
2244
|
-
* @param {
|
|
2270
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2245
2271
|
* @returns {Promise<string>} attribute value
|
|
2246
2272
|
*
|
|
2247
2273
|
* {{ react }}
|
|
@@ -2263,7 +2289,7 @@ class Puppeteer extends Helper {
|
|
|
2263
2289
|
* ```js
|
|
2264
2290
|
* let inputs = await I.grabValueFromAll('//form/input');
|
|
2265
2291
|
* ```
|
|
2266
|
-
* @param {
|
|
2292
|
+
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
2267
2293
|
* @returns {Promise<string[]>} attribute value
|
|
2268
2294
|
*
|
|
2269
2295
|
*/
|
|
@@ -2284,7 +2310,7 @@ class Puppeteer extends Helper {
|
|
|
2284
2310
|
* ```js
|
|
2285
2311
|
* let email = await I.grabValueFrom('input[name=email]');
|
|
2286
2312
|
* ```
|
|
2287
|
-
* @param {
|
|
2313
|
+
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
2288
2314
|
* @returns {Promise<string>} attribute value
|
|
2289
2315
|
*
|
|
2290
2316
|
*/
|
|
@@ -2306,7 +2332,7 @@ class Puppeteer extends Helper {
|
|
|
2306
2332
|
* let postHTMLs = await I.grabHTMLFromAll('.post');
|
|
2307
2333
|
* ```
|
|
2308
2334
|
*
|
|
2309
|
-
* @param {
|
|
2335
|
+
* @param {CodeceptJS.LocatorOrString} element located by CSS|XPath|strict locator.
|
|
2310
2336
|
* @returns {Promise<string[]>} HTML code for an element
|
|
2311
2337
|
*
|
|
2312
2338
|
*/
|
|
@@ -2325,7 +2351,7 @@ class Puppeteer extends Helper {
|
|
|
2325
2351
|
* let postHTML = await I.grabHTMLFrom('#post');
|
|
2326
2352
|
* ```
|
|
2327
2353
|
*
|
|
2328
|
-
* @param {
|
|
2354
|
+
* @param {CodeceptJS.LocatorOrString} element located by CSS|XPath|strict locator.
|
|
2329
2355
|
* @returns {Promise<string>} HTML code for an element
|
|
2330
2356
|
*
|
|
2331
2357
|
*/
|
|
@@ -2347,7 +2373,7 @@ class Puppeteer extends Helper {
|
|
|
2347
2373
|
* const values = await I.grabCssPropertyFromAll('h3', 'font-weight');
|
|
2348
2374
|
* ```
|
|
2349
2375
|
*
|
|
2350
|
-
* @param {
|
|
2376
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2351
2377
|
* @param {string} cssProperty CSS property name.
|
|
2352
2378
|
* @returns {Promise<string[]>} CSS value
|
|
2353
2379
|
*
|
|
@@ -2370,7 +2396,7 @@ class Puppeteer extends Helper {
|
|
|
2370
2396
|
* const value = await I.grabCssPropertyFrom('h3', 'font-weight');
|
|
2371
2397
|
* ```
|
|
2372
2398
|
*
|
|
2373
|
-
* @param {
|
|
2399
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2374
2400
|
* @param {string} cssProperty CSS property name.
|
|
2375
2401
|
* @returns {Promise<string>} CSS value
|
|
2376
2402
|
*
|
|
@@ -2394,8 +2420,9 @@ class Puppeteer extends Helper {
|
|
|
2394
2420
|
* I.seeCssPropertiesOnElements('h3', { 'font-weight': "bold"});
|
|
2395
2421
|
* ```
|
|
2396
2422
|
*
|
|
2397
|
-
* @param {
|
|
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) {
|
|
@@ -2440,8 +2467,9 @@ class Puppeteer extends Helper {
|
|
|
2440
2467
|
* I.seeAttributesOnElements('//form', { method: "post"});
|
|
2441
2468
|
* ```
|
|
2442
2469
|
*
|
|
2443
|
-
* @param {
|
|
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) {
|
|
@@ -2480,8 +2508,9 @@ class Puppeteer extends Helper {
|
|
|
2480
2508
|
* I.dragSlider('#slider', -70);
|
|
2481
2509
|
* ```
|
|
2482
2510
|
*
|
|
2483
|
-
* @param {
|
|
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) {
|
|
@@ -2509,7 +2538,7 @@ class Puppeteer extends Helper {
|
|
|
2509
2538
|
* ```js
|
|
2510
2539
|
* let hints = await I.grabAttributeFromAll('.tooltip', 'title');
|
|
2511
2540
|
* ```
|
|
2512
|
-
* @param {
|
|
2541
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2513
2542
|
* @param {string} attr attribute name.
|
|
2514
2543
|
* @returns {Promise<string[]>} attribute value
|
|
2515
2544
|
*
|
|
@@ -2533,7 +2562,7 @@ class Puppeteer extends Helper {
|
|
|
2533
2562
|
* ```js
|
|
2534
2563
|
* let hint = await I.grabAttributeFrom('#tooltip', 'title');
|
|
2535
2564
|
* ```
|
|
2536
|
-
* @param {
|
|
2565
|
+
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2537
2566
|
* @param {string} attr attribute name.
|
|
2538
2567
|
* @returns {Promise<string>} attribute value
|
|
2539
2568
|
*
|
|
@@ -2557,9 +2586,9 @@ class Puppeteer extends Helper {
|
|
|
2557
2586
|
* I.saveElementScreenshot(`#submit`,'debug.png');
|
|
2558
2587
|
* ```
|
|
2559
2588
|
*
|
|
2560
|
-
* @param {
|
|
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) => {
|
|
@@ -2629,8 +2660,9 @@ class Puppeteer extends Helper {
|
|
|
2629
2660
|
* Waits for element to become enabled (by default waits for 1sec).
|
|
2630
2661
|
* Element can be located by CSS or XPath.
|
|
2631
2662
|
*
|
|
2632
|
-
* @param {
|
|
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;
|
|
@@ -2666,10 +2698,10 @@ class Puppeteer extends Helper {
|
|
|
2666
2698
|
* I.waitForValue('//input', "GoodValue");
|
|
2667
2699
|
* ```
|
|
2668
2700
|
*
|
|
2669
|
-
* @param {
|
|
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;
|
|
@@ -2706,9 +2738,10 @@ class Puppeteer extends Helper {
|
|
|
2706
2738
|
* I.waitNumberOfVisibleElements('a', 3);
|
|
2707
2739
|
* ```
|
|
2708
2740
|
*
|
|
2709
|
-
* @param {
|
|
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) {
|
|
@@ -2747,8 +2780,9 @@ class Puppeteer extends Helper {
|
|
|
2747
2780
|
* I.waitForClickable('.btn.continue', 5); // wait for 5 secs
|
|
2748
2781
|
* ```
|
|
2749
2782
|
*
|
|
2750
|
-
* @param {
|
|
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);
|
|
@@ -2772,8 +2806,9 @@ class Puppeteer extends Helper {
|
|
|
2772
2806
|
* I.waitForElement('.btn.continue', 5); // wait for 5 secs
|
|
2773
2807
|
* ```
|
|
2774
2808
|
*
|
|
2775
|
-
* @param {
|
|
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) {
|
|
@@ -2800,9 +2835,9 @@ class Puppeteer extends Helper {
|
|
|
2800
2835
|
* I.waitForVisible('#popup');
|
|
2801
2836
|
* ```
|
|
2802
2837
|
*
|
|
2803
|
-
* @param {
|
|
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
|
*/
|
|
@@ -2830,8 +2865,9 @@ class Puppeteer extends Helper {
|
|
|
2830
2865
|
* I.waitForInvisible('#popup');
|
|
2831
2866
|
* ```
|
|
2832
2867
|
*
|
|
2833
|
-
* @param {
|
|
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;
|
|
@@ -2857,8 +2893,9 @@ class Puppeteer extends Helper {
|
|
|
2857
2893
|
* I.waitToHide('#popup');
|
|
2858
2894
|
* ```
|
|
2859
2895
|
*
|
|
2860
|
-
* @param {
|
|
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;
|
|
@@ -2952,7 +2991,8 @@ class Puppeteer extends Helper {
|
|
|
2952
2991
|
*
|
|
2953
2992
|
* @param {string }text to wait for.
|
|
2954
2993
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2955
|
-
* @param {
|
|
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;
|
|
@@ -3027,7 +3067,8 @@ class Puppeteer extends Helper {
|
|
|
3027
3067
|
* I.switchTo(); // switch back to main page
|
|
3028
3068
|
* ```
|
|
3029
3069
|
*
|
|
3030
|
-
* @param {?
|
|
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 = [];
|
|
@@ -3128,8 +3169,9 @@ class Puppeteer extends Helper {
|
|
|
3128
3169
|
* I.waitForDetached('#popup');
|
|
3129
3170
|
* ```
|
|
3130
3171
|
*
|
|
3131
|
-
* @param {
|
|
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;
|
|
@@ -3201,7 +3244,7 @@ class Puppeteer extends Helper {
|
|
|
3201
3244
|
* const width = await I.grabElementBoundingRect('h3', 'width');
|
|
3202
3245
|
* // width == 527
|
|
3203
3246
|
* ```
|
|
3204
|
-
* @param {
|
|
3247
|
+
* @param {LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
3205
3248
|
* @param {string=} elementSize x, y, width or height of the given element.
|
|
3206
3249
|
* @returns {Promise<DOMRect>|Promise<number>} Element bounding rectangle
|
|
3207
3250
|
*
|