codeceptjs 3.3.1 → 3.3.4
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 +49 -0
- package/README.md +4 -25
- package/docs/api.md +4 -0
- package/docs/basics.md +2 -0
- package/docs/build/Appium.js +18 -28
- package/docs/build/JSONResponse.js +44 -3
- package/docs/build/Nightmare.js +53 -53
- package/docs/build/Playwright.js +95 -103
- package/docs/build/Protractor.js +66 -66
- package/docs/build/Puppeteer.js +74 -74
- package/docs/build/REST.js +8 -4
- package/docs/build/TestCafe.js +53 -53
- package/docs/build/WebDriver.js +84 -86
- package/docs/changelog.md +49 -0
- package/docs/helpers/Appium.md +212 -268
- package/docs/helpers/JSONResponse.md +24 -0
- package/docs/helpers/Nightmare.md +92 -141
- package/docs/helpers/Playwright.md +302 -413
- package/docs/helpers/Puppeteer.md +171 -231
- package/docs/helpers/REST.md +2 -0
- package/docs/helpers/TestCafe.md +125 -174
- package/docs/helpers/WebDriver.md +184 -247
- package/docs/plugins.md +41 -1
- package/docs/secrets.md +30 -0
- package/docs/webapi/amOnPage.mustache +1 -1
- package/docs/webapi/appendField.mustache +1 -1
- package/docs/webapi/attachFile.mustache +1 -1
- package/docs/webapi/checkOption.mustache +1 -1
- package/docs/webapi/clearCookie.mustache +1 -1
- package/docs/webapi/clearField.mustache +1 -1
- package/docs/webapi/click.mustache +1 -1
- package/docs/webapi/clickLink.mustache +1 -1
- package/docs/webapi/closeCurrentTab.mustache +1 -1
- package/docs/webapi/closeOtherTabs.mustache +1 -1
- package/docs/webapi/dontSee.mustache +1 -1
- package/docs/webapi/dontSeeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/dontSeeCookie.mustache +1 -1
- package/docs/webapi/dontSeeCurrentUrlEquals.mustache +1 -1
- package/docs/webapi/dontSeeElement.mustache +1 -1
- package/docs/webapi/dontSeeElementInDOM.mustache +1 -1
- package/docs/webapi/dontSeeInCurrentUrl.mustache +1 -1
- package/docs/webapi/dontSeeInField.mustache +1 -1
- package/docs/webapi/dontSeeInSource.mustache +1 -1
- package/docs/webapi/dontSeeInTitle.mustache +1 -1
- package/docs/webapi/doubleClick.mustache +1 -1
- package/docs/webapi/downloadFile.mustache +1 -1
- package/docs/webapi/dragAndDrop.mustache +1 -1
- package/docs/webapi/dragSlider.mustache +1 -1
- package/docs/webapi/executeAsyncScript.mustache +1 -1
- package/docs/webapi/executeScript.mustache +1 -1
- package/docs/webapi/fillField.mustache +1 -1
- package/docs/webapi/forceClick.mustache +1 -1
- package/docs/webapi/forceRightClick.mustache +1 -1
- package/docs/webapi/grabDataFromPerformanceTiming.mustache +1 -1
- package/docs/webapi/moveCursorTo.mustache +1 -1
- package/docs/webapi/openNewTab.mustache +1 -1
- package/docs/webapi/pressKey.mustache +1 -1
- package/docs/webapi/pressKeyDown.mustache +1 -1
- package/docs/webapi/pressKeyUp.mustache +1 -1
- package/docs/webapi/pressKeyWithKeyNormalization.mustache +1 -1
- package/docs/webapi/refreshPage.mustache +1 -1
- package/docs/webapi/resizeWindow.mustache +1 -1
- package/docs/webapi/rightClick.mustache +1 -1
- package/docs/webapi/saveElementScreenshot.mustache +1 -1
- package/docs/webapi/saveScreenshot.mustache +1 -1
- package/docs/webapi/say.mustache +1 -1
- package/docs/webapi/scrollIntoView.mustache +1 -1
- package/docs/webapi/scrollPageToBottom.mustache +1 -1
- package/docs/webapi/scrollPageToTop.mustache +1 -1
- package/docs/webapi/scrollTo.mustache +1 -1
- package/docs/webapi/see.mustache +1 -1
- package/docs/webapi/seeAttributesOnElements.mustache +1 -1
- package/docs/webapi/seeCheckboxIsChecked.mustache +1 -1
- package/docs/webapi/seeCookie.mustache +1 -1
- package/docs/webapi/seeCssPropertiesOnElements.mustache +1 -1
- package/docs/webapi/seeCurrentUrlEquals.mustache +1 -1
- package/docs/webapi/seeElement.mustache +1 -1
- package/docs/webapi/seeElementInDOM.mustache +1 -1
- package/docs/webapi/seeInCurrentUrl.mustache +1 -1
- package/docs/webapi/seeInField.mustache +1 -1
- package/docs/webapi/seeInPopup.mustache +1 -1
- package/docs/webapi/seeInSource.mustache +1 -1
- package/docs/webapi/seeInTitle.mustache +1 -1
- package/docs/webapi/seeNumberOfElements.mustache +1 -1
- package/docs/webapi/seeNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/seeTextEquals.mustache +1 -1
- package/docs/webapi/seeTitleEquals.mustache +1 -1
- package/docs/webapi/selectOption.mustache +1 -1
- package/docs/webapi/setCookie.mustache +1 -1
- package/docs/webapi/setGeoLocation.mustache +1 -1
- package/docs/webapi/switchTo.mustache +1 -1
- package/docs/webapi/switchToNextTab.mustache +1 -1
- package/docs/webapi/switchToPreviousTab.mustache +1 -1
- package/docs/webapi/type.mustache +1 -1
- package/docs/webapi/uncheckOption.mustache +1 -1
- package/docs/webapi/wait.mustache +1 -1
- package/docs/webapi/waitForClickable.mustache +1 -1
- package/docs/webapi/waitForDetached.mustache +1 -1
- package/docs/webapi/waitForElement.mustache +1 -1
- package/docs/webapi/waitForEnabled.mustache +1 -1
- package/docs/webapi/waitForFunction.mustache +1 -1
- package/docs/webapi/waitForInvisible.mustache +1 -1
- package/docs/webapi/waitForText.mustache +1 -1
- package/docs/webapi/waitForValue.mustache +1 -1
- package/docs/webapi/waitForVisible.mustache +1 -1
- package/docs/webapi/waitInUrl.mustache +1 -1
- package/docs/webapi/waitNumberOfVisibleElements.mustache +1 -1
- package/docs/webapi/waitToHide.mustache +1 -1
- package/docs/webapi/waitUrlEquals.mustache +1 -1
- package/lib/cli.js +1 -1
- package/lib/command/interactive.js +1 -1
- package/lib/command/run-workers.js +1 -1
- package/lib/command/workers/runTests.js +15 -0
- package/lib/helper/Appium.js +0 -10
- package/lib/helper/JSONResponse.js +44 -3
- package/lib/helper/Playwright.js +24 -32
- package/lib/helper/REST.js +8 -4
- package/lib/helper/WebDriver.js +5 -7
- package/lib/output.js +4 -0
- package/lib/plugin/customLocator.js +50 -3
- package/lib/plugin/retryFailedStep.js +1 -1
- package/lib/plugin/retryTo.js +1 -8
- package/lib/secret.js +30 -0
- package/lib/step.js +1 -1
- package/package.json +4 -4
- package/typings/types.d.ts +1016 -520
package/docs/build/Playwright.js
CHANGED
|
@@ -167,7 +167,8 @@ const { createValueEngine, createDisabledEngine } = require('./extras/Playwright
|
|
|
167
167
|
* Playwright: {
|
|
168
168
|
* url: "http://localhost",
|
|
169
169
|
* chromium: {
|
|
170
|
-
* browserWSEndpoint: 'ws://localhost:9222/devtools/browser/c5aa6160-b5bc-4d53-bb49-6ecb36cd2e0a'
|
|
170
|
+
* browserWSEndpoint: 'ws://localhost:9222/devtools/browser/c5aa6160-b5bc-4d53-bb49-6ecb36cd2e0a',
|
|
171
|
+
* cdpConnection: false // default is false
|
|
171
172
|
* }
|
|
172
173
|
* }
|
|
173
174
|
* }
|
|
@@ -272,6 +273,7 @@ class Playwright extends Helper {
|
|
|
272
273
|
this.sessionPages = {};
|
|
273
274
|
this.activeSessionName = '';
|
|
274
275
|
this.isElectron = false;
|
|
276
|
+
this.isCDPConnection = false;
|
|
275
277
|
this.electronSessions = [];
|
|
276
278
|
this.storageState = null;
|
|
277
279
|
|
|
@@ -347,6 +349,7 @@ class Playwright extends Helper {
|
|
|
347
349
|
this.isRemoteBrowser = !!this.playwrightOptions.browserWSEndpoint;
|
|
348
350
|
this.isElectron = this.options.browser === 'electron';
|
|
349
351
|
this.userDataDir = this.playwrightOptions.userDataDir;
|
|
352
|
+
this.isCDPConnection = this.playwrightOptions.cdpConnection;
|
|
350
353
|
popupStore.defaultAction = this.options.defaultPopupAction;
|
|
351
354
|
}
|
|
352
355
|
|
|
@@ -553,8 +556,7 @@ class Playwright extends Helper {
|
|
|
553
556
|
* ```
|
|
554
557
|
*
|
|
555
558
|
* @param {string} description used to show in logs.
|
|
556
|
-
* @param {function} fn async function that executed with Playwright helper as
|
|
557
|
-
* @return {Promise<any>}
|
|
559
|
+
* @param {function} fn async function that executed with Playwright helper as argumen
|
|
558
560
|
*/
|
|
559
561
|
usePlaywrightTo(description, fn) {
|
|
560
562
|
return this._useTo(...arguments);
|
|
@@ -569,7 +571,6 @@ class Playwright extends Helper {
|
|
|
569
571
|
* I.click('#triggerPopup');
|
|
570
572
|
* I.acceptPopup();
|
|
571
573
|
* ```
|
|
572
|
-
* @return {Promise<any>}
|
|
573
574
|
*/
|
|
574
575
|
amAcceptingPopups() {
|
|
575
576
|
popupStore.actionType = 'accept';
|
|
@@ -579,7 +580,6 @@ class Playwright extends Helper {
|
|
|
579
580
|
* Accepts the active JavaScript native popup window, as created by window.alert|window.confirm|window.prompt.
|
|
580
581
|
* Don't confuse popups with modal windows, as created by [various
|
|
581
582
|
* libraries](http://jster.net/category/windows-modals-popups).
|
|
582
|
-
* @return {Promise<any>}
|
|
583
583
|
*/
|
|
584
584
|
acceptPopup() {
|
|
585
585
|
popupStore.assertPopupActionType('accept');
|
|
@@ -594,7 +594,6 @@ class Playwright extends Helper {
|
|
|
594
594
|
* I.click('#triggerPopup');
|
|
595
595
|
* I.cancelPopup();
|
|
596
596
|
* ```
|
|
597
|
-
* @return {Promise<any>}
|
|
598
597
|
*/
|
|
599
598
|
amCancellingPopups() {
|
|
600
599
|
popupStore.actionType = 'cancel';
|
|
@@ -602,7 +601,6 @@ class Playwright extends Helper {
|
|
|
602
601
|
|
|
603
602
|
/**
|
|
604
603
|
* Dismisses the active JavaScript popup, as created by window.alert|window.confirm|window.prompt.
|
|
605
|
-
* @return {Promise<any>}
|
|
606
604
|
*/
|
|
607
605
|
cancelPopup() {
|
|
608
606
|
popupStore.assertPopupActionType('cancel');
|
|
@@ -616,7 +614,7 @@ class Playwright extends Helper {
|
|
|
616
614
|
* I.seeInPopup('Popup text');
|
|
617
615
|
* ```
|
|
618
616
|
* @param {string} text value to check.
|
|
619
|
-
*
|
|
617
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
620
618
|
*/
|
|
621
619
|
async seeInPopup(text) {
|
|
622
620
|
popupStore.assertPopupVisible();
|
|
@@ -627,7 +625,6 @@ class Playwright extends Helper {
|
|
|
627
625
|
/**
|
|
628
626
|
* Set current page
|
|
629
627
|
* @param {object} page page to set
|
|
630
|
-
* @return {Promise<any>}
|
|
631
628
|
*/
|
|
632
629
|
async _setPage(page) {
|
|
633
630
|
page = await page;
|
|
@@ -652,7 +649,6 @@ class Playwright extends Helper {
|
|
|
652
649
|
/**
|
|
653
650
|
* Add the 'dialog' event listener to a page
|
|
654
651
|
* @page {playwright.Page}
|
|
655
|
-
* @return {Promise<any>}
|
|
656
652
|
*
|
|
657
653
|
* The popup listener handles the dialog with the predefined action when it appears on the page.
|
|
658
654
|
* It also saves a reference to the object which is used in seeInPopup.
|
|
@@ -683,7 +679,6 @@ class Playwright extends Helper {
|
|
|
683
679
|
|
|
684
680
|
/**
|
|
685
681
|
* Gets page URL including hash.
|
|
686
|
-
* @return {Promise<any>}
|
|
687
682
|
*/
|
|
688
683
|
async _getPageUrl() {
|
|
689
684
|
return this.executeScript(() => window.location.href);
|
|
@@ -707,6 +702,15 @@ class Playwright extends Helper {
|
|
|
707
702
|
async _startBrowser() {
|
|
708
703
|
if (this.isElectron) {
|
|
709
704
|
this.browser = await playwright._electron.launch(this.playwrightOptions);
|
|
705
|
+
} else if (this.isRemoteBrowser && this.isCDPConnection) {
|
|
706
|
+
try {
|
|
707
|
+
this.browser = await playwright[this.options.browser].connectOverCDP(this.playwrightOptions);
|
|
708
|
+
} catch (err) {
|
|
709
|
+
if (err.toString().indexOf('ECONNREFUSED')) {
|
|
710
|
+
throw new RemoteBrowserConnectionRefused(err);
|
|
711
|
+
}
|
|
712
|
+
throw err;
|
|
713
|
+
}
|
|
710
714
|
} else if (this.isRemoteBrowser) {
|
|
711
715
|
try {
|
|
712
716
|
this.browser = await playwright[this.options.browser].connect(this.playwrightOptions);
|
|
@@ -800,7 +804,7 @@ class Playwright extends Helper {
|
|
|
800
804
|
* ```
|
|
801
805
|
*
|
|
802
806
|
* @param {string} url url path or global url.
|
|
803
|
-
* @return {
|
|
807
|
+
* @return {void} automatically synchronized promise with recorder #!
|
|
804
808
|
*/
|
|
805
809
|
async amOnPage(url) {
|
|
806
810
|
if (this.isElectron) {
|
|
@@ -838,7 +842,7 @@ class Playwright extends Helper {
|
|
|
838
842
|
*
|
|
839
843
|
* @param {number} width width in pixels or `maximize`.
|
|
840
844
|
* @param {number} height height in pixels.
|
|
841
|
-
*
|
|
845
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
842
846
|
*
|
|
843
847
|
* Unlike other drivers Playwright changes the size of a viewport, not the window!
|
|
844
848
|
* Playwright does not control the window of a browser so it can't adjust its real size.
|
|
@@ -871,7 +875,6 @@ class Playwright extends Helper {
|
|
|
871
875
|
* ```
|
|
872
876
|
*
|
|
873
877
|
* @param {object} customHeaders headers to set
|
|
874
|
-
* @return {Promise<any>}
|
|
875
878
|
*/
|
|
876
879
|
async haveRequestHeaders(customHeaders) {
|
|
877
880
|
if (!customHeaders) {
|
|
@@ -892,7 +895,7 @@ class Playwright extends Helper {
|
|
|
892
895
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
893
896
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
894
897
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
895
|
-
*
|
|
898
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
896
899
|
*
|
|
897
900
|
*/
|
|
898
901
|
async moveCursorTo(locator, offsetX = 0, offsetY = 0) {
|
|
@@ -914,7 +917,7 @@ class Playwright extends Helper {
|
|
|
914
917
|
*
|
|
915
918
|
* @param {LocatorOrString} srcElement located by CSS|XPath|strict locator.
|
|
916
919
|
* @param {LocatorOrString} destElement located by CSS|XPath|strict locator.
|
|
917
|
-
*
|
|
920
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
918
921
|
*
|
|
919
922
|
* @param {any} [options] [Additional options](https://playwright.dev/docs/api/class-page#page-drag-and-drop) can be passed as 3rd argument.
|
|
920
923
|
*
|
|
@@ -938,7 +941,7 @@ class Playwright extends Helper {
|
|
|
938
941
|
* ```js
|
|
939
942
|
* I.refreshPage();
|
|
940
943
|
* ```
|
|
941
|
-
*
|
|
944
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
942
945
|
*/
|
|
943
946
|
async refreshPage() {
|
|
944
947
|
return this.page.reload({ timeout: this.options.getPageTimeout, waitUntil: this.options.waitForNavigation });
|
|
@@ -950,7 +953,7 @@ class Playwright extends Helper {
|
|
|
950
953
|
* ```js
|
|
951
954
|
* I.scrollPageToTop();
|
|
952
955
|
* ```
|
|
953
|
-
*
|
|
956
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
954
957
|
*/
|
|
955
958
|
scrollPageToTop() {
|
|
956
959
|
return this.executeScript(() => {
|
|
@@ -964,7 +967,7 @@ class Playwright extends Helper {
|
|
|
964
967
|
* ```js
|
|
965
968
|
* I.scrollPageToBottom();
|
|
966
969
|
* ```
|
|
967
|
-
*
|
|
970
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
968
971
|
*/
|
|
969
972
|
async scrollPageToBottom() {
|
|
970
973
|
return this.executeScript(() => {
|
|
@@ -989,7 +992,7 @@ class Playwright extends Helper {
|
|
|
989
992
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
990
993
|
* @param {number} [offsetX=0] (optional, `0` by default) X-axis offset.
|
|
991
994
|
* @param {number} [offsetY=0] (optional, `0` by default) Y-axis offset.
|
|
992
|
-
*
|
|
995
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
993
996
|
*/
|
|
994
997
|
async scrollTo(locator, offsetX = 0, offsetY = 0) {
|
|
995
998
|
if (typeof locator === 'number' && typeof offsetX === 'number') {
|
|
@@ -1018,7 +1021,7 @@ class Playwright extends Helper {
|
|
|
1018
1021
|
* ```
|
|
1019
1022
|
*
|
|
1020
1023
|
* @param {string} text text value to check.
|
|
1021
|
-
*
|
|
1024
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1022
1025
|
*/
|
|
1023
1026
|
async seeInTitle(text) {
|
|
1024
1027
|
const title = await this.page.title();
|
|
@@ -1056,7 +1059,7 @@ class Playwright extends Helper {
|
|
|
1056
1059
|
* ```
|
|
1057
1060
|
*
|
|
1058
1061
|
* @param {string} text value to check.
|
|
1059
|
-
*
|
|
1062
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1060
1063
|
*/
|
|
1061
1064
|
async seeTitleEquals(text) {
|
|
1062
1065
|
const title = await this.page.title();
|
|
@@ -1071,7 +1074,7 @@ class Playwright extends Helper {
|
|
|
1071
1074
|
* ```
|
|
1072
1075
|
*
|
|
1073
1076
|
* @param {string} text value to check.
|
|
1074
|
-
*
|
|
1077
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1075
1078
|
*/
|
|
1076
1079
|
async dontSeeInTitle(text) {
|
|
1077
1080
|
const title = await this.page.title();
|
|
@@ -1099,7 +1102,6 @@ class Playwright extends Helper {
|
|
|
1099
1102
|
* ```js
|
|
1100
1103
|
* const elements = await this.helpers['Playwright']._locate({name: 'password'});
|
|
1101
1104
|
* ```
|
|
1102
|
-
* @return {Promise<any>}
|
|
1103
1105
|
*/
|
|
1104
1106
|
async _locate(locator) {
|
|
1105
1107
|
const context = await this.context || await this._getContext();
|
|
@@ -1113,7 +1115,6 @@ class Playwright extends Helper {
|
|
|
1113
1115
|
* ```js
|
|
1114
1116
|
* this.helpers['Playwright']._locateCheckable('I agree with terms and conditions').then // ...
|
|
1115
1117
|
* ```
|
|
1116
|
-
* @return {Promise<any>}
|
|
1117
1118
|
*/
|
|
1118
1119
|
async _locateCheckable(locator, providedContext = null) {
|
|
1119
1120
|
const context = providedContext || await this._getContext();
|
|
@@ -1128,7 +1129,6 @@ class Playwright extends Helper {
|
|
|
1128
1129
|
* ```js
|
|
1129
1130
|
* this.helpers['Playwright']._locateClickable('Next page').then // ...
|
|
1130
1131
|
* ```
|
|
1131
|
-
* @return {Promise<any>}
|
|
1132
1132
|
*/
|
|
1133
1133
|
async _locateClickable(locator) {
|
|
1134
1134
|
const context = await this._getContext();
|
|
@@ -1141,7 +1141,6 @@ class Playwright extends Helper {
|
|
|
1141
1141
|
* ```js
|
|
1142
1142
|
* this.helpers['Playwright']._locateFields('Your email').then // ...
|
|
1143
1143
|
* ```
|
|
1144
|
-
* @return {Promise<any>}
|
|
1145
1144
|
*/
|
|
1146
1145
|
async _locateFields(locator) {
|
|
1147
1146
|
return findFields.call(this, locator);
|
|
@@ -1156,7 +1155,6 @@ class Playwright extends Helper {
|
|
|
1156
1155
|
* ```
|
|
1157
1156
|
*
|
|
1158
1157
|
* @param {number} [num=1]
|
|
1159
|
-
* @return {Promise<any>}
|
|
1160
1158
|
*/
|
|
1161
1159
|
async switchToNextTab(num = 1) {
|
|
1162
1160
|
if (this.isElectron) {
|
|
@@ -1171,6 +1169,7 @@ class Playwright extends Helper {
|
|
|
1171
1169
|
if (!page) {
|
|
1172
1170
|
throw new Error(`There is no ability to switch to next tab with offset ${num}`);
|
|
1173
1171
|
}
|
|
1172
|
+
targetCreatedHandler.call(this, page);
|
|
1174
1173
|
await this._setPage(page);
|
|
1175
1174
|
return this._waitForAction();
|
|
1176
1175
|
}
|
|
@@ -1183,7 +1182,6 @@ class Playwright extends Helper {
|
|
|
1183
1182
|
* I.switchToPreviousTab(2);
|
|
1184
1183
|
* ```
|
|
1185
1184
|
* @param {number} [num=1]
|
|
1186
|
-
* @return {Promise<any>}
|
|
1187
1185
|
*/
|
|
1188
1186
|
async switchToPreviousTab(num = 1) {
|
|
1189
1187
|
if (this.isElectron) {
|
|
@@ -1208,7 +1206,6 @@ class Playwright extends Helper {
|
|
|
1208
1206
|
* ```js
|
|
1209
1207
|
* I.closeCurrentTab();
|
|
1210
1208
|
* ```
|
|
1211
|
-
* @return {Promise<any>}
|
|
1212
1209
|
*/
|
|
1213
1210
|
async closeCurrentTab() {
|
|
1214
1211
|
if (this.isElectron) {
|
|
@@ -1226,7 +1223,6 @@ class Playwright extends Helper {
|
|
|
1226
1223
|
* ```js
|
|
1227
1224
|
* I.closeOtherTabs();
|
|
1228
1225
|
* ```
|
|
1229
|
-
* @return {Promise<any>}
|
|
1230
1226
|
*/
|
|
1231
1227
|
async closeOtherTabs() {
|
|
1232
1228
|
const pages = await this.browserContext.pages();
|
|
@@ -1251,13 +1247,14 @@ class Playwright extends Helper {
|
|
|
1251
1247
|
* // enable mobile
|
|
1252
1248
|
* I.openNewTab({ isMobile: true });
|
|
1253
1249
|
* ```
|
|
1254
|
-
* @return {Promise<any>}
|
|
1255
1250
|
*/
|
|
1256
1251
|
async openNewTab(options) {
|
|
1257
1252
|
if (this.isElectron) {
|
|
1258
1253
|
throw new Error('Cannot open new tabs inside an Electron container');
|
|
1259
1254
|
}
|
|
1260
|
-
|
|
1255
|
+
const page = await this.browserContext.newPage(options);
|
|
1256
|
+
targetCreatedHandler.call(this, page);
|
|
1257
|
+
await this._setPage(page);
|
|
1261
1258
|
return this._waitForAction();
|
|
1262
1259
|
}
|
|
1263
1260
|
|
|
@@ -1285,7 +1282,7 @@ class Playwright extends Helper {
|
|
|
1285
1282
|
* I.seeElement('#modal');
|
|
1286
1283
|
* ```
|
|
1287
1284
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
1288
|
-
*
|
|
1285
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1289
1286
|
*
|
|
1290
1287
|
*/
|
|
1291
1288
|
async seeElement(locator) {
|
|
@@ -1302,7 +1299,7 @@ class Playwright extends Helper {
|
|
|
1302
1299
|
* ```
|
|
1303
1300
|
*
|
|
1304
1301
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
1305
|
-
*
|
|
1302
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1306
1303
|
*
|
|
1307
1304
|
*/
|
|
1308
1305
|
async dontSeeElement(locator) {
|
|
@@ -1319,7 +1316,7 @@ class Playwright extends Helper {
|
|
|
1319
1316
|
* I.seeElementInDOM('#modal');
|
|
1320
1317
|
* ```
|
|
1321
1318
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
1322
|
-
*
|
|
1319
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1323
1320
|
*/
|
|
1324
1321
|
async seeElementInDOM(locator) {
|
|
1325
1322
|
const els = await this._locate(locator);
|
|
@@ -1334,7 +1331,7 @@ class Playwright extends Helper {
|
|
|
1334
1331
|
* ```
|
|
1335
1332
|
*
|
|
1336
1333
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator.
|
|
1337
|
-
*
|
|
1334
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1338
1335
|
*/
|
|
1339
1336
|
async dontSeeElementInDOM(locator) {
|
|
1340
1337
|
const els = await this._locate(locator);
|
|
@@ -1397,7 +1394,7 @@ class Playwright extends Helper {
|
|
|
1397
1394
|
*
|
|
1398
1395
|
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1399
1396
|
* @param {?CodeceptJS.LocatorOrString | null} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1400
|
-
*
|
|
1397
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1401
1398
|
*
|
|
1402
1399
|
*
|
|
1403
1400
|
* @param {any} [opts] [Additional options](https://playwright.dev/docs/api/class-page#page-click) for click available as 3rd argument.
|
|
@@ -1419,7 +1416,6 @@ class Playwright extends Helper {
|
|
|
1419
1416
|
|
|
1420
1417
|
/**
|
|
1421
1418
|
* Clicks link and waits for navigation (deprecated)
|
|
1422
|
-
* @return {Promise<any>}
|
|
1423
1419
|
*/
|
|
1424
1420
|
async clickLink(locator, context = null) {
|
|
1425
1421
|
console.log('clickLink deprecated: Playwright automatically waits for navigation to happen.');
|
|
@@ -1455,7 +1451,7 @@ class Playwright extends Helper {
|
|
|
1455
1451
|
*
|
|
1456
1452
|
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1457
1453
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1458
|
-
*
|
|
1454
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1459
1455
|
*
|
|
1460
1456
|
*/
|
|
1461
1457
|
async forceClick(locator, context = null) {
|
|
@@ -1475,7 +1471,7 @@ class Playwright extends Helper {
|
|
|
1475
1471
|
*
|
|
1476
1472
|
* @param {CodeceptJS.LocatorOrString} locator clickable link or button located by text, or any element located by CSS|XPath|strict locator.
|
|
1477
1473
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element to search in CSS|XPath|Strict locator.
|
|
1478
|
-
*
|
|
1474
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1479
1475
|
*
|
|
1480
1476
|
*
|
|
1481
1477
|
*/
|
|
@@ -1497,7 +1493,7 @@ class Playwright extends Helper {
|
|
|
1497
1493
|
*
|
|
1498
1494
|
* @param {CodeceptJS.LocatorOrString} locator clickable element located by CSS|XPath|strict locator.
|
|
1499
1495
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
1500
|
-
*
|
|
1496
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1501
1497
|
*
|
|
1502
1498
|
*
|
|
1503
1499
|
*/
|
|
@@ -1518,7 +1514,7 @@ class Playwright extends Helper {
|
|
|
1518
1514
|
* ```
|
|
1519
1515
|
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
1520
1516
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1521
|
-
*
|
|
1517
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1522
1518
|
*
|
|
1523
1519
|
* [Additional options](https://playwright.dev/docs/api/class-elementhandle#element-handle-check) for check available as 3rd argument.
|
|
1524
1520
|
*
|
|
@@ -1549,7 +1545,7 @@ class Playwright extends Helper {
|
|
|
1549
1545
|
* ```
|
|
1550
1546
|
* @param {CodeceptJS.LocatorOrString} field checkbox located by label | name | CSS | XPath | strict locator.
|
|
1551
1547
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS | XPath | strict locator.
|
|
1552
|
-
*
|
|
1548
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1553
1549
|
*
|
|
1554
1550
|
* [Additional options](https://playwright.dev/docs/api/class-elementhandle#element-handle-uncheck) for uncheck available as 3rd argument.
|
|
1555
1551
|
*
|
|
@@ -1577,7 +1573,7 @@ class Playwright extends Helper {
|
|
|
1577
1573
|
* ```
|
|
1578
1574
|
*
|
|
1579
1575
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1580
|
-
*
|
|
1576
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1581
1577
|
*/
|
|
1582
1578
|
async seeCheckboxIsChecked(field) {
|
|
1583
1579
|
return proceedIsChecked.call(this, 'assert', field);
|
|
@@ -1593,7 +1589,7 @@ class Playwright extends Helper {
|
|
|
1593
1589
|
* ```
|
|
1594
1590
|
*
|
|
1595
1591
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1596
|
-
*
|
|
1592
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1597
1593
|
*/
|
|
1598
1594
|
async dontSeeCheckboxIsChecked(field) {
|
|
1599
1595
|
return proceedIsChecked.call(this, 'negate', field);
|
|
@@ -1611,7 +1607,7 @@ class Playwright extends Helper {
|
|
|
1611
1607
|
* ```
|
|
1612
1608
|
*
|
|
1613
1609
|
* @param {string} key name of key to press down.
|
|
1614
|
-
*
|
|
1610
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1615
1611
|
*/
|
|
1616
1612
|
async pressKeyDown(key) {
|
|
1617
1613
|
key = getNormalizedKey.call(this, key);
|
|
@@ -1631,7 +1627,7 @@ class Playwright extends Helper {
|
|
|
1631
1627
|
* ```
|
|
1632
1628
|
*
|
|
1633
1629
|
* @param {string} key name of key to release.
|
|
1634
|
-
*
|
|
1630
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1635
1631
|
*/
|
|
1636
1632
|
async pressKeyUp(key) {
|
|
1637
1633
|
key = getNormalizedKey.call(this, key);
|
|
@@ -1699,7 +1695,7 @@ class Playwright extends Helper {
|
|
|
1699
1695
|
* - `'Tab'`
|
|
1700
1696
|
*
|
|
1701
1697
|
* @param {string|string[]} key key or array of keys to press.
|
|
1702
|
-
*
|
|
1698
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1703
1699
|
*
|
|
1704
1700
|
*
|
|
1705
1701
|
* _Note:_ Shortcuts like `'Meta'` + `'A'` do not work on macOS ([GoogleChrome/Puppeteer#1313](https://github.com/GoogleChrome/puppeteer/issues/1313)).
|
|
@@ -1747,7 +1743,7 @@ class Playwright extends Helper {
|
|
|
1747
1743
|
*
|
|
1748
1744
|
* @param {string|string[]} key or array of keys to type.
|
|
1749
1745
|
* @param {?number} [delay=null] (optional) delay in ms between key presses
|
|
1750
|
-
*
|
|
1746
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1751
1747
|
*/
|
|
1752
1748
|
async type(keys, delay = null) {
|
|
1753
1749
|
if (!Array.isArray(keys)) {
|
|
@@ -1776,7 +1772,7 @@ class Playwright extends Helper {
|
|
|
1776
1772
|
* ```
|
|
1777
1773
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1778
1774
|
* @param {CodeceptJS.StringOrSecret} value text value to fill.
|
|
1779
|
-
*
|
|
1775
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1780
1776
|
*
|
|
1781
1777
|
*/
|
|
1782
1778
|
async fillField(field, value) {
|
|
@@ -1803,7 +1799,7 @@ class Playwright extends Helper {
|
|
|
1803
1799
|
* I.clearField('#email');
|
|
1804
1800
|
* ```
|
|
1805
1801
|
* @param {LocatorOrString} editable field located by label|name|CSS|XPath|strict locator.
|
|
1806
|
-
*
|
|
1802
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1807
1803
|
*/
|
|
1808
1804
|
async clearField(field) {
|
|
1809
1805
|
return this.fillField(field, '');
|
|
@@ -1818,7 +1814,7 @@ class Playwright extends Helper {
|
|
|
1818
1814
|
* ```
|
|
1819
1815
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
|
|
1820
1816
|
* @param {string} value text value to append.
|
|
1821
|
-
*
|
|
1817
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1822
1818
|
*
|
|
1823
1819
|
*
|
|
1824
1820
|
*/
|
|
@@ -1842,7 +1838,7 @@ class Playwright extends Helper {
|
|
|
1842
1838
|
* ```
|
|
1843
1839
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1844
1840
|
* @param {string} value value to check.
|
|
1845
|
-
*
|
|
1841
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1846
1842
|
*/
|
|
1847
1843
|
async seeInField(field, value) {
|
|
1848
1844
|
return proceedSeeInField.call(this, 'assert', field, value);
|
|
@@ -1859,7 +1855,7 @@ class Playwright extends Helper {
|
|
|
1859
1855
|
*
|
|
1860
1856
|
* @param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator.
|
|
1861
1857
|
* @param {string} value value to check.
|
|
1862
|
-
*
|
|
1858
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1863
1859
|
*/
|
|
1864
1860
|
async dontSeeInField(field, value) {
|
|
1865
1861
|
return proceedSeeInField.call(this, 'negate', field, value);
|
|
@@ -1877,7 +1873,7 @@ class Playwright extends Helper {
|
|
|
1877
1873
|
*
|
|
1878
1874
|
* @param {CodeceptJS.LocatorOrString} locator field located by label|name|CSS|XPath|strict locator.
|
|
1879
1875
|
* @param {string} pathToFile local file path relative to codecept.json config file.
|
|
1880
|
-
*
|
|
1876
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1881
1877
|
*
|
|
1882
1878
|
*/
|
|
1883
1879
|
async attachFile(locator, pathToFile) {
|
|
@@ -1913,7 +1909,7 @@ class Playwright extends Helper {
|
|
|
1913
1909
|
* ```
|
|
1914
1910
|
* @param {LocatorOrString} select field located by label|name|CSS|XPath|strict locator.
|
|
1915
1911
|
* @param {string|Array<*>} option visible text or value of option.
|
|
1916
|
-
*
|
|
1912
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1917
1913
|
*/
|
|
1918
1914
|
async selectOption(select, option) {
|
|
1919
1915
|
const els = await findFields.call(this, select);
|
|
@@ -1970,7 +1966,7 @@ class Playwright extends Helper {
|
|
|
1970
1966
|
* ```
|
|
1971
1967
|
*
|
|
1972
1968
|
* @param {string} url a fragment to check
|
|
1973
|
-
*
|
|
1969
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1974
1970
|
*/
|
|
1975
1971
|
async seeInCurrentUrl(url) {
|
|
1976
1972
|
stringIncludes('url').assert(url, await this._getPageUrl());
|
|
@@ -1980,7 +1976,7 @@ class Playwright extends Helper {
|
|
|
1980
1976
|
* Checks that current url does not contain a provided fragment.
|
|
1981
1977
|
*
|
|
1982
1978
|
* @param {string} url value to check.
|
|
1983
|
-
*
|
|
1979
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
1984
1980
|
*/
|
|
1985
1981
|
async dontSeeInCurrentUrl(url) {
|
|
1986
1982
|
stringIncludes('url').negate(url, await this._getPageUrl());
|
|
@@ -1997,7 +1993,7 @@ class Playwright extends Helper {
|
|
|
1997
1993
|
* ```
|
|
1998
1994
|
*
|
|
1999
1995
|
* @param {string} url value to check.
|
|
2000
|
-
*
|
|
1996
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2001
1997
|
*/
|
|
2002
1998
|
async seeCurrentUrlEquals(url) {
|
|
2003
1999
|
urlEquals(this.options.url).assert(url, await this._getPageUrl());
|
|
@@ -2013,7 +2009,7 @@ class Playwright extends Helper {
|
|
|
2013
2009
|
* ```
|
|
2014
2010
|
*
|
|
2015
2011
|
* @param {string} url value to check.
|
|
2016
|
-
*
|
|
2012
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2017
2013
|
*/
|
|
2018
2014
|
async dontSeeCurrentUrlEquals(url) {
|
|
2019
2015
|
urlEquals(this.options.url).negate(url, await this._getPageUrl());
|
|
@@ -2030,7 +2026,7 @@ class Playwright extends Helper {
|
|
|
2030
2026
|
* ```
|
|
2031
2027
|
* @param {string} text expected on page.
|
|
2032
2028
|
* @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text.
|
|
2033
|
-
*
|
|
2029
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2034
2030
|
*
|
|
2035
2031
|
*
|
|
2036
2032
|
*/
|
|
@@ -2047,7 +2043,7 @@ class Playwright extends Helper {
|
|
|
2047
2043
|
*
|
|
2048
2044
|
* @param {string} text element value to check.
|
|
2049
2045
|
* @param {CodeceptJS.LocatorOrString?} [context=null] element located by CSS|XPath|strict locator.
|
|
2050
|
-
*
|
|
2046
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2051
2047
|
*/
|
|
2052
2048
|
async seeTextEquals(text, context = null) {
|
|
2053
2049
|
return proceedSee.call(this, 'assert', text, context, true);
|
|
@@ -2064,7 +2060,7 @@ class Playwright extends Helper {
|
|
|
2064
2060
|
*
|
|
2065
2061
|
* @param {string} text which is not present.
|
|
2066
2062
|
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search.
|
|
2067
|
-
*
|
|
2063
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2068
2064
|
*
|
|
2069
2065
|
*
|
|
2070
2066
|
*/
|
|
@@ -2090,9 +2086,11 @@ class Playwright extends Helper {
|
|
|
2090
2086
|
* Get JS log from browser.
|
|
2091
2087
|
*
|
|
2092
2088
|
* ```js
|
|
2093
|
-
*
|
|
2094
|
-
*
|
|
2089
|
+
* const logs = await I.grabBrowserLogs();
|
|
2090
|
+
* const errors = logs.map(l => ({ type: l.type(), text: l.text() })).filter(l => l.type === 'error');
|
|
2091
|
+
* console.log(JSON.stringify(errors));
|
|
2095
2092
|
* ```
|
|
2093
|
+
* [Learn more about console messages](https://playwright.dev/docs/api/class-consolemessage)
|
|
2096
2094
|
* @return {Promise<any[]>}
|
|
2097
2095
|
*/
|
|
2098
2096
|
async grabBrowserLogs() {
|
|
@@ -2123,7 +2121,7 @@ class Playwright extends Helper {
|
|
|
2123
2121
|
* I.seeInSource('<h1>Green eggs & ham</h1>');
|
|
2124
2122
|
* ```
|
|
2125
2123
|
* @param {string} text value to check.
|
|
2126
|
-
*
|
|
2124
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2127
2125
|
*/
|
|
2128
2126
|
async seeInSource(text) {
|
|
2129
2127
|
const source = await this.page.content();
|
|
@@ -2138,7 +2136,7 @@ class Playwright extends Helper {
|
|
|
2138
2136
|
* ```
|
|
2139
2137
|
*
|
|
2140
2138
|
* @param {string} value to check.
|
|
2141
|
-
*
|
|
2139
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2142
2140
|
*/
|
|
2143
2141
|
async dontSeeInSource(text) {
|
|
2144
2142
|
const source = await this.page.content();
|
|
@@ -2156,7 +2154,7 @@ class Playwright extends Helper {
|
|
|
2156
2154
|
*
|
|
2157
2155
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2158
2156
|
* @param {number} num number of elements.
|
|
2159
|
-
*
|
|
2157
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2160
2158
|
*
|
|
2161
2159
|
*
|
|
2162
2160
|
*/
|
|
@@ -2175,7 +2173,7 @@ class Playwright extends Helper {
|
|
|
2175
2173
|
*
|
|
2176
2174
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2177
2175
|
* @param {number} num number of elements.
|
|
2178
|
-
*
|
|
2176
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2179
2177
|
*
|
|
2180
2178
|
*
|
|
2181
2179
|
*/
|
|
@@ -2200,7 +2198,7 @@ class Playwright extends Helper {
|
|
|
2200
2198
|
* ```
|
|
2201
2199
|
*
|
|
2202
2200
|
* @param {Cookie|Array<Cookie>} cookie a cookie object or array of cookie objects.
|
|
2203
|
-
*
|
|
2201
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2204
2202
|
*/
|
|
2205
2203
|
async setCookie(cookie) {
|
|
2206
2204
|
if (Array.isArray(cookie)) {
|
|
@@ -2217,7 +2215,7 @@ class Playwright extends Helper {
|
|
|
2217
2215
|
* ```
|
|
2218
2216
|
*
|
|
2219
2217
|
* @param {string} name cookie name.
|
|
2220
|
-
*
|
|
2218
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2221
2219
|
*
|
|
2222
2220
|
*/
|
|
2223
2221
|
async seeCookie(name) {
|
|
@@ -2233,7 +2231,7 @@ class Playwright extends Helper {
|
|
|
2233
2231
|
* ```
|
|
2234
2232
|
*
|
|
2235
2233
|
* @param {string} name cookie name.
|
|
2236
|
-
*
|
|
2234
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2237
2235
|
*/
|
|
2238
2236
|
async dontSeeCookie(name) {
|
|
2239
2237
|
const cookies = await this.browserContext.cookies();
|
|
@@ -2273,7 +2271,7 @@ class Playwright extends Helper {
|
|
|
2273
2271
|
* ```
|
|
2274
2272
|
*
|
|
2275
2273
|
* @param {?string} [cookie=null] (optional, `null` by default) cookie name
|
|
2276
|
-
*
|
|
2274
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2277
2275
|
*/
|
|
2278
2276
|
async clearCookie() {
|
|
2279
2277
|
// Playwright currently doesn't support to delete a certain cookie
|
|
@@ -2304,7 +2302,6 @@ class Playwright extends Helper {
|
|
|
2304
2302
|
*
|
|
2305
2303
|
* @param {string|function} fn function to be executed in browser context.
|
|
2306
2304
|
* @param {any} [arg] optional argument to pass to the function
|
|
2307
|
-
* @return {Promise<any>}
|
|
2308
2305
|
*/
|
|
2309
2306
|
async executeScript(fn, arg) {
|
|
2310
2307
|
let context = this.page;
|
|
@@ -2502,7 +2499,7 @@ class Playwright extends Helper {
|
|
|
2502
2499
|
*
|
|
2503
2500
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
2504
2501
|
* @param {object} cssProperties object with CSS properties and their values to check.
|
|
2505
|
-
*
|
|
2502
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2506
2503
|
*
|
|
2507
2504
|
*/
|
|
2508
2505
|
async seeCssPropertiesOnElements(locator, cssProperties) {
|
|
@@ -2548,7 +2545,7 @@ class Playwright extends Helper {
|
|
|
2548
2545
|
*
|
|
2549
2546
|
* @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator.
|
|
2550
2547
|
* @param {object} attributes attributes and their values to check.
|
|
2551
|
-
*
|
|
2548
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2552
2549
|
*
|
|
2553
2550
|
*/
|
|
2554
2551
|
async seeAttributesOnElements(locator, attributes) {
|
|
@@ -2587,7 +2584,7 @@ class Playwright extends Helper {
|
|
|
2587
2584
|
*
|
|
2588
2585
|
* @param {CodeceptJS.LocatorOrString} locator located by label|name|CSS|XPath|strict locator.
|
|
2589
2586
|
* @param {number} offsetX position to drag.
|
|
2590
|
-
*
|
|
2587
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2591
2588
|
*
|
|
2592
2589
|
*/
|
|
2593
2590
|
async dragSlider(locator, offsetX = 0) {
|
|
@@ -2665,7 +2662,7 @@ class Playwright extends Helper {
|
|
|
2665
2662
|
*
|
|
2666
2663
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2667
2664
|
* @param {string} fileName file name to save.
|
|
2668
|
-
*
|
|
2665
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2669
2666
|
*
|
|
2670
2667
|
*/
|
|
2671
2668
|
async saveElementScreenshot(locator, fileName) {
|
|
@@ -2691,7 +2688,7 @@ class Playwright extends Helper {
|
|
|
2691
2688
|
*
|
|
2692
2689
|
* @param {string} fileName file name to save.
|
|
2693
2690
|
* @param {boolean} [fullPage=false] (optional, `false` by default) flag to enable fullscreen screenshot mode.
|
|
2694
|
-
*
|
|
2691
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2695
2692
|
*/
|
|
2696
2693
|
async saveScreenshot(fileName, fullPage) {
|
|
2697
2694
|
const fullPageOption = fullPage || this.options.fullPageScreenshots;
|
|
@@ -2807,7 +2804,7 @@ class Playwright extends Helper {
|
|
|
2807
2804
|
* ```
|
|
2808
2805
|
*
|
|
2809
2806
|
* @param {number} sec number of second to wait.
|
|
2810
|
-
*
|
|
2807
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2811
2808
|
*/
|
|
2812
2809
|
async wait(sec) {
|
|
2813
2810
|
return new Promise(((done) => {
|
|
@@ -2821,7 +2818,7 @@ class Playwright extends Helper {
|
|
|
2821
2818
|
*
|
|
2822
2819
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2823
2820
|
* @param {number} [sec=1] (optional) time in seconds to wait, 1 by default.
|
|
2824
|
-
*
|
|
2821
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2825
2822
|
*/
|
|
2826
2823
|
async waitForEnabled(locator, sec) {
|
|
2827
2824
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -2856,7 +2853,7 @@ class Playwright extends Helper {
|
|
|
2856
2853
|
* @param {LocatorOrString} field input field.
|
|
2857
2854
|
* @param {string }value expected value.
|
|
2858
2855
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2859
|
-
*
|
|
2856
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2860
2857
|
*/
|
|
2861
2858
|
async waitForValue(field, value, sec) {
|
|
2862
2859
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -2892,7 +2889,7 @@ class Playwright extends Helper {
|
|
|
2892
2889
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2893
2890
|
* @param {number} num number of elements.
|
|
2894
2891
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2895
|
-
*
|
|
2892
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2896
2893
|
*
|
|
2897
2894
|
*/
|
|
2898
2895
|
async waitNumberOfVisibleElements(locator, num, sec) {
|
|
@@ -2933,7 +2930,7 @@ class Playwright extends Helper {
|
|
|
2933
2930
|
*
|
|
2934
2931
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2935
2932
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
2936
|
-
*
|
|
2933
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2937
2934
|
*/
|
|
2938
2935
|
async waitForClickable(locator, waitTimeout) {
|
|
2939
2936
|
console.log('I.waitForClickable is DEPRECATED: This is no longer needed, Playwright automatically waits for element to be clickable');
|
|
@@ -2951,7 +2948,7 @@ class Playwright extends Helper {
|
|
|
2951
2948
|
*
|
|
2952
2949
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2953
2950
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
2954
|
-
*
|
|
2951
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2955
2952
|
*
|
|
2956
2953
|
*/
|
|
2957
2954
|
async waitForElement(locator, sec) {
|
|
@@ -2975,7 +2972,7 @@ class Playwright extends Helper {
|
|
|
2975
2972
|
*
|
|
2976
2973
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
2977
2974
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
2978
|
-
*
|
|
2975
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
2979
2976
|
*
|
|
2980
2977
|
* This method accepts [React selectors](https://codecept.io/react).
|
|
2981
2978
|
*/
|
|
@@ -2999,7 +2996,7 @@ class Playwright extends Helper {
|
|
|
2999
2996
|
*
|
|
3000
2997
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
3001
2998
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3002
|
-
*
|
|
2999
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
3003
3000
|
*/
|
|
3004
3001
|
async waitForInvisible(locator, sec) {
|
|
3005
3002
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -3021,7 +3018,7 @@ class Playwright extends Helper {
|
|
|
3021
3018
|
*
|
|
3022
3019
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
3023
3020
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3024
|
-
*
|
|
3021
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
3025
3022
|
*/
|
|
3026
3023
|
async waitToHide(locator, sec) {
|
|
3027
3024
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -3048,7 +3045,7 @@ class Playwright extends Helper {
|
|
|
3048
3045
|
*
|
|
3049
3046
|
* @param {string} urlPart value to check.
|
|
3050
3047
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3051
|
-
*
|
|
3048
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
3052
3049
|
*/
|
|
3053
3050
|
async waitInUrl(urlPart, sec = null) {
|
|
3054
3051
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -3076,7 +3073,7 @@ class Playwright extends Helper {
|
|
|
3076
3073
|
*
|
|
3077
3074
|
* @param {string} urlPart value to check.
|
|
3078
3075
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3079
|
-
*
|
|
3076
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
3080
3077
|
*/
|
|
3081
3078
|
async waitUrlEquals(urlPart, sec = null) {
|
|
3082
3079
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -3112,7 +3109,7 @@ class Playwright extends Helper {
|
|
|
3112
3109
|
* @param {string }text to wait for.
|
|
3113
3110
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3114
3111
|
* @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator.
|
|
3115
|
-
*
|
|
3112
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
3116
3113
|
*/
|
|
3117
3114
|
async waitForText(text, sec = null, context = null) {
|
|
3118
3115
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -3152,7 +3149,6 @@ class Playwright extends Helper {
|
|
|
3152
3149
|
*
|
|
3153
3150
|
* @param {string|function} urlOrPredicate
|
|
3154
3151
|
* @param {?number} [sec=null] seconds to wait
|
|
3155
|
-
* @return {Promise<any>}
|
|
3156
3152
|
*/
|
|
3157
3153
|
async waitForRequest(urlOrPredicate, sec = null) {
|
|
3158
3154
|
const timeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -3169,7 +3165,6 @@ class Playwright extends Helper {
|
|
|
3169
3165
|
*
|
|
3170
3166
|
* @param {string|function} urlOrPredicate
|
|
3171
3167
|
* @param {?number} [sec=null] number of seconds to wait
|
|
3172
|
-
* @return {Promise<any>}
|
|
3173
3168
|
*/
|
|
3174
3169
|
async waitForResponse(urlOrPredicate, sec = null) {
|
|
3175
3170
|
const timeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -3185,7 +3180,7 @@ class Playwright extends Helper {
|
|
|
3185
3180
|
* ```
|
|
3186
3181
|
*
|
|
3187
3182
|
* @param {?CodeceptJS.LocatorOrString} [locator=null] (optional, `null` by default) element located by CSS|XPath|strict locator.
|
|
3188
|
-
*
|
|
3183
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
3189
3184
|
*/
|
|
3190
3185
|
async switchTo(locator) {
|
|
3191
3186
|
if (Number.isInteger(locator)) {
|
|
@@ -3243,7 +3238,7 @@ class Playwright extends Helper {
|
|
|
3243
3238
|
* @param {string|function} fn to be executed in browser context.
|
|
3244
3239
|
* @param {any[]|number} [argsOrSec] (optional, `1` by default) arguments for function or seconds.
|
|
3245
3240
|
* @param {number} [sec] (optional, `1` by default) time in seconds to wait
|
|
3246
|
-
*
|
|
3241
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
3247
3242
|
*/
|
|
3248
3243
|
async waitForFunction(fn, argsOrSec = null, sec = null) {
|
|
3249
3244
|
let args = [];
|
|
@@ -3265,7 +3260,6 @@ class Playwright extends Helper {
|
|
|
3265
3260
|
* See [Playwright's reference](https://playwright.dev/docs/api/class-page?_highlight=waitfornavi#pagewaitfornavigationoptions)
|
|
3266
3261
|
*
|
|
3267
3262
|
* @param {*} opts
|
|
3268
|
-
* @return {Promise<any>}
|
|
3269
3263
|
*/
|
|
3270
3264
|
async waitForNavigation(opts = {}) {
|
|
3271
3265
|
opts = {
|
|
@@ -3293,7 +3287,7 @@ class Playwright extends Helper {
|
|
|
3293
3287
|
*
|
|
3294
3288
|
* @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator.
|
|
3295
3289
|
* @param {number} [sec=1] (optional, `1` by default) time in seconds to wait
|
|
3296
|
-
*
|
|
3290
|
+
* [!] returns a _promise_ which is synchronized internally by recorder
|
|
3297
3291
|
*/
|
|
3298
3292
|
async waitForDetached(locator, sec) {
|
|
3299
3293
|
const waitTimeout = sec ? sec * 1000 : this.options.waitForTimeout;
|
|
@@ -3339,7 +3333,7 @@ class Playwright extends Helper {
|
|
|
3339
3333
|
* loadEventEnd: 241
|
|
3340
3334
|
* }
|
|
3341
3335
|
* ```
|
|
3342
|
-
* @return {Promise<any>}
|
|
3336
|
+
* @return {Promise<any>} automatically synchronized promise through #recorder
|
|
3343
3337
|
*/
|
|
3344
3338
|
async grabDataFromPerformanceTiming() {
|
|
3345
3339
|
return perfTiming;
|
|
@@ -3385,8 +3379,7 @@ class Playwright extends Helper {
|
|
|
3385
3379
|
* This method allows intercepting and mocking requests & responses. [Learn more about it](https://playwright.dev/docs/network#handle-requests)
|
|
3386
3380
|
*
|
|
3387
3381
|
* @param {string|RegExp} [url] URL, regex or pattern for to match URL
|
|
3388
|
-
* @param {function} [handler] a function to process
|
|
3389
|
-
* @return {Promise<any>}
|
|
3382
|
+
* @param {function} [handler] a function to process reques
|
|
3390
3383
|
*/
|
|
3391
3384
|
async mockRoute(url, handler) {
|
|
3392
3385
|
return this.browserContext.route(...arguments);
|
|
@@ -3402,8 +3395,7 @@ class Playwright extends Helper {
|
|
|
3402
3395
|
* If no handler is passed, all mock requests for the rote are disabled.
|
|
3403
3396
|
*
|
|
3404
3397
|
* @param {string|RegExp} [url] URL, regex or pattern for to match URL
|
|
3405
|
-
* @param {function} [handler] a function to process
|
|
3406
|
-
* @return {Promise<any>}
|
|
3398
|
+
* @param {function} [handler] a function to process reques
|
|
3407
3399
|
*/
|
|
3408
3400
|
async stopMockingRoute(url, handler) {
|
|
3409
3401
|
return this.browserContext.unroute(...arguments);
|